mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
Misc changes
This commit is contained in:
parent
b27ec3a264
commit
afd6fc49ea
@ -193,10 +193,9 @@ void PatchIAT()
|
||||
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hInstance + ((IMAGE_DOS_HEADER*)hInstance)->e_lfanew);
|
||||
|
||||
// Give _rwcseg proper access rights
|
||||
WORD NumberOfSections = ntHeader->FileHeader.NumberOfSections;
|
||||
IMAGE_SECTION_HEADER* pSection = IMAGE_FIRST_SECTION(ntHeader);
|
||||
|
||||
for ( WORD i = 0; i < NumberOfSections; i++, pSection++ )
|
||||
for ( SIZE_T i = 0, j = ntHeader->FileHeader.NumberOfSections; i < j; i++, pSection++ )
|
||||
{
|
||||
if ( *(uint64_t*)(pSection->Name) == 0x006765736377725F ) // _rwcseg
|
||||
{
|
||||
|
@ -317,7 +317,6 @@ static char aNoDesktopMode[64];
|
||||
void Patch_III_10(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51F970;
|
||||
SetScale = (void(*)(float,float))0x501B80;
|
||||
@ -498,7 +497,6 @@ void Patch_III_10(const RECT& desktop)
|
||||
void Patch_III_11(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51FBA0;
|
||||
SetScale = (void(*)(float,float))0x501C60;
|
||||
@ -658,7 +656,6 @@ void Patch_III_11(const RECT& desktop)
|
||||
void Patch_III_Steam(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51FB30;
|
||||
SetScale = (void(*)(float,float))0x501BF0;
|
||||
@ -814,6 +811,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
if (*(DWORD*)0x5C1E75 == 0xB85548EC) Patch_III_10(desktop);
|
||||
else if (*(DWORD*)0x5C2135 == 0xB85548EC) Patch_III_11(desktop);
|
||||
else if (*(DWORD*)0x5C6FD5 == 0xB85548EC) Patch_III_Steam(desktop);
|
||||
|
@ -72,6 +72,7 @@
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -100,6 +101,7 @@
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
|
@ -116,7 +116,7 @@ void CEscalator::SwitchOffNoRemove()
|
||||
if ( !m_bExists )
|
||||
return;
|
||||
|
||||
for ( int i = 0, j = field_7C + field_80 + field_84; i < j; ++i )
|
||||
for ( ptrdiff_t i = 0, j = field_7C + field_80 + field_84; i < j; ++i )
|
||||
{
|
||||
if ( m_pSteps[i] != nullptr )
|
||||
{
|
||||
|
@ -2614,9 +2614,6 @@ static char aNoDesktopMode[64];
|
||||
void Patch_SA_10()
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
ScopedUnprotect::Section Protect2( (HINSTANCE)0x400000, ".rdata" );
|
||||
|
||||
|
||||
// IsAlreadyRunning needs to be read relatively late - the later, the better
|
||||
int pIsAlreadyRunning = AddressByRegion_10<int>(0x74872D);
|
||||
@ -3028,8 +3025,6 @@ void Patch_SA_10()
|
||||
void Patch_SA_11()
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
ScopedUnprotect::Section Protect2( (HINSTANCE)0x400000, ".rdata" );
|
||||
|
||||
// IsAlreadyRunning needs to be read relatively late - the later, the better
|
||||
int pIsAlreadyRunning = AddressByRegion_11<int>(0x749000);
|
||||
@ -3369,8 +3364,6 @@ void Patch_SA_11()
|
||||
void Patch_SA_Steam()
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
ScopedUnprotect::Section Protect2( (HINSTANCE)0x400000, ".rdata" );
|
||||
|
||||
// IsAlreadyRunning needs to be read relatively late - the later, the better
|
||||
ReadCall( 0x7826ED, IsAlreadyRunning );
|
||||
@ -3725,8 +3718,6 @@ void Patch_SA_Steam()
|
||||
void Patch_SA_NewSteam_r1()
|
||||
{
|
||||
using namespace Memory::DynBase;
|
||||
ScopedUnprotect::Section Protect( GetModuleHandle( nullptr ), ".text" );
|
||||
ScopedUnprotect::Section Protect2( GetModuleHandle( nullptr ), ".rdata" );
|
||||
|
||||
// Nazi EXE?
|
||||
if ( *(DWORD*)DynBaseAddress(0x49F810) == 0x64EC8B55 )
|
||||
@ -3808,8 +3799,6 @@ void Patch_SA_NewSteam_r1()
|
||||
void Patch_SA_NewSteam_r2()
|
||||
{
|
||||
using namespace Memory::DynBase;
|
||||
ScopedUnprotect::Section Protect( GetModuleHandle( nullptr ), ".text" );
|
||||
ScopedUnprotect::Section Protect2( GetModuleHandle( nullptr ), ".rdata" );
|
||||
|
||||
// (Hopefully) more precise frame limiter
|
||||
ReadCall( DynBaseAddress(0x77D55F), RsEventHandler );
|
||||
@ -3997,8 +3986,6 @@ void Patch_SA_NewSteam_r2()
|
||||
void Patch_SA_NewSteam_r2_lv()
|
||||
{
|
||||
using namespace Memory::DynBase;
|
||||
ScopedUnprotect::Section Protect( GetModuleHandle( nullptr ), ".text" );
|
||||
ScopedUnprotect::Section Protect2( GetModuleHandle( nullptr ), ".rdata" );
|
||||
|
||||
// (Hopefully) more precise frame limiter
|
||||
ReadCall( DynBaseAddress(0x77D44F), RsEventHandler );
|
||||
@ -4192,6 +4179,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
hDLLModule = hinstDLL;
|
||||
|
||||
HINSTANCE hGameHandle = GetModuleHandle( nullptr );
|
||||
ScopedUnprotect::Section Protect( hGameHandle, ".text" );
|
||||
ScopedUnprotect::Section Protect2( hGameHandle, ".rdata" );
|
||||
|
||||
if (*(DWORD*)DynBaseAddress(0x82457C) == 0x94BF || *(DWORD*)DynBaseAddress(0x8245BC) == 0x94BF) Patch_SA_10();
|
||||
else if (*(DWORD*)DynBaseAddress(0x8252FC) == 0x94BF || *(DWORD*)DynBaseAddress(0x82533C) == 0x94BF) Patch_SA_11(), MessageBox( nullptr, "You're using a 1.01 executable which is no longer supported by SilentPatch!\n\nI have no idea if anyone was still using it, so if you do - shoot me an e-mail!", "SilentPatch", MB_OK | MB_ICONWARNING );
|
||||
else if (*(DWORD*)DynBaseAddress(0x85EC4A) == 0x94BF) Patch_SA_Steam();
|
||||
|
@ -60,6 +60,7 @@
|
||||
<PrecompiledHeaderFile>StdAfxSA.h</PrecompiledHeaderFile>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -92,6 +93,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
|
||||
<PrecompiledHeaderFile>StdAfxSA.h</PrecompiledHeaderFile>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -195,7 +195,6 @@ static char aNoDesktopMode[64];
|
||||
void Patch_VC_10(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
AudioResetTimers = (void(__stdcall*)(unsigned int))0x5F98D0;
|
||||
PrintString = (void(*)(float,float,const wchar_t*))0x551040;
|
||||
@ -344,7 +343,6 @@ void Patch_VC_10(const RECT& desktop)
|
||||
void Patch_VC_11(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
AudioResetTimers = (void(__stdcall*)(unsigned int))0x5F98F0;
|
||||
PrintString = (void(*)(float,float,const wchar_t*))0x551060;
|
||||
@ -484,7 +482,6 @@ void Patch_VC_11(const RECT& desktop)
|
||||
void Patch_VC_Steam(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
AudioResetTimers = (void(__stdcall*)(unsigned int))0x5F9530;
|
||||
PrintString = (void(*)(float,float,const wchar_t*))0x550F30;
|
||||
@ -645,6 +642,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
if(*(DWORD*)0x667BF5 == 0xB85548EC) Patch_VC_10(desktop);
|
||||
else if(*(DWORD*)0x667C45 == 0xB85548EC) Patch_VC_11(desktop);
|
||||
else if (*(DWORD*)0x666BA5 == 0xB85548EC) Patch_VC_Steam(desktop);
|
||||
|
@ -58,6 +58,7 @@
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -84,6 +85,7 @@
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
|
Loading…
Reference in New Issue
Block a user