From ade8e7315640dfd382a78c5593f878337d5bc703 Mon Sep 17 00:00:00 2001 From: EM Date: Mon, 30 Mar 2026 04:52:25 +0300 Subject: [PATCH] Add Xenia Patches (DoF, ShadowMap, and radialblur toggles) --- UnleashedRecomp/patches/video_patches.cpp | 31 +++++++++++++++++++++++ UnleashedRecomp/user/config_def.h | 3 +++ UnleashedRecompLib/config/SWA.toml | 27 ++++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/UnleashedRecomp/patches/video_patches.cpp b/UnleashedRecomp/patches/video_patches.cpp index a2320b37b..a8c24bffb 100644 --- a/UnleashedRecomp/patches/video_patches.cpp +++ b/UnleashedRecomp/patches/video_patches.cpp @@ -69,6 +69,37 @@ bool MotionBlurMidAsmHook() return Config::MotionBlur != EMotionBlur::Off; } +// Xenia patch 0x82BAD958 +void DisableShadowMapsMidAsmHook(PPCRegister& r11) +{ + if (Config::DisableShadowMaps) + r11.u64 = 0; +} + +bool DisableShadowMapsEarlyMidAsmHook() +{ + return Config::DisableShadowMaps; +} + +// Xenia patch 0x82BB20F8 +void DisableDepthOfFieldInitMidAsmHook(PPCRegister& r11) +{ + if (Config::DisableDepthOfField) + r11.u64 = 0; +} + +// Xenia patch 0x82BB21A4 +bool DisableDepthOfFieldStoreMidAsmHook() +{ + return Config::DisableDepthOfField; +} + +// Xenia patch 0x82FC1F28 +bool DisableRadialBlurMidAsmHook() +{ + return Config::DisableRadialBlur; +} + // Hedgehog::MirageDebug::PrepareRenderPrimitive2D PPC_FUNC_IMPL(__imp__sub_830D25D8); PPC_FUNC(sub_830D25D8) diff --git a/UnleashedRecomp/user/config_def.h b/UnleashedRecomp/user/config_def.h index 80eb29c93..17af21c14 100644 --- a/UnleashedRecomp/user/config_def.h +++ b/UnleashedRecomp/user/config_def.h @@ -78,10 +78,13 @@ CONFIG_DEFINE_ENUM_LOCALISED("Video", EUIAlignmentMode, UIAlignmentMode, EUIAlig CONFIG_DEFINE_HIDDEN("Codes", bool, AllowCancellingUnleash, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableAutoSaveWarning, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableBoostFilter, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDepthOfField, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDLCIcon, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDPadMovement, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDWMRoundedCorners, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableLowResolutionFontOnCustomUI, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, DisableRadialBlur, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, DisableShadowMaps, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableEventCollisionDebugView, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableGIMipLevelDebugView, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableObjectCollisionDebugView, false); diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 5063e7123..9dcbb1aa5 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -91,6 +91,17 @@ name = "SetShadowResolutionMidAsmHook" address = 0x82BAD87C registers = ["r11"] +[[midasm_hook]] +name = "DisableShadowMapsEarlyMidAsmHook" +address = 0x82BAD954 +jump_address_on_true = 0x82BADBE8 + +[[midasm_hook]] +name = "DisableShadowMapsMidAsmHook" +address = 0x82BAD958 +registers = ["r11"] +after_instruction = true + [[midasm_hook]] name = "CameraAspectRatioMidAsmHook" address = 0x82468E78 @@ -471,6 +482,17 @@ name = "PostProcessResolutionFix" address = 0x82BA4064 registers = ["r4", "f1", "f2"] +[[midasm_hook]] +name = "DisableDepthOfFieldInitMidAsmHook" +address = 0x82BB20F8 +registers = ["r11"] +after_instruction = true + +[[midasm_hook]] +name = "DisableDepthOfFieldStoreMidAsmHook" +address = 0x82BB21A4 +jump_address_on_true = 0x82BB21A8 + # Light shaft resolution fix [[midasm_hook]] name = "PostProcessResolutionFix" @@ -1080,6 +1102,11 @@ name = "SparkleLocusMidAsmHook" address = 0x82E96804 jump_address_on_true = 0x82E96808 +[[midasm_hook]] +name = "DisableRadialBlurMidAsmHook" +address = 0x82FC1F28 +jump_address_on_true = 0x82FC1F2C + # Rooftop Run barrel fix (works at up to ~400 FPS) [[midasm_hook]] name = "HighFrameRateDeltaTimeFixVectorMidAsmHook"