From e99cd889cc7a564045c75335b1a09ba787f78523 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 16 Nov 2022 20:36:02 -0800 Subject: [PATCH] Match and link CDecalDescription, nearly match CWeaponDescription Former-commit-id: 181f0435d2faf6a8b4d61810c5eee231dcaf8daf --- asm/Weapons/CDecalDescription.s | 16 +++++++- asm/Weapons/CWeaponDescription.s | 12 ------ configure.py | 2 +- include/Weapons/CDecalDescription.hpp | 3 ++ include/Weapons/CWeaponDescription.hpp | 57 +++++++++++++++++++++----- obj_files.mk | 2 +- src/Weapons/CDecalDescription.cpp | 10 +++++ src/Weapons/CWeaponDescription.cpp | 17 ++++++++ 8 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 src/Weapons/CDecalDescription.cpp create mode 100644 src/Weapons/CWeaponDescription.cpp diff --git a/asm/Weapons/CDecalDescription.s b/asm/Weapons/CDecalDescription.s index 5f9c4bec..5a3fff49 100644 --- a/asm/Weapons/CDecalDescription.s +++ b/asm/Weapons/CDecalDescription.s @@ -2,6 +2,18 @@ .section .text, "ax" +.global __ct__Q217CDecalDescription10SQuadDescrFv +__ct__Q217CDecalDescription10SQuadDescrFv: +/* 802B5CC0 002B2C20 38 00 00 00 */ li r0, 0 +/* 802B5CC4 002B2C24 90 03 00 00 */ stw r0, 0(r3) +/* 802B5CC8 002B2C28 90 03 00 04 */ stw r0, 4(r3) +/* 802B5CCC 002B2C2C 90 03 00 08 */ stw r0, 8(r3) +/* 802B5CD0 002B2C30 90 03 00 0C */ stw r0, 0xc(r3) +/* 802B5CD4 002B2C34 90 03 00 10 */ stw r0, 0x10(r3) +/* 802B5CD8 002B2C38 90 03 00 14 */ stw r0, 0x14(r3) +/* 802B5CDC 002B2C3C 98 03 00 18 */ stb r0, 0x18(r3) +/* 802B5CE0 002B2C40 4E 80 00 20 */ blr + .global __ct__17CDecalDescriptionFv __ct__17CDecalDescriptionFv: /* 802B5CE4 002B2C44 94 21 FF F0 */ stwu r1, -0x10(r1) @@ -9,9 +21,9 @@ __ct__17CDecalDescriptionFv: /* 802B5CEC 002B2C4C 90 01 00 14 */ stw r0, 0x14(r1) /* 802B5CF0 002B2C50 93 E1 00 0C */ stw r31, 0xc(r1) /* 802B5CF4 002B2C54 7C 7F 1B 78 */ mr r31, r3 -/* 802B5CF8 002B2C58 4B FF FF C9 */ bl sub_802b5cc0 +/* 802B5CF8 002B2C58 4B FF FF C9 */ bl __ct__Q217CDecalDescription10SQuadDescrFv /* 802B5CFC 002B2C5C 38 7F 00 1C */ addi r3, r31, 0x1c -/* 802B5D00 002B2C60 4B FF FF C1 */ bl sub_802b5cc0 +/* 802B5D00 002B2C60 4B FF FF C1 */ bl __ct__Q217CDecalDescription10SQuadDescrFv /* 802B5D04 002B2C64 38 80 00 00 */ li r4, 0 /* 802B5D08 002B2C68 7F E3 FB 78 */ mr r3, r31 /* 802B5D0C 002B2C6C 98 9F 00 44 */ stb r4, 0x44(r31) diff --git a/asm/Weapons/CWeaponDescription.s b/asm/Weapons/CWeaponDescription.s index f1d88e3a..7ba0ed9c 100644 --- a/asm/Weapons/CWeaponDescription.s +++ b/asm/Weapons/CWeaponDescription.s @@ -314,15 +314,3 @@ __ct__18CWeaponDescriptionFv: /* 802B5CB4 002B2C14 90 A3 00 AC */ stw r5, 0xac(r3) /* 802B5CB8 002B2C18 90 A3 00 B0 */ stw r5, 0xb0(r3) /* 802B5CBC 002B2C1C 4E 80 00 20 */ blr - -.global sub_802b5cc0 -sub_802b5cc0: -/* 802B5CC0 002B2C20 38 00 00 00 */ li r0, 0 -/* 802B5CC4 002B2C24 90 03 00 00 */ stw r0, 0(r3) -/* 802B5CC8 002B2C28 90 03 00 04 */ stw r0, 4(r3) -/* 802B5CCC 002B2C2C 90 03 00 08 */ stw r0, 8(r3) -/* 802B5CD0 002B2C30 90 03 00 0C */ stw r0, 0xc(r3) -/* 802B5CD4 002B2C34 90 03 00 10 */ stw r0, 0x10(r3) -/* 802B5CD8 002B2C38 90 03 00 14 */ stw r0, 0x14(r3) -/* 802B5CDC 002B2C3C 98 03 00 18 */ stb r0, 0x18(r3) -/* 802B5CE0 002B2C40 4E 80 00 20 */ blr diff --git a/configure.py b/configure.py index 6cc5c773..bced93b1 100755 --- a/configure.py +++ b/configure.py @@ -426,7 +426,7 @@ LIBS = [ "Weapons/CDecalDataFactory", ["Weapons/CDecal", False], "Weapons/CWeaponDescription", - "Weapons/CDecalDescription", + ["Weapons/CDecalDescription", True], ], }, { diff --git a/include/Weapons/CDecalDescription.hpp b/include/Weapons/CDecalDescription.hpp index 5b85fa80..2586bf58 100644 --- a/include/Weapons/CDecalDescription.hpp +++ b/include/Weapons/CDecalDescription.hpp @@ -13,8 +13,11 @@ public: rstl::single_ptr< CColorElement > x10_CLR; rstl::single_ptr< CUVElement > x14_TEX; bool x18_ADD; + SQuadDescr(); }; + CDecalDescription(); + // private: SQuadDescr x0_quad1; SQuadDescr x1c_quad2; diff --git a/include/Weapons/CWeaponDescription.hpp b/include/Weapons/CWeaponDescription.hpp index bacfc691..ea524a70 100644 --- a/include/Weapons/CWeaponDescription.hpp +++ b/include/Weapons/CWeaponDescription.hpp @@ -1,23 +1,58 @@ #ifndef _CWEAPONDESCRIPTION #define _CWEAPONDESCRIPTION -#include "Kyoto/Particles/CVectorElement.hpp" #include "Kyoto/Particles/CModVectorElement.hpp" +#include "Kyoto/Particles/CVectorElement.hpp" +#include "rstl/optional_object.hpp" #include "rstl/single_ptr.hpp" +class CModel; +class CElectricDescription; +class CSwooshDescription; +class CGenDescription; +class CCollisionResponseData; + class CWeaponDescription { - public: - rstl::single_ptr x0_IORN; - rstl::single_ptr x4_IVEC; - rstl::single_ptr x8_PSOV; - rstl::single_ptr xc_PSVM; +public: + typedef rstl::optional_object< TCachedToken< CModel > > TParticleModel; + typedef rstl::optional_object< TCachedToken< CGenDescription > > TChildGeneratorDesc; + typedef rstl::optional_object< TCachedToken< CSwooshDescription > > TSwooshGeneratorDesc; + typedef rstl::optional_object< TCachedToken< CCollisionResponseData > > TCollisionResponseDesc; + + CWeaponDescription(); + ~CWeaponDescription(); + rstl::single_ptr< CVectorElement > x0_IORN; + rstl::single_ptr< CVectorElement > x4_IVEC; + rstl::single_ptr< CVectorElement > x8_PSOV; + rstl::single_ptr< CModVectorElement > xc_PSVM; bool x10_VMD2; - rstl::single_ptr x14_PSLT; - rstl::single_ptr x18_PSCL; - rstl::single_ptr x1c_PCOL; - rstl::single_ptr x20_POFS; - rstl::single_ptr x24_OFST; + rstl::single_ptr< CIntElement > x14_PSLT; + rstl::single_ptr< CVectorElement > x18_PSCL; + rstl::single_ptr< CColorElement > x1c_PCOL; + rstl::single_ptr< CVectorElement > x20_POFS; + rstl::single_ptr< CVectorElement > x24_OFST; + bool x28_APSO; + bool x29_HOMG; + bool x2a_AP11; + bool x2b_AP21; + bool x2c_AS11; + bool x2d_AS12; + bool x2e_AS13; + rstl::single_ptr< CRealElement > x30_TRAT; + TChildGeneratorDesc x34_APSM; + TChildGeneratorDesc x44_APS2; + TSwooshGeneratorDesc x54_ASW1; + TSwooshGeneratorDesc x64_ASW2; + TSwooshGeneratorDesc x74_ASW3; + TParticleModel x84_OHEF; + TCollisionResponseDesc x94_COLR; + bool xa4_EWTR; + bool xa5_LWTR; + bool xa6_SWTR; + int xa8_PJFX; + rstl::single_ptr< CRealElement > xac_RNGE; + rstl::single_ptr< CRealElement > xb0_FOFF; }; #endif // _CWEAPONDESCRIPTION diff --git a/obj_files.mk b/obj_files.mk index 0f0bc95b..41e2afbf 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -379,7 +379,7 @@ WEAPONS :=\ $(BUILD_DIR)/asm/Weapons/CDecalDataFactory.o\ $(BUILD_DIR)/asm/Weapons/CDecal.o\ $(BUILD_DIR)/asm/Weapons/CWeaponDescription.o\ - $(BUILD_DIR)/asm/Weapons/CDecalDescription.o\ + $(BUILD_DIR)/src/Weapons/CDecalDescription.o\ METARENDER :=\ $(BUILD_DIR)/asm/MetaRender/CCubeRenderer.o\ diff --git a/src/Weapons/CDecalDescription.cpp b/src/Weapons/CDecalDescription.cpp new file mode 100644 index 00000000..41222654 --- /dev/null +++ b/src/Weapons/CDecalDescription.cpp @@ -0,0 +1,10 @@ +#include "Weapons/CDecalDescription.hpp" + +CDecalDescription::CDecalDescription() +: x5c_24_DMAB(false) +, x5c_25_DMOO(false) { + +} + +CDecalDescription::SQuadDescr::SQuadDescr() +: x18_ADD(false) {} diff --git a/src/Weapons/CWeaponDescription.cpp b/src/Weapons/CWeaponDescription.cpp new file mode 100644 index 00000000..8f9806e5 --- /dev/null +++ b/src/Weapons/CWeaponDescription.cpp @@ -0,0 +1,17 @@ +#include "Weapons/CWeaponDescription.hpp" +#include "Kyoto/Alloc/CMemory.hpp" + +CWeaponDescription::CWeaponDescription() +: x10_VMD2(false) +, x28_APSO(false) +, x2a_AP11(false) +, x2b_AP21(false) +, x2c_AS11(false) +, x2d_AS12(false) +, x2e_AS13(false) +, xa4_EWTR(true) +, xa5_LWTR(true) +, xa6_SWTR(true) +, xa8_PJFX(-1) {} + +CWeaponDescription::~CWeaponDescription() {}