Skip to content

Commit

Permalink
Reverted screen effect changes from #32.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyall committed Mar 21, 2024
1 parent a9e6bcb commit 856b85c
Showing 1 changed file with 7 additions and 39 deletions.
46 changes: 7 additions & 39 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,57 +285,25 @@ void GraphicalFixes()

// Screen Effects
uint8_t* ScreenEffectsScanResult = Memory::PatternScan(baseModule, "C5 ?? ?? ?? 48 ?? ?? ?? ?? ?? 00 C5 ?? ?? ?? ?? ?? ?? 00 C3") + 0xB;
uint8_t* ScreenEffects2ScanResult = Memory::PatternScan(baseModule, "C5 ?? ?? ?? ?? C7 ?? ?? 00 00 80 3F F6 ?? ?? ?? 75 ??");
if (ScreenEffectsScanResult && ScreenEffects2ScanResult)
if (ScreenEffectsScanResult)
{
spdlog::info("Screen Effects: Address 1 is {:s}+{:x}", sExeName.c_str(), (uintptr_t)ScreenEffectsScanResult - (uintptr_t)baseModule);

static SafetyHookMid ScreenEffectsMidHook{};
ScreenEffectsMidHook = safetyhook::create_mid(ScreenEffectsScanResult,
[](SafetyHookContext& ctx)
{
if (fAspectRatio > fNativeAspect)
{
ctx.xmm0.f32[0] = 1.0f;
}
else if (fAspectRatio < fNativeAspect)
{
// Not necessary
}
});
/*
static SafetyHookMid ScreenEffects2MidHook{};
ScreenEffects2MidHook = safetyhook::create_mid(ScreenEffectsScanResult - 0x9B, // TODO: This is a long gap, maybe do a third pattern?
[](SafetyHookContext& ctx)
{
if (fAspectRatio > fNativeAspect)
{
// Not necessary
}
else if (fAspectRatio < fNativeAspect)
{
// Not necessary
}
});
*/
spdlog::info("Screen Effects: Address 2 is {:s}+{:x}", sExeName.c_str(), (uintptr_t)ScreenEffects2ScanResult - (uintptr_t)baseModule);

static SafetyHookMid ScreenEffects3MidHook{};
ScreenEffects3MidHook = safetyhook::create_mid(ScreenEffects2ScanResult,

static SafetyHookMid ScreenEffects1MidHook{};
ScreenEffects1MidHook = safetyhook::create_mid(ScreenEffectsScanResult,
[](SafetyHookContext& ctx)
{
if (fAspectRatio > fNativeAspect)
{
ctx.xmm0.f32[0] *= fAspectMultiplier;
ctx.xmm0.f32[0] = fAspectMultiplier;
}
else if (fAspectRatio < fNativeAspect)
{
// Not necessary
ctx.xmm0.f32[0] = 1.0f * fAspectMultiplier;
}
});

}
else if (!ScreenEffectsScanResult || !ScreenEffects2ScanResult)
else if (!ScreenEffectsScanResult)
{
spdlog::error("Screen Effects: Pattern scan failed.");
}
Expand Down

0 comments on commit 856b85c

Please sign in to comment.