Skip to content

Commit

Permalink
saboteur: add fps unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 26, 2024
1 parent 8b34678 commit b106931
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[MAIN]
FixFOV = 1
BorderlessWindowed = 1
UnlockFPS = 0
16 changes: 14 additions & 2 deletions source/TheSaboteur.FusionFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ struct OdinCamera

void Init()
{
WFP::onInitEventAsync() += []()
WFP::onInitEvent() += []()
{
CIniReader iniReader("");
auto bFixFOV = iniReader.ReadInteger("MAIN", "FixFOV", 1) != 0;
auto bBorderlessWindowed = iniReader.ReadInteger("MAIN", "BorderlessWindowed", 1) != 0;
auto bUnlockFPS = iniReader.ReadInteger("MAIN", "UnlockFPS", 0) != 0;

// Unlock resolutions with any refresh rate
auto pattern = hook::pattern("74 ? 83 C6 01 83 C0 20");
injector::WriteMemory<uint8_t>(pattern.get_first(0), 0xEB, true);

if (bFixFOV)
{
Expand All @@ -87,6 +92,13 @@ void Init()
std::forward_as_tuple("SetWindowPos", WindowedModeWrapper::SetWindowPos_Hook)
);
}

if (bUnlockFPS)
{
static float f = 1.0f / 360.0f;
auto pattern = hook::pattern("D9 05 ? ? ? ? A2 ? ? ? ? D9 1D ? ? ? ? E8");
injector::WriteMemory(pattern.get_first(2), &f, true);
}
};

static auto futures = WFP::onInitEventAsync().executeAllAsync();
Expand All @@ -105,7 +117,7 @@ CEXP void InitializeASI()
{
std::call_once(CallbackHandler::flag, []()
{
CallbackHandler::RegisterCallback(Init, hook::pattern("D9 44 24 04 56 DC 0D ? ? ? ? 8B F1 D9 5C 24 08"));
CallbackHandler::RegisterCallbackAtGetSystemTimeAsFileTime(Init, hook::pattern("D9 44 24 04 56 DC 0D ? ? ? ? 8B F1 D9 5C 24 08"));
});
}

Expand Down

0 comments on commit b106931

Please sign in to comment.