File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,9 +162,43 @@ MMRESULT __stdcall fTimeKillEvent(UINT id) {
162162
163163static __declspec (naked) void scripts_check_state_hook() {
164164 __asm {
165- inc slideShow;
165+ mov slideShow, 1 ;
166166 call fo::funcoffs::endgame_slideshow_;
167- dec slideShow;
167+ mov slideShow, 0 ;
168+ retn;
169+ }
170+ }
171+
172+ // same as elapsed_time_ engine function, but bypasses the speed tweak
173+ static DWORD __fastcall elapsed_time_simple (DWORD start) {
174+ DWORD end = GetTickCount ();
175+ if (end >= start) {
176+ return (end - start);
177+ } else {
178+ return INT_MAX ;
179+ }
180+ }
181+
182+ static __declspec (naked) void map_scroll_hook_elapsed_time() {
183+ __asm {
184+ push ecx;
185+ push edx;
186+ mov ecx, eax;
187+ call elapsed_time_simple;
188+ pop edx;
189+ pop ecx;
190+ retn;
191+ }
192+ }
193+
194+ // get_time_ engine function is only a wrapper of GetTickCount
195+ static __declspec (naked) void map_scrall_hook_get_time() {
196+ __asm {
197+ push ecx;
198+ push edx;
199+ call GetTickCount; // bypass speed tweak
200+ pop edx;
201+ pop ecx;
168202 retn;
169203 }
170204}
@@ -220,6 +254,8 @@ void SpeedPatch::init() {
220254 }
221255 SafeWrite32 (0x4FDF58 , (DWORD )&getLocalTimeOffs);
222256 HookCall (0x4A433E , scripts_check_state_hook);
257+ HookCall (0x4826CF , map_scroll_hook_elapsed_time);
258+ HookCall (0x4826EB , map_scrall_hook_get_time);
223259
224260 TimerInit ();
225261}
You can’t perform that action at this time.
0 commit comments