From e61b52ceb9b81bef49fe5463f13b19e28ba16c0e Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Thu, 10 Nov 2022 23:39:23 +0200 Subject: [PATCH] Add CTweakGuiColors Former-commit-id: 3c5e962c6a4fd42497665e07d7e6f7ec19b6f97b --- asm/MetroidPrime/Tweaks/CTweakGuiColors.s | 18 +-- configure.py | 2 +- include/MetroidPrime/Tweaks/CTweakBall.hpp | 1 - .../MetroidPrime/Tweaks/CTweakGuiColors.hpp | 44 ++++++- src/MetroidPrime/Tweaks/CTweakBall.cpp | 1 + src/MetroidPrime/Tweaks/CTweakGuiColors.cpp | 119 ++++++++++++++++++ 6 files changed, 170 insertions(+), 15 deletions(-) create mode 100644 src/MetroidPrime/Tweaks/CTweakGuiColors.cpp diff --git a/asm/MetroidPrime/Tweaks/CTweakGuiColors.s b/asm/MetroidPrime/Tweaks/CTweakGuiColors.s index ca1ebdce..f049e1c7 100644 --- a/asm/MetroidPrime/Tweaks/CTweakGuiColors.s +++ b/asm/MetroidPrime/Tweaks/CTweakGuiColors.s @@ -3,8 +3,8 @@ .section .data .balign 8 -.global lbl_803E5748 -lbl_803E5748: +.global __vt__15CTweakGuiColors +__vt__15CTweakGuiColors: # ROM: 0x3E2748 .4byte 0 .4byte 0 @@ -24,9 +24,9 @@ __ct__15CTweakGuiColorsFR12CInputStream: /* 801CDA44 001CA9A4 7C 9F 23 78 */ mr r31, r4 /* 801CDA48 001CA9A8 93 C1 00 08 */ stw r30, 8(r1) /* 801CDA4C 001CA9AC 7C 7E 1B 78 */ mr r30, r3 -/* 801CDA50 001CA9B0 3C 60 80 3E */ lis r3, lbl_803E5748@ha +/* 801CDA50 001CA9B0 3C 60 80 3E */ lis r3, __vt__15CTweakGuiColors@ha /* 801CDA54 001CA9B4 90 1E 00 00 */ stw r0, 0(r30) -/* 801CDA58 001CA9B8 38 03 57 48 */ addi r0, r3, lbl_803E5748@l +/* 801CDA58 001CA9B8 38 03 57 48 */ addi r0, r3, __vt__15CTweakGuiColors@l /* 801CDA5C 001CA9BC 38 7E 00 04 */ addi r3, r30, 4 /* 801CDA60 001CA9C0 90 1E 00 00 */ stw r0, 0(r30) /* 801CDA64 001CA9C4 48 19 59 E9 */ bl __ct__6CColorFR12CInputStream @@ -365,7 +365,7 @@ __ct__15CTweakGuiColorsFR12CInputStream: /* 801CDF98 001CAEF8 48 19 54 B5 */ bl __ct__6CColorFR12CInputStream /* 801CDF9C 001CAEFC 7F E4 FB 78 */ mr r4, r31 /* 801CDFA0 001CAF00 38 7E 01 C4 */ addi r3, r30, 0x1c4 -/* 801CDFA4 001CAF04 48 00 00 21 */ bl sub_801cdfc4 +/* 801CDFA4 001CAF04 48 00 00 21 */ bl "__ct__Q24rstl55reserved_vectorFR12CInputStream" /* 801CDFA8 001CAF08 80 01 00 14 */ lwz r0, 0x14(r1) /* 801CDFAC 001CAF0C 7F C3 F3 78 */ mr r3, r30 /* 801CDFB0 001CAF10 83 E1 00 0C */ lwz r31, 0xc(r1) @@ -374,8 +374,8 @@ __ct__15CTweakGuiColorsFR12CInputStream: /* 801CDFBC 001CAF1C 38 21 00 10 */ addi r1, r1, 0x10 /* 801CDFC0 001CAF20 4E 80 00 20 */ blr -.global sub_801cdfc4 -sub_801cdfc4: +.global "__ct__Q24rstl55reserved_vectorFR12CInputStream" +"__ct__Q24rstl55reserved_vectorFR12CInputStream": /* 801CDFC4 001CAF24 94 21 FF B0 */ stwu r1, -0x50(r1) /* 801CDFC8 001CAF28 7C 08 02 A6 */ mflr r0 /* 801CDFCC 001CAF2C 90 01 00 54 */ stw r0, 0x54(r1) @@ -454,9 +454,9 @@ __dt__15CTweakGuiColorsFv: /* 801CE0D8 001CB038 93 E1 00 0C */ stw r31, 0xc(r1) /* 801CE0DC 001CB03C 7C 7F 1B 79 */ or. r31, r3, r3 /* 801CE0E0 001CB040 41 82 00 90 */ beq lbl_801CE170 -/* 801CE0E4 001CB044 3C 60 80 3E */ lis r3, lbl_803E5748@ha +/* 801CE0E4 001CB044 3C 60 80 3E */ lis r3, __vt__15CTweakGuiColors@ha /* 801CE0E8 001CB048 34 1F 01 C4 */ addic. r0, r31, 0x1c4 -/* 801CE0EC 001CB04C 38 03 57 48 */ addi r0, r3, lbl_803E5748@l +/* 801CE0EC 001CB04C 38 03 57 48 */ addi r0, r3, __vt__15CTweakGuiColors@l /* 801CE0F0 001CB050 90 1F 00 00 */ stw r0, 0(r31) /* 801CE0F4 001CB054 41 82 00 58 */ beq lbl_801CE14C /* 801CE0F8 001CB058 80 DF 01 C4 */ lwz r6, 0x1c4(r31) diff --git a/configure.py b/configure.py index d1a2313d..fb20866b 100755 --- a/configure.py +++ b/configure.py @@ -280,7 +280,7 @@ LIBS = [ ["MetroidPrime/Weapons/GunController/CGSFreeLook", False], ["MetroidPrime/Weapons/GunController/CGSComboFire", True], ["MetroidPrime/HUD/CHudBallInterface", False], - "MetroidPrime/Tweaks/CTweakGuiColors", + ["MetroidPrime/Tweaks/CTweakGuiColors", False], "MetroidPrime/ScriptObjects/CFishCloud", ["MetroidPrime/CHealthInfo", True], "MetroidPrime/Player/CGameState", diff --git a/include/MetroidPrime/Tweaks/CTweakBall.hpp b/include/MetroidPrime/Tweaks/CTweakBall.hpp index a50bc843..a6dfb92e 100644 --- a/include/MetroidPrime/Tweaks/CTweakBall.hpp +++ b/include/MetroidPrime/Tweaks/CTweakBall.hpp @@ -7,7 +7,6 @@ #include "Kyoto/TOneStatic.hpp" #include "Kyoto/Math/CVector3f.hpp" -#include "Kyoto/Math/CRelAngle.hpp" #include "rstl/string.hpp" diff --git a/include/MetroidPrime/Tweaks/CTweakGuiColors.hpp b/include/MetroidPrime/Tweaks/CTweakGuiColors.hpp index 6497f6a2..48774da6 100644 --- a/include/MetroidPrime/Tweaks/CTweakGuiColors.hpp +++ b/include/MetroidPrime/Tweaks/CTweakGuiColors.hpp @@ -4,9 +4,18 @@ #include "MetroidPrime/Tweaks/ITweakObject.hpp" #include "Kyoto/Graphics/CColor.hpp" +#include "Kyoto/Streams/CInputStream.hpp" +#include "Kyoto/TOneStatic.hpp" -class CTweakGuiColors : public ITweakObject { + +#include "rstl/reserved_vector.hpp" + +class CTweakGuiColors; +class CTweakGuiColors : public ITweakObject, public TOneStatic< CTweakGuiColors > { public: + ~CTweakGuiColors() override; + CTweakGuiColors(CInputStream& in); + const CColor& GetPauseBlurFilterColor() const { return x4_pauseBlurFilterColor; } const CColor& GetRadarStuffColor() const { return x8_radarStuffColor; } const CColor& GetRadarPlayerPaintColor() const { return xc_radarPlayerPaintColor; } @@ -39,7 +48,9 @@ public: const CColor& GetHelmetLightColor() const { return x8c_helmetLightColor; } const CColor& GetThreatIconSafeColor() const { return x90_threatIconSafeColor; } const CColor& GetMissileIconColorInactive() const { return x94_missileIconColorInactive; } - const CColor& GetMissileIconColorChargedCanAlt() const { return x98_missileIconColorChargedCanAlt; } + const CColor& GetMissileIconColorChargedCanAlt() const { + return x98_missileIconColorChargedCanAlt; + } const CColor& GetMissileIconColorChargedNoAlt() const { return x9c_missileIconColorChargedNoAlt; } const CColor& GetMissileIconColorDepleteAlt() const { return xa0_missileIconColorDepleteAlt; } const CColor& GetVisorBeamMenuLozColor() const { return xb0_visorBeamMenuLozColor; } @@ -59,14 +70,18 @@ public: const CColor& GetXRayEnergyDecoColor() const { return x100_xrayEnergyDecoColor; } const CColor& GetScanDataDotColor() const { return x138_scanDataDotColor; } const CColor& GetPowerBombDigitAvailableFont() const { return x13c_powerBombDigitAvailableFont; } - const CColor& GetPowerBombDigitAvailableOutline() const { return x140_powerBombDigitAvailableOutline; } + const CColor& GetPowerBombDigitAvailableOutline() const { + return x140_powerBombDigitAvailableOutline; + } const CColor& GetBallBombFilledColor() const { return x148_ballBombFilled; } const CColor& GetBallBombEmptyColor() const { return x14c_ballBombEmpty; } const CColor& GetPowerBombIconAvailableColor() const { return x150_powerBombIconAvailable; } const CColor& GetBallBombEnergyColor() const { return x158_ballEnergyDeco; } const CColor& GetBallBombDecoColor() const { return x15c_ballBombDeco; } const CColor& GetPowerBombDigitDelpetedFont() const { return x160_powerBombDigitDepletedFont; } - const CColor& GetPowerBombDigitDelpetedOutline() const { return x164_powerBombDigitDepletedOutline; } + const CColor& GetPowerBombDigitDelpetedOutline() const { + return x164_powerBombDigitDepletedOutline; + } const CColor& GetPowerBombIconDepletedColor() const { return x168_powerBombIconUnavailable; } const CColor& GetScanDisplayImagePaneColor() const { return x174_scanDisplayImagePaneColor; } const CColor& GetThreatIconWarningColor() const { return x17c_threatIconWarningColor; } @@ -200,7 +215,28 @@ private: CColor x1b8_thermalLockColor; CColor x1bc_pauseItemAmber; CColor x1c0_pauseItemBlue; + struct SPerVisorColors { + CColor x0_energyBarFilled; + CColor x4_energyBarEmpty; + CColor x8_energyBarShadow; + CColor xc_energyTankFilled; + CColor x10_energyTankEmpty; + CColor x14_energyDigitsFont; + CColor x18_energyDigitsOutline; + + explicit SPerVisorColors(CInputStream& in) + : x0_energyBarFilled(in) + , x4_energyBarEmpty(in) + , x8_energyBarShadow(in) + , xc_energyTankFilled(in) + , x10_energyTankEmpty(in) + , x14_energyDigitsFont(in) + , x18_energyDigitsOutline(in) {} + }; + /* Combat, Scan, XRay, Thermal, Ball */ + rstl::reserved_vector< SPerVisorColors, 5 > x1c4_perVisorColors; }; +CHECK_SIZEOF(CTweakGuiColors, 0x254) extern CTweakGuiColors* gpTweakGuiColors; diff --git a/src/MetroidPrime/Tweaks/CTweakBall.cpp b/src/MetroidPrime/Tweaks/CTweakBall.cpp index ac398964..caaff9b5 100644 --- a/src/MetroidPrime/Tweaks/CTweakBall.cpp +++ b/src/MetroidPrime/Tweaks/CTweakBall.cpp @@ -1,6 +1,7 @@ #include "MetroidPrime/Tweaks/CTweakBall.hpp" #include "Kyoto/Streams/CInputStream.hpp" +#include "Kyoto/Math/CMath.hpp" CTweakBall::~CTweakBall() {} diff --git a/src/MetroidPrime/Tweaks/CTweakGuiColors.cpp b/src/MetroidPrime/Tweaks/CTweakGuiColors.cpp new file mode 100644 index 00000000..0d1695ee --- /dev/null +++ b/src/MetroidPrime/Tweaks/CTweakGuiColors.cpp @@ -0,0 +1,119 @@ +#include "MetroidPrime/Tweaks/CTweakGuiColors.hpp" + +CTweakGuiColors::~CTweakGuiColors() {} + +CTweakGuiColors::CTweakGuiColors(CInputStream& in) +: x4_pauseBlurFilterColor(in) +, x8_radarStuffColor(in) +, xc_radarPlayerPaintColor(in) +, x10_radarEnemyPaintColor(in) +, x14_hudMessageFill(in) +, x18_hudMessageOutline(in) +, x1c_hudFrameColor(in) +, x20_(in) +, x24_(in) +, x28_missileIconColorActive(in) +, x2c_visorBeamMenuItemActive(in) +, x30_visorBeamMenuColorInactive(in) +, x34_energyBarFilledLowEnergy(in) +, x38_energyBarShadowLowEnergy(in) +, x3c_energyBarEmptyLowEnergy(in) +, x40_hudDamageLightColor(in) +, x44_(in) +, x48_(in) +, x4c_visorMenuTextFont(in) +, x50_visorMenuTextOutline(in) +, x54_beamMenuTextFont(in) +, x58_beamMenuTextOutline(in) +, x5c_energyWarningFont(in) +, x60_threatWarningFont(in) +, x64_missileWarningFont(in) +, x68_threatBarFilled(in) +, x6c_threatBarShadow(in) +, x70_threatBarEmpty(in) +, x74_missileBarFilled(in) +, x78_missileBarShadow(in) +, x7c_missileBarEmpty(in) +, x80_threatIconColor(in) +, x84_(in) +, x88_tickDecoColor(in) +, x8c_helmetLightColor(in) +, x90_threatIconSafeColor(in) +, x94_missileIconColorInactive(in) +, x98_missileIconColorChargedCanAlt(in) +, x9c_missileIconColorChargedNoAlt(in) +, xa0_missileIconColorDepleteAlt(in) +, xa4_(in) +, xa8_(in) +, xac_(in) +, xb0_visorBeamMenuLozColor(in) +, xb4_energyWarningOutline(in) +, xb8_threatWarningOutline(in) +, xbc_missileWarningOutline(in) +, xc0_(in) +, xc4_damageAmbientColor(in) +, xc8_scanFrameInactiveColor(in) +, xcc_scanFrameActiveColor(in) +, xd0_scanFrameImpulseColor(in) +, xd4_scanVisorHudLightMultiply(in) +, xd8_scanVisorScreenDimColor(in) +, xdc_thermalVisorHudLightMultiply(in) +, xe0_energyDrainFilterColor(in) +, xe4_damageAmbientPulseColor(in) +, xe8_energyBarFlashColor(in) +, xec_(in) +, xf0_(in) +, xf4_(in) +, xf8_(in) +, xfc_(in) +, x100_xrayEnergyDecoColor(in) +, x104_(in) +, x108_(in) +, x10c_(in) +, x110_(in) +, x114_(in) +, x118_(in) +, x11c_(in) +, x120_(in) +, x124_(in) +, x128_(in) +, x12c_(in) +, x130_(in) +, x134_(in) +, x138_scanDataDotColor(in) +, x13c_powerBombDigitAvailableFont(in) +, x140_powerBombDigitAvailableOutline(in) +, x144_(in) +, x148_ballBombFilled(in) +, x14c_ballBombEmpty(in) +, x150_powerBombIconAvailable(in) +, x154_(in) +, x158_ballEnergyDeco(in) +, x15c_ballBombDeco(in) +, x160_powerBombDigitDepletedFont(in) +, x164_powerBombDigitDepletedOutline(in) +, x168_powerBombIconUnavailable(in) +, x16c_(in) +, x170_(in) +, x174_scanDisplayImagePaneColor(in) +, x178_(in) +, x17c_threatIconWarningColor(in) +, x180_hudCounterFill(in) +, x184_hudCounterOutline(in) +, x188_scanIconCriticalColor(in) +, x18c_scanIconCriticalDimColor(in) +, x190_scanIconNoncriticalColor(in) +, x194_scanIconNoncriticalDimColor(in) +, x198_scanReticuleColor(in) +, x19c_threatDigitsFont(in) +, x1a0_threatDigitsOutline(in) +, x1a4_missileDigitsFont(in) +, x1a8_missileDigitsOutline(in) +, x1ac_thermalDecoColor(in) +, x1b0_thermalOutlinesColor(in) +, x1b4_(in) +, x1b8_thermalLockColor(in) +, x1bc_pauseItemAmber(in) +, x1c0_pauseItemBlue(in) +, x1c4_perVisorColors(in) +{}