mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
MxQueue and parts of LegoInputManager
This commit is contained in:
parent
42a82794a8
commit
02e012167a
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(LegoEventNotificationParam, 0x1c);
|
DECOMP_SIZE_ASSERT(LegoEventNotificationParam, 0x20);
|
||||||
|
|||||||
@ -8,15 +8,27 @@
|
|||||||
class LegoEventNotificationParam : public MxNotificationParam {
|
class LegoEventNotificationParam : public MxNotificationParam {
|
||||||
public:
|
public:
|
||||||
inline LegoEventNotificationParam() : MxNotificationParam((MxParamType) 0, NULL) {}
|
inline LegoEventNotificationParam() : MxNotificationParam((MxParamType) 0, NULL) {}
|
||||||
|
inline LegoEventNotificationParam(
|
||||||
|
MxParamType p_type,
|
||||||
|
MxCore* p_sender,
|
||||||
|
MxU8 p_modifier,
|
||||||
|
MxS32 p_x,
|
||||||
|
MxS32 p_y,
|
||||||
|
MxU8 p_key
|
||||||
|
)
|
||||||
|
: MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_unk1c(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~LegoEventNotificationParam() override {} // vtable+0x0 (scalar deleting destructor)
|
virtual ~LegoEventNotificationParam() override {} // vtable+0x0 (scalar deleting destructor)
|
||||||
inline MxU8 GetKey() { return m_key; }
|
inline MxU8 GetKey() const { return m_key; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MxU8 m_modifier; // 0x0c
|
MxU8 m_modifier; // 0x0c
|
||||||
MxS32 m_x; // 0x10
|
MxS32 m_x; // 0x10
|
||||||
MxS32 m_y; // 0x14
|
MxS32 m_y; // 0x14
|
||||||
MxU8 m_key; // 0x18
|
MxU8 m_key; // 0x18
|
||||||
|
MxU32 m_unk1c; // 0x1c
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEGOEVENTNOTIFICATIONPARAM_H
|
#endif // LEGOEVENTNOTIFICATIONPARAM_H
|
||||||
|
|||||||
@ -9,10 +9,10 @@ DECOMP_SIZE_ASSERT(LegoInputManager, 0x338);
|
|||||||
// OFFSET: LEGO1 0x1005b790
|
// OFFSET: LEGO1 0x1005b790
|
||||||
LegoInputManager::LegoInputManager()
|
LegoInputManager::LegoInputManager()
|
||||||
{
|
{
|
||||||
m_eventQueue = NULL;
|
m_unk0x5c = NULL;
|
||||||
m_world = NULL;
|
m_world = NULL;
|
||||||
m_camera = NULL;
|
m_camera = NULL;
|
||||||
m_unk0x68 = NULL;
|
m_eventQueue = NULL;
|
||||||
m_unk0x80 = 0;
|
m_unk0x80 = 0;
|
||||||
m_timer = 0;
|
m_timer = 0;
|
||||||
m_unk0x6c = 0;
|
m_unk0x6c = 0;
|
||||||
@ -36,7 +36,7 @@ LegoInputManager::LegoInputManager()
|
|||||||
// OFFSET: LEGO1 0x1005b8b0 STUB
|
// OFFSET: LEGO1 0x1005b8b0 STUB
|
||||||
MxResult LegoInputManager::Tickle()
|
MxResult LegoInputManager::Tickle()
|
||||||
{
|
{
|
||||||
// TODO
|
ProcessEvents();
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,19 +46,27 @@ LegoInputManager::~LegoInputManager()
|
|||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005b960
|
||||||
|
void LegoInputManager::Create()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
if (m_eventQueue == NULL)
|
||||||
|
m_eventQueue = new LegoEventQueue();
|
||||||
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1005bfe0
|
// OFFSET: LEGO1 0x1005bfe0
|
||||||
void LegoInputManager::Destroy()
|
void LegoInputManager::Destroy()
|
||||||
{
|
{
|
||||||
ReleaseDX();
|
ReleaseDX();
|
||||||
|
|
||||||
|
if (m_unk0x5c)
|
||||||
|
delete m_unk0x5c;
|
||||||
|
m_unk0x5c = NULL;
|
||||||
|
|
||||||
if (m_eventQueue)
|
if (m_eventQueue)
|
||||||
delete m_eventQueue;
|
delete m_eventQueue;
|
||||||
m_eventQueue = NULL;
|
m_eventQueue = NULL;
|
||||||
|
|
||||||
if (m_unk0x68)
|
|
||||||
delete m_unk0x68;
|
|
||||||
m_unk0x68 = NULL;
|
|
||||||
|
|
||||||
if (m_controlManager)
|
if (m_controlManager)
|
||||||
delete m_controlManager;
|
delete m_controlManager;
|
||||||
}
|
}
|
||||||
@ -215,10 +223,35 @@ void LegoInputManager::ClearWorld()
|
|||||||
m_world = NULL;
|
m_world = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1005c740 STUB
|
// OFFSET: LEGO1 0x1005c740
|
||||||
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
|
void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key)
|
||||||
|
{
|
||||||
|
// TODO: param type wrong?
|
||||||
|
LegoEventNotificationParam param =
|
||||||
|
LegoEventNotificationParam((MxParamType) p_id, NULL, p_modifier, p_x, p_y, p_key);
|
||||||
|
|
||||||
|
if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == MOUSEDOWN)))) || ((m_unk0x336 && (p_key == ' ')))) {
|
||||||
|
ProcessOneEvent(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005c820
|
||||||
|
void LegoInputManager::ProcessEvents()
|
||||||
|
{
|
||||||
|
MxAutoLocker lock(&m_criticalSection);
|
||||||
|
|
||||||
|
LegoEventNotificationParam event;
|
||||||
|
while (m_eventQueue->Dequeue(event)) {
|
||||||
|
if (ProcessOneEvent(event))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005c9c0 STUB
|
||||||
|
MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1005cfb0
|
// OFFSET: LEGO1 0x1005cfb0
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include "legoworld.h"
|
#include "legoworld.h"
|
||||||
#include "mxlist.h"
|
#include "mxlist.h"
|
||||||
#include "mxpresenter.h"
|
#include "mxpresenter.h"
|
||||||
|
#include "mxqueue.h"
|
||||||
|
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
|
|
||||||
@ -19,8 +20,9 @@ enum NotificationId {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class LegoControlManager;
|
class LegoControlManager;
|
||||||
// TODO Really a MxQueue, but we don't have one of those
|
|
||||||
class LegoEventQueue : public MxList<LegoEventNotificationParam> {};
|
// VTABLE 0x100d8800
|
||||||
|
class LegoEventQueue : public MxQueue<LegoEventNotificationParam> {};
|
||||||
|
|
||||||
// VTABLE 0x100d8760
|
// VTABLE 0x100d8760
|
||||||
// SIZE 0x338
|
// SIZE 0x338
|
||||||
@ -29,12 +31,13 @@ class LegoInputManager : public MxPresenter {
|
|||||||
LegoInputManager();
|
LegoInputManager();
|
||||||
virtual ~LegoInputManager() override;
|
virtual ~LegoInputManager() override;
|
||||||
|
|
||||||
__declspec(dllexport) void QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5);
|
__declspec(dllexport) void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key);
|
||||||
__declspec(dllexport) void Register(MxCore*);
|
__declspec(dllexport) void Register(MxCore*);
|
||||||
__declspec(dllexport) void UnRegister(MxCore*);
|
__declspec(dllexport) void UnRegister(MxCore*);
|
||||||
|
|
||||||
virtual MxResult Tickle() override; // vtable+0x8
|
virtual MxResult Tickle() override; // vtable+0x8
|
||||||
|
|
||||||
|
void Create();
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void CreateAndAcquireKeyboard(HWND hwnd);
|
void CreateAndAcquireKeyboard(HWND hwnd);
|
||||||
void ReleaseDX();
|
void ReleaseDX();
|
||||||
@ -53,12 +56,15 @@ class LegoInputManager : public MxPresenter {
|
|||||||
inline LegoControlManager* GetControlManager() { return m_controlManager; }
|
inline LegoControlManager* GetControlManager() { return m_controlManager; }
|
||||||
inline LegoWorld* GetWorld() { return m_world; }
|
inline LegoWorld* GetWorld() { return m_world; }
|
||||||
|
|
||||||
|
void ProcessEvents();
|
||||||
|
MxBool ProcessOneEvent(LegoEventNotificationParam& p_param);
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
MxCriticalSection m_criticalSection;
|
MxCriticalSection m_criticalSection;
|
||||||
LegoEventQueue* m_eventQueue; // list or hash table
|
MxList<undefined4>* m_unk0x5c; // list or hash table
|
||||||
LegoCameraController* m_camera;
|
LegoCameraController* m_camera;
|
||||||
LegoWorld* m_world;
|
LegoWorld* m_world;
|
||||||
MxList<undefined4>* m_unk0x68; // list or hash table
|
LegoEventQueue* m_eventQueue; // +0x68
|
||||||
undefined4 m_unk0x6c;
|
undefined4 m_unk0x6c;
|
||||||
undefined4 m_unk0x70;
|
undefined4 m_unk0x70;
|
||||||
undefined4 m_unk0x74;
|
undefined4 m_unk0x74;
|
||||||
@ -83,4 +89,37 @@ class LegoInputManager : public MxPresenter {
|
|||||||
MxBool m_unk0x336;
|
MxBool m_unk0x336;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005bb80 TEMPLATE
|
||||||
|
// MxListParent<LegoEventNotificationParam>::Compare
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005bc30 TEMPLATE
|
||||||
|
// MxListParent<LegoEventNotificationParam>::Destroy
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005bc80 TEMPLATE
|
||||||
|
// MxList<LegoEventNotificationParam>::~MxList<LegoEventNotificationParam>
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005bd50 TEMPLATE
|
||||||
|
// MxListParent<LegoEventNotificationParam>::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005bdc0 TEMPLATE
|
||||||
|
// MxList<LegoEventNotificationParam>::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005beb0 TEMPLATE
|
||||||
|
// LegoEventQueue::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005bf70 TEMPLATE
|
||||||
|
// MxQueue<LegoEventNotificationParam>::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x1005d010 TEMPLATE
|
||||||
|
// MxListEntry<LegoEventNotificationParam>::GetValue
|
||||||
|
|
||||||
|
// VTABLE 0x100d87e8
|
||||||
|
// class MxQueue<LegoEventNotificationParam>
|
||||||
|
|
||||||
|
// VTABLE 0x100d87d0
|
||||||
|
// class MxList<LegoEventNotificationParam>
|
||||||
|
|
||||||
|
// VTABLE 0x100d87b8
|
||||||
|
// class MxListParent<LegoEventNotificationParam>
|
||||||
|
|
||||||
#endif // LEGOINPUTMANAGER_H
|
#endif // LEGOINPUTMANAGER_H
|
||||||
|
|||||||
@ -27,6 +27,10 @@ class MxListEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
T GetValue() { return this->m_obj; }
|
T GetValue() { return this->m_obj; }
|
||||||
|
inline MxListEntry* GetPrev() const { return m_prev; };
|
||||||
|
inline MxListEntry* GetNext() const { return m_next; };
|
||||||
|
inline void SetPrev(MxListEntry* p_node) { m_prev = p_node; };
|
||||||
|
inline void SetNext(MxListEntry* p_node) { m_next = p_node; };
|
||||||
|
|
||||||
friend class MxList<T>;
|
friend class MxList<T>;
|
||||||
friend class MxListCursor<T>;
|
friend class MxListCursor<T>;
|
||||||
@ -81,7 +85,6 @@ class MxList : protected MxListParent<T> {
|
|||||||
MxListEntry<T>* m_first; // +0x10
|
MxListEntry<T>* m_first; // +0x10
|
||||||
MxListEntry<T>* m_last; // +0x14
|
MxListEntry<T>* m_last; // +0x14
|
||||||
|
|
||||||
private:
|
|
||||||
void _DeleteEntry(MxListEntry<T>* match);
|
void _DeleteEntry(MxListEntry<T>* match);
|
||||||
MxListEntry<T>* _InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
|
MxListEntry<T>* _InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class MxNotificationParam : public MxParam {
|
|||||||
|
|
||||||
inline MxParamType GetNotification() const { return m_type; }
|
inline MxParamType GetNotification() const { return m_type; }
|
||||||
inline MxCore* GetSender() const { return m_sender; }
|
inline MxCore* GetSender() const { return m_sender; }
|
||||||
|
inline MxParamType GetType() const { return m_type; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MxParamType m_type; // 0x4
|
MxParamType m_type; // 0x4
|
||||||
|
|||||||
27
LEGO1/mxqueue.h
Normal file
27
LEGO1/mxqueue.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef MXQUEUE_H
|
||||||
|
#define MXQUEUE_H
|
||||||
|
|
||||||
|
#include "mxlist.h"
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class MxQueue : public MxList<T> {
|
||||||
|
public:
|
||||||
|
void Enqueue(T& p_obj)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
MxBool Dequeue(T& p_obj)
|
||||||
|
{
|
||||||
|
MxBool has_next = (m_first != NULL);
|
||||||
|
if (m_first) {
|
||||||
|
p_obj = m_first->GetValue();
|
||||||
|
_DeleteEntry(m_first);
|
||||||
|
}
|
||||||
|
|
||||||
|
return has_next;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MXQUEUE_H
|
||||||
Loading…
Reference in New Issue
Block a user