From 11863beb46b0d1f5dc23623599a196f9efd84117 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:14:20 +0000 Subject: [PATCH] Initial research --- .../MatrixNode/hhMatrixNodeListener.h | 12 ++++++ UnleashedRecomp/api/SWA.h | 2 + .../api/SWA/Object/Event/Hint/ObjHintRing.h | 14 +++++++ UnleashedRecomp/patches/misc_patches.cpp | 41 ++++++++++++++++++- UnleashedRecomp/ui/options_menu.cpp | 5 +-- UnleashedRecompLib/config/SWA.toml | 12 ------ 6 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNodeListener.h create mode 100644 UnleashedRecomp/api/SWA/Object/Event/Hint/ObjHintRing.h diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNodeListener.h b/UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNodeListener.h new file mode 100644 index 0000000..75e8df9 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNodeListener.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +namespace Hedgehog::Mirage +{ + class CMatrixNodeListener : public Base::CObject + { + public: + SWA_INSERT_PADDING(0x04); + }; +} diff --git a/UnleashedRecomp/api/SWA.h b/UnleashedRecomp/api/SWA.h index bf2f5ea..64f91cc 100644 --- a/UnleashedRecomp/api/SWA.h +++ b/UnleashedRecomp/api/SWA.h @@ -31,6 +31,7 @@ #include "Hedgehog/Math/Quaternion.h" #include "Hedgehog/Math/Vector.h" #include "Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h" +#include "Hedgehog/MirageCore/MatrixNode/hhMatrixNodeListener.h" #include "Hedgehog/MirageCore/Misc/hhTransform.h" #include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h" #include "Hedgehog/MirageCore/RenderData/hhMaterialData.h" @@ -91,6 +92,7 @@ #include "SWA/Movie/MovieDisplayer.h" #include "SWA/Movie/MovieManager.h" #include "SWA/Object/Common/DashPanel/ObjDashPanel.h" +#include "SWA/Object/Event/Hint/ObjHintRing.h" #include "SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h" #include "SWA/Player/Character/EvilSonic/EvilSonic.h" #include "SWA/Player/Character/EvilSonic/EvilSonicContext.h" diff --git a/UnleashedRecomp/api/SWA/Object/Event/Hint/ObjHintRing.h b/UnleashedRecomp/api/SWA/Object/Event/Hint/ObjHintRing.h new file mode 100644 index 0000000..8190754 --- /dev/null +++ b/UnleashedRecomp/api/SWA/Object/Event/Hint/ObjHintRing.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace SWA +{ + class CObjHintRing + { + public: + SWA_INSERT_PADDING(0x160); + be m_AnimationID; + bool m_Field164; + }; +} diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index 12c754c..f01a964 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -13,6 +13,38 @@ bool DisableHintsMidAsmHook() return !Config::Hints; } +// Disable hint ring visuals. +PPC_FUNC_IMPL(__imp__sub_82738088); +PPC_FUNC(sub_82738088) +{ + auto pObjHintRing = (SWA::CObjHintRing*)(base + ctx.r3.u32); + auto pDeltaTime = (be*)(base + ctx.r4.u32); + + if (!Config::Hints) + { + auto pAnimationControl = PPC_LOAD_U32(ctx.r3.u32 + 0xF0); + + // how does this even work + guest_stack_var> time = 0.0f; + GuestToHostFunction(sub_82BB4A40, pAnimationControl, time.get()); + GuestToHostFunction(sub_82BBC050, pAnimationControl, *pDeltaTime); + + return; + } + + __imp__sub_82738088(ctx, base); +} + +// Disable hint ring hit event. +PPC_FUNC_IMPL(__imp__sub_827391E0); +PPC_FUNC(sub_827391E0) +{ + if (!Config::Hints) + return; + + __imp__sub_827391E0(ctx, base); +} + // Disable Perfect Dark Gaia hints. PPC_FUNC_IMPL(__imp__sub_82AC36E0); PPC_FUNC(sub_82AC36E0) @@ -24,9 +56,14 @@ PPC_FUNC(sub_82AC36E0) __imp__sub_82AC36E0(ctx, base); } -bool DisableControlTutorialMidAsmHook() +// Disable navigation volumes. +PPC_FUNC_IMPL(__imp__sub_8273C4C8); +PPC_FUNC(sub_8273C4C8) { - return !Config::ControlTutorial; + if (!Config::ControlTutorial) + return; + + __imp__sub_8273C4C8(ctx, base); } bool DisableEvilControlTutorialMidAsmHook(PPCRegister& r4, PPCRegister& r5) diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 87134dd..26c6f85 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -1206,7 +1206,6 @@ static void DrawConfigOptions() int32_t rowCount = 0; - bool isStage = OptionsMenu::s_pauseMenuType == SWA::eMenuType_Stage || OptionsMenu::s_pauseMenuType == SWA::eMenuType_Hub; auto cmnReason = &Localise("Options_Desc_NotAvailable"); // TODO: Don't use raw numbers here! @@ -1216,8 +1215,8 @@ static void DrawConfigOptions() DrawConfigOption(rowCount++, yOffset, &Config::Language, !OptionsMenu::s_isPause, cmnReason); DrawConfigOption(rowCount++, yOffset, &Config::VoiceLanguage, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason); DrawConfigOption(rowCount++, yOffset, &Config::Subtitles, true); - DrawConfigOption(rowCount++, yOffset, &Config::Hints, !isStage, cmnReason); - DrawConfigOption(rowCount++, yOffset, &Config::ControlTutorial, !isStage, cmnReason); + DrawConfigOption(rowCount++, yOffset, &Config::Hints, true); + DrawConfigOption(rowCount++, yOffset, &Config::ControlTutorial, true); DrawConfigOption(rowCount++, yOffset, &Config::AchievementNotifications, true); DrawConfigOption(rowCount++, yOffset, &Config::TimeOfDayTransition, !Config::UseArrowsForTimeOfDayTransition); break; diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 901688c..94f706f 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -106,12 +106,6 @@ jump_address = 0x82468EE0 name = "ResetScoreOnRestartMidAsmHook" address = 0x82304374 -# Disable hint rings -[[midasm_hook]] -name = "DisableHintsMidAsmHook" -address = 0x827A2E34 -jump_address_on_true = 0x827A2E4C - # Disable Tornado Defense hints [[midasm_hook]] name = "DisableHintsMidAsmHook" @@ -184,12 +178,6 @@ name = "DisableHintsMidAsmHook" address = 0x82691CB0 jump_address_on_true = 0x82691E24 -# Disable navigation volumes -[[midasm_hook]] -name = "DisableControlTutorialMidAsmHook" -address = 0x827AA5EC -jump_address_on_true = 0x827AA604 - # Disable Werehog button prompts [[midasm_hook]] name = "DisableEvilControlTutorialMidAsmHook"