From 8ca5f1bf53adbf51798db612c7ac7736501107b0 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Mon, 24 Mar 2025 18:57:35 +0000 Subject: [PATCH] Added code to force the alternate game title (#1249) --- UnleashedRecomp/patches/misc_patches.cpp | 10 ++++++++++ UnleashedRecomp/ui/game_window.cpp | 7 ++++++- UnleashedRecomp/user/config_def.h | 1 + UnleashedRecompLib/config/SWA.toml | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index 9f318fb4..addeff94 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -53,6 +53,16 @@ void WerehogBattleMusicMidAsmHook(PPCRegister& r11) r11.u8 = 3; } +bool UseAlternateTitleMidAsmHook() +{ + auto isSWA = Config::Language == ELanguage::Japanese; + + if (Config::UseAlternateTitle) + isSWA = !isSWA; + + return isSWA; +} + /* Hook function that gets the game region and force result to zero for Japanese to display the correct logos. */ diff --git a/UnleashedRecomp/ui/game_window.cpp b/UnleashedRecomp/ui/game_window.cpp index 2bd5ad10..1bcdf336 100644 --- a/UnleashedRecomp/ui/game_window.cpp +++ b/UnleashedRecomp/ui/game_window.cpp @@ -282,7 +282,12 @@ const char* GameWindow::GetTitle() { if (Config::UseOfficialTitleOnTitleBar) { - return Config::Language == ELanguage::Japanese + auto isSWA = Config::Language == ELanguage::Japanese; + + if (Config::UseAlternateTitle) + isSWA = !isSWA; + + return isSWA ? "SONIC WORLD ADVENTURE" : "SONIC UNLEASHED"; } diff --git a/UnleashedRecomp/user/config_def.h b/UnleashedRecomp/user/config_def.h index 37fd59c6..80eb29c9 100644 --- a/UnleashedRecomp/user/config_def.h +++ b/UnleashedRecomp/user/config_def.h @@ -92,6 +92,7 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, HomingAttackOnJump, false); CONFIG_DEFINE_HIDDEN("Codes", bool, HUDToggleKey, false); CONFIG_DEFINE_HIDDEN("Codes", bool, SaveScoreAtCheckpoints, false); CONFIG_DEFINE_HIDDEN("Codes", bool, SkipIntroLogos, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, UseAlternateTitle, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseArrowsForTimeOfDayTransition, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false); diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 2c0177ee..db6ed45d 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -1105,3 +1105,9 @@ registers = ["r3"] name = "DisableBoostFilterMidAsmHook" address = 0x82B48C9C registers = ["r11"] + +[[midasm_hook]] +name = "UseAlternateTitleMidAsmHook" +address = 0x82580F44 +jump_address_on_true = 0x82580F48 +jump_address_on_false = 0x82580FA0