diff --git a/pack/rel_objects.txt b/pack/rel_objects.txt index 5d7cd892..1e1ddf9b 100644 --- a/pack/rel_objects.txt +++ b/pack/rel_objects.txt @@ -15,7 +15,8 @@ out/rel/data_808b2c84_808b2d38.o out/GhostFile.o out/rel/text_8051d4d4_8051e85c.o out/KPadController.o -out/rel/text_805230e0_80525f88.o +out/KPadDirector.o +out/rel/text_80524ac4_80525f88.o out/rel/rodata_8088fcd8_8088fd60.o out/Mii.o out/rel/text_80525ff4_8052a098.o diff --git a/pack/rel_slices.yml b/pack/rel_slices.yml index 01a037d3..335051ef 100644 --- a/pack/rel_slices.yml +++ b/pack/rel_slices.yml @@ -21,6 +21,9 @@ source/game/system/KPadController.cpp: text: [0x8051e85c, 0x805230e0] rodata: [0x8088fcc0, 0x8088fcd8] +source/game/system/KPadDirector.cpp: + text: [0x805230e0, 0x80524ac4] + source/game/system/Mii.cpp: text: [0x80525f88, 0x80525ff4] rodata: [0x8088fd60, 0x8088fd64] diff --git a/pack/symbols.yml b/pack/symbols.yml index dbd142ef..74efa02a 100644 --- a/pack/symbols.yml +++ b/pack/symbols.yml @@ -15439,58 +15439,58 @@ global: 0x80522f40: 'readFrame__Q26System17KPadFaceButtonsStreamFv' 0x805230a8: 'getSequenceSize__Q26System17KPadFaceButtonsStreamFv' 0x805230b0: '__sinit__KPadController_cpp' - 0x805230e0: 'unk_805230e0' - 0x8052313c: 'KPadDirector_createInstance' - 0x8052318c: 'InputMgr_destroyStaticInstance' - 0x805231dc: 'InputMgr_destroy' - 0x805232b0: 'unk_805232b0' - 0x805232f0: 'KPadDirector_construct' - 0x805234a0: 'AiKartInput_construct' - 0x80523520: 'unk_80523520' - 0x80523524: 'unk_80523524' - 0x805235ac: 'unk_805235ac' - 0x805235d4: 'unk_805235d4' - 0x80523690: 'KPadDirector_reset' - 0x80523724: 'unk_80523724' - 0x805237ac: 'unk_805237ac' - 0x805237e8: 'KPadDirector_calcPads' - 0x805238f0: 'InputMgr_calc' - 0x80523990: 'unk_80523990' - 0x80523a58: 'unk_80523a58' - 0x80523a80: 'unk_80523a80' - 0x80523bc8: 'unk_80523bc8' - 0x80523d10: 'unk_80523d10' - 0x80523eac: 'unk_80523eac' - 0x80523ebc: 'KPadDirector_tryRegister' - 0x805240ec: 'unk_805240ec' - 0x80524264: 'KPadDirector_resetPlayerController' - 0x8052427c: 'unk_8052427c' - 0x805242d8: 'InputMgr_initControllers' - 0x80524438: 'unk_80524438' - 0x80524500: 'unk_80524500' - 0x8052453c: 'setGhostController__Q26System12KPadDirectorFUcPvb' + 0x805230e0: 'syncDeviceCallback__Q26System12KPadDirectorFi' + 0x8052313c: 'createInstance__Q26System12KPadDirectorFv' + 0x8052318c: 'destroyInstance__Q26System12KPadDirectorFv' + 0x805231dc: '__dt__Q26System12KPadDirectorFv' + 0x805232b0: '__dt__Q26System19KPadDummyControllerFv' + 0x805232f0: '__ct__Q26System12KPadDirectorFv' + 0x805234a0: '__ct__Q26System6KPadAIFv' + 0x80523520: 'initialize__Q26System12KPadDirectorFv' + 0x80523524: 'reset2__Q26System12KPadDirectorFv' + 0x805235ac: 'resetPlayersActivityStatus__Q26System12KPadDirectorFv' + 0x805235d4: 'checkPlayerActivityStatus__Q26System12KPadDirectorFUcUsUs' + 0x80523690: 'reset__Q26System12KPadDirectorFv' + 0x80523724: 'stopAllMotors__Q26System12KPadDirectorFv' + 0x805237ac: 'readPads__Q26System12KPadDirectorFv' + 0x805237e8: 'calcControllers__Q26System12KPadDirectorFb' + 0x805238f0: 'calc__Q26System12KPadDirectorFv' + 0x80523990: 'setController__Q26System12KPadDirectorFPQ26System4KPadQ26System18eControllerTypeUcb' + 0x80523a58: 'getControllerType__Q26System12KPadDirectorFQ26System14eControlSource' + 0x80523a80: 'copyController__Q26System12KPadDirectorFPQ26System4KPadPQ26System4KPadb' + 0x80523bc8: 'initMasterController__Q26System12KPadDirectorFv' + 0x80523d10: 'setPlayerToMasterController__Q26System12KPadDirectorFUc' + 0x80523eac: 'resetMasterController__Q26System12KPadDirectorFv' + 0x80523ebc: 'initPlayerController__Q26System12KPadDirectorFUcb' + 0x805240ec: 'setMasterToPlayerController__Q26System12KPadDirectorFUc' + 0x80524264: 'resetPlayerController__Q26System12KPadDirectorFUc' + 0x8052427c: 'resetPlayerControllers__Q26System12KPadDirectorFv' + 0x805242d8: 'initPlayerControllers__Q26System12KPadDirectorFv' + 0x80524438: 'setPlayerController__Q26System12KPadDirectorFUcQ26System14eControlSourceUc' + 0x80524500: 'setGhostController__Q26System12KPadDirectorFUc' + 0x8052453c: 'setGhostController__Q26System12KPadDirectorFUcPUsb' 0x80524558: 'unk_80524558' - 0x80524568: 'KPadDirector_startRace' - 0x80524580: 'KPadDirector_startGhostProxies' - 0x805245cc: 'KPadDirector_endGhostProxy' - 0x805245dc: 'unk_805245dc' - 0x80524628: 'KPadDirector_getPadStatus' - 0x805246c0: 'unk_805246c0' - 0x80524718: 'unk_80524718' - 0x80524734: 'unk_80524734' - 0x80524788: 'unk_80524788' - 0x805247e4: 'unk_805247e4' - 0x80524840: 'unk_80524840' - 0x805248d8: 'unk_805248d8' + 0x80524568: 'lockGhostProxies__Q26System12KPadDirectorFv' + 0x80524580: 'startGhostProxies__Q26System12KPadDirectorFv' + 0x805245cc: 'endGhostProxy__Q26System12KPadDirectorFUc' + 0x805245dc: 'endGhostProxies__Q26System12KPadDirectorFv' + 0x80524628: 'getPadStatus__Q26System12KPadDirectorFUcP9PADStatus' + 0x805246c0: 'loadRumbleSettings__Q26System12KPadDirectorFv' + 0x80524718: 'unloadRumbleSettings__Q26System12KPadDirectorFv' + 0x80524734: 'syncDeviceCallbackImpl__Q26System12KPadDirectorFi' + 0x80524788: 'startSync__Q26System12KPadDirectorFv' + 0x805247e4: 'stopSync__Q26System12KPadDirectorFv' + 0x80524840: 'enableDpds__Q26System12KPadDirectorFPb' + 0x805248d8: 'restoreDpds__Q26System12KPadDirectorFPb' 0x80524944: 'unk_80524944' 0x80524998: 'unk_80524998' 0x805249b0: 'unk_805249b0' - 0x805249c8: 'unk_805249c8' + 0x805249c8: 'stopAllMotors2__Q26System12KPadDirectorFv' 0x80524a50: 'unk_80524a50' - 0x80524a58: 'unk_80524a58' - 0x80524aa8: 'AiController_vf10' - 0x80524ab0: 'unk_80524ab0' - 0x80524ab4: 'unk_80524ab4' + 0x80524a58: 'calcInner__Q26System16KPadAIControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState' + 0x80524aa8: 'getControlSource__Q26System16KPadAIControllerFv' + 0x80524ab0: 'calcInner__Q26System19KPadDummyControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState' + 0x80524ab4: '__sinit__KPadDirector_cpp' 0x80524ac4: 'GhostWriter_construct' 0x80524c2c: 'GhostWriter_destroy' 0x80524ca8: 'GhostWriter_reset' diff --git a/source/game/system/KPadController.cpp b/source/game/system/KPadController.cpp index 50be1768..70e8b5c9 100644 --- a/source/game/system/KPadController.cpp +++ b/source/game/system/KPadController.cpp @@ -37,9 +37,9 @@ extern UNKNOWN_FUNCTION(__nwa__FUl); // PAL: 0x80229ee0 extern UNKNOWN_FUNCTION(__dla__FPv); // PAL: 0x80523a58 -extern UNKNOWN_FUNCTION(unk_80523a58); +extern UNKNOWN_FUNCTION(getControllerType__Q26System12KPadDirectorFQ26System14eControlSource); // PAL: 0x80524628 -extern UNKNOWN_FUNCTION(KPadDirector_getPadStatus); +extern UNKNOWN_FUNCTION(getPadStatus__Q26System12KPadDirectorFUcP9PADStatus); // PAL: 0x80524ac4 extern UNKNOWN_FUNCTION(GhostWriter_construct); // PAL: 0x80524ca8 diff --git a/source/game/system/KPadController.hpp b/source/game/system/KPadController.hpp index 9414d13a..00500d4d 100644 --- a/source/game/system/KPadController.hpp +++ b/source/game/system/KPadController.hpp @@ -373,7 +373,7 @@ class KPadController { virtual void setDriftIsAuto(bool isAuto); // [vt+0x38] virtual void* vf_3c(); // [vt+0x3c] virtual u32 getBatteryLevelAsync(); // [vt+0x40] - virtual void reset(bool isDriftAuto); // [vt+0x44] + virtual void reset(bool driftIsAuto); // [vt+0x44] public: KPadRaceInputState mRaceInputState; // [this+0x04] @@ -410,7 +410,7 @@ class KPadWiiController : public KPadController { bool isDpdEnabled() override; // [vt+0x2c] int getChan() override; // [vt+0x34] u32 getBatteryLevelAsync() override; // [vt+0x40] - void reset(bool isDriftAuto) override; // [vt+0x44] + void reset(bool driftIsAuto) override; // [vt+0x44] private: @@ -473,7 +473,7 @@ class KPadGCController : public KPadController { void stopMotor() override; // [vt+0x1c] void stopMotorHard() override; // [vt+0x20] int getChan() override; // [vt+0x34] - void reset(bool isDriftAuto) override; // [vt+0x44] + void reset(bool driftIsAuto) override; // [vt+0x44] public: PADStatus mPadStatus; // [this+0x90] @@ -501,7 +501,7 @@ class KPadGhostController : public KPadController { eControlSource getControlSource() override; // [vt+0x10] double getStreamSize() override; // [vt+0x24] void setDriftIsAuto(bool isAuto) override; // [vt+0x38] - void reset(bool isDriftAuto) override; // [vt+0x44] + void reset(bool driftIsAuto) override; // [vt+0x44] bool hasGhostBuffer() const; void readGhostBuffer(u16* buttonsData, bool isAuto); @@ -606,8 +606,8 @@ class KPad { KPadUIInputState mUIInputState; // [this+0x58] KPadUIInputState mPrevUIPInputState; // [this+0x8c] s16 _c0; // Is drift auto (?) - u16 _c2; // Frames holding the same input - u16 _c4; // Frames controller has been disconnected + u16 mInactivityFrames; // [this+0xc2] + u16 mDisconnectedFrames; // [this+0xc4] bool _c6; // Is paused (?) u8 _c7; KPadControllerInfo mControllerInfo; // [this+0xc8] @@ -629,7 +629,7 @@ class KPadPlayer : public KPad { void setGhostController(KPadController* controller, KPadController* controller2, - bool isDriftAuto); + bool driftIsAuto); public: u16* mGhostBuffer; // [this+0xd8] @@ -646,7 +646,7 @@ static_assert(sizeof(KPadPlayer) == 0xec); class KPadAI : public KPad { public: - virtual ~KPadAI() {}; // [vt+0x08] + virtual ~KPadAI() {}; // [vt+0x08] // [vt+0x14] void setInputState(KPadRaceInputState* raceInputState) override; diff --git a/source/game/system/KPadDirector.cpp b/source/game/system/KPadDirector.cpp new file mode 100644 index 00000000..75520698 --- /dev/null +++ b/source/game/system/KPadDirector.cpp @@ -0,0 +1,477 @@ +#include "KPadDirector.hpp" + +// --- EXTERN DECLARATIONS BEGIN --- + +extern "C" { + +// Extern function references. +// PAL: 0x80006038 +extern UNKNOWN_FUNCTION(memset); +// PAL: 0x80020ff4 +extern UNKNOWN_FUNCTION(__construct_array); +// PAL: 0x800210ec +extern UNKNOWN_FUNCTION(__destroy_arr); +// PAL: 0x80229dcc +extern UNKNOWN_FUNCTION(__nw__FUl); +// PAL: 0x8051e85c +extern UNKNOWN_FUNCTION(reset__Q26System18KPadRaceInputStateFv); +// PAL: 0x8051eba8 +extern UNKNOWN_FUNCTION(__ct__Q26System14KPadControllerFv); +// PAL: 0x8051ed14 +extern UNKNOWN_FUNCTION(calc__Q26System14KPadControllerFv); +// PAL: 0x8051f088 +extern UNKNOWN_FUNCTION(__ct__Q26System17KPadWiiControllerFv); +// PAL: 0x8051ffd0 +extern UNKNOWN_FUNCTION(__ct__Q26System16KPadGCControllerFv); +// PAL: 0x80520730 +extern UNKNOWN_FUNCTION(__ct__Q26System19KPadGhostControllerFv); +// PAL: 0x80520924 +extern UNKNOWN_FUNCTION(__dt__Q26System19KPadGhostControllerFv); +// PAL: 0x80520f64 +extern UNKNOWN_FUNCTION(__ct__Q26System4KPadFv); +// PAL: 0x80521554 +extern UNKNOWN_FUNCTION(setController__Q26System4KPadFPQ26System14KPadControllerPQ26System14KPadController); +// PAL: 0x805215d4 +extern UNKNOWN_FUNCTION(startGhostProxy__Q26System10KPadPlayerFv); +// PAL: 0x80521688 +extern UNKNOWN_FUNCTION(endGhostProxy__Q26System10KPadPlayerFv); +// PAL: 0x80521844 +extern UNKNOWN_FUNCTION(setGhostController__Q26System10KPadPlayerFPQ26System14KPadControllerPQ26System14KPadControllerb); +// PAL: 0x80521930 +extern UNKNOWN_FUNCTION(unk_80521930); +// PAL: 0x80521a34 +extern UNKNOWN_FUNCTION(unk_80521a34); +// PAL: 0x80521d8c +extern UNKNOWN_FUNCTION(unk_80521d8c); +// PAL: 0x80521ed0 +extern UNKNOWN_FUNCTION(unk_80521ed0); +// PAL: 0x805220bc +extern UNKNOWN_FUNCTION(__ct__Q26System10KPadPlayerFv); +// PAL: 0x805222f4 +extern UNKNOWN_FUNCTION(__dt__Q26System10KPadPlayerFv); +// PAL: 0x80522358 +extern UNKNOWN_FUNCTION(unk_80522358); +// PAL: 0x80522364 +extern UNKNOWN_FUNCTION(init__Q26System18KPadControllerInfoFPQ26System14KPadController); +// PAL: 0x80522690 +extern UNKNOWN_FUNCTION(unk_80522690); +// PAL: 0x8052279c +extern UNKNOWN_FUNCTION(__dt__Q26System6KPadAIFv); +// PAL: 0x80522874 +extern UNKNOWN_FUNCTION(__dt__Q26System16KPadGCControllerFv); +// PAL: 0x80522934 +extern UNKNOWN_FUNCTION(__dt__Q26System17KPadWiiControllerFv); +// PAL: 0x805230e0 +extern UNKNOWN_FUNCTION(syncDeviceCallback__Q26System12KPadDirectorFi); +// PAL: 0x805232f0 +extern UNKNOWN_FUNCTION(__ct__Q26System12KPadDirectorFv); +// PAL: 0x805234a0 +extern UNKNOWN_FUNCTION(__ct__Q26System6KPadAIFv); +// PAL: 0x805237e8 +extern UNKNOWN_FUNCTION(calcControllers__Q26System12KPadDirectorFb); +// PAL: 0x805250c8 +extern UNKNOWN_FUNCTION(RumbleSettings_load); +// PAL: 0x80525204 +extern UNKNOWN_FUNCTION(RumbleSettings_dt); +// PAL: 0x805411fc +extern UNKNOWN_FUNCTION(getFile__Q26System15ResourceManagerFlPCcPUl);// Extern data references. +// PAL: 0x8088fd10 +extern UNKNOWN_DATA(lbl_8088fd10); +// PAL: 0x8088fd20 +extern UNKNOWN_DATA(lbl_8088fd20); +// PAL: 0x8088fd2c +extern UNKNOWN_DATA(lbl_8088fd2c); +// PAL: 0x808b2db4 +extern UNKNOWN_DATA(lbl_808b2db4); +// PAL: 0x808b2f2c +extern UNKNOWN_DATA(lbl_808b2f2c); +// PAL: 0x808b2fc8 +extern UNKNOWN_DATA(lbl_808b2fc8); +// PAL: 0x808b2fd8 +extern UNKNOWN_DATA(lbl_808b2fd8); +// PAL: 0x808b3020 +extern UNKNOWN_DATA(lbl_808b3020); +// PAL: 0x808b30fc +extern UNKNOWN_DATA(lbl_808b30fc); +// PAL: 0x809bd708 +extern UNKNOWN_DATA(lbl_809bd708); +// PAL: 0x809bd70c +extern UNKNOWN_DATA(spInstance__Q26System12KPadDirector); +// PAL: 0x809bd738 +extern UNKNOWN_DATA(spInstance__Q26System15ResourceManager); +} + +// --- EXTERN DECLARATIONS END --- + +// .rodata + +// .data + + +// .bss + + +// Symbol: syncDeviceCallback__Q26System12KPadDirectorFi +// PAL: 0x805230e0..0x8052313c +MARK_BINARY_BLOB(syncDeviceCallback__Q26System12KPadDirectorFi, 0x805230e0, 0x8052313c); +asm UNKNOWN_FUNCTION(syncDeviceCallback__Q26System12KPadDirectorFi) { + #include "asm/805230e0.s" +} + +// Symbol: createInstance__Q26System12KPadDirectorFv +// PAL: 0x8052313c..0x8052318c +MARK_BINARY_BLOB(createInstance__Q26System12KPadDirectorFv, 0x8052313c, 0x8052318c); +asm UNKNOWN_FUNCTION(createInstance__Q26System12KPadDirectorFv) { + #include "asm/8052313c.s" +} + +// Symbol: destroyInstance__Q26System12KPadDirectorFv +// PAL: 0x8052318c..0x805231dc +MARK_BINARY_BLOB(destroyInstance__Q26System12KPadDirectorFv, 0x8052318c, 0x805231dc); +asm UNKNOWN_FUNCTION(destroyInstance__Q26System12KPadDirectorFv) { + #include "asm/8052318c.s" +} + +// Symbol: __dt__Q26System12KPadDirectorFv +// PAL: 0x805231dc..0x805232b0 +MARK_BINARY_BLOB(__dt__Q26System12KPadDirectorFv, 0x805231dc, 0x805232b0); +asm UNKNOWN_FUNCTION(__dt__Q26System12KPadDirectorFv) { + #include "asm/805231dc.s" +} + +// Symbol: __dt__Q26System19KPadDummyControllerFv +// PAL: 0x805232b0..0x805232f0 +MARK_BINARY_BLOB(__dt__Q26System19KPadDummyControllerFv, 0x805232b0, 0x805232f0); +asm UNKNOWN_FUNCTION(__dt__Q26System19KPadDummyControllerFv) { + #include "asm/805232b0.s" +} + +// Symbol: __ct__Q26System12KPadDirectorFv +// PAL: 0x805232f0..0x805234a0 +MARK_BINARY_BLOB(__ct__Q26System12KPadDirectorFv, 0x805232f0, 0x805234a0); +asm UNKNOWN_FUNCTION(__ct__Q26System12KPadDirectorFv) { + #include "asm/805232f0.s" +} + +// Symbol: __ct__Q26System6KPadAIFv +// PAL: 0x805234a0..0x80523520 +MARK_BINARY_BLOB(__ct__Q26System6KPadAIFv, 0x805234a0, 0x80523520); +asm UNKNOWN_FUNCTION(__ct__Q26System6KPadAIFv) { + #include "asm/805234a0.s" +} + +// Symbol: initialize__Q26System12KPadDirectorFv +// PAL: 0x80523520..0x80523524 +MARK_BINARY_BLOB(initialize__Q26System12KPadDirectorFv, 0x80523520, 0x80523524); +asm UNKNOWN_FUNCTION(initialize__Q26System12KPadDirectorFv) { + #include "asm/80523520.s" +} + +// Symbol: reset2__Q26System12KPadDirectorFv +// PAL: 0x80523524..0x805235ac +MARK_BINARY_BLOB(reset2__Q26System12KPadDirectorFv, 0x80523524, 0x805235ac); +asm UNKNOWN_FUNCTION(reset2__Q26System12KPadDirectorFv) { + #include "asm/80523524.s" +} + +// Symbol: resetPlayersActivityStatus__Q26System12KPadDirectorFv +// PAL: 0x805235ac..0x805235d4 +MARK_BINARY_BLOB(resetPlayersActivityStatus__Q26System12KPadDirectorFv, 0x805235ac, 0x805235d4); +asm UNKNOWN_FUNCTION(resetPlayersActivityStatus__Q26System12KPadDirectorFv) { + #include "asm/805235ac.s" +} + +// Symbol: checkPlayerActivityStatus__Q26System12KPadDirectorFUcUsUs +// PAL: 0x805235d4..0x80523690 +MARK_BINARY_BLOB(checkPlayerActivityStatus__Q26System12KPadDirectorFUcUsUs, 0x805235d4, 0x80523690); +asm UNKNOWN_FUNCTION(checkPlayerActivityStatus__Q26System12KPadDirectorFUcUsUs) { + #include "asm/805235d4.s" +} + +// Symbol: reset__Q26System12KPadDirectorFv +// PAL: 0x80523690..0x80523724 +MARK_BINARY_BLOB(reset__Q26System12KPadDirectorFv, 0x80523690, 0x80523724); +asm UNKNOWN_FUNCTION(reset__Q26System12KPadDirectorFv) { + #include "asm/80523690.s" +} + +// Symbol: stopAllMotors__Q26System12KPadDirectorFv +// PAL: 0x80523724..0x805237ac +MARK_BINARY_BLOB(stopAllMotors__Q26System12KPadDirectorFv, 0x80523724, 0x805237ac); +asm UNKNOWN_FUNCTION(stopAllMotors__Q26System12KPadDirectorFv) { + #include "asm/80523724.s" +} + +// Symbol: readPads__Q26System12KPadDirectorFv +// PAL: 0x805237ac..0x805237e8 +MARK_BINARY_BLOB(readPads__Q26System12KPadDirectorFv, 0x805237ac, 0x805237e8); +asm UNKNOWN_FUNCTION(readPads__Q26System12KPadDirectorFv) { + #include "asm/805237ac.s" +} + +// Symbol: calcControllers__Q26System12KPadDirectorFb +// PAL: 0x805237e8..0x805238f0 +MARK_BINARY_BLOB(calcControllers__Q26System12KPadDirectorFb, 0x805237e8, 0x805238f0); +asm UNKNOWN_FUNCTION(calcControllers__Q26System12KPadDirectorFb) { + #include "asm/805237e8.s" +} + +// Symbol: calc__Q26System12KPadDirectorFv +// PAL: 0x805238f0..0x80523990 +MARK_BINARY_BLOB(calc__Q26System12KPadDirectorFv, 0x805238f0, 0x80523990); +asm UNKNOWN_FUNCTION(calc__Q26System12KPadDirectorFv) { + #include "asm/805238f0.s" +} + +// Symbol: setController__Q26System12KPadDirectorFPQ26System4KPadQ26System18eControllerTypeUcb +// PAL: 0x80523990..0x80523a58 +MARK_BINARY_BLOB(setController__Q26System12KPadDirectorFPQ26System4KPadQ26System18eControllerTypeUcb, 0x80523990, 0x80523a58); +asm UNKNOWN_FUNCTION(setController__Q26System12KPadDirectorFPQ26System4KPadQ26System18eControllerTypeUcb) { + #include "asm/80523990.s" +} + +// Symbol: getControllerType__Q26System12KPadDirectorFQ26System14eControlSource +// PAL: 0x80523a58..0x80523a80 +MARK_BINARY_BLOB(getControllerType__Q26System12KPadDirectorFQ26System14eControlSource, 0x80523a58, 0x80523a80); +asm UNKNOWN_FUNCTION(getControllerType__Q26System12KPadDirectorFQ26System14eControlSource) { + #include "asm/80523a58.s" +} + +// Symbol: copyController__Q26System12KPadDirectorFPQ26System4KPadPQ26System4KPadb +// PAL: 0x80523a80..0x80523bc8 +MARK_BINARY_BLOB(copyController__Q26System12KPadDirectorFPQ26System4KPadPQ26System4KPadb, 0x80523a80, 0x80523bc8); +asm UNKNOWN_FUNCTION(copyController__Q26System12KPadDirectorFPQ26System4KPadPQ26System4KPadb) { + #include "asm/80523a80.s" +} + +// Symbol: initMasterController__Q26System12KPadDirectorFv +// PAL: 0x80523bc8..0x80523d10 +MARK_BINARY_BLOB(initMasterController__Q26System12KPadDirectorFv, 0x80523bc8, 0x80523d10); +asm UNKNOWN_FUNCTION(initMasterController__Q26System12KPadDirectorFv) { + #include "asm/80523bc8.s" +} + +// Symbol: setPlayerToMasterController__Q26System12KPadDirectorFUc +// PAL: 0x80523d10..0x80523eac +MARK_BINARY_BLOB(setPlayerToMasterController__Q26System12KPadDirectorFUc, 0x80523d10, 0x80523eac); +asm UNKNOWN_FUNCTION(setPlayerToMasterController__Q26System12KPadDirectorFUc) { + #include "asm/80523d10.s" +} + +// Symbol: resetMasterController__Q26System12KPadDirectorFv +// PAL: 0x80523eac..0x80523ebc +MARK_BINARY_BLOB(resetMasterController__Q26System12KPadDirectorFv, 0x80523eac, 0x80523ebc); +asm UNKNOWN_FUNCTION(resetMasterController__Q26System12KPadDirectorFv) { + #include "asm/80523eac.s" +} + +// Symbol: initPlayerController__Q26System12KPadDirectorFUcb +// PAL: 0x80523ebc..0x805240ec +MARK_BINARY_BLOB(initPlayerController__Q26System12KPadDirectorFUcb, 0x80523ebc, 0x805240ec); +asm UNKNOWN_FUNCTION(initPlayerController__Q26System12KPadDirectorFUcb) { + #include "asm/80523ebc.s" +} + +// Symbol: setMasterToPlayerController__Q26System12KPadDirectorFUc +// PAL: 0x805240ec..0x80524264 +MARK_BINARY_BLOB(setMasterToPlayerController__Q26System12KPadDirectorFUc, 0x805240ec, 0x80524264); +asm UNKNOWN_FUNCTION(setMasterToPlayerController__Q26System12KPadDirectorFUc) { + #include "asm/805240ec.s" +} + +// Symbol: resetPlayerController__Q26System12KPadDirectorFUc +// PAL: 0x80524264..0x8052427c +MARK_BINARY_BLOB(resetPlayerController__Q26System12KPadDirectorFUc, 0x80524264, 0x8052427c); +asm UNKNOWN_FUNCTION(resetPlayerController__Q26System12KPadDirectorFUc) { + #include "asm/80524264.s" +} + +// Symbol: resetPlayerControllers__Q26System12KPadDirectorFv +// PAL: 0x8052427c..0x805242d8 +MARK_BINARY_BLOB(resetPlayerControllers__Q26System12KPadDirectorFv, 0x8052427c, 0x805242d8); +asm UNKNOWN_FUNCTION(resetPlayerControllers__Q26System12KPadDirectorFv) { + #include "asm/8052427c.s" +} + +// Symbol: initPlayerControllers__Q26System12KPadDirectorFv +// PAL: 0x805242d8..0x80524438 +MARK_BINARY_BLOB(initPlayerControllers__Q26System12KPadDirectorFv, 0x805242d8, 0x80524438); +asm UNKNOWN_FUNCTION(initPlayerControllers__Q26System12KPadDirectorFv) { + #include "asm/805242d8.s" +} + +// Symbol: setPlayerController__Q26System12KPadDirectorFUcQ26System14eControlSourceUc +// PAL: 0x80524438..0x80524500 +MARK_BINARY_BLOB(setPlayerController__Q26System12KPadDirectorFUcQ26System14eControlSourceUc, 0x80524438, 0x80524500); +asm UNKNOWN_FUNCTION(setPlayerController__Q26System12KPadDirectorFUcQ26System14eControlSourceUc) { + #include "asm/80524438.s" +} + +// Symbol: setGhostController__Q26System12KPadDirectorFUc +// PAL: 0x80524500..0x8052453c +MARK_BINARY_BLOB(setGhostController__Q26System12KPadDirectorFUc, 0x80524500, 0x8052453c); +asm UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUc) { + #include "asm/80524500.s" +} + +// Symbol: setGhostController__Q26System12KPadDirectorFUcPUsb +// PAL: 0x8052453c..0x80524558 +MARK_BINARY_BLOB(setGhostController__Q26System12KPadDirectorFUcPUsb, 0x8052453c, 0x80524558); +asm UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUcPUsb) { + #include "asm/8052453c.s" +} + +// Symbol: unk_80524558 +// PAL: 0x80524558..0x80524568 +MARK_BINARY_BLOB(unk_80524558, 0x80524558, 0x80524568); +asm UNKNOWN_FUNCTION(unk_80524558) { + #include "asm/80524558.s" +} + +// Symbol: lockGhostProxies__Q26System12KPadDirectorFv +// PAL: 0x80524568..0x80524580 +MARK_BINARY_BLOB(lockGhostProxies__Q26System12KPadDirectorFv, 0x80524568, 0x80524580); +asm UNKNOWN_FUNCTION(lockGhostProxies__Q26System12KPadDirectorFv) { + #include "asm/80524568.s" +} + +// Symbol: startGhostProxies__Q26System12KPadDirectorFv +// PAL: 0x80524580..0x805245cc +MARK_BINARY_BLOB(startGhostProxies__Q26System12KPadDirectorFv, 0x80524580, 0x805245cc); +asm UNKNOWN_FUNCTION(startGhostProxies__Q26System12KPadDirectorFv) { + #include "asm/80524580.s" +} + +// Symbol: endGhostProxy__Q26System12KPadDirectorFUc +// PAL: 0x805245cc..0x805245dc +MARK_BINARY_BLOB(endGhostProxy__Q26System12KPadDirectorFUc, 0x805245cc, 0x805245dc); +asm UNKNOWN_FUNCTION(endGhostProxy__Q26System12KPadDirectorFUc) { + #include "asm/805245cc.s" +} + +// Symbol: endGhostProxies__Q26System12KPadDirectorFv +// PAL: 0x805245dc..0x80524628 +MARK_BINARY_BLOB(endGhostProxies__Q26System12KPadDirectorFv, 0x805245dc, 0x80524628); +asm UNKNOWN_FUNCTION(endGhostProxies__Q26System12KPadDirectorFv) { + #include "asm/805245dc.s" +} + +// Symbol: getPadStatus__Q26System12KPadDirectorFUcP9PADStatus +// PAL: 0x80524628..0x805246c0 +MARK_BINARY_BLOB(getPadStatus__Q26System12KPadDirectorFUcP9PADStatus, 0x80524628, 0x805246c0); +asm UNKNOWN_FUNCTION(getPadStatus__Q26System12KPadDirectorFUcP9PADStatus) { + #include "asm/80524628.s" +} + +// Symbol: loadRumbleSettings__Q26System12KPadDirectorFv +// PAL: 0x805246c0..0x80524718 +MARK_BINARY_BLOB(loadRumbleSettings__Q26System12KPadDirectorFv, 0x805246c0, 0x80524718); +asm UNKNOWN_FUNCTION(loadRumbleSettings__Q26System12KPadDirectorFv) { + #include "asm/805246c0.s" +} + +// Symbol: unloadRumbleSettings__Q26System12KPadDirectorFv +// PAL: 0x80524718..0x80524734 +MARK_BINARY_BLOB(unloadRumbleSettings__Q26System12KPadDirectorFv, 0x80524718, 0x80524734); +asm UNKNOWN_FUNCTION(unloadRumbleSettings__Q26System12KPadDirectorFv) { + #include "asm/80524718.s" +} + +// Symbol: syncDeviceCallbackImpl__Q26System12KPadDirectorFi +// PAL: 0x80524734..0x80524788 +MARK_BINARY_BLOB(syncDeviceCallbackImpl__Q26System12KPadDirectorFi, 0x80524734, 0x80524788); +asm UNKNOWN_FUNCTION(syncDeviceCallbackImpl__Q26System12KPadDirectorFi) { + #include "asm/80524734.s" +} + +// Symbol: startSync__Q26System12KPadDirectorFv +// PAL: 0x80524788..0x805247e4 +MARK_BINARY_BLOB(startSync__Q26System12KPadDirectorFv, 0x80524788, 0x805247e4); +asm UNKNOWN_FUNCTION(startSync__Q26System12KPadDirectorFv) { + #include "asm/80524788.s" +} + +// Symbol: stopSync__Q26System12KPadDirectorFv +// PAL: 0x805247e4..0x80524840 +MARK_BINARY_BLOB(stopSync__Q26System12KPadDirectorFv, 0x805247e4, 0x80524840); +asm UNKNOWN_FUNCTION(stopSync__Q26System12KPadDirectorFv) { + #include "asm/805247e4.s" +} + +// Symbol: enableDpds__Q26System12KPadDirectorFPb +// PAL: 0x80524840..0x805248d8 +MARK_BINARY_BLOB(enableDpds__Q26System12KPadDirectorFPb, 0x80524840, 0x805248d8); +asm UNKNOWN_FUNCTION(enableDpds__Q26System12KPadDirectorFPb) { + #include "asm/80524840.s" +} + +// Symbol: restoreDpds__Q26System12KPadDirectorFPb +// PAL: 0x805248d8..0x80524944 +MARK_BINARY_BLOB(restoreDpds__Q26System12KPadDirectorFPb, 0x805248d8, 0x80524944); +asm UNKNOWN_FUNCTION(restoreDpds__Q26System12KPadDirectorFPb) { + #include "asm/805248d8.s" +} + +// Symbol: unk_80524944 +// PAL: 0x80524944..0x80524998 +MARK_BINARY_BLOB(unk_80524944, 0x80524944, 0x80524998); +asm UNKNOWN_FUNCTION(unk_80524944) { + #include "asm/80524944.s" +} + +// Symbol: unk_80524998 +// PAL: 0x80524998..0x805249b0 +MARK_BINARY_BLOB(unk_80524998, 0x80524998, 0x805249b0); +asm UNKNOWN_FUNCTION(unk_80524998) { + #include "asm/80524998.s" +} + +// Symbol: unk_805249b0 +// PAL: 0x805249b0..0x805249c8 +MARK_BINARY_BLOB(unk_805249b0, 0x805249b0, 0x805249c8); +asm UNKNOWN_FUNCTION(unk_805249b0) { + #include "asm/805249b0.s" +} + +// Symbol: stopAllMotors2__Q26System12KPadDirectorFv +// PAL: 0x805249c8..0x80524a50 +MARK_BINARY_BLOB(stopAllMotors2__Q26System12KPadDirectorFv, 0x805249c8, 0x80524a50); +asm UNKNOWN_FUNCTION(stopAllMotors2__Q26System12KPadDirectorFv) { + #include "asm/805249c8.s" +} + +// Symbol: unk_80524a50 +// PAL: 0x80524a50..0x80524a58 +MARK_BINARY_BLOB(unk_80524a50, 0x80524a50, 0x80524a58); +asm UNKNOWN_FUNCTION(unk_80524a50) { + #include "asm/80524a50.s" +} + +// Symbol: calcInner__Q26System16KPadAIControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState +// PAL: 0x80524a58..0x80524aa8 +MARK_BINARY_BLOB(calcInner__Q26System16KPadAIControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState, 0x80524a58, 0x80524aa8); +asm UNKNOWN_FUNCTION(calcInner__Q26System16KPadAIControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState) { + #include "asm/80524a58.s" +} + +// Symbol: getControlSource__Q26System16KPadAIControllerFv +// PAL: 0x80524aa8..0x80524ab0 +MARK_BINARY_BLOB(getControlSource__Q26System16KPadAIControllerFv, 0x80524aa8, 0x80524ab0); +asm UNKNOWN_FUNCTION(getControlSource__Q26System16KPadAIControllerFv) { + #include "asm/80524aa8.s" +} + +// Symbol: calcInner__Q26System19KPadDummyControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState +// PAL: 0x80524ab0..0x80524ab4 +MARK_BINARY_BLOB(calcInner__Q26System19KPadDummyControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState, 0x80524ab0, 0x80524ab4); +asm UNKNOWN_FUNCTION(calcInner__Q26System19KPadDummyControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState) { + #include "asm/80524ab0.s" +} + +// Symbol: __sinit__KPadDirector_cpp +// PAL: 0x80524ab4..0x80524ac4 +MARK_BINARY_BLOB(__sinit__KPadDirector_cpp, 0x80524ab4, 0x80524ac4); +asm UNKNOWN_FUNCTION(__sinit__KPadDirector_cpp) { + #include "asm/80524ab4.s" +} + diff --git a/source/game/system/KPadDirector.hpp b/source/game/system/KPadDirector.hpp index 2a7548ec..34f73910 100644 --- a/source/game/system/KPadDirector.hpp +++ b/source/game/system/KPadDirector.hpp @@ -2,34 +2,230 @@ #include +#include + +#include + +#include + + +extern "C" { +// PAL: 0x805230e0..0x8052313c +UNKNOWN_FUNCTION(syncDeviceCallback__Q26System12KPadDirectorFi); +// PAL: 0x8052313c..0x8052318c +UNKNOWN_FUNCTION(createInstance__Q26System12KPadDirectorFv); +// PAL: 0x8052318c..0x805231dc +UNKNOWN_FUNCTION(destroyInstance__Q26System12KPadDirectorFv); +// PAL: 0x805231dc..0x805232b0 +UNKNOWN_FUNCTION(__dt__Q26System12KPadDirectorFv); +// PAL: 0x805232b0..0x805232f0 +UNKNOWN_FUNCTION(__dt__Q26System19KPadDummyControllerFv); +// PAL: 0x805232f0..0x805234a0 +UNKNOWN_FUNCTION(__ct__Q26System12KPadDirectorFv); +// PAL: 0x805234a0..0x80523520 +UNKNOWN_FUNCTION(__ct__Q26System6KPadAIFv); +// PAL: 0x80523520..0x80523524 +UNKNOWN_FUNCTION(initialize__Q26System12KPadDirectorFv); +// PAL: 0x80523524..0x805235ac +UNKNOWN_FUNCTION(reset2__Q26System12KPadDirectorFv); +// PAL: 0x805235ac..0x805235d4 +UNKNOWN_FUNCTION(resetPlayersActivityStatus__Q26System12KPadDirectorFv); +// PAL: 0x805235d4..0x80523690 +UNKNOWN_FUNCTION(checkPlayerActivityStatus__Q26System12KPadDirectorFUcUsUs); +// PAL: 0x80523690..0x80523724 +UNKNOWN_FUNCTION(reset__Q26System12KPadDirectorFv); +// PAL: 0x80523724..0x805237ac +UNKNOWN_FUNCTION(stopAllMotors__Q26System12KPadDirectorFv); +// PAL: 0x805237ac..0x805237e8 +UNKNOWN_FUNCTION(readPads__Q26System12KPadDirectorFv); +// PAL: 0x805237e8..0x805238f0 +UNKNOWN_FUNCTION(calcControllers__Q26System12KPadDirectorFb); +// PAL: 0x805238f0..0x80523990 +UNKNOWN_FUNCTION(calc__Q26System12KPadDirectorFv); +// PAL: 0x80523990..0x80523a58 +UNKNOWN_FUNCTION(setController__Q26System12KPadDirectorFPQ26System4KPadQ26System18eControllerTypeUcb); +// PAL: 0x80523a58..0x80523a80 +UNKNOWN_FUNCTION(getControllerType__Q26System12KPadDirectorFQ26System14eControlSource); +// PAL: 0x80523a80..0x80523bc8 +UNKNOWN_FUNCTION(copyController__Q26System12KPadDirectorFPQ26System4KPadPQ26System4KPadb); +// PAL: 0x80523bc8..0x80523d10 +UNKNOWN_FUNCTION(initMasterController__Q26System12KPadDirectorFv); +// PAL: 0x80523d10..0x80523eac +UNKNOWN_FUNCTION(setPlayerToMasterController__Q26System12KPadDirectorFUc); +// PAL: 0x80523eac..0x80523ebc +UNKNOWN_FUNCTION(resetMasterController__Q26System12KPadDirectorFv); +// PAL: 0x80523ebc..0x805240ec +UNKNOWN_FUNCTION(initPlayerController__Q26System12KPadDirectorFUcb); +// PAL: 0x805240ec..0x80524264 +UNKNOWN_FUNCTION(setMasterToPlayerController__Q26System12KPadDirectorFUc); +// PAL: 0x80524264..0x8052427c +UNKNOWN_FUNCTION(resetPlayerController__Q26System12KPadDirectorFUc); +// PAL: 0x8052427c..0x805242d8 +UNKNOWN_FUNCTION(resetPlayerControllers__Q26System12KPadDirectorFv); +// PAL: 0x805242d8..0x80524438 +UNKNOWN_FUNCTION(initPlayerControllers__Q26System12KPadDirectorFv); +// PAL: 0x80524438..0x80524500 +UNKNOWN_FUNCTION(setPlayerController__Q26System12KPadDirectorFUcQ26System14eControlSourceUc); +// PAL: 0x80524500..0x8052453c +UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUc); +// PAL: 0x8052453c..0x80524558 +UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUcPUsb); +// PAL: 0x80524558..0x80524568 +UNKNOWN_FUNCTION(unk_80524558); +// PAL: 0x80524568..0x80524580 +UNKNOWN_FUNCTION(lockGhostProxies__Q26System12KPadDirectorFv); +// PAL: 0x80524580..0x805245cc +UNKNOWN_FUNCTION(startGhostProxies__Q26System12KPadDirectorFv); +// PAL: 0x805245cc..0x805245dc +UNKNOWN_FUNCTION(endGhostProxy__Q26System12KPadDirectorFUc); +// PAL: 0x805245dc..0x80524628 +UNKNOWN_FUNCTION(endGhostProxies__Q26System12KPadDirectorFv); +// PAL: 0x80524628..0x805246c0 +UNKNOWN_FUNCTION(getPadStatus__Q26System12KPadDirectorFUcP9PADStatus); +// PAL: 0x805246c0..0x80524718 +UNKNOWN_FUNCTION(loadRumbleSettings__Q26System12KPadDirectorFv); +// PAL: 0x80524718..0x80524734 +UNKNOWN_FUNCTION(unloadRumbleSettings__Q26System12KPadDirectorFv); +// PAL: 0x80524734..0x80524788 +UNKNOWN_FUNCTION(syncDeviceCallbackImpl__Q26System12KPadDirectorFi); +// PAL: 0x80524788..0x805247e4 +UNKNOWN_FUNCTION(startSync__Q26System12KPadDirectorFv); +// PAL: 0x805247e4..0x80524840 +UNKNOWN_FUNCTION(stopSync__Q26System12KPadDirectorFv); +// PAL: 0x80524840..0x805248d8 +UNKNOWN_FUNCTION(enableDpds__Q26System12KPadDirectorFPb); +// PAL: 0x805248d8..0x80524944 +UNKNOWN_FUNCTION(restoreDpds__Q26System12KPadDirectorFPb); +// PAL: 0x80524944..0x80524998 +UNKNOWN_FUNCTION(unk_80524944); +// PAL: 0x80524998..0x805249b0 +UNKNOWN_FUNCTION(unk_80524998); +// PAL: 0x805249b0..0x805249c8 +UNKNOWN_FUNCTION(unk_805249b0); +// PAL: 0x805249c8..0x80524a50 +UNKNOWN_FUNCTION(stopAllMotors2__Q26System12KPadDirectorFv); +// PAL: 0x80524a50..0x80524a58 +UNKNOWN_FUNCTION(unk_80524a50); +// PAL: 0x80524a58..0x80524aa8 +UNKNOWN_FUNCTION(calcInner__Q26System16KPadAIControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState); +// PAL: 0x80524aa8..0x80524ab0 +UNKNOWN_FUNCTION(getControlSource__Q26System16KPadAIControllerFv); +// PAL: 0x80524ab0..0x80524ab4 +UNKNOWN_FUNCTION(calcInner__Q26System19KPadDummyControllerFPQ26System18KPadRaceInputStatePQ26System16KPadUIInputState); +// PAL: 0x80524ab4..0x80524ac4 +UNKNOWN_FUNCTION(__sinit__KPadDirector_cpp); +} + + namespace System { -// Placeholder class for RaceConfig -class Controller { -public: - virtual ~Controller(); - virtual s32 getControllerId(); +// Temporary definition +struct RumbleManager { + u8 _00[0x10]; }; -class PlayerInput { +class KPadDirector { public: - u8 _00[0x04 - 0x00]; - Controller* controller; - void* controller2; - void* controller3; - u8 _10[0xEC - 0x10]; -}; + enum eControllerType { + + //! @brief Wiimote, Nunchuck or Classic + CONTROLLER_TYPE_WII = 0, + + //! @brief Gamecube + CONTROLLER_TYPE_GC = 1, + + CONTROLLER_TYPE_OTHER = 3, + }; + +public: + static KPadDirector* spInstance; + + static KPadDirector* createInstance(); + static void destroyInstance(); + + static void syncDeviceCallback(int result); + + static eControllerType getControllerType(eControlSource controlSource); -class KPadDirector { public: KPadDirector(); - virtual ~KPadDirector(); - void setGhostController(u8 playerInputIdx, void* inputs, bool driftIsAuto); + virtual ~KPadDirector() {} // [vt+0x08] - static KPadDirector* spInstance; + void initialize(); + + void resetPlayersActivityStatus(); + bool checkPlayerActivityStatus(u8 playerIdx, + u16 maxInactiveFrames, + u16 maxDisconnectedFrames); + + void reset(); + void reset2(); // inlined in reset + + void stopAllMotors(); + void stopAllMotors2(); // stop gc motors first instead of wii motors first... + + void readPads(); + + void calcControllers(bool isPaused); + void calc(); + + bool setController(KPad* dest, eControllerType type, + u8 playerIdx, bool noSet); + bool copyController(KPad* dest, KPad* source, bool noSet); + + bool initMasterController(); + bool setPlayerToMasterController(u8 playerIdx); + void resetMasterController(); - PlayerInput mPlayerInputs[4]; - u8 _3b4[0x4154 - 0x3b4]; + bool initPlayerController(u8 playerIdx, bool noSet = false); + bool setMasterToPlayerController(u8 playerIdx); + void resetPlayerController(u8 playerIdx); + void resetPlayerControllers(); + u32 initPlayerControllers(); + void setPlayerController(u8 playerIdx, eControlSource controlSource, + u8 controllerIdx); + + void setGhostController(u8 playerIdx); + void setGhostController(u8 playerIdx, u16* ghostBuffer, bool driftIsAuto); + + void lockGhostProxies(); + void startGhostProxies(); + void endGhostProxy(u8 playerIdx); + void endGhostProxies(); + + u32 getPadStatus(u8 padIdx, PADStatus* dest = nullptr); + + void loadRumbleSettings(); + void unloadRumbleSettings(); + + void syncDeviceCallbackImpl(int result); // inlined in syncDeviceCallback + void startSync(); + void stopSync(); + + void enableDpds(bool* prevStates); + void restoreDpds(bool* prevStates); + +public: + KPadPlayer mPlayers[4]; // [this+0x0004] + KPadAI mAIs[12]; // [this+0x03b4] + KPad mMaster; // [this+0x15b4] + bool _168c; + u8 _168d; + u8 _168e; + u8 _168f; + KPadDummyController mDummyController; // [this+0x1690] + KPadWiiController mWiiControllers[4]; // [this+0x1720] + KPadGCController mGCControllers[4]; // [this+0x3ba0] + KPadGhostController mGhostControllers[4]; // [this+0x3e60] + RumbleManager mRumbleManager; // [this+0x4100] + u8 _4110[0x10]; + PADStatus mPadStatuses[4]; // [this+0x4120] + u32 _4150; bool mIsPaused; // [this+0x4154] bool mIsMirror; // [this+0x4155] + u8 _4156; + u8 _4157; + s32 _4158; // WPAD sync related }; + +static_assert(sizeof(KPadDirector) == 0x415c); } // namespace System diff --git a/source/game/system/RaceConfig.cpp b/source/game/system/RaceConfig.cpp index 0c7e82de..4f1ef2e6 100644 --- a/source/game/system/RaceConfig.cpp +++ b/source/game/system/RaceConfig.cpp @@ -25,7 +25,7 @@ extern UNKNOWN_FUNCTION(_savegpr_14); // PAL: 0x8052d1c0 extern UNKNOWN_FUNCTION(calcNegPoints__Q26System6RatingCFRCQ26System6Rating); // PAL: 0x80524500 -extern UNKNOWN_FUNCTION(unk_80524500); +extern UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUc); // PAL: 0x80524558 extern UNKNOWN_FUNCTION(unk_80524558); // PAL: 0x8051c120 @@ -35,7 +35,7 @@ extern UNKNOWN_FUNCTION(__destroy_arr); // PAL: 0x8051c334 extern UNKNOWN_FUNCTION(__dt__Q26System4TimeFv); // PAL: 0x8052453c -extern UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUcPvb); +extern UNKNOWN_FUNCTION(setGhostController__Q26System12KPadDirectorFUcPUsb); // PAL: 0x8051c790 extern UNKNOWN_FUNCTION(read__Q26System9GhostFileFRCQ26System12RawGhostFile); // PAL: 0x8051c270 @@ -790,7 +790,7 @@ asm UNKNOWN_FUNCTION( /* 8052EEB8 41800010 */ blt- lbl_8052eec8 /* 8052EEBC 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) /* 8052EEC0 5404063E */ clrlwi r4, r0, 0x18 - /* 8052EEC4 4BFF563D */ bl unk_80524500 + /* 8052EEC4 4BFF563D */ bl setGhostController__Q26System12KPadDirectorFUc lbl_8052eec8: /* 8052EEC8 3BBD0001 */ addi r29, r29, 0x1 /* 8052EECC 281D000C */ cmplwi r29, 0xc @@ -817,7 +817,7 @@ bool RaceConfig::Scenario::initGhost(u8 playerIdx, s8 playerInputIdx) { if (ghost.mCourseId == mSettings.mCourseId) { if (playerInputIdx >= 0) { KPadDirector::spInstance->setGhostController( - playerInputIdx, (void*)ghost.mInputs, ghost.mDriftIsAuto); + playerInputIdx, (u16*)ghost.mInputs, ghost.mDriftIsAuto); } mPlayers[playerIdx].mCharacterId = (CharacterId)ghost.mCharacterId; @@ -1225,7 +1225,7 @@ asm UNKNOWN_FUNCTION(initControllers__Q36System10RaceConfig8ScenarioFUc) { /* 8052F604 5764063E */ clrlwi r4, r27, 0x18 /* 8052F608 80A100DC */ lwz r5, 0xdc(r1) /* 8052F60C 88C100D0 */ lbz r6, 0xd0(r1) - /* 8052F610 4BFF4F2D */ bl setGhostController__Q26System12KPadDirectorFUcPvb + /* 8052F610 4BFF4F2D */ bl setGhostController__Q26System12KPadDirectorFUcPUsb lbl_8052f614: /* 8052F614 800100B8 */ lwz r0, 0xb8(r1) /* 8052F618 3AA00001 */ li r21, 0x1 diff --git a/source/game/system/RaceManager.cpp b/source/game/system/RaceManager.cpp index 20028678..236d0bbf 100644 --- a/source/game/system/RaceManager.cpp +++ b/source/game/system/RaceManager.cpp @@ -90,13 +90,13 @@ extern UNKNOWN_FUNCTION(__dt__Q26System4TimeFv); // PAL: 0x8051c374 extern UNKNOWN_FUNCTION(__ct__Q26System4TimeFv); // PAL: 0x805235ac -extern UNKNOWN_FUNCTION(unk_805235ac); +extern UNKNOWN_FUNCTION(resetPlayersActivityStatus__Q26System12KPadDirectorFv); // PAL: 0x80524568 -extern UNKNOWN_FUNCTION(KPadDirector_startRace); +extern UNKNOWN_FUNCTION(lockGhostProxies__Q26System12KPadDirectorFv); // PAL: 0x80524580 -extern UNKNOWN_FUNCTION(KPadDirector_startGhostProxies); +extern UNKNOWN_FUNCTION(startGhostProxies__Q26System12KPadDirectorFv); // PAL: 0x805245cc -extern UNKNOWN_FUNCTION(KPadDirector_endGhostProxy); +extern UNKNOWN_FUNCTION(endGhostProxy__Q26System12KPadDirectorFUc); // PAL: 0x805275ec extern UNKNOWN_FUNCTION(isMii); // PAL: 0x8052cb6c @@ -1724,7 +1724,7 @@ asm UNKNOWN_FUNCTION(Raceinfo_init) { /* 80533018 901F0038 */ stw r0, 0x38(r31) /* 8053301C 3C60809C */ lis r3, spInstance__Q26System12KPadDirector@ha /* 80533020 8063D70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r3) - /* 80533024 4BFF1545 */ bl KPadDirector_startRace + /* 80533024 4BFF1545 */ bl lockGhostProxies__Q26System12KPadDirectorFv /* 80533028 3BA00000 */ li r29, 0x0 /* 8053302C 3FC0809C */ lis r30, spInstance__Q26System10RaceConfig@ha /* 80533030 48000018 */ b lbl_80533048 @@ -2044,7 +2044,7 @@ asm UNKNOWN_FUNCTION(RaceInfo_update) { /* 80533448 4E800421 */ bctrl /* 8053344C 3C60809C */ lis r3, spInstance__Q26System12KPadDirector@ha /* 80533450 8063D70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r3) - /* 80533454 4BFF112D */ bl KPadDirector_startGhostProxies + /* 80533454 4BFF112D */ bl startGhostProxies__Q26System12KPadDirectorFv /* 80533458 3C80809C */ lis r4, spInstance__Q26System10RaceConfig@ha /* 8053345C 38600000 */ li r3, 0x0 /* 80533460 8084D728 */ lwz r4, spInstance__Q26System10RaceConfig@l(r4) @@ -2059,7 +2059,7 @@ asm UNKNOWN_FUNCTION(RaceInfo_update) { /* 80533480 41820020 */ beq- lbl_805334a0 /* 80533484 3FC0809C */ lis r30, spInstance__Q26System12KPadDirector@ha /* 80533488 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) - /* 8053348C 4BFF0121 */ bl unk_805235ac + /* 8053348C 4BFF0121 */ bl resetPlayersActivityStatus__Q26System12KPadDirectorFv /* 80533490 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) /* 80533494 38000001 */ li r0, 0x1 /* 80533498 98034156 */ stb r0, 0x4156(r3) @@ -2135,7 +2135,7 @@ asm UNKNOWN_FUNCTION(RaceInfo_update) { /* 80533594 4E800421 */ bctrl /* 80533598 3C60809C */ lis r3, spInstance__Q26System12KPadDirector@ha /* 8053359C 8063D70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r3) - /* 805335A0 4BFF0FE1 */ bl KPadDirector_startGhostProxies + /* 805335A0 4BFF0FE1 */ bl startGhostProxies__Q26System12KPadDirectorFv /* 805335A4 3C80809C */ lis r4, spInstance__Q26System10RaceConfig@ha /* 805335A8 38600000 */ li r3, 0x0 /* 805335AC 8084D728 */ lwz r4, spInstance__Q26System10RaceConfig@l(r4) @@ -2150,7 +2150,7 @@ asm UNKNOWN_FUNCTION(RaceInfo_update) { /* 805335CC 41820020 */ beq- lbl_805335ec /* 805335D0 3FC0809C */ lis r30, spInstance__Q26System12KPadDirector@ha /* 805335D4 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) - /* 805335D8 4BFEFFD5 */ bl unk_805235ac + /* 805335D8 4BFEFFD5 */ bl resetPlayersActivityStatus__Q26System12KPadDirectorFv /* 805335DC 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) /* 805335E0 38000001 */ li r0, 0x1 /* 805335E4 98034156 */ stb r0, 0x4156(r3) @@ -2548,7 +2548,7 @@ asm UNKNOWN_FUNCTION(unk_80533afc) { /* 80533B24 4E800421 */ bctrl /* 80533B28 3C60809C */ lis r3, spInstance__Q26System12KPadDirector@ha /* 80533B2C 8063D70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r3) - /* 80533B30 4BFF0A51 */ bl KPadDirector_startGhostProxies + /* 80533B30 4BFF0A51 */ bl startGhostProxies__Q26System12KPadDirectorFv /* 80533B34 3C80809C */ lis r4, spInstance__Q26System10RaceConfig@ha /* 80533B38 38600000 */ li r3, 0x0 /* 80533B3C 8084D728 */ lwz r4, spInstance__Q26System10RaceConfig@l(r4) @@ -2563,7 +2563,7 @@ asm UNKNOWN_FUNCTION(unk_80533afc) { /* 80533B5C 41820020 */ beq- lbl_80533b7c /* 80533B60 3FC0809C */ lis r30, spInstance__Q26System12KPadDirector@ha /* 80533B64 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) - /* 80533B68 4BFEFA45 */ bl unk_805235ac + /* 80533B68 4BFEFA45 */ bl resetPlayersActivityStatus__Q26System12KPadDirectorFv /* 80533B6C 807ED70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r30) /* 80533B70 38000001 */ li r0, 0x1 /* 80533B74 98034156 */ stb r0, 0x4156(r3) @@ -2683,7 +2683,7 @@ asm UNKNOWN_FUNCTION(unk_80533c6c) { /* 80533CAC 3C60809C */ lis r3, spInstance__Q26System12KPadDirector@ha /* 80533CB0 5404063E */ clrlwi r4, r0, 0x18 /* 80533CB4 8063D70C */ lwz r3, spInstance__Q26System12KPadDirector@l(r3) - /* 80533CB8 4BFF0915 */ bl KPadDirector_endGhostProxy + /* 80533CB8 4BFF0915 */ bl endGhostProxy__Q26System12KPadDirectorFUc lbl_80533cbc: /* 80533CBC 3C80809C */ lis r4, spInstance__Q26System10RaceConfig@ha /* 80533CC0 3C60809C */ lis r3, lbl_809bd730@ha diff --git a/source/rvl/wpad/wpad.h b/source/rvl/wpad/wpad.h index 51289216..cd69eef4 100644 --- a/source/rvl/wpad/wpad.h +++ b/source/rvl/wpad/wpad.h @@ -75,6 +75,12 @@ typedef struct WPADInfo { // PAL: 0x801bf5c4 extern UNKNOWN_FUNCTION(WPADInit); +// PAL: 0x801bf634 +extern UNKNOWN_FUNCTION(WPADStartSyncSimple); +// PAL: 0x801bf63c +extern UNKNOWN_FUNCTION(WPADStopSimpleSync); +// PAL: 0x801bf640 +extern UNKNOWN_FUNCTION(WPADSetSyncDeviceCallback); // PAL: 0x801bf64c extern UNKNOWN_FUNCTION(WPADGetStatus); // PAL: 0x801bf714 diff --git a/sources.py b/sources.py index 2c5f7130..ad488260 100644 --- a/sources.py +++ b/sources.py @@ -468,6 +468,7 @@ class Source: Source(src="source/game/system/DvdArchive.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/system/GhostFile.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/system/KPadController.cpp", cc='4201_127', opts=REL_OPTS), + Source(src="source/game/system/KPadDirector.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/system/Mii.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/system/LocalizedArchive.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/system/MultiDvdArchive.cpp", cc='4201_127', opts=REL_OPTS),