From 5af0e9b47aedcd44a1b3b2009d5193f94b56d5e2 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 31 Dec 2022 11:01:15 -0800 Subject: [PATCH] Match and link CGuiWidgetDrawParms Former-commit-id: 9980e07a46837862444cacd8b4978996202032be --- asm/GuiSys/CGuiWidgetDrawParms.s | 7 +++---- asm/MetroidPrime/CFrontEndUI.s | 16 ++++++++-------- asm/MetroidPrime/CSaveGameScreen.s | 4 ++-- asm/MetroidPrime/HUD/CHudDecoInterface.s | 4 ++-- asm/MetroidPrime/HUD/CSamusHud.s | 4 ++-- configure.py | 2 +- include/GuiSys/CGuiWidgetDrawParms.hpp | 21 +++++++++++++++++++++ src/GuiSys/CGuiWidgetDrawParms.cpp | 3 +++ 8 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 include/GuiSys/CGuiWidgetDrawParms.hpp create mode 100644 src/GuiSys/CGuiWidgetDrawParms.cpp diff --git a/asm/GuiSys/CGuiWidgetDrawParms.s b/asm/GuiSys/CGuiWidgetDrawParms.s index 64c99327..42603c90 100644 --- a/asm/GuiSys/CGuiWidgetDrawParms.s +++ b/asm/GuiSys/CGuiWidgetDrawParms.s @@ -1,6 +1,6 @@ .include "macros.inc" -.comm lbl_8059FD08, 0x10, 4 +.comm sDefaultDrawParms__19CGuiWidgetDrawParms, 0x10, 4 .section .ctors, "wa" lbl_ctor: @@ -11,9 +11,9 @@ lbl_ctor: .global __sinit_CGuiWidgetDrawParms_cpp __sinit_CGuiWidgetDrawParms_cpp: /* 802CB1B0 002C8110 C0 22 C4 18 */ lfs f1, lbl_805AE138@sda21(r2) -/* 802CB1B4 002C8114 3C 60 80 5A */ lis r3, lbl_8059FD08@ha +/* 802CB1B4 002C8114 3C 60 80 5A */ lis r3, sDefaultDrawParms__19CGuiWidgetDrawParms@ha /* 802CB1B8 002C8118 C0 02 C4 1C */ lfs f0, lbl_805AE13C@sda21(r2) -/* 802CB1BC 002C811C D4 23 FD 08 */ stfsu f1, lbl_8059FD08@l(r3) +/* 802CB1BC 002C811C D4 23 FD 08 */ stfsu f1, sDefaultDrawParms__19CGuiWidgetDrawParms@l(r3) /* 802CB1C0 002C8120 D0 03 00 04 */ stfs f0, 4(r3) /* 802CB1C4 002C8124 D0 03 00 08 */ stfs f0, 8(r3) /* 802CB1C8 002C8128 D0 03 00 0C */ stfs f0, 0xc(r3) @@ -30,4 +30,3 @@ lbl_805AE138: lbl_805AE13C: # ROM: 0x3FA9DC .4byte 0 - diff --git a/asm/MetroidPrime/CFrontEndUI.s b/asm/MetroidPrime/CFrontEndUI.s index e820c491..50b18b62 100644 --- a/asm/MetroidPrime/CFrontEndUI.s +++ b/asm/MetroidPrime/CFrontEndUI.s @@ -4015,8 +4015,8 @@ lbl_8001EB40: /* 8001EB40 0001BAA0 80 63 00 24 */ lwz r3, 0x24(r3) /* 8001EB44 0001BAA4 28 03 00 00 */ cmplwi r3, 0 /* 8001EB48 0001BAA8 41 82 00 10 */ beq lbl_8001EB58 -/* 8001EB4C 0001BAAC 3C 80 80 5A */ lis r4, lbl_8059FD08@ha -/* 8001EB50 0001BAB0 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 8001EB4C 0001BAAC 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha +/* 8001EB50 0001BAB0 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 8001EB54 0001BAB4 48 2A 3B E1 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms lbl_8001EB58: /* 8001EB58 0001BAB8 80 01 00 14 */ lwz r0, 0x14(r1) @@ -5658,9 +5658,9 @@ Draw__19SNewFileSelectFrameFv: /* 800202EC 0001D24C 88 03 01 0C */ lbz r0, 0x10c(r3) /* 800202F0 0001D250 28 00 00 00 */ cmplwi r0, 0 /* 800202F4 0001D254 41 82 00 14 */ beq lbl_80020308 -/* 800202F8 0001D258 3C 80 80 5A */ lis r4, lbl_8059FD08@ha +/* 800202F8 0001D258 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha /* 800202FC 0001D25C 7C A3 2B 78 */ mr r3, r5 -/* 80020300 0001D260 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 80020300 0001D260 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 80020304 0001D264 48 2A 24 31 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms lbl_80020308: /* 80020308 0001D268 80 01 00 14 */ lwz r0, 0x14(r1) @@ -6824,9 +6824,9 @@ lbl_80021360: Draw__14SFrontEndFrameFv: /* 80021374 0001E2D4 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80021378 0001E2D8 7C 08 02 A6 */ mflr r0 -/* 8002137C 0001E2DC 3C 80 80 5A */ lis r4, lbl_8059FD08@ha +/* 8002137C 0001E2DC 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha /* 80021380 0001E2E0 90 01 00 14 */ stw r0, 0x14(r1) -/* 80021384 0001E2E4 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 80021384 0001E2E4 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 80021388 0001E2E8 80 63 00 14 */ lwz r3, 0x14(r3) /* 8002138C 0001E2EC 48 2A 13 A9 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms /* 80021390 0001E2F0 80 01 00 14 */ lwz r0, 0x14(r1) @@ -7841,9 +7841,9 @@ FinishedLoading__13SGBALinkFrameFv: Draw__13SGBALinkFrameFv: /* 800221BC 0001F11C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 800221C0 0001F120 7C 08 02 A6 */ mflr r0 -/* 800221C4 0001F124 3C 80 80 5A */ lis r4, lbl_8059FD08@ha +/* 800221C4 0001F124 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha /* 800221C8 0001F128 90 01 00 14 */ stw r0, 0x14(r1) -/* 800221CC 0001F12C 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 800221CC 0001F12C 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 800221D0 0001F130 80 63 00 08 */ lwz r3, 8(r3) /* 800221D4 0001F134 48 2A 05 61 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms /* 800221D8 0001F138 80 01 00 14 */ lwz r0, 0x14(r1) diff --git a/asm/MetroidPrime/CSaveGameScreen.s b/asm/MetroidPrime/CSaveGameScreen.s index ffe9b735..a7313d49 100644 --- a/asm/MetroidPrime/CSaveGameScreen.s +++ b/asm/MetroidPrime/CSaveGameScreen.s @@ -517,8 +517,8 @@ Draw__15CSaveGameScreenFv: /* 8024F72C 0024C68C 80 63 00 50 */ lwz r3, 0x50(r3) /* 8024F730 0024C690 28 03 00 00 */ cmplwi r3, 0 /* 8024F734 0024C694 41 82 00 10 */ beq lbl_8024F744 -/* 8024F738 0024C698 3C 80 80 5A */ lis r4, lbl_8059FD08@ha -/* 8024F73C 0024C69C 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 8024F738 0024C698 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha +/* 8024F73C 0024C69C 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 8024F740 0024C6A0 48 07 2F F5 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms lbl_8024F744: /* 8024F744 0024C6A4 80 01 00 14 */ lwz r0, 0x14(r1) diff --git a/asm/MetroidPrime/HUD/CHudDecoInterface.s b/asm/MetroidPrime/HUD/CHudDecoInterface.s index d38e8e1a..12d9a06d 100644 --- a/asm/MetroidPrime/HUD/CHudDecoInterface.s +++ b/asm/MetroidPrime/HUD/CHudDecoInterface.s @@ -7553,8 +7553,8 @@ Draw__21CHudDecoInterfaceScanCFv: /* 8019589C 001927FC 80 7F 00 10 */ lwz r3, 0x10(r31) /* 801958A0 00192800 28 03 00 00 */ cmplwi r3, 0 /* 801958A4 00192804 41 82 00 10 */ beq lbl_801958B4 -/* 801958A8 00192808 3C 80 80 5A */ lis r4, lbl_8059FD08@ha -/* 801958AC 0019280C 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 801958A8 00192808 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha +/* 801958AC 0019280C 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 801958B0 00192810 48 12 CE 85 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms lbl_801958B4: /* 801958B4 00192814 80 01 00 14 */ lwz r0, 0x14(r1) diff --git a/asm/MetroidPrime/HUD/CSamusHud.s b/asm/MetroidPrime/HUD/CSamusHud.s index d501ce8f..a9aabbe5 100644 --- a/asm/MetroidPrime/HUD/CSamusHud.s +++ b/asm/MetroidPrime/HUD/CSamusHud.s @@ -1936,8 +1936,8 @@ lbl_80065C08: /* 80065C08 00062B68 80 7F 02 74 */ lwz r3, 0x274(r31) /* 80065C0C 00062B6C 28 03 00 00 */ cmplwi r3, 0 /* 80065C10 00062B70 41 82 00 48 */ beq lbl_80065C58 -/* 80065C14 00062B74 3C 80 80 5A */ lis r4, lbl_8059FD08@ha -/* 80065C18 00062B78 38 84 FD 08 */ addi r4, r4, lbl_8059FD08@l +/* 80065C14 00062B74 3C 80 80 5A */ lis r4, sDefaultDrawParms__19CGuiWidgetDrawParms@ha +/* 80065C18 00062B78 38 84 FD 08 */ addi r4, r4, sDefaultDrawParms__19CGuiWidgetDrawParms@l /* 80065C1C 00062B7C 48 25 CB 19 */ bl Draw__9CGuiFrameCFRC19CGuiWidgetDrawParms /* 80065C20 00062B80 7F B5 EB 78 */ mr r21, r29 /* 80065C24 00062B84 7F 36 CB 78 */ mr r22, r25 diff --git a/configure.py b/configure.py index da961694..e6a03b24 100755 --- a/configure.py +++ b/configure.py @@ -435,7 +435,7 @@ LIBS = [ "GuiSys/CGuiTextSupport", "GuiSys/CGuiWidget", "GuiSys/CGuiWidgetIdDB", - "GuiSys/CGuiWidgetDrawParms", + ["GuiSys/CGuiWidgetDrawParms", True], "GuiSys/CAuiEnergyBarT01", "GuiSys/CAuiImagePane", ["GuiSys/CRepeatState", True], diff --git a/include/GuiSys/CGuiWidgetDrawParms.hpp b/include/GuiSys/CGuiWidgetDrawParms.hpp new file mode 100644 index 00000000..86d9a662 --- /dev/null +++ b/include/GuiSys/CGuiWidgetDrawParms.hpp @@ -0,0 +1,21 @@ +#ifndef _CGUIWIDGETDRAWPARMS +#define _CGUIWIDGETDRAWPARMS + +#include "Kyoto/Math/CVector3f.hpp" + +class CGuiWidgetDrawParms { +private: + static CGuiWidgetDrawParms sDefaultDrawParms; + +public: + CGuiWidgetDrawParms(float alpha) : mAlpha(alpha), mCameraOffset(0.f, 0.f, 0.f) {} + float GetAlpha() const { return mAlpha; } + const CVector3f& GetCameraOffset() const { return mCameraOffset; } + static CGuiWidgetDrawParms Default() { return sDefaultDrawParms; } + +private: + float mAlpha; + CVector3f mCameraOffset; +}; + +#endif // _CGUIWIDGETDRAWPARMS diff --git a/src/GuiSys/CGuiWidgetDrawParms.cpp b/src/GuiSys/CGuiWidgetDrawParms.cpp new file mode 100644 index 00000000..5cbc5ac1 --- /dev/null +++ b/src/GuiSys/CGuiWidgetDrawParms.cpp @@ -0,0 +1,3 @@ +#include "GuiSys/CGuiWidgetDrawParms.hpp" + +CGuiWidgetDrawParms CGuiWidgetDrawParms::sDefaultDrawParms(1.f);