From d4cb8677b81456689378b25b6ea4b83019e0f40e Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:15:12 -0500 Subject: [PATCH] implement LegoInputManager register and unregister (#496) * implement LegoInputManager::Create * Fixes * Add annotation * Add size assert * push changes * Add size assert * Order annotations --------- Co-authored-by: Christian Semmler --- .../lego/legoomni/include/legoinputmanager.h | 31 +++++++++++++++++++ .../legoomni/src/input/legoinputmanager.cpp | 21 +++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 5f596a3d..89e30dc7 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -48,6 +48,19 @@ class LegoNotifyList : public MxPtrList { LegoNotifyList(MxBool p_ownership = FALSE) : MxPtrList(p_ownership) {} }; +// VTABLE: LEGO1 0x100d6ac0 +// class MxListCursor + +// VTABLE: LEGO1 0x100d6ad8 +// class MxPtrListCursor + +// VTABLE: LEGO1 0x100d6aa8 +// SIZE 0x10 +class LegoNotifyListCursor : public MxPtrListCursor { +public: + LegoNotifyListCursor(LegoNotifyList* p_list) : MxPtrListCursor(p_list) {} +}; + // VTABLE: LEGO1 0x100d8760 // SIZE 0x338 class LegoInputManager : public MxPresenter { @@ -157,6 +170,24 @@ class LegoInputManager : public MxPresenter { // SYNTHETIC: LEGO1 0x10028b30 // MxPtrList::`scalar deleting destructor' +// SYNTHETIC: LEGO1 0x10028fd0 +// LegoNotifyListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x10029040 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x10029090 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10029100 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x10029170 +// MxListCursor::~MxListCursor + +// TEMPLATE: LEGO1 0x100291c0 +// LegoNotifyListCursor::~LegoNotifyListCursor + // TEMPLATE: LEGO1 0x1005bb80 // MxCollection::Compare diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index ec871b47..2a551c71 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -6,6 +6,7 @@ DECOMP_SIZE_ASSERT(LegoInputManager, 0x338) DECOMP_SIZE_ASSERT(LegoNotifyList, 0x18) +DECOMP_SIZE_ASSERT(LegoNotifyListCursor, 0x10) DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18) // GLOBAL: LEGO1 0x100f31b0 @@ -211,16 +212,24 @@ MxResult LegoInputManager::GetJoystickState( return FAILURE; } -// STUB: LEGO1 0x1005c470 -void LegoInputManager::Register(MxCore*) +// FUNCTION: LEGO1 0x1005c470 +void LegoInputManager::Register(MxCore* p_notify) { - // TODO + MxAutoLocker lock(&m_criticalSection); + + LegoNotifyListCursor cursor(m_keyboardNotifyList); + if (!cursor.Find(p_notify)) + m_keyboardNotifyList->Append(p_notify); } -// STUB: LEGO1 0x1005c5c0 -void LegoInputManager::UnRegister(MxCore*) +// FUNCTION: LEGO1 0x1005c5c0 +void LegoInputManager::UnRegister(MxCore* p_notify) { - // TODO + MxAutoLocker lock(&m_criticalSection); + + LegoNotifyListCursor cursor(m_keyboardNotifyList); + if (cursor.Find(p_notify)) + cursor.Detach(); } // FUNCTION: LEGO1 0x1005c700