Skip to content
Permalink
Browse files
Merge branch 'master' of github.com:GTAmodding/miscmods
  • Loading branch information
aap committed May 8, 2020
2 parents 30988dd + 0967de1 commit 80d850fe48d338a8dada1d9870b75cf627839ba1
Showing with 53 additions and 0 deletions.
  1. +1 −0 build.cmd
  2. +52 −0 regionfree.cpp
@@ -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
@@ -0,0 +1,52 @@
#include "windows.h"
#include <stdint.h>
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(0x600B42, 0x600BA2, PATCH_JUMP);
}

BOOL WINAPI
DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
{
if(reason == DLL_PROCESS_ATTACH){
AddressByVersion<uint32_t>(0, 0, 0, 0, 0, 0);
if (gtaversion == III_10)
patchIII10();
else if(gtaversion == VC_10)
patchVC10();
}

return TRUE;
}

0 comments on commit 80d850f

Please sign in to comment.