Skip to content

Commit

Permalink
Add option to disable cinematic effects.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyall committed Sep 27, 2024
1 parent 91ad8cb commit a074a5b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions FFXVIFix.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ Enabled = false
; Set "Enabled" to true to force depth of field off at all times.
Enabled = false

[Disable Cinematic Effects]
; Set "Enabled" to true to disable cinematic effects (vignette, film grain and chromatic aberration) during cutscenes/photo mode.
Enabled = false

[Dynamic Resolution]
; Set dynamic resolution parameters. It scales based off your set framerate target in-game.
; Set "MaxResolution" (Default: 95) or "MinResolution" (Default: 50) to adjust the min/max resolution scale percentage. (Valid range: 50 to 100)
Expand Down
26 changes: 26 additions & 0 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ float fJXLQuality = 75.0f;
int iJXLThreads = 1;
bool bDisableDbgCheck;
bool bDisableDOF;
bool bDisableCinematicEffects;
bool bBackgroundAudio;
bool bLockCursor;
bool bResizableWindow;
Expand Down Expand Up @@ -236,6 +237,7 @@ void Configuration()
inipp::get_value(ini.sections["JPEG XL Tweaks"], "Quality", fJXLQuality);
inipp::get_value(ini.sections["Disable Graphics Debugger Check"], "Enabled", bDisableDbgCheck);
inipp::get_value(ini.sections["Disable Depth of Field"], "Enabled", bDisableDOF);
inipp::get_value(ini.sections["Disable Cinematic Effects"], "Enabled", bDisableCinematicEffects);
inipp::get_value(ini.sections["Game Window"], "BackgroundAudio", bBackgroundAudio);
inipp::get_value(ini.sections["Game Window"], "LockCursor", bLockCursor);
inipp::get_value(ini.sections["Game Window"], "Resizable", bResizableWindow);
Expand Down Expand Up @@ -298,6 +300,7 @@ void Configuration()
spdlog::info("Config Parse: fJXLQuality: {}", fJXLQuality);
spdlog::info("Config Parse: bDisableDbgCheck: {}", bDisableDbgCheck);
spdlog::info("Config Parse: bDisableDOF: {}", bDisableDOF);
spdlog::info("Config Parse: bDisableCinematicEffects: {}", bDisableCinematicEffects);
spdlog::info("Config Parse: bBackgroundAudio: {}", bBackgroundAudio);
spdlog::info("Config Parse: bLockCursor: {}", bLockCursor);
spdlog::info("Config Parse: bResizableWindow: {}", bResizableWindow);
Expand Down Expand Up @@ -930,6 +933,29 @@ void Misc()
}
}

if (bDisableCinematicEffects) {
// Disable cinematic effects (thanks FransBouma!)
uint8_t* CinematicEffectsScanResult = Memory::PatternScan(baseModule, "89 ?? ?? C1 ?? ?? 41 ?? ?? 74 ?? C6 ?? ?? ?? EB ?? 8B ??");
if (CinematicEffectsScanResult) {
spdlog::info("Cinematic Effects: Address is {:s}+{:x}", sExeName.c_str(), (uintptr_t)CinematicEffectsScanResult - (uintptr_t)baseModule);

static SafetyHookMid CinematicEffectsMidHook{};
CinematicEffectsMidHook = safetyhook::create_mid(CinematicEffectsScanResult,
[](SafetyHookContext& ctx) {
if (ctx.rcx & 0x0B) {
ctx.rcx = (ctx.rcx & ~0xFF) | 0x03;
}

if (ctx.rcx & 0x13) {
ctx.rcx = (ctx.rcx & ~0xFF) | 0x03;
}
});
}
else if (!CinematicEffectsScanResult) {
spdlog::error("Cinematic Effects: Pattern scan failed.");
}
}

if (iMaxDynRes != 95 || iMinDynRes != 50) {
// Dynamic resolution upper/lower bounds
uint8_t* DynamicResBoundsScanResult = Memory::PatternScan(baseModule, "0F ?? ?? ?? 3A ?? 0F ?? ?? 0F ?? ?? 0F ?? ?? ?? 3B ?? 0F ?? ?? 3B ?? 0F ?? ?? ??");
Expand Down

0 comments on commit a074a5b

Please sign in to comment.