From 57e888658ac22bf9d771987f917b3f1b7c758563 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Sun, 26 Jan 2025 13:37:55 +0000 Subject: [PATCH] Fix PS3 time of day transition aspect ratio and outro animation (#197) --- UnleashedRecomp/api/SWA/HUD/Loading/Loading.h | 10 ++++++++-- UnleashedRecomp/patches/aspect_ratio_patches.cpp | 10 ++++++++-- UnleashedRecomp/patches/resident_patches.cpp | 6 +++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h b/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h index 27f1c9a..66d88d8 100644 --- a/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h +++ b/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h @@ -21,14 +21,20 @@ namespace SWA { public: SWA_INSERT_PADDING(0xD8); - be m_pUnk; + be m_FieldD8; SWA_INSERT_PADDING(0x3C); Chao::CSD::RCPtr m_rcNightToDay; SWA_INSERT_PADDING(0x0C); be m_IsVisible; SWA_INSERT_PADDING(0x0C); be m_LoadingDisplayType; - SWA_INSERT_PADDING(0x65); + SWA_INSERT_PADDING(0x61); bool m_IsNightToDay; }; + + SWA_ASSERT_OFFSETOF(CLoading, m_FieldD8, 0xD8); + SWA_ASSERT_OFFSETOF(CLoading, m_rcNightToDay, 0x118); + SWA_ASSERT_OFFSETOF(CLoading, m_IsVisible, 0x12C); + SWA_ASSERT_OFFSETOF(CLoading, m_LoadingDisplayType, 0x13C); + SWA_ASSERT_OFFSETOF(CLoading, m_IsNightToDay, 0x1A1); } diff --git a/UnleashedRecomp/patches/aspect_ratio_patches.cpp b/UnleashedRecomp/patches/aspect_ratio_patches.cpp index 5caf786..a830ea7 100644 --- a/UnleashedRecomp/patches/aspect_ratio_patches.cpp +++ b/UnleashedRecomp/patches/aspect_ratio_patches.cpp @@ -370,7 +370,7 @@ static const ankerl::unordered_dense::map g_modifiers { HashStr("ui_gate/footer/status_footer"), { ALIGN_BOTTOM } }, { HashStr("ui_gate/header/status_title"), { ALIGN_TOP | OFFSET_SCALE_LEFT, 652.0f } }, { HashStr("ui_gate/header/status_title/title_bg/center"), { ALIGN_TOP | EXTEND_LEFT } }, - { HashStr("ui_gate/header/status_title/title_bg/center/h_light"), { ALIGN_TOP | EXTEND_LEFT} }, + { HashStr("ui_gate/header/status_title/title_bg/center/h_light"), { ALIGN_TOP | EXTEND_LEFT } }, { HashStr("ui_gate/header/status_title/title_bg/right"), { ALIGN_TOP | STORE_RIGHT_CORNER } }, { HashStr("ui_gate/window/window_bg"), { STRETCH } }, @@ -383,12 +383,18 @@ static const ankerl::unordered_dense::map g_modifiers { HashStr("ui_itemresult/main/iresult_title"), { ALIGN_TOP } }, { HashStr("ui_itemresult/main/iresult_title"), { ALIGN_TOP | OFFSET_SCALE_LEFT, 688.0f } }, { HashStr("ui_itemresult/main/iresult_title/title_bg/center"), { ALIGN_TOP | EXTEND_LEFT } }, - { HashStr("ui_itemresult/main/iresult_title/title_bg/center/h_light"), { ALIGN_TOP | EXTEND_LEFT} }, + { HashStr("ui_itemresult/main/iresult_title/title_bg/center/h_light"), { ALIGN_TOP | EXTEND_LEFT } }, { HashStr("ui_itemresult/main/iresult_title/title_bg/right"), { ALIGN_TOP | STORE_RIGHT_CORNER } }, // ui_loading { HashStr("ui_loading/bg_1"), { STRETCH } }, { HashStr("ui_loading/bg_2"), { STRETCH } }, + { HashStr("ui_loading/n_2_d/bg/sky"), { STRETCH } }, + { HashStr("ui_loading/n_2_d/bg/under"), { STRETCH } }, + { HashStr("ui_loading/n_2_d/letterbox/letterbox_under"), { STRETCH } }, + { HashStr("ui_loading/n_2_d/letterbox/letterbox_top"), { STRETCH } }, + { HashStr("ui_loading/n_2_d/letterbox/black_l"), { EXTEND_LEFT | STRETCH_VERTICAL } }, + { HashStr("ui_loading/n_2_d/letterbox/black_r"), { EXTEND_RIGHT | STRETCH_VERTICAL } }, // ui_mediaroom { HashStr("ui_mediaroom/header/bg/img_1"), { EXTEND_LEFT } }, diff --git a/UnleashedRecomp/patches/resident_patches.cpp b/UnleashedRecomp/patches/resident_patches.cpp index 06d4b1a..725d704 100644 --- a/UnleashedRecomp/patches/resident_patches.cpp +++ b/UnleashedRecomp/patches/resident_patches.cpp @@ -11,13 +11,17 @@ bool m_isSavedAchievementData = false; PPC_FUNC_IMPL(__imp__sub_824DCF38); PPC_FUNC(sub_824DCF38) { + auto pLoading = (SWA::CLoading*)g_memory.Translate(ctx.r3.u32); + App::s_isLoading = true; - // TODO: use the actual PS3 loading screen ("n_2_d"). if (Config::TimeOfDayTransition == ETimeOfDayTransition::PlayStation) { if (ctx.r4.u32 == SWA::eLoadingDisplayType_WerehogMovie) + { ctx.r4.u32 = SWA::eLoadingDisplayType_ChangeTimeOfDay; + pLoading->m_IsNightToDay = App::s_isWerehog; + } } if (auto pGameDocument = SWA::CGameDocument::GetInstance())