implement LegoInputManager::Create ()

* 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
// LegoControlManager::`scalar deleting destructor'
private:
undefined m_padding0x08[0x58]; // 0x08
};
#endif // LEGOCONTROLMANAGER_H

View file

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

View file

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

View file

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