From 98daa27c146db8c9069384823ac80497ab5fb752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90e=C3=A4Th?= <55578911+DeaTh-G@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:34:57 +0100 Subject: [PATCH] Added exceptions for specific hint messages being allowed/blocked by the Hints option (#462) * Fix Windmill Isle Act 1 (Night) chip 'hint' not being shown * code style adjustments * Fix Apotos entrance gate first time Chip hint appearing with hints disabled --------- Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com> --- UnleashedRecomp/api/SWA.h | 1 + .../api/SWA/Message/MsgRequestHelp.h | 13 +++++++ UnleashedRecomp/patches/misc_patches.cpp | 39 +++++++++++++++++++ UnleashedRecompLib/config/SWA.toml | 12 +++--- UnleashedRecompResources | 2 +- 5 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h diff --git a/UnleashedRecomp/api/SWA.h b/UnleashedRecomp/api/SWA.h index fecf2ad..bf2f5ea 100644 --- a/UnleashedRecomp/api/SWA.h +++ b/UnleashedRecomp/api/SWA.h @@ -86,6 +86,7 @@ #include "SWA/Inspire/InspireTextureAnimationInfo.h" #include "SWA/Inspire/InspireTextureOverlay.h" #include "SWA/Inspire/InspireTextureOverlayInfo.h" +#include "SWA/Message/MsgRequestHelp.h" #include "SWA/Menu/MenuWindowBase.h" #include "SWA/Movie/MovieDisplayer.h" #include "SWA/Movie/MovieManager.h" diff --git a/UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h b/UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h new file mode 100644 index 0000000..3b8ed1c --- /dev/null +++ b/UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +namespace SWA::Message +{ + class MsgRequestHelp + { + public: + SWA_INSERT_PADDING(0x1C); + Hedgehog::Base::CSharedString m_Name; + }; +} diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index f9365ec..12c754c 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -108,3 +108,42 @@ PPC_FUNC(sub_82586698) __imp__sub_82586698(ctx, base); } + +// SWA::CObjHint::MsgNotifyObjectEvent::Impl +// Disable only certain hints from hint volumes. +// This hook should be used to allow hint volumes specifically to also prevent them from affecting the player. +PPC_FUNC_IMPL(__imp__sub_82736E80); +PPC_FUNC(sub_82736E80) +{ + // GroupID parameter text + auto* groupId = (const char*)(base + PPC_LOAD_U32(ctx.r3.u32 + 0x100)); + + if (!Config::Hints) + { + // WhiteIsland_ACT1_001 (Windmill Isle Act 1 Night, Start) + // Your friend went off that way, Sonic. Quick, let's go after him! + if (strcmp(groupId, "WhiteIsland_ACT1_001") != 0) + return; + } + + __imp__sub_82736E80(ctx, base); +} + +// SWA::CHelpWindow::MsgRequestHelp::Impl +// Disable only certain hints from other sequences. +// This hook should be used to block hint messages from unknown sources. +PPC_FUNC_IMPL(__imp__sub_824C1E60); +PPC_FUNC(sub_824C1E60) +{ + auto pMsgRequestHelp = (SWA::Message::MsgRequestHelp*)(base + ctx.r4.u32); + + if (!Config::Hints) + { + // s10d_mykETF_c_navi (Town Mykonos Entrance, First Entry) + // Looks like we can get to a bunch of places in the village from here! + if (strcmp(pMsgRequestHelp->m_Name.c_str(), "s10d_mykETF_c_navi") == 0) + return; + } + + __imp__sub_824C1E60(ctx, base); +} diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 6f5781c..901688c 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -106,18 +106,18 @@ jump_address = 0x82468EE0 name = "ResetScoreOnRestartMidAsmHook" address = 0x82304374 -# Disable hint volumes -[[midasm_hook]] -name = "DisableHintsMidAsmHook" -address = 0x827A2504 -jump_address_on_true = 0x827A251C - # Disable hint rings [[midasm_hook]] name = "DisableHintsMidAsmHook" address = 0x827A2E34 jump_address_on_true = 0x827A2E4C +# Disable Tornado Defense hints +[[midasm_hook]] +name = "DisableHintsMidAsmHook" +address = 0x82AF52BC +jump_address_on_true = 0x82AF52E4 + # Disable Egg Dragoon hint "V_WHG_083" ("That lit-up part on the bottom looks fishy. I'll try aiming for that.") [[midasm_hook]] name = "DisableHintsMidAsmHook" diff --git a/UnleashedRecompResources b/UnleashedRecompResources index 89c82c0..1375ed7 160000 --- a/UnleashedRecompResources +++ b/UnleashedRecompResources @@ -1 +1 @@ -Subproject commit 89c82c0aa820d3e3b6a1599faccfca8a4697a33c +Subproject commit 1375ed71841dd391be609f9380ec456f2679463b