From af4dab39bed04dd04d66ea14fe7d42e39f3d736d Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Sun, 16 Oct 2022 17:57:07 +0300 Subject: [PATCH] Match and link CTweakGame Former-commit-id: e2c87919cb6318093828ed5993bfd5a5db1c06f9 --- asm/MetroidPrime/Tweaks/CTweakGame.s | 12 ++++----- configure.py | 2 +- include/MetroidPrime/Tweaks/CTweakGame.hpp | 7 ++++- obj_files.mk | 2 +- src/MetroidPrime/Tweaks/CTweakGame.cpp | 31 ++++++++++++++++++++++ 5 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 src/MetroidPrime/Tweaks/CTweakGame.cpp diff --git a/asm/MetroidPrime/Tweaks/CTweakGame.s b/asm/MetroidPrime/Tweaks/CTweakGame.s index c4f9e191..2b9e02d4 100644 --- a/asm/MetroidPrime/Tweaks/CTweakGame.s +++ b/asm/MetroidPrime/Tweaks/CTweakGame.s @@ -2,8 +2,8 @@ .section .data .balign 8 -.global lbl_803D9CD0 -lbl_803D9CD0: +.global __vt__10CTweakGame +__vt__10CTweakGame: # ROM: 0x3D6CD0 .4byte 0 .4byte 0 @@ -24,9 +24,9 @@ __ct__10CTweakGameFR12CInputStream: /* 80037200 00034160 7C 9F 23 78 */ mr r31, r4 /* 80037204 00034164 93 C1 00 18 */ stw r30, 0x18(r1) /* 80037208 00034168 7C 7E 1B 78 */ mr r30, r3 -/* 8003720C 0003416C 3C 60 80 3E */ lis r3, lbl_803D9CD0@ha +/* 8003720C 0003416C 3C 60 80 3E */ lis r3, __vt__10CTweakGame@ha /* 80037210 00034170 90 1E 00 00 */ stw r0, 0(r30) -/* 80037214 00034174 38 03 9C D0 */ addi r0, r3, lbl_803D9CD0@l +/* 80037214 00034174 38 03 9C D0 */ addi r0, r3, __vt__10CTweakGame@l /* 80037218 00034178 38 7E 00 04 */ addi r3, r30, 4 /* 8003721C 0003417C 90 1E 00 00 */ stw r0, 0(r30) /* 80037220 00034180 48 30 70 D9 */ bl "__ct__Q24rstl66basic_string,Q24rstl17rmemory_allocator>FR12CInputStreamRCQ24rstl17rmemory_allocator" @@ -114,9 +114,9 @@ __dt__10CTweakGameFv: /* 8003735C 000342BC 93 C1 00 08 */ stw r30, 8(r1) /* 80037360 000342C0 7C 7E 1B 79 */ or. r30, r3, r3 /* 80037364 000342C4 41 82 00 54 */ beq lbl_800373B8 -/* 80037368 000342C8 3C 60 80 3E */ lis r3, lbl_803D9CD0@ha +/* 80037368 000342C8 3C 60 80 3E */ lis r3, __vt__10CTweakGame@ha /* 8003736C 000342CC 34 1E 00 14 */ addic. r0, r30, 0x14 -/* 80037370 000342D0 38 03 9C D0 */ addi r0, r3, lbl_803D9CD0@l +/* 80037370 000342D0 38 03 9C D0 */ addi r0, r3, __vt__10CTweakGame@l /* 80037374 000342D4 90 1E 00 00 */ stw r0, 0(r30) /* 80037378 000342D8 41 82 00 0C */ beq lbl_80037384 /* 8003737C 000342DC 38 7E 00 14 */ addi r3, r30, 0x14 diff --git a/configure.py b/configure.py index 964be856..91327f2e 100755 --- a/configure.py +++ b/configure.py @@ -57,7 +57,7 @@ LIBS = [ "MetroidPrime/Factories/CAssetFactory", "MetroidPrime/Tweaks/CTweakPlayer", "MetroidPrime/Tweaks/CTweaks", - "MetroidPrime/Tweaks/CTweakGame", + ["MetroidPrime/Tweaks/CTweakGame", True], "MetroidPrime/CGameProjectile", "MetroidPrime/Player/CPlayerGun", "MetroidPrime/CStateManager", diff --git a/include/MetroidPrime/Tweaks/CTweakGame.hpp b/include/MetroidPrime/Tweaks/CTweakGame.hpp index f2fc498b..60286d4b 100644 --- a/include/MetroidPrime/Tweaks/CTweakGame.hpp +++ b/include/MetroidPrime/Tweaks/CTweakGame.hpp @@ -5,10 +5,15 @@ #include "MetroidPrime/Tweaks/ITweakObject.hpp" +#include "Kyoto/TOneStatic.hpp" + #include "rstl/string.hpp" -class CTweakGame : public ITweakObject { +class CTweakGame; + +class CTweakGame : public ITweakObject, public TOneStatic< CTweakGame > { public: + CTweakGame(CInputStream&); ~CTweakGame() override; const rstl::string& GetWorldPrefix() { return x4_worldPrefix; } diff --git a/obj_files.mk b/obj_files.mk index 0859bea9..ebb5a04d 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -24,7 +24,7 @@ METROIDPRIME :=\ $(BUILD_DIR)/asm/MetroidPrime/Factories/CAssetFactory.o\ $(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakPlayer.o\ $(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweaks.o\ - $(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakGame.o\ + $(BUILD_DIR)/src/MetroidPrime/Tweaks/CTweakGame.o\ $(BUILD_DIR)/asm/MetroidPrime/CGameProjectile.o\ $(BUILD_DIR)/asm/MetroidPrime/Player/CPlayerGun.o\ $(BUILD_DIR)/asm/MetroidPrime/CStateManager.o\ diff --git a/src/MetroidPrime/Tweaks/CTweakGame.cpp b/src/MetroidPrime/Tweaks/CTweakGame.cpp new file mode 100644 index 00000000..ed8bf2d9 --- /dev/null +++ b/src/MetroidPrime/Tweaks/CTweakGame.cpp @@ -0,0 +1,31 @@ +#include "MetroidPrime/Tweaks/CTweakGame.hpp" + +#include "Kyoto/Streams/CInputStream.hpp" + +CTweakGame::~CTweakGame() {} + +CTweakGame::CTweakGame(CInputStream& in) +: x4_worldPrefix(in) +, x14_defaultRoom(in) +, x24_fov(in.ReadFloat()) +, x28_unknown1(in.ReadBool()) +, x29_unknown2(in.ReadBool()) +, x2a_unknown3(in.ReadBool()) +, x2b_splashScreensDisabled(in.ReadBool()) +, x2c_unknown5(in.ReadFloat()) +, x30_pressStartDelay(in.ReadFloat()) +, x34_wavecapIntensityNormal(in.ReadFloat()) +, x38_wavecapIntensityPoison(in.ReadFloat()) +, x3c_wavecapIntensityLava(in.ReadFloat()) +, x40_rippleIntensityNormal(in.ReadFloat()) +, x44_rippleIntensityPoison(in.ReadFloat()) +, x48_rippleIntensityLava(in.ReadFloat()) +, x4c_fluidEnvBumpScale(in.ReadFloat()) +, x50_waterFogDistanceBase(in.ReadFloat()) +, x54_waterFogDistanceRange(in.ReadFloat()) +, x58_gravityWaterFogDistanceBase(in.ReadFloat()) +, x5c_gravityWaterFogDistanceRange(in.ReadFloat()) +, x60_hardmodeDamageMult(in.ReadFloat()) +, x64_hardmodeWeaponMult(in.ReadFloat()) { + x2b_splashScreensDisabled = false; +}