From 597e3eff74ab4e25bc6d54e310117779214a807d Mon Sep 17 00:00:00 2001 From: withmorten Date: Fri, 29 Jun 2018 19:58:50 +0200 Subject: [PATCH] add regionfree.dll; gta3 and vc now ignore german and french specific settings --- build.cmd | 1 + regionfree.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 regionfree.cpp diff --git a/build.cmd b/build.cmd index edf2952..6708487 100644 --- a/build.cmd +++ b/build.cmd @@ -15,3 +15,4 @@ cl /LD extradirfix.cpp /Feextradirfix.dll cl /LD overridecd.cpp /Feoverridecd.dll cl /LD portablegta.cpp /Feportablegta.dll cl /LD hydraulics.cpp /Fehydraulics.dll +cl /LD regionfree.cpp /Feregionfree.dll diff --git a/regionfree.cpp b/regionfree.cpp new file mode 100644 index 0000000..dabbe57 --- /dev/null +++ b/regionfree.cpp @@ -0,0 +1,52 @@ +#include "windows.h" +#include +typedef uintptr_t uintptr; +#include "MemoryMgr.h" // take from skygfx_vc + +typedef uint8_t uint8, uchar; +typedef uint16_t uint16, ushort; +typedef uint32_t uint32, uint; +typedef uint64_t uint64; +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +#define nil NULL +#define FIELD(type, var, offset) *(type*)((uint8*)var + offset) + +int gtaversion = -1; + +void +patchIII10(void) +{ + // don't set frenchGame and germanGame in + // CMenuManager::InitialiseChangedLanguageSettings + InjectHook(0x47A51B, 0x47A537, PATCH_JUMP); + + // and additionally nastyGame, noProstitues and m_PrefsAllowNastyGame in + // InitialiseLanguage + InjectHook(0x5821C2, 0x582222, PATCH_JUMP); +} + +void +patchVC10(void) +{ + // same as patchIII10 + InjectHook(0x4A38EC, 0x4A3948, PATCH_JUMP); + InjectHook(0x600B66, 0x600BA2, PATCH_JUMP); +} + +BOOL WINAPI +DllMain(HINSTANCE hInst, DWORD reason, LPVOID) +{ + if(reason == DLL_PROCESS_ATTACH){ + AddressByVersion(0, 0, 0, 0, 0, 0); + if (gtaversion == III_10) + patchIII10(); + else if(gtaversion == VC_10) + patchVC10(); + } + + return TRUE; +}