mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
Update code for new Memory
This commit is contained in:
parent
e344ee91a0
commit
e78ff41605
6 changed files with 46 additions and 23 deletions
|
@ -42,7 +42,7 @@
|
|||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_SIMPLE_MEMORY_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>..\SilentPatch;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
|
|
@ -44,7 +44,7 @@ char* GetMyDocumentsPath()
|
|||
|
||||
void InjectHooks()
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory::VP;
|
||||
|
||||
static char aNoDesktopMode[64];
|
||||
|
||||
|
@ -179,8 +179,6 @@ VOID WINAPI GetStartupInfoA_Hook(LPSTARTUPINFOA lpStartupInfo)
|
|||
static bool bPatched = false;
|
||||
if ( !bPatched )
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
|
||||
bPatched = true;
|
||||
|
||||
InjectHooks();
|
||||
|
|
|
@ -316,7 +316,8 @@ static char aNoDesktopMode[64];
|
|||
|
||||
void Patch_III_10(const RECT& desktop)
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51F970;
|
||||
SetScale = (void(*)(float,float))0x501B80;
|
||||
|
@ -498,7 +499,8 @@ void Patch_III_10(const RECT& desktop)
|
|||
|
||||
void Patch_III_11(const RECT& desktop)
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51FBA0;
|
||||
SetScale = (void(*)(float,float))0x501C60;
|
||||
|
@ -659,7 +661,8 @@ void Patch_III_11(const RECT& desktop)
|
|||
|
||||
void Patch_III_Steam(const RECT& desktop)
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
DrawRect = (void(*)(const CRect&,const CRGBA&))0x51FB30;
|
||||
SetScale = (void(*)(float,float))0x501BF0;
|
||||
|
|
|
@ -27,7 +27,7 @@ RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
|||
static BYTE* pMem = AddressByVersion<BYTE*>(0x7CF9CA, 0x7D02CA, 0x80998A);
|
||||
RwTexture* pTexture = nullptr;
|
||||
|
||||
MemoryVP::Patch<BYTE>(pMem, rwSTREAMMEMORY);
|
||||
Memory::VP::Patch<BYTE>(pMem, rwSTREAMMEMORY);
|
||||
|
||||
RwMemory PNGMemory;
|
||||
PNGMemory.start = const_cast<RwUInt8*>(static_cast<const RwUInt8*>(pMemory));
|
||||
|
@ -48,7 +48,7 @@ RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
|||
RwImageDestroy(pImage);
|
||||
}
|
||||
|
||||
MemoryVP::Patch<BYTE>(pMem, rwSTREAMFILENAME);
|
||||
Memory::VP::Patch<BYTE>(pMem, rwSTREAMFILENAME);
|
||||
|
||||
return pTexture;
|
||||
}
|
|
@ -1946,7 +1946,9 @@ BOOL InjectDelayedPatches_10()
|
|||
{
|
||||
if ( !IsAlreadyRunning() )
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
ScopedUnprotect::Section Protect2( (HINSTANCE)0x400000, ".rdata" );
|
||||
|
||||
// Obtain a path to the ASI
|
||||
wchar_t wcModulePath[MAX_PATH];
|
||||
|
@ -2172,7 +2174,9 @@ BOOL InjectDelayedPatches_11()
|
|||
{
|
||||
if ( !IsAlreadyRunning() )
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
ScopedUnprotect::Section Protect2( (HINSTANCE)0x400000, ".rdata" );
|
||||
|
||||
// Obtain a path to the ASI
|
||||
wchar_t wcModulePath[MAX_PATH];
|
||||
|
@ -2395,7 +2399,9 @@ BOOL InjectDelayedPatches_Steam()
|
|||
{
|
||||
if ( !IsAlreadyRunning() )
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
ScopedUnprotect::Section Protect2( (HINSTANCE)0x400000, ".rdata" );
|
||||
|
||||
// Obtain a path to the ASI
|
||||
wchar_t wcModulePath[MAX_PATH];
|
||||
|
@ -2606,7 +2612,10 @@ static char aNoDesktopMode[64];
|
|||
|
||||
void Patch_SA_10()
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
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);
|
||||
|
@ -3022,7 +3031,9 @@ void Patch_SA_10()
|
|||
|
||||
void Patch_SA_11()
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
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);
|
||||
|
@ -3364,7 +3375,9 @@ void Patch_SA_11()
|
|||
|
||||
void Patch_SA_Steam()
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
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
|
||||
IsAlreadyRunning = (BOOL(*)())(*(int*)(0x7826ED+1) + 0x7826ED + 5);
|
||||
|
@ -3726,7 +3739,9 @@ void Patch_SA_Steam()
|
|||
|
||||
void Patch_SA_NewSteam_r1()
|
||||
{
|
||||
using namespace MemoryVP::DynBase;
|
||||
using namespace Memory::DynBase;
|
||||
ScopedUnprotect::Section Protect( GetModuleHandle( nullptr ), ".text" );
|
||||
ScopedUnprotect::Section Protect2( GetModuleHandle( nullptr ), ".rdata" );
|
||||
|
||||
// Nazi EXE?
|
||||
if ( *(DWORD*)DynBaseAddress(0x49F810) == 0x64EC8B55 )
|
||||
|
@ -3807,7 +3822,9 @@ void Patch_SA_NewSteam_r1()
|
|||
|
||||
void Patch_SA_NewSteam_r2()
|
||||
{
|
||||
using namespace MemoryVP::DynBase;
|
||||
using namespace Memory::DynBase;
|
||||
ScopedUnprotect::Section Protect( GetModuleHandle( nullptr ), ".text" );
|
||||
ScopedUnprotect::Section Protect2( GetModuleHandle( nullptr ), ".rdata" );
|
||||
|
||||
// (Hopefully) more precise frame limiter
|
||||
int pAddress = DynBaseAddress(0x77D55F);
|
||||
|
@ -4001,7 +4018,9 @@ void Patch_SA_NewSteam_r2()
|
|||
|
||||
void Patch_SA_NewSteam_r2_lv()
|
||||
{
|
||||
using namespace MemoryVP::DynBase;
|
||||
using namespace Memory::DynBase;
|
||||
ScopedUnprotect::Section Protect( GetModuleHandle( nullptr ), ".text" );
|
||||
ScopedUnprotect::Section Protect2( GetModuleHandle( nullptr ), ".rdata" );
|
||||
|
||||
// (Hopefully) more precise frame limiter
|
||||
int pAddress = DynBaseAddress(0x77D44F);
|
||||
|
|
|
@ -194,7 +194,8 @@ static char aNoDesktopMode[64];
|
|||
|
||||
void Patch_VC_10(const RECT& desktop)
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
AudioResetTimers = (void(__stdcall*)(unsigned int))0x5F98D0;
|
||||
PrintString = (void(*)(float,float,const wchar_t*))0x551040;
|
||||
|
@ -327,7 +328,6 @@ void Patch_VC_10(const RECT& desktop)
|
|||
// Reinit free resprays flag
|
||||
InjectHook(0x4349BB, GaragesInit_SilentPatch, PATCH_JUMP);
|
||||
|
||||
|
||||
// Fixed ammo for melee weapons in cheats
|
||||
Patch<BYTE>(0x4AED14+1, 1); // katana
|
||||
Patch<BYTE>(0x4AEB74+1, 1); // chainsaw
|
||||
|
@ -345,7 +345,8 @@ void Patch_VC_10(const RECT& desktop)
|
|||
|
||||
void Patch_VC_11(const RECT& desktop)
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
AudioResetTimers = (void(__stdcall*)(unsigned int))0x5F98F0;
|
||||
PrintString = (void(*)(float,float,const wchar_t*))0x551060;
|
||||
|
@ -486,7 +487,8 @@ void Patch_VC_11(const RECT& desktop)
|
|||
|
||||
void Patch_VC_Steam(const RECT& desktop)
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
AudioResetTimers = (void(__stdcall*)(unsigned int))0x5F9530;
|
||||
PrintString = (void(*)(float,float,const wchar_t*))0x550F30;
|
||||
|
@ -626,7 +628,8 @@ void Patch_VC_Steam(const RECT& desktop)
|
|||
|
||||
void Patch_VC_JP()
|
||||
{
|
||||
using namespace MemoryVP;
|
||||
using namespace Memory;
|
||||
ScopedUnprotect::Section Protect( (HINSTANCE)0x400000, ".text" );
|
||||
|
||||
// Y axis sensitivity fix
|
||||
// By ThirteenAG
|
||||
|
|
Loading…
Reference in a new issue