Skip to content

Commit

Permalink
simplify last hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Jan 14, 2024
1 parent 7236bd7 commit 355dd73
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions source/framelimit.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,11 @@ void __cdecl sub_855640()
}
}

bool bIsC64CB0XRef = false;
injector::hook_back<void(__cdecl*)(void*)> hbsub_C64CB0;
void __cdecl sub_C64CB0(void* a1)
{
bIsC64CB0XRef = true;
hbsub_C64CB0.fun(a1);
bIsC64CB0XRef = false;
}

SafetyHookInline CCutsceneObjectHook{};
void __fastcall sub_C64380(void* _this, void* edx)
{
if (bIsC64CB0XRef)
LoadingFpsLimiter.Sync();
return CCutsceneObjectHook.unsafe_fastcall(_this, edx);
LoadingFpsLimiter.Sync();
return hbsub_C64CB0.fun(a1);
}

class Framelimit
Expand Down Expand Up @@ -252,11 +242,7 @@ public:
FusionFix::onInitEvent() += []()
{
// Off Route infinite loading (CCutsceneObject method causes CRenderer::removeAllTexturesFromDictionary to softlock for unidentified reason)
auto pattern = hook::pattern("56 8B F1 83 BE ? ? ? ? ? C7 06 ? ? ? ? 0F 85");
if (!pattern.empty())
CCutsceneObjectHook = safetyhook::create_inline(pattern.get_first(0), sub_C64380);

pattern = hook::pattern("E8 ? ? ? ? 83 C4 0C C7 04 B5 ? ? ? ? ? ? ? ? 4E");
auto pattern = hook::pattern("E8 ? ? ? ? 83 C4 0C C7 04 B5 ? ? ? ? ? ? ? ? 4E");
if (!pattern.empty())
hbsub_C64CB0.fun = injector::MakeCALL(pattern.get_first(0), sub_C64CB0).get();
};
Expand Down

0 comments on commit 355dd73

Please sign in to comment.