@@ -7,6 +7,7 @@ HMODULE GameModule = GetModuleHandleA("METAL GEAR SOLID3.exe");
77uintptr_t GameBase = (uintptr_t )GameModule;
88uintptr_t * CamoIndexData = NULL ;
99float CamoIndexModifier = 1 .0f ;
10+ int CamoIndexValue = 0 ;
1011mINI ::INIStructure Config;
1112
1213typedef uintptr_t * __fastcall InitializeCamoIndexDelegate (uintptr_t a1, int a2);
@@ -24,11 +25,17 @@ uintptr_t __fastcall CalculateCamoIndexHook(uintptr_t a1, int a2)
2425 auto camoIndex = (int *)((char *)&CamoIndexData[4 ] + index + 4 );
2526 auto movementState = (int *)((char *)&CamoIndexData[4 ] + index + 8 );
2627
28+ if (*camoIndex >= 1000 ) // ignore if stealth is equipped
29+ {
30+ return result;
31+ }
32+
2733 if (*movementState == 0x6002 )
2834 {
2935 *camoIndex = *camoIndex < 0 ? *camoIndex / CamoIndexModifier : *camoIndex * CamoIndexModifier;
36+ *camoIndex += CamoIndexValue;
3037
31- if (*camoIndex > 1000 ) *camoIndex = 1000 ;
38+ if (*camoIndex > 950 ) *camoIndex = 950 ;
3239 if (*camoIndex < -1000 ) *camoIndex = -1000 ;
3340 }
3441 }
@@ -40,12 +47,12 @@ void InstallHooks()
4047{
4148 int status = MH_Initialize ();
4249
43- uintptr_t CalcuateCamoIndexOffset = (uintptr_t )Memory::PatternScan (GameModule, " 48 83 EC 30 0F 29 74 24 20 48 8B F9 48 63 F2 E8" ) - 0x10 ;
44- uintptr_t InitializeCamoIndexOffset = (uintptr_t )Memory::PatternScan (GameModule, " 85 D2 75 33 0F 57 C0 48 63 C2 48 C1 E0 07 48 8D" );
50+ uintptr_t calcuateCamoIndexOffset = (uintptr_t )Memory::PatternScan (GameModule, " 48 83 EC 30 0F 29 74 24 20 48 8B F9 48 63 F2 E8" ) - 0x10 ;
51+ uintptr_t initializeCamoIndexOffset = (uintptr_t )Memory::PatternScan (GameModule, " 85 D2 75 33 0F 57 C0 48 63 C2 48 C1 E0 07 48 8D" );
4552
46- Memory::DetourFunction (CalcuateCamoIndexOffset , (LPVOID)CalculateCamoIndexHook, (LPVOID*)&CalculateCamoIndex);
53+ Memory::DetourFunction (calcuateCamoIndexOffset , (LPVOID)CalculateCamoIndexHook, (LPVOID*)&CalculateCamoIndex);
4754
48- InitializeCamoIndex = (InitializeCamoIndexDelegate*)InitializeCamoIndexOffset ;
55+ InitializeCamoIndex = (InitializeCamoIndexDelegate*)initializeCamoIndexOffset ;
4956 CamoIndexData = InitializeCamoIndex (0 , 0 );
5057}
5158
@@ -54,6 +61,7 @@ void ReadConfig()
5461 mINI ::INIFile file (" MGS3CrouchWalk.ini" );
5562 file.read (Config);
5663 CamoIndexModifier = std::stof (Config[" Settings" ][" CamoIndexModifier" ]);
64+ CamoIndexValue = std::stoi (Config[" Settings" ][" CamoIndexValue" ]) * 10 ;
5765}
5866
5967DWORD WINAPI MainThread (LPVOID lpParam)
0 commit comments