implement LegoInputManager::Create (#495)

* implement LegoInputManager::Create

* Fixes

* Add annotation

* Add size assert

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-27 16:55:59 -05:00 committed by GitHub
parent 19c771b85d
commit f706f80483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 109 additions and 38 deletions

View File

@ -32,6 +32,9 @@ public:
// SYNTHETIC: LEGO1 0x10028d40 // SYNTHETIC: LEGO1 0x10028d40
// LegoControlManager::`scalar deleting destructor' // LegoControlManager::`scalar deleting destructor'
private:
undefined m_padding0x08[0x58]; // 0x08
}; };
#endif // LEGOCONTROLMANAGER_H #endif // LEGOCONTROLMANAGER_H

View File

@ -25,6 +25,29 @@ class LegoControlManager;
// SIZE 0x18 // SIZE 0x18
class LegoEventQueue : public MxQueue<LegoEventNotificationParam> {}; class LegoEventQueue : public MxQueue<LegoEventNotificationParam> {};
// VTABLE: LEGO1 0x100d6a20
// class MxCollection<MxCore*>
// VTABLE: LEGO1 0x100d6a38
// class MxList<MxCore*>
// VTABLE: LEGO1 0x100d6a50
// class MxPtrList<MxCore>
// VTABLE: LEGO1 0x100d6a68
// SIZE 0x18
class LegoNotifyList : public MxPtrList<MxCore> {
protected:
// FUNCTION: LEGO1 0x10028830
virtual MxS8 Compare(MxCore* p_element1, MxCore* p_element2) override
{
return p_element1 == p_element2 ? 0 : p_element1 < p_element2 ? -1 : 1;
} // vtable+0x14
public:
LegoNotifyList(MxBool p_ownership = FALSE) : MxPtrList<MxCore>(p_ownership) {}
};
// VTABLE: LEGO1 0x100d8760 // VTABLE: LEGO1 0x100d8760
// SIZE 0x338 // SIZE 0x338
class LegoInputManager : public MxPresenter { class LegoInputManager : public MxPresenter {
@ -78,47 +101,59 @@ public:
// LegoInputManager::`scalar deleting destructor' // LegoInputManager::`scalar deleting destructor'
private: private:
MxCriticalSection m_criticalSection; MxCriticalSection m_criticalSection; // 0x58
MxList<undefined4>* m_unk0x5c; // list or hash table LegoNotifyList* m_keyboardNotifyList; // 0x5c
LegoCameraController* m_camera; LegoCameraController* m_camera; // 0x60
LegoWorld* m_world; LegoWorld* m_world; // 0x64
LegoEventQueue* m_eventQueue; // +0x68 LegoEventQueue* m_eventQueue; // 0x68
undefined4 m_unk0x6c; undefined4 m_unk0x6c; // 0x6c
undefined4 m_unk0x70; undefined4 m_unk0x70; // 0x70
undefined4 m_unk0x74; undefined4 m_unk0x74; // 0x74
UINT m_timer; UINT m_timer; // 0x78
UINT m_timeout; UINT m_timeout; // 0x7c
undefined m_unk0x80; undefined m_unk0x80; // 0x80
undefined m_unk0x81; undefined m_unk0x81; // 0x81
LegoControlManager* m_controlManager; LegoControlManager* m_controlManager; // 0x84
MxBool m_unk0x88; MxBool m_unk0x88; // 0x88
IDirectInput* m_directInput; IDirectInput* m_directInput; // 0x8c
IDirectInputDevice* m_directInputDevice; IDirectInputDevice* m_directInputDevice; // 0x90
undefined m_unk0x94; undefined m_unk0x94; // 0x94
undefined4 m_unk0x98; undefined4 m_unk0x98; // 0x98
undefined m_unk0x9c[0xF8]; undefined m_unk0x9c[0xf8]; // 0x9c
undefined m_unk0x194; undefined m_unk0x194; // 0x194
MxBool m_unk0x195; MxBool m_unk0x195; // 0x195
MxS32 m_joyid; MxS32 m_joyid; // 0x198
MxS32 m_joystickIndex; MxS32 m_joystickIndex; // 0x19c
JOYCAPS m_joyCaps; JOYCAPS m_joyCaps; // 0x200
MxBool m_useJoystick; MxBool m_useJoystick; // 0x334
MxBool m_unk0x335; MxBool m_unk0x335; // 0x335
MxBool m_unk0x336; MxBool m_unk0x336; // 0x336
}; };
// TEMPLATE: LEGO1 0x1005bb80 // TEMPLATE: LEGO1 0x1005bb80
// MxCollection<LegoEventNotificationParam>::Compare // MxCollection<LegoEventNotificationParam>::Compare
// TEMPLATE: LEGO1 0x100288b0
// MxCollection<MxCore *>::Destroy
// TEMPLATE: LEGO1 0x10028850
// MxCollection<MxCore *>::Compare
// TEMPLATE: LEGO1 0x1005bbe0 // TEMPLATE: LEGO1 0x1005bbe0
// MxCollection<LegoEventNotificationParam>::~MxCollection<LegoEventNotificationParam> // MxCollection<LegoEventNotificationParam>::~MxCollection<LegoEventNotificationParam>
// TEMPLATE: LEGO1 0x10028860
// MxCollection<MxCore *>::~MxCollection<MxCore *>
// TEMPLATE: LEGO1 0x1005bc30 // TEMPLATE: LEGO1 0x1005bc30
// MxCollection<LegoEventNotificationParam>::Destroy // MxCollection<LegoEventNotificationParam>::Destroy
// TEMPLATE: LEGO1 0x1005bc80 // TEMPLATE: LEGO1 0x1005bc80
// MxList<LegoEventNotificationParam>::~MxList<LegoEventNotificationParam> // MxList<LegoEventNotificationParam>::~MxList<LegoEventNotificationParam>
// TEMPLATE: LEGO1 0x100288c0
// MxList<MxCore *>::~MxList<MxCore *>
// SYNTHETIC: LEGO1 0x1005bd50 // SYNTHETIC: LEGO1 0x1005bd50
// MxCollection<LegoEventNotificationParam>::`scalar deleting destructor' // MxCollection<LegoEventNotificationParam>::`scalar deleting destructor'
@ -128,9 +163,24 @@ private:
// SYNTHETIC: LEGO1 0x1005beb0 // SYNTHETIC: LEGO1 0x1005beb0
// LegoEventQueue::`scalar deleting destructor' // LegoEventQueue::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x10028a10
// MxCollection<MxCore *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x10028a80
// MxList<MxCore *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x10028b30
// MxPtrList<MxCore>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x10028950
// LegoNotifyList::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1005bf20 // TEMPLATE: LEGO1 0x1005bf20
// MxQueue<LegoEventNotificationParam>::~MxQueue<LegoEventNotificationParam> // MxQueue<LegoEventNotificationParam>::~MxQueue<LegoEventNotificationParam>
// TEMPLATE: LEGO1 0x100289c0
// MxPtrList<MxCore>::~MxPtrList<MxCore>
// SYNTHETIC: LEGO1 0x1005bf70 // SYNTHETIC: LEGO1 0x1005bf70
// MxQueue<LegoEventNotificationParam>::`scalar deleting destructor' // MxQueue<LegoEventNotificationParam>::`scalar deleting destructor'

View File

@ -1,5 +1,7 @@
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
DECOMP_SIZE_ASSERT(LegoControlManager, 0x60);
// STUB: LEGO1 0x10028520 // STUB: LEGO1 0x10028520
LegoControlManager::LegoControlManager() LegoControlManager::LegoControlManager()
{ {

View File

@ -4,8 +4,9 @@
#include "legoomni.h" #include "legoomni.h"
#include "mxautolocker.h" #include "mxautolocker.h"
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338); DECOMP_SIZE_ASSERT(LegoInputManager, 0x338)
DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18); DECOMP_SIZE_ASSERT(LegoNotifyList, 0x18)
DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18)
// GLOBAL: LEGO1 0x100f31b0 // GLOBAL: LEGO1 0x100f31b0
MxS32 g_unk0x100f31b0 = -1; MxS32 g_unk0x100f31b0 = -1;
@ -16,7 +17,7 @@ MxS32 g_unk0x100f31b4 = 0;
// FUNCTION: LEGO1 0x1005b790 // FUNCTION: LEGO1 0x1005b790
LegoInputManager::LegoInputManager() LegoInputManager::LegoInputManager()
{ {
m_unk0x5c = NULL; m_keyboardNotifyList = NULL;
m_world = NULL; m_world = NULL;
m_camera = NULL; m_camera = NULL;
m_eventQueue = NULL; m_eventQueue = NULL;
@ -40,7 +41,7 @@ LegoInputManager::LegoInputManager()
m_timeout = 1000; m_timeout = 1000;
} }
// STUB: LEGO1 0x1005b8b0 // FUNCTION: LEGO1 0x1005b8b0
MxResult LegoInputManager::Tickle() MxResult LegoInputManager::Tickle()
{ {
ProcessEvents(); ProcessEvents();
@ -56,10 +57,25 @@ LegoInputManager::~LegoInputManager()
// FUNCTION: LEGO1 0x1005b960 // FUNCTION: LEGO1 0x1005b960
MxResult LegoInputManager::Create(HWND p_hwnd) MxResult LegoInputManager::Create(HWND p_hwnd)
{ {
// TODO MxResult result = SUCCESS;
if (m_eventQueue == NULL)
m_eventQueue = new LegoEventQueue(); m_controlManager = new LegoControlManager;
return SUCCESS;
if (!m_keyboardNotifyList)
m_keyboardNotifyList = new LegoNotifyList;
if (!m_eventQueue)
m_eventQueue = new LegoEventQueue;
CreateAndAcquireKeyboard(p_hwnd);
GetJoystickId();
if (!m_keyboardNotifyList || !m_eventQueue || !m_directInputDevice) {
Destroy();
result = FAILURE;
}
return result;
} }
// FUNCTION: LEGO1 0x1005bfe0 // FUNCTION: LEGO1 0x1005bfe0
@ -67,9 +83,9 @@ void LegoInputManager::Destroy()
{ {
ReleaseDX(); ReleaseDX();
if (m_unk0x5c) if (m_keyboardNotifyList)
delete m_unk0x5c; delete m_keyboardNotifyList;
m_unk0x5c = NULL; m_keyboardNotifyList = NULL;
if (m_eventQueue) if (m_eventQueue)
delete m_eventQueue; delete m_eventQueue;