| 6 | import Movie; |
| 7 | bool bUsingLegacy = false; |
| 8 | |
| 9 | void Init() |
| 10 | { |
| 11 | CIniReader reader(L"GTAVC.WidescreenFixLegacy.ini"); |
| 12 | if (std::filesystem::exists(reader.GetIniPath())) |
| 13 | { |
| 14 | bUsingLegacy = true; |
| 15 | InitLegacy(); |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | // VC has separate movie setup and focus-restoration paths. |
| 20 | Movie::Init({ |
| 21 | "FF 15 ? ? ? ? 8B 84 24 0C 02 00 00 8B 8C 24 08 02 00 00 50 8B 84 24 08 02 00 00 8B 94 24 04 02 00 00 51 50 A1 ? ? ? ? 8B 18 52 50 FF 93 9C 00 00 00", |
| 22 | "FF 15 ? ? ? ? 8B 44 24 ? 8B 5C 24 ? 50 8B 44 24 ? 8B 4C 24 ? 53 50 A1 ? ? ? ? 8B 28 51 50 FF 95 9C 00 00 00" |
| 23 | }); |
| 24 | |
| 25 | auto pattern = hook::pattern("BE ? ? ? ? 59 89 C7"); |
| 26 | static auto WinMainHook = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs) |
| 27 | { |
| 28 | WFP::onInitEvent().executeAll(); |
| 29 | }); |
| 30 | |
| 31 | pattern = hook::pattern("8D 44 24 ? 6A ? 6A ? 6A ? 6A ? 50 FF 15 ? ? ? ? 85 C0 74 ? 83 7C 24"); |
| 32 | static auto MainLoopHook = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs) |
| 33 | { |
| 34 | static std::once_flag of; |
| 35 | std::call_once(of, []() |
| 36 | { |
| 37 | WFP::onGameInitEvent().executeAll(); |
| 38 | }); |
| 39 | |
| 40 | WFP::onGameProcessEvent().executeAll(); |
| 41 | }); |
| 42 | |
| 43 | pattern = find_pattern<3>("68 ? ? ? ? 50 ? ? FF 52", "68 ? ? ? ? 50 ? ? FF 52"); |
| 44 | static auto _rwD3D8CameraClearBeforeResetHook = safetyhook::create_mid(pattern.get(0).get<void*>(), [](SafetyHookContext& regs) { WFP::onBeforeReset().executeAll(); }); |
| 45 | //static auto _rwD3D8BeginSceneBeforeResetHook = safetyhook::create_mid(pattern.get(1).get<void*>(), [](SafetyHookContext& regs) { WFP::onBeforeReset().executeAll(); }); |
| 46 | static auto _rwD3D8CameraBeginUpdateBeforeResetHook = safetyhook::create_mid(pattern.get(2).get<void*>(), [](SafetyHookContext& regs) { WFP::onBeforeReset().executeAll(); }); |
| 47 | |
| 48 | pattern = find_pattern("68 ? ? ? ? 50 ? ? FF 51 ? 3D"); |
| 49 | static auto _rwD3D8BeginSceneBeforeResetHook2 = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs) { WFP::onBeforeReset().executeAll(); }); |
| 50 |
nothing calls this directly
no test coverage detected