diff --git a/config/RMCP01/module/splits.txt b/config/RMCP01/module/splits.txt index 99eb9b7f..72a477b6 100644 --- a/config/RMCP01/module/splits.txt +++ b/config/RMCP01/module/splits.txt @@ -151,18 +151,20 @@ ui/MessageGroup.cpp: .text start:0x000E8780 end:0x000E89A8 .rodata start:0x00006A28 end:0x00006A38 -Page.o: +ui/Page.cpp: .text start:0x000F15C8 end:0x000F2978 + .data start:0x000079F0 end:0x00007A54 -Section.o: +ui/Section.o: .text start:0x00111958 end:0x001142DC ui/SectionAutogens.cpp: .text start:0x0011BFF0 end:0x00122058 .data start:0x00009C40 end:0x0000A400 -SectionDirector.o: +ui/SectionManager.cpp: .text start:0x001247CC end:0x00125B04 + .bss start:0x00004758 end:0x00004760 net/MiscPacketHandler.cpp: .text start:0x00142E54 end:0x00145484 diff --git a/config/RMCP01/module/symbols.txt b/config/RMCP01/module/symbols.txt index f2f7af69..f51945bf 100644 --- a/config/RMCP01/module/symbols.txt +++ b/config/RMCP01/module/symbols.txt @@ -2817,19 +2817,19 @@ __ct__Q24Kart15KartObjectProxyFv = .text:0x0007FDD8; // type:function size:0x44 setupSingle = .text:0x0007FE1C; // type:function size:0x3C scope:global align:4 getPos__Q24Kart15KartObjectProxyCFv = .text:0x0007FE58; // type:function size:0x18 scope:global align:4 PlayerPointers_getPlayerPhysicsHolderPosition = .text:0x0007FE70; // type:function size:0x14 scope:global align:4 -various_stuff_set_player_position = .text:0x0007FE84; // type:function size:0x2C scope:global align:4 -PlayerPointers_getMat = .text:0x0007FEB0; // type:function size:0x14 scope:global align:4 -fn_1_7FEC4 = .text:0x0007FEC4; // type:function size:0x10 -various_stuff_set_player_rotation = .text:0x0007FED4; // type:function size:0x54 scope:global align:4 -PlayerPointers_getWheelCount0 = .text:0x0007FF28; // type:function size:0x10 scope:global align:4 -PlayerPointers_getWheelCount1 = .text:0x0007FF38; // type:function size:0x10 scope:global align:4 -fn_1_7FF48 = .text:0x0007FF48; // type:function size:0x10 -fn_1_7FF58 = .text:0x0007FF58; // type:function size:0x10 -fn_1_7FF68 = .text:0x0007FF68; // type:function size:0x1C -fn_1_7FF84 = .text:0x0007FF84; // type:function size:0x18 +setPos__Q24Kart15KartObjectProxyFPQ23EGG8Vector3f = .text:0x0007FE84; // type:function size:0x2C scope:global align:4 +getPose__Q24Kart15KartObjectProxyCFv = .text:0x0007FEB0; // type:function size:0x14 scope:global align:4 +getBodyRot__Q24Kart15KartObjectProxyCFv = .text:0x0007FEC4; // type:function size:0x10 +setRot__Q24Kart15KartObjectProxyFQ23EGG5Quatf = .text:0x0007FED4; // type:function size:0x54 scope:global align:4 +getSuspCount__Q24Kart15KartObjectProxyFv = .text:0x0007FF28; // type:function size:0x10 scope:global align:4 +getWheelCount__Q24Kart15KartObjectProxyFv = .text:0x0007FF38; // type:function size:0x10 scope:global align:4 +getWheelCountRecip__Q24Kart15KartObjectProxyFv = .text:0x0007FF48; // type:function size:0x10 +getWheelCountPlusOneRecip__Q24Kart15KartObjectProxyFv = .text:0x0007FF58; // type:function size:0x10 +getWheelPos__Q24Kart15KartObjectProxyFUl = .text:0x0007FF68; // type:function size:0x1C +wheelIdxHasFloorCollision__Q24Kart15KartObjectProxyFUl = .text:0x0007FF84; // type:function size:0x18 fn_1_7FF9C = .text:0x0007FF9C; // type:function size:0x18 fn_1_7FFB4 = .text:0x0007FFB4; // type:function size:0x18 -fn_1_7FFCC = .text:0x0007FFCC; // type:function size:0x10 +setStartBoostIdx__Q24Kart15KartObjectProxyFl = .text:0x0007FFCC; // type:function size:0x10 fn_1_7FFDC = .text:0x0007FFDC; // type:function size:0x1C kartPhysics__Q24Kart15KartObjectProxyFv = .text:0x0007FFF8; // type:function size:0x10 scope:global align:4 kartPhysics__Q24Kart15KartObjectProxyCFv = .text:0x00080008; // type:function size:0x10 scope:global align:4 @@ -2842,9 +2842,9 @@ fn_1_800C4 = .text:0x000800C4; // type:function size:0xF4 fn_1_801B8 = .text:0x000801B8; // type:function size:0x4 fn_1_801BC = .text:0x000801BC; // type:function size:0xDC fn_1_80298 = .text:0x00080298; // type:function size:0x4 -PlayerPointers_isReal = .text:0x0008029C; // type:function size:0x14 scope:global align:4 +isLocal__Q24Kart15KartObjectProxyFv = .text:0x0008029C; // type:function size:0x14 scope:global align:4 isCpu__Q24Kart15KartObjectProxyCFv = .text:0x000802B0; // type:function size:0x14 scope:global align:4 -PlayerPointers_isGhost = .text:0x000802C4; // type:function size:0x14 scope:global align:4 +isGhost__Q24Kart15KartObjectProxyFv = .text:0x000802C4; // type:function size:0x14 scope:global align:4 PlayerModel_isMii = .text:0x000802D8; // type:function size:0x10 scope:global align:4 kartBody__Q24Kart15KartObjectProxyFv = .text:0x000802E8; // type:function size:0xC scope:global align:4 kartBody__Q24Kart15KartObjectProxyCFv = .text:0x000802F4; // type:function size:0xC scope:global align:4 @@ -2852,10 +2852,10 @@ kartSus__Q24Kart15KartObjectProxyFl = .text:0x00080300; // type:function size:0x kartSus__Q24Kart15KartObjectProxyCFl = .text:0x00080314; // type:function size:0x14 scope:global align:4 kartWheel__Q24Kart15KartObjectProxyFl = .text:0x00080328; // type:function size:0x14 scope:global align:4 kartWheel__Q24Kart15KartObjectProxyCFl = .text:0x0008033C; // type:function size:0x14 scope:global align:4 -PlayerPointers_getWheelPhysicsHolder = .text:0x00080350; // type:function size:0x18 scope:global align:4 -fn_1_80368 = .text:0x00080368; // type:function size:0x18 -PlayerPointers_getWheelPhysics = .text:0x00080380; // type:function size:0x18 scope:global align:4 -fn_1_80398 = .text:0x00080398; // type:function size:0x18 +kartSusPhysics__Q24Kart15KartObjectProxyFl = .text:0x00080350; // type:function size:0x18 scope:global align:4 +kartSusPhysics__Q24Kart15KartObjectProxyCFl = .text:0x00080368; // type:function size:0x18 +kartWheelPhysics__Q24Kart15KartObjectProxyFl = .text:0x00080380; // type:function size:0x18 scope:global align:4 +kartWheelPhysics__Q24Kart15KartObjectProxyCFl = .text:0x00080398; // type:function size:0x18 kartPhysicsEngine__Q24Kart15KartObjectProxyFv = .text:0x000803B0; // type:function size:0xC scope:global align:4 kartPhysicsEngine__Q24Kart15KartObjectProxyCFv = .text:0x000803BC; // type:function size:0xC scope:global align:4 kartMove__Q24Kart15KartObjectProxyFv = .text:0x000803C8; // type:function size:0xC scope:global align:4 diff --git a/configure.py b/configure.py index d56d2071..d616529f 100755 --- a/configure.py +++ b/configure.py @@ -778,6 +778,7 @@ def MatchingFor(*versions): Object(NonMatching, "kart/KartState.cpp"), Object(NonMatching, "kart/KartSus.cpp"), Object(NonMatching, "kart/KartWheelPhysics.cpp"), + Object(NonMatching, "kart/KartSusPhysics.cpp"), Object(NonMatching, "kart/KartPhysics.cpp"), Object(Matching, "kart/KartPhysicsInstance.cpp"), Object(NonMatching, "kart/KartDynamics.cpp"), @@ -786,6 +787,8 @@ def MatchingFor(*versions): Object(Matching, "ui/ControlGroup.cpp"), Object(Matching, "ui/MessageGroup.cpp"), Object(NonMatching, "ui/SectionAutogens.cpp"), + Object(NonMatching, "ui/SectionManager.cpp"), + Object(NonMatching, "ui/Page.cpp"), Object(Equivalent, "enemy/AI.cpp"), Object(Equivalent, "enemy/AITrickHandler.cpp"), diff --git a/src/kart/KartObjectProxy.cpp b/src/kart/KartObjectProxy.cpp index 08fd9795..189e7adc 100644 --- a/src/kart/KartObjectProxy.cpp +++ b/src/kart/KartObjectProxy.cpp @@ -1,4 +1,11 @@ #include "KartObjectProxy.hpp" +#include "egg/math/eggMatrix.hpp" +#include "host_system/SystemManager.hpp" +#include "kart/KartPart.hpp" +#include "kart/KartPhysics.hpp" +#include "kart/KartState.hpp" +#include "system/KPadController.hpp" +#include "system/RaceManager.hpp" #include #include @@ -30,6 +37,51 @@ KartObjectProxy::KartObjectProxy() : mAccessor(nullptr) { const EGG::Vector3f& KartObjectProxy::getPos() const { return kartDynamics()->pos; } +const EGG::Vector3f& KartObjectProxy::getPrevPos() const { return kartPhysics()->pos; } + +void KartObjectProxy::setPos(const EGG::Vector3f &pos) { + kartDynamics()->pos = pos; +} + +const EGG::Matrix34f& KartObjectProxy::getPose() const { return kartPhysics()->pose; } + +const EGG::Matrix34f& KartObjectProxy::getBodyRot() const { return kartBody()->pose; } + +void KartObjectProxy::setRot(const EGG::Quatf &rot) { + KartDynamics* dynamics = kartDynamics(); + dynamics->fullRot = rot; + dynamics->mainRot = rot; +} + +u16 KartObjectProxy::getSuspCount() { return kartSettings()->susCount; } +u16 KartObjectProxy::getWheelCount() { return kartSettings()->wheelCount; } +float KartObjectProxy::getWheelCountRecip() { return kartSettings()->wheelCountRecip; } +float KartObjectProxy::getWheelCountPlusOneRecip() { return kartSettings()->wheelCountPlusOneRecip; } + +const EGG::Vector3f& KartObjectProxy::getWheelPos(u32 wheelIdx) { + return kartWheel(wheelIdx)->getPhysics()->wheelPos; +} + +bool KartObjectProxy::wheelIdxHasFloorCollision(u32 wheelIdx) { + return kartWheel(wheelIdx)->getPhysics()->hasFloorCollision(); +} + +void KartObjectProxy::setBodyAngle(f32 angle) { + // TODO + //kartBody()->setAngle(angle); +} + +void KartObjectProxy::setStartBoostIdx(s32 idx) { + kartState()->setStartBoostIdx(idx); +} + +const EGG::Vector3f& KartObjectProxy::getWheelEdgePos(u32 wheelIdx) { + return kartWheel(wheelIdx)->getPhysics()->wheelEdgePos; +} + +KartSettings* KartObjectProxy::kartSettings() { return mAccessor->kartSettings; } + +const KartSettings* KartObjectProxy::kartSettings() const { return mAccessor->kartSettings; } KartPhysics* KartObjectProxy::kartPhysics() { return mAccessor->mBody->getPhysics(); } const KartPhysics* KartObjectProxy::kartPhysics() const { return mAccessor->mBody->getPhysics(); } @@ -38,6 +90,22 @@ KartDynamics* KartObjectProxy::kartDynamics() { return mAccessor->mBody->getPhys const KartDynamics* KartObjectProxy::kartDynamics() const { return mAccessor->mBody->getPhysics()->mpDynamics; } +System::KPad* KartObjectProxy::getInput() { + return System::RaceManager::spInstance->players[kartSettings()->playerIdx]->kpadPlayer; +} + +bool KartObjectProxy::isLocal() { + return kartState()->on(KART_FLAG_LOCAL); +} + +bool KartObjectProxy::isCpu() { + return kartState()->on(KART_FLAG_CPU); +} + +bool KartObjectProxy::isGhost() { + return kartState()->on(KART_FLAG_GHOST); +} + KartBody* KartObjectProxy::kartBody() { return mAccessor->mBody; } const KartBody* KartObjectProxy::kartBody() const { return mAccessor->mBody; } @@ -54,6 +122,19 @@ const KartWheel* KartObjectProxy::kartWheel(s32 idx) const { return mAccessor->mWheels[idx]; } +KartSusPhysics* KartObjectProxy::kartSusPhysics(s32 idx) { return kartSus(idx)->getPhysics(); } + +const KartSusPhysics* KartObjectProxy::kartSusPhysics(s32 idx) const { + return kartSus(idx)->getPhysics(); +} + +KartWheelPhysics* KartObjectProxy::kartWheelPhysics(s32 idx) { return mAccessor->mWheels[idx]->getPhysics(); } + +const KartWheelPhysics* KartObjectProxy::kartWheelPhysics(s32 idx) const { + return mAccessor->mWheels[idx]->getPhysics(); +} + + KartPhysicsEngine* KartObjectProxy::kartPhysicsEngine() { return mAccessor->mPhysicsEngine; } const KartPhysicsEngine* KartObjectProxy::kartPhysicsEngine() const { return mAccessor->mPhysicsEngine; } diff --git a/src/kart/KartObjectProxy.hpp b/src/kart/KartObjectProxy.hpp index eb3123d2..6f3826b5 100644 --- a/src/kart/KartObjectProxy.hpp +++ b/src/kart/KartObjectProxy.hpp @@ -10,6 +10,11 @@ #include "KartSettings.hpp" #include "KartHitbox.hpp" +#include "egg/math/eggMatrix.hpp" +#include "egg/math/eggQuat.hpp" +#include "kart/KartWheel.hpp" +#include "kart/KartSus.hpp" +#include "system/KPadController.hpp" namespace Kart { @@ -18,6 +23,8 @@ class KartPhysics; class KartDynamics; class KartSus; class KartWheel; +class KartSusPhysics; +class KartWheelPhysics; class KartPhysicsEngine; class KartMove; class KartSnd; @@ -77,6 +84,8 @@ class KartObjectProxy { public: KartObjectProxy(); + KartSettings* kartSettings(); + const KartSettings* kartSettings() const; KartPhysics* kartPhysics(); const KartPhysics* kartPhysics() const; KartDynamics* kartDynamics(); @@ -87,6 +96,10 @@ class KartObjectProxy { const KartSus* kartSus(s32 idx) const; KartWheel* kartWheel(s32 idx); const KartWheel* kartWheel(s32 idx) const; + KartSusPhysics* kartSusPhysics(s32 idx); + const KartSusPhysics* kartSusPhysics(s32 idx) const; + KartWheelPhysics* kartWheelPhysics(s32 idx); + const KartWheelPhysics* kartWheelPhysics(s32 idx) const; KartPhysicsEngine* kartPhysicsEngine(); const KartPhysicsEngine* kartPhysicsEngine() const; KartMove* kartMove(); @@ -135,6 +148,24 @@ class KartObjectProxy { const KartJump* kartJump(); const EGG::Vector3f& getPos() const; + const EGG::Vector3f& getPrevPos() const; + void setPos(const EGG::Vector3f &pos); + const EGG::Matrix34f& getPose() const; + const EGG::Matrix34f& getBodyRot() const; + void setRot(const EGG::Quatf& rot); + u16 getSuspCount(); + u16 getWheelCount(); + float getWheelCountRecip(); + float getWheelCountPlusOneRecip(); + const EGG::Vector3f& getWheelPos(u32 wheelIdx); + bool wheelIdxHasFloorCollision(u32 wheelIdx); + void setBodyAngle(f32 angle); + void setStartBoostIdx(s32 idx); + const EGG::Vector3f& getWheelEdgePos(u32 wheelIdx); + System::KPad* getInput(); + bool isLocal(); + bool isCpu(); + bool isGhost(); void getBodyForward(EGG::Vector3f& out); s32 getHopStickX(); s32 getAppliedHopStickX(); diff --git a/src/kart/KartPart.hpp b/src/kart/KartPart.hpp index 80ac949f..13f59c18 100644 --- a/src/kart/KartPart.hpp +++ b/src/kart/KartPart.hpp @@ -2,12 +2,20 @@ #pragma once #include "KartSettings.hpp" +#include "egg/math/eggMatrix.hpp" +#include "egg/math/eggVector.hpp" namespace Kart { class KartPart { - u8 todo[0x90]; + public: KartPart(const KartSettings& kartSettings, u32 thing); + const EGG::Matrix34f getPose() const { return pose; }; + + // TODO : structure is still very wrong + EGG::Vector3f pos; + EGG::Matrix34f pose; + u8 todo[0x90-0x3c]; }; } diff --git a/src/kart/KartState.hpp b/src/kart/KartState.hpp index 3cc7ce73..a3d75001 100644 --- a/src/kart/KartState.hpp +++ b/src/kart/KartState.hpp @@ -71,6 +71,7 @@ class KartState { void setBoostRampType(s32 type) { mBoostRampType = type; } void setJumpPadType(s32 type) { mJumpPadType = type; } void setHalfpipeInvisibilityTimer(s32 timer) { mHalfpipeInvisibilityTimer = timer; } + void setStartBoostIdx(s32 idx) { mStartBoostIdx = idx; } private: RKBitField<160> mFlags; diff --git a/src/kart/KartSus.hpp b/src/kart/KartSus.hpp index b1c2259e..b71cc1df 100644 --- a/src/kart/KartSus.hpp +++ b/src/kart/KartSus.hpp @@ -5,9 +5,17 @@ #include #include "KartPart.hpp" +#include "kart/KartObjectProxy.hpp" namespace Kart { -class KartSus { +class KartSusPhysics; +class KartSus: KartPart { +public: + inline const KartSusPhysics* getPhysics() const { return susPhysics; } + inline KartSusPhysics* getPhysics() { return susPhysics; } + +private: + KartSusPhysics* susPhysics; }; }