diff --git a/DDraw/DDraw.vcxproj b/DDraw/DDraw.vcxproj
index 9955b29..d461450 100644
--- a/DDraw/DDraw.vcxproj
+++ b/DDraw/DDraw.vcxproj
@@ -42,7 +42,7 @@
AnySuitable
Speed
true
- NDEBUG;%(PreprocessorDefinitions)
+ NDEBUG;_SIMPLE_MEMORY_ONLY;%(PreprocessorDefinitions)
true
MultiThreaded
..\SilentPatch;%(AdditionalIncludeDirectories)
diff --git a/DDraw/dllmain.cpp b/DDraw/dllmain.cpp
index f528040..992ce7e 100644
--- a/DDraw/dllmain.cpp
+++ b/DDraw/dllmain.cpp
@@ -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();
diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp
index 5ebdd80..deef4bd 100644
--- a/SilentPatchIII/SilentPatchIII.cpp
+++ b/SilentPatchIII/SilentPatchIII.cpp
@@ -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;
diff --git a/SilentPatchSA/PNGFile.cpp b/SilentPatchSA/PNGFile.cpp
index a5506db..1995e71 100644
--- a/SilentPatchSA/PNGFile.cpp
+++ b/SilentPatchSA/PNGFile.cpp
@@ -27,7 +27,7 @@ RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
static BYTE* pMem = AddressByVersion(0x7CF9CA, 0x7D02CA, 0x80998A);
RwTexture* pTexture = nullptr;
- MemoryVP::Patch(pMem, rwSTREAMMEMORY);
+ Memory::VP::Patch(pMem, rwSTREAMMEMORY);
RwMemory PNGMemory;
PNGMemory.start = const_cast(static_cast(pMemory));
@@ -48,7 +48,7 @@ RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
RwImageDestroy(pImage);
}
- MemoryVP::Patch(pMem, rwSTREAMFILENAME);
+ Memory::VP::Patch(pMem, rwSTREAMFILENAME);
return pTexture;
}
\ No newline at end of file
diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp
index ef6cc01..2b09563 100644
--- a/SilentPatchSA/SilentPatchSA.cpp
+++ b/SilentPatchSA/SilentPatchSA.cpp
@@ -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(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(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);
diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp
index 6ab8c0b..f1979c5 100644
--- a/SilentPatchVC/SilentPatchVC.cpp
+++ b/SilentPatchVC/SilentPatchVC.cpp
@@ -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(0x4AED14+1, 1); // katana
Patch(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