Skip to content

Commit

Permalink
Merge to upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
SandeMC committed Nov 4, 2024
2 parents 95e527a + a0cce46 commit 0c76882
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ The original repository has no support for GFWL (it does have support for outdat
- Change the default option of `SkipMenu` to 0 to be able to load into DLC's first.
- Change the default option of `RecoilFix` to 0 to avoid being as disadvantage to other players in the multiplayer.
- Enable Windowed by default, which also enables Borderless and No Block on Focus Loss.
- Fixed loading text glow and broken cop blips (by removing a fix? huh?)

Keep in mind that you still want additional mods to be used for a pleasant GFWL multiplayer experience, including disabling the mod check to even allow this fork to work.

Expand Down
36 changes: 35 additions & 1 deletion source/frameratevigilante.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ public:
}; injector::MakeInline<FramerateVigilanteHook1>(pattern.get_first(0), pattern.get_first(6));
}

pattern = hook::pattern("F3 0F 10 05 ? ? ? ? F3 0F 58 C1 F3 0F 11 05 ? ? ? ? EB 36");
if (!pattern.empty())
{
static auto f1032790 = *pattern.get_first<float*>(4);
struct LoadingTextSpeed
{
void operator()(injector::reg_pack& regs)
{
regs.xmm0.f32[0] = *f1032790 * *CTimer::fTimeStep;
regs.xmm0.f32[0] += regs.xmm1.f32[0];
}
}; injector::MakeInline<LoadingTextSpeed>(pattern.get_first(0), pattern.get_first(12));
}

pattern = hook::pattern("F3 0F 58 0D ? ? ? ? 0F 5B C0 F3 0F 11 0D");
if (!pattern.empty())
{
Expand All @@ -75,7 +89,7 @@ public:
}

// CD/busy spinner
pattern = find_pattern("F3 0F 58 05 ? ? ? ? 33 C0 A3 ? ? ? ? F3 0F 11 05");
pattern = hook::pattern("F3 0F 58 05 ? ? ? ? 33 C0 A3 ? ? ? ? F3 0F 11 05");
if (!pattern.empty())
{
struct CDSpinnerHook
Expand All @@ -86,6 +100,26 @@ public:
}
}; injector::MakeInline<CDSpinnerHook>(pattern.get_first(0), pattern.get_first(8));
}

// Cop blips
pattern = hook::pattern("F3 0F 10 4C 24 ? 0F 28 C1 F3 0F 59 C2");
if (!pattern.empty())
{
static int CustomFrameCounter = 0;

static auto CounterHook = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs)
{
static float accumulator = 0.0f;
accumulator += (*CTimer::fTimeStep / (1.0f / 30.0f));
int increment = static_cast<int>(accumulator);
CustomFrameCounter += increment;
accumulator -= increment;
});

pattern = hook::pattern("A1 ? ? ? ? 6B C0 15");
if (!pattern.empty())
injector::WriteMemory(pattern.get_first(1), &CustomFrameCounter, true);
}
};
}
} FramerateVigilante;

0 comments on commit 0c76882

Please sign in to comment.