diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 4a78cdec..ede1a2eb 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -498,7 +498,7 @@ fn_800146E0 = .text:0x800146E0; // type:function size:0x38 fn_80014720 = .text:0x80014720; // type:function size:0x228 fn_80014950 = .text:0x80014950; // type:function size:0x5C fn_800149B0 = .text:0x800149B0; // type:function size:0x478 -fn_80014E30 = .text:0x80014E30; // type:function size:0x18 +isTriggered__Q23EGG14CoreControllerFUi = .text:0x80014E30; // type:function size:0x18 fn_80014E50 = .text:0x80014E50; // type:function size:0x54 fn_80014EB0 = .text:0x80014EB0; // type:function size:0x3C4 fn_80015280 = .text:0x80015280; // type:function size:0x1C @@ -2370,8 +2370,8 @@ fn_800597A0 = .text:0x800597A0; // type:function size:0x18 fn_800597C0 = .text:0x800597C0; // type:function size:0x18 fn_800597E0 = .text:0x800597E0; // type:function size:0x18 fn_80059800 = .text:0x80059800; // type:function size:0x18 -fn_80059820 = .text:0x80059820; // type:function size:0x18 -fn_80059840 = .text:0x80059840; // type:function size:0x18 +isPressed__Q23EGG14CoreControllerFUi = .text:0x80059820; // type:function size:0x18 +isAllPressed__Q23EGG14CoreControllerFv = .text:0x80059840; // type:function size:0x18 fn_80059860 = .text:0x80059860; // type:function size:0x18 fn_80059880 = .text:0x80059880; // type:function size:0x18 fn_800598A0 = .text:0x800598A0; // type:function size:0x18 @@ -2384,12 +2384,12 @@ fn_80059960 = .text:0x80059960; // type:function size:0x18 fn_80059980 = .text:0x80059980; // type:function size:0x18 fn_800599A0 = .text:0x800599A0; // type:function size:0x18 fn_800599C0 = .text:0x800599C0; // type:function size:0x18 -fn_800599E0 = .text:0x800599E0; // type:function size:0x18 +isReleased__Q23EGG14CoreControllerFv = .text:0x800599E0; // type:function size:0x18 fn_80059A00 = .text:0x80059A00; // type:function size:0x18 fn_80059A20 = .text:0x80059A20; // type:function size:0x18 fn_80059A40 = .text:0x80059A40; // type:function size:0x18 -fn_80059A60 = .text:0x80059A60; // type:function size:0x1C -fn_80059A80 = .text:0x80059A80; // type:function size:0x14 +isAnyPressed__Q23EGG14CoreControllerFUi = .text:0x80059A60; // type:function size:0x1C +isNotPressed__Q23EGG14CoreControllerFv = .text:0x80059A80; // type:function size:0x14 fn_80059AA0 = .text:0x80059AA0; // type:function size:0x18 fn_80059AC0 = .text:0x80059AC0; // type:function size:0x8 fn_80059AD0 = .text:0x80059AD0; // type:function size:0xC @@ -2835,7 +2835,7 @@ fn_800644D0 = .text:0x800644D0; // type:function size:0x10 fn_800644E0 = .text:0x800644E0; // type:function size:0x60 fn_80064540 = .text:0x80064540; // type:function size:0x14 fn_80064560 = .text:0x80064560; // type:function size:0x3BC -fn_80064920 = .text:0x80064920; // type:function size:0x8 +setPosParam__Q23EGG14CoreControllerFff = .text:0x80064920; // type:function size:0x8 fn_80064930 = .text:0x80064930; // type:function size:0x1F4 fn_80064B30 = .text:0x80064B30; // type:function size:0x268 fn_80064DA0 = .text:0x80064DA0; // type:function size:0xB8 diff --git a/include/egg/core/eggController.h b/include/egg/core/eggController.h index dd886686..ac43d1c9 100644 --- a/include/egg/core/eggController.h +++ b/include/egg/core/eggController.h @@ -41,16 +41,21 @@ public: class CoreController { public: // vtable 0x000 | 8056ec50 - /* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32); + // TODO all of these have inline implementations and are scattered + // across the binary + /* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32) {} /* vt 0x0C | 8049a940 */ virtual void setHoriParam(f32, f32) {} /* vt 0x10 | 8049a930 */ virtual void setDistParam(f32, f32) {} /* vt 0x14 | 8049a920 */ virtual void setAccParam(f32, f32) {} - /* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask); - /* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask); - /* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask); - /* vt 0x24 | 800599e0 */ virtual bool isReleased(); - /* vt 0x28 | 80059840 */ virtual bool isAllPressed(); - /* vt 0x2C | 80059a80 */ virtual bool isNotPressed(); + /* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask) {} + /* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask) {} + /* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask) {} + /* vt 0x24 | 800599e0 */ virtual bool isReleased() {} + /* vt 0x28 | 80059840 */ virtual bool isAllPressed() {} + /* vt 0x2C | 80059a80 */ virtual bool isNotPressed() {} + // We know the above are inline because if a class has any non-inline virtual functions, + // then the TU that contains an implementation of said function gets the vtable, + // and we know that eggController.cpp contains the vtable and the functions below /* vt 0x30 | 80499660 */ virtual void beginFrame(void *padStatus); // Really needs to be PADStatus /* vt 0x34 | 80499a60 */ virtual void endFrame(); @@ -98,6 +103,44 @@ public: /* 80499ae0 */ f32 getFreeStickY() const; }; +class CoreControllerMgr { +public: + struct T__Disposer : Disposer { + /* vt 0x08 | 80499b00 */ virtual ~T__Disposer(); + /* 805767ac */ static T__Disposer *sStaticDisposer; + }; + // Disposer Vtable: 8056ec40 + /* 0x0000 */ T__Disposer mDisposer; // for the static T__Disposer +public: + // 0x0010 vtable | 8056ebf8 + /* vt 0x08 | 8049a130 */ virtual void beginFrame(); + /* vt 0x0C | 8049a1e0 */ virtual void endFrame(); + +public: + /* 0x0014 */ TBuffer mControllers; + /* 0x0020 */ u8 field_0x20[0x10a4 - 0x0020]; + /* 0x10A4 */ TBuffer mDevTypes; + /* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0]; + +public: + /* 80499b80 */ static CoreControllerMgr *createInstance(); + /* 80499bd0 */ static void deleteInstance(); + /* 80499be0 */ CoreController *getNthController(s32); + + static void *allocThunk(size_t size); + static void deleteThunk(void *ptr); + + /* 80499cd0 */ static void connectCallback(s32, s32); + /* 80499d10 */ CoreControllerMgr(); + +public: + /* 805767a8 */ static CoreControllerMgr *sInstance; + /* 805767b0 */ static CoreController *(*sCoreControllerFactory)(); + /* 805767b4 */ static ConnectCallback sConnectCallback; + /* 805767b8 */ static bool sUseBuiltinWpadAllocator; + // /* 805767bc */ static sAllocator; // defined in cpp file +}; + class NullController : public CoreController { public: NullController() { @@ -146,52 +189,7 @@ public: /* 8049a7a0 */ void startPattern(const char *pattern, int, bool); /* 8049a7f0 */ ControllerRumbleUnit *getUnitFromList(bool bGrabActive); }; -class CoreControllerMgr { -public: - struct T__Disposer : Disposer { - /* vt 0x08 | 80499b00 */ virtual ~T__Disposer(); - /* 805767ac */ static T__Disposer *sStaticDisposer; - }; - // Disposer Vtable: 8056ec40 - /* 0x0000 */ T__Disposer mDisposer; // for the static T__Disposer -public: - // 0x0010 vtable | 8056ebf8 - /* vt 0x08 | 8049a130 */ virtual void beginFrame(); - /* vt 0x0C | 8049a1e0 */ virtual void endFrame(); -public: - /* 0x0014 */ TBuffer mControllers; - /* 0x0020 */ u8 field_0x20[0x10a4 - 0x0020]; - /* 0x10A4 */ TBuffer mDevTypes; - /* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0]; - -public: - /* 80499b80 */ static CoreControllerMgr *createInstance(); - /* 80499bd0 */ static void deleteInstance(); - /* 80499be0 */ CoreController *getNthController(s32); - - static void *allocThunk(size_t size); - static void deleteThunk(void *ptr); - - /* 80499cd0 */ static void connectCallback(s32, s32); - /* 80499d10 */ CoreControllerMgr(); - -public: - /* 805767a8 */ static CoreControllerMgr *sInstance; - /* 805767b0 */ static CoreController *(*sCoreControllerFactory)(); - /* 805767b4 */ static ConnectCallback sConnectCallback; - /* 805767b8 */ static bool sUseBuiltinWpadAllocator; - // /* 805767bc */ static sAllocator; // defined in cpp file - - // Other Stuff thats autogen (buffers/sinit/etc) - // /* 8049a950 */ void TBuffer::allocate(int, int); - // /* 8049a9a0 */ void TBuffer::allocate(int, Heap*, int); - // /* 8049aa20 */ void TBuffer::onAllocate(Heap*); - // /* 8049aa30 */ void TBuffer::allocate(int, int); - // /* 8049aa80 */ void TBuffer::allocate(int, Heap*, int); - // /* 8049ab00 */ void TBuffer::onAllocate(Heap*); - // /* 8049ab10 */ void sinit(); // NULL CONTROLLER -}; } // namespace EGG diff --git a/src/egg/core/eggController.cpp b/src/egg/core/eggController.cpp index 4ec96e43..bb032446 100644 --- a/src/egg/core/eggController.cpp +++ b/src/egg/core/eggController.cpp @@ -2,13 +2,7 @@ #include "MSL_C/string.h" #include "rvl/VI.h" -extern EGG::CoreControllerMgr *lbl_805767AC; - EGG::NullController null_controller; - -// TODO vtable order in this TU is still messed up -// TODO NullController implementation - namespace EGG { CoreControllerMgr *CoreControllerMgr::sInstance; @@ -165,14 +159,14 @@ extern "C" void fn_803DB1E0(s32 channel, bool arg); if (CoreControllerMgr::sInstance == nullptr) { CoreControllerMgr *mgr = new CoreControllerMgr(); CoreControllerMgr::sInstance = mgr; - lbl_805767AC = mgr; + CoreControllerMgr::T__Disposer::sStaticDisposer = &mgr->mDisposer; } return CoreControllerMgr::sInstance; } /* 0x80499BD0 */ void CoreControllerMgr::deleteInstance() { CoreControllerMgr::sInstance = nullptr; - lbl_805767AC = nullptr; + CoreControllerMgr::T__Disposer::sStaticDisposer = nullptr; } /* 0x80499BE0 */ EGG::CoreController *CoreControllerMgr::getNthController(s32 n) { @@ -196,6 +190,8 @@ extern "C" void fn_803DB1E0(s32 channel, bool arg); /* 0x80499D10 */ CoreControllerMgr::CoreControllerMgr() { const int idxes[] = {0, 1, 2, 3}; if (sUseBuiltinWpadAllocator == false) { + // TODO I just want the string in .data already + TODO_Allocator = (void*)"EGG::CoreControllerMgr"; // TODO create heap, register allocator thunks } // init KPAD