MCPcopy Create free account
hub / github.com/ThirteenAG/WidescreenFixesPack / Init

Function Init

source/NFSCarbon.WidescreenFix/dllmain.cpp:47–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void Init()
48{
49 auto pattern = hook::pattern("A1 ? ? ? ? 68 ? ? ? ? 50 FF 15 ? ? ? ? 8B 0D");
50 hWnd.SetAddress(*pattern.get_first<HWND*>(1));
51 WindowRect.SetAddress(*pattern.get_first<tagRECT*>(6));
52
53 pattern = hook::pattern("8B 0D ? ? ? ? 2B FA");
54 dwWindowedMode.SetAddress(*pattern.get_first<uint32_t*>(2));
55
56 pattern = hook::pattern("A1 ? ? ? ? 8B 4C 24 ? 8D A4 24");
57 g_RacingResolution.SetAddress(*pattern.get_first<int*>(1));
58
59 pattern = hook::pattern("6A ? 68 ? ? ? ? 64 A1 ? ? ? ? 50 64 89 25 ? ? ? ? 83 EC ? ? ? ? ? 56 ? ? ? ? ? ? ? ? ? ? E8 ? ? ? ? E8");
60 shMainLoop = safetyhook::create_inline(pattern.get_first(), MainLoop);
61
62 pattern = hook::pattern("51 6A ? E8 ? ? ? ? A1");
63 shMiniMainLoop = safetyhook::create_inline(pattern.get_first(), MiniMainLoop);
64
65 pattern = hook::pattern("E8 ? ? ? ? 84 C0 0F 85 ? ? ? ? 8B 46 ? C7 80");
66 GameFlowManager::IsPaused = decltype(GameFlowManager::IsPaused)(injector::GetBranchDestination(pattern.get_first()).get());
67
68 pattern = hook::pattern("A1 ? ? ? ? 6A 01 6A 1C C7 44 24");
69 Sim::Internal::mLastFrameTime.SetAddress(*pattern.get_first<float*>(1));
70
71 pattern = hook::pattern("DB 05 ? ? ? ? 56 D8 25");
72 cFEngGameInterface::GetMouseInfo = decltype(cFEngGameInterface::GetMouseInfo)(pattern.get_first());
73
74 pattern = hook::pattern("8B 0D ? ? ? ? 85 C9 74 ? E8 ? ? ? ? 84 C0 75 ? 8B CE E8");
75 MoviePlayerInstance.SetAddress(*pattern.get_first<void**>(2));
76
77 pattern = hook::pattern("8B 0D ? ? ? ? E8 ? ? ? ? 8B 0D ? ? ? ? 3B CF 5F");
78 cFEng::pInstance = *pattern.get_first<void**>(2);
79 cFEng::MakeLoadedPackagesDirty = (decltype(cFEng::MakeLoadedPackagesDirty))injector::GetBranchDestination(pattern.get_first(6)).as_int();
80
81 pattern = hook::pattern("E8 ? ? ? ? 83 C4 ? 8B F0 57");
82 CreateResourceFile = (decltype(CreateResourceFile))injector::GetBranchDestination(pattern.get_first(0)).as_int();
83
84 pattern = hook::pattern("E8 ? ? ? ? 6A ? C6 05");
85 ResourceFileBeginLoading = (decltype(ResourceFileBeginLoading))injector::GetBranchDestination(pattern.get_first(0)).as_int();
86
87 pattern = hook::pattern("E8 ? ? ? ? A1 ? ? ? ? 85 C0 75 ? A1 ? ? ? ? 85 C0 8B D0");
88 ServiceResourceLoading = (decltype(ServiceResourceLoading))injector::GetBranchDestination(pattern.get_first(0)).as_int();
89
90 pattern = hook::pattern("E8 ? ? ? ? C7 44 24 ? ? ? ? ? 8D 44 24");
91 FEPackage::ForAllObjects = (decltype(FEPackage::ForAllObjects))injector::GetBranchDestination(pattern.get_first(0)).as_int();
92
93 pattern = hook::pattern("8B 14 CD ? ? ? ? ? ? ? ? ? ? 85 C9");
94 gActionBindings = *pattern.get_first<ActionBindingData*>(3);
95
96 pattern = hook::pattern("8B 0D ? ? ? ? 46 8D 54 09 ? 83 C7");
97 gNumControllers.SetAddress(*pattern.get_first<int*>(2));
98
99 pattern = hook::pattern("A1 ? ? ? ? ? ? 68 ? ? ? ? 50 FF 52 ? A1");
100 Direct3DDevice.SetAddress(*pattern.get_first<IDirect3DDevice9**>(1));
101 static auto BeforeResetHook = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs)
102 {
103 WFP::onBeforeReset().executeAll();
104 });

Callers

nothing calls this directly

Calls 6

SetAddressMethod · 0.80
executeAllMethod · 0.80
executeAllAsyncMethod · 0.80
GetBranchDestinationFunction · 0.50
getMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected