mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
modloader compatibility
This commit is contained in:
parent
134521530a
commit
7452ea4831
3 changed files with 31 additions and 11 deletions
|
@ -56,7 +56,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
||||||
<AdditionalDependencies>winmm.lib;libFLAC_static_d.lib;win_utf8_io_static_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>winmm.lib;Shlwapi.lib;libFLAC_static_d.lib;win_utf8_io_static_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\SilentPatchSA.asi"</Command>
|
<Command>copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\SilentPatchSA.asi"</Command>
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
||||||
<AdditionalDependencies>winmm.lib;libFLAC_static.lib;win_utf8_io_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>winmm.lib;Shlwapi.lib;libFLAC_static.lib;win_utf8_io_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\SilentPatchSA.asi"</Command>
|
<Command>copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\SilentPatchSA.asi"</Command>
|
||||||
|
@ -106,10 +106,10 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="..\SilentPatch\nvc.fx">
|
<CustomBuild Include="..\SilentPatch\nvc.fx">
|
||||||
<FileType>Document</FileType>
|
<FileType>Document</FileType>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"C:\Program Files\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h ..\SilentPatch\nvc.fx</Command>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxc /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h ..\SilentPatch\nvc.fx</Command>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\SilentPatch\nvc.h</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\SilentPatch\nvc.h</Outputs>
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shaders...</Message>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shaders...</Message>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"C:\Program Files\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h ..\SilentPatch\nvc.fx</Command>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxc /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h ..\SilentPatch\nvc.fx</Command>
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling shaders...</Message>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling shaders...</Message>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\SilentPatch\nvc.h</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\SilentPatch\nvc.h</Outputs>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
#include <Shlwapi.h>
|
||||||
|
|
||||||
#define RwEngineInstance (*rwengine)
|
#define RwEngineInstance (*rwengine)
|
||||||
#define RWFRAMESTATICPLUGINSSIZE 24
|
#define RWFRAMESTATICPLUGINSSIZE 24
|
||||||
|
|
|
@ -1354,6 +1354,7 @@ void __declspec(naked) ResetAlphaFuncRefAfterRender()
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bUseTwoPass;
|
static bool bUseTwoPass;
|
||||||
|
static HMODULE hDLLModule;
|
||||||
|
|
||||||
void SetRendererForAtomic(RpAtomic* pAtomic)
|
void SetRendererForAtomic(RpAtomic* pAtomic)
|
||||||
{
|
{
|
||||||
|
@ -1980,9 +1981,26 @@ BOOL InjectDelayedPatches_10()
|
||||||
{
|
{
|
||||||
using namespace MemoryVP;
|
using namespace MemoryVP;
|
||||||
|
|
||||||
bUseTwoPass = GetPrivateProfileInt("SilentPatch", "TwoPassRendering", FALSE, ".\\SilentPatchSA.ini") != FALSE;
|
// Obtain a path to the ASI
|
||||||
|
wchar_t wcModulePath[MAX_PATH];
|
||||||
|
|
||||||
if ( GetPrivateProfileInt("SilentPatch", "EnableScriptFixes", TRUE, ".\\SilentPatchSA.ini") != FALSE )
|
GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
|
||||||
|
|
||||||
|
wchar_t* pSlash = wcsrchr(wcModulePath, '\\');
|
||||||
|
if ( pSlash )
|
||||||
|
{
|
||||||
|
*pSlash = '\0';
|
||||||
|
PathAppendW(wcModulePath, L"SilentPatchSA.ini");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Should never happen - if it does, something's fucking up
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bUseTwoPass = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE;
|
||||||
|
|
||||||
|
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
|
||||||
{
|
{
|
||||||
// Gym glitch fix
|
// Gym glitch fix
|
||||||
Patch<WORD>(0x470B03, 0xCD8B);
|
Patch<WORD>(0x470B03, 0xCD8B);
|
||||||
|
@ -1997,7 +2015,7 @@ BOOL InjectDelayedPatches_10()
|
||||||
InjectHook(0x464BC0, StartNewMission_BasketballFix, PATCH_JUMP);
|
InjectHook(0x464BC0, StartNewMission_BasketballFix, PATCH_JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetPrivateProfileInt("SilentPatch", "NVCShader", TRUE, ".\\SilentPatchSA.ini") != FALSE )
|
if ( GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE )
|
||||||
{
|
{
|
||||||
// Shaders!
|
// Shaders!
|
||||||
InjectHook(0x5DA743, SetShader);
|
InjectHook(0x5DA743, SetShader);
|
||||||
|
@ -2026,13 +2044,13 @@ BOOL InjectDelayedPatches_10()
|
||||||
Patch<float>(*(float**)0x7034C0, 0.0);
|
Patch<float>(*(float**)0x7034C0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetPrivateProfileInt("SilentPatch", "SkipIntroSplashes", TRUE, ".\\SilentPatchSA.ini") != FALSE )
|
if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE )
|
||||||
{
|
{
|
||||||
// Skip the damn intro splash
|
// Skip the damn intro splash
|
||||||
Patch<WORD>(0x748AA8, 0x3DEB);
|
Patch<WORD>(0x748AA8, 0x3DEB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetPrivateProfileInt("SilentPatch", "SmallSteamTexts", TRUE, ".\\SilentPatchSA.ini") != FALSE )
|
if ( GetPrivateProfileIntW(L"SilentPatch", L"SmallSteamTexts", TRUE, wcModulePath) != FALSE )
|
||||||
{
|
{
|
||||||
// We're on 1.0 - make texts smaller
|
// We're on 1.0 - make texts smaller
|
||||||
Patch<const void*>(0x58C387, &fSteamSubtitleSizeY);
|
Patch<const void*>(0x58C387, &fSteamSubtitleSizeY);
|
||||||
|
@ -2048,7 +2066,7 @@ BOOL InjectDelayedPatches_10()
|
||||||
Patch<const void*>(0x4E9F38, &fSteamRadioNameSizeX);
|
Patch<const void*>(0x4E9F38, &fSteamRadioNameSizeX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetPrivateProfileInt("SilentPatch", "ColouredZoneNames", FALSE, ".\\SilentPatchSA.ini") != FALSE )
|
if ( GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", FALSE, wcModulePath) != FALSE )
|
||||||
{
|
{
|
||||||
// Coloured zone names
|
// Coloured zone names
|
||||||
Patch<WORD>(0x58ADBE, 0x0E75);
|
Patch<WORD>(0x58ADBE, 0x0E75);
|
||||||
|
@ -2270,11 +2288,12 @@ __forceinline void Patch_SA_Steam()
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(hinstDLL);
|
//UNREFERENCED_PARAMETER(hinstDLL);
|
||||||
UNREFERENCED_PARAMETER(lpvReserved);
|
UNREFERENCED_PARAMETER(lpvReserved);
|
||||||
|
|
||||||
if ( fdwReason == DLL_PROCESS_ATTACH )
|
if ( fdwReason == DLL_PROCESS_ATTACH )
|
||||||
{
|
{
|
||||||
|
hDLLModule = hinstDLL;
|
||||||
#if defined SILENTPATCH_III_VER
|
#if defined SILENTPATCH_III_VER
|
||||||
if (*(DWORD*)0x5C1E70 == 0x53E58955) Patch_III_10();
|
if (*(DWORD*)0x5C1E70 == 0x53E58955) Patch_III_10();
|
||||||
else if (*(DWORD*)0x5C2130 == 0x53E58955) Patch_III_11();
|
else if (*(DWORD*)0x5C2130 == 0x53E58955) Patch_III_11();
|
||||||
|
|
Loading…
Reference in a new issue