@@ -220,12 +220,7 @@ bool DetectGame()
220220 return false ;
221221 }
222222
223- while ((dllModule2 = GetModuleHandleA (" render.dll" )) == nullptr )
224- {
225- spdlog::warn (" render.dll not loaded yet. Waiting..." );
226- }
227-
228- spdlog::info (" Successfully obtained handle for render.dll: 0x{:X}" , reinterpret_cast <uintptr_t >(dllModule2));
223+ dllModule2 = Memory::GetHandle (" render.dll" );
229224
230225 return true ;
231226}
@@ -253,7 +248,7 @@ void WidescreenFix()
253248 fAspectRatioScale = fNewAspectRatio / fOldAspectRatio ;
254249
255250 std::vector<std::uint8_t *> ResolutionInstructionsScansResult = Memory::PatternScan (exeModule, " 89 0D 18 B2 62 00 89 15 1C B2 62 00 BF 01 00 00 00 BE C4 F4 55 00" , " 8B 0D 40 55 AE 00 8B 15 90 55 AE 00 56 57" , " 68 ?? ?? ?? ?? 68 ?? ?? ?? ?? FF 15 ?? ?? ?? ?? 68" ,
256- dllModule2, " A1 ?? ?? ?? ?? 8B 0D ?? ?? ?? ?? 89 35" , " 89 0D ?? ?? ?? ?? 89 15 ?? ?? ?? ?? 5E" , " 89 35 ?? ?? ?? ?? 89 35 ?? ?? ?? ?? 89 35 ?? ?? ?? ?? 89 35" , " A3 ?? ?? ?? ?? 8B 44 24 ?? 6A 00 6A 00 68 ?? ?? ?? ?? 50 89 7C 24 ?? FF D6 85 C0 0F 85 ?? ?? ?? ?? 8B 44 24 ?? 85 C0 0F 84 ?? ?? ?? ?? 8B 4C 24 ?? 8D 54 24 ?? 8D 44 24 ?? 52 50 89 0D ?? ?? ?? ??" );
251+ dllModule2, " A1 ?? ?? ?? ?? 8B 0D ?? ?? ?? ?? 89 35" , " 89 0D ?? ?? ?? ?? 89 15 ?? ?? ?? ?? 5E" , " 89 35 ?? ?? ?? ?? 89 35 ?? ?? ?? ?? 89 35 ?? ?? ?? ?? 89 35" , " A3 ?? ?? ?? ?? 8B 44 24 ?? 6A 00 6A 00 68 ?? ?? ?? ?? 50 89 7C 24 ?? FF D6 85 C0 0F 85 ?? ?? ?? ?? 8B 44 24 ?? 85 C0 0F 84 ?? ?? ?? ?? 8B 4C 24 ?? 8D 54 24 ?? 8D 44 24 ?? 52 50 89 0D ?? ?? ?? ??" );
257252 if (Memory::AreAllSignaturesValid (ResolutionInstructionsScansResult) == true )
258253 {
259254 spdlog::info (" Resolution Instructions 1 Scan: Address is {:s}+{:x}" , sExeName .c_str (), ResolutionInstructionsScansResult[Resolution1Scan] - (std::uint8_t *)exeModule);
@@ -286,7 +281,7 @@ void WidescreenFix()
286281
287282 ResolutionHeight7Address = Memory::GetPointerFromAddress<uint32_t >(ResolutionInstructionsScansResult[Resolution7Scan] + 61 , Memory::PointerMode::Absolute);
288283
289- Memory::PatchBytes (ResolutionInstructionsScansResult[Resolution1Scan], " \x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90 " , 12 );
284+ Memory::WriteNOPs (ResolutionInstructionsScansResult[Resolution1Scan], 12 );
290285
291286 static SafetyHookMid ResolutionInstructions1MidHook{};
292287
@@ -312,7 +307,7 @@ void WidescreenFix()
312307 Memory::Write(ResolutionInstructionsScansResult[Resolution3Scan] + 1, iCurrentResY);
313308 */
314309
315- Memory::PatchBytes (ResolutionInstructionsScansResult[Resolution4Scan], " \x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90 " , 11 );
310+ Memory::WriteNOPs (ResolutionInstructionsScansResult[Resolution4Scan], 11 );
316311
317312 static SafetyHookMid ResolutionInstructions4MidHook{};
318313
@@ -323,7 +318,7 @@ void WidescreenFix()
323318 ctx.ecx = std::bit_cast<uintptr_t >(iCurrentResY);
324319 });
325320
326- Memory::PatchBytes (ResolutionInstructionsScansResult[Resolution5Scan], " \x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90 " , 12 );
321+ Memory::WriteNOPs (ResolutionInstructionsScansResult[Resolution5Scan], 12 );
327322
328323 static SafetyHookMid ResolutionInstructions5MidHook{};
329324
@@ -334,7 +329,7 @@ void WidescreenFix()
334329 *reinterpret_cast <int *>(ResolutionHeight5Address) = iCurrentResY;
335330 });
336331
337- Memory::PatchBytes (ResolutionInstructionsScansResult[Resolution6Scan], " \x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90 " , 12 );
332+ Memory::WriteNOPs (ResolutionInstructionsScansResult[Resolution6Scan], 12 );
338333
339334 static SafetyHookMid ResolutionInstructions6MidHook{};
340335
@@ -345,7 +340,7 @@ void WidescreenFix()
345340 *reinterpret_cast <int *>(ResolutionHeight6Address) = iCurrentResY;
346341 });
347342
348- Memory::PatchBytes (ResolutionInstructionsScansResult[Resolution7Scan], " \x90\x90\x90\x90\x90 " , 5 );
343+ Memory::WriteNOPs (ResolutionInstructionsScansResult[Resolution7Scan], 5 );
349344
350345 static SafetyHookMid ResolutionWidthInstruction7MidHook{};
351346
@@ -354,7 +349,7 @@ void WidescreenFix()
354349 *reinterpret_cast <int *>(ResolutionWidth7Address) = iCurrentResX;
355350 });
356351
357- Memory::PatchBytes (ResolutionInstructionsScansResult[Resolution7Scan] + 59 , " \x90\x90\x90\x90\x90\x90 " , 6 );
352+ Memory::WriteNOPs (ResolutionInstructionsScansResult[Resolution7Scan] + 59 , 6 );
358353
359354 static SafetyHookMid ResolutionHeightInstruction7MidHook{};
360355
@@ -369,7 +364,7 @@ void WidescreenFix()
369364 {
370365 spdlog::info (" Camera FOV Instruction: Address is render.dll+{:x}" , CameraFOVInstructionScanResult - (std::uint8_t *)dllModule2);
371366
372- Memory::PatchBytes (CameraFOVInstructionScanResult, " \x90\x90\x90\x90 " , 4 );
367+ Memory::WriteNOPs (CameraFOVInstructionScanResult, 4 );
373368
374369 CameraFOVInstructionHook = safetyhook::create_mid (CameraFOVInstructionScanResult, CameraFOVInstructionMidHook);
375370 }
0 commit comments