Fix LegoOmni vtable (#140)

This commit is contained in:
MattKC 2023-09-25 13:28:25 -07:00 committed by GitHub
parent e1e2abc510
commit 3f6e3af8ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 53 deletions

View file

@ -91,9 +91,9 @@ void IsleApp::Close()
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL); VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL);
Lego()->RemoveWorld(ds.GetAtomId(), ds.GetObjectId()); Lego()->RemoveWorld(ds.GetAtomId(), ds.GetObjectId());
Lego()->vtable24(ds); Lego()->DeleteObject(ds);
TransitionManager()->SetWaitIndicator(NULL); TransitionManager()->SetWaitIndicator(NULL);
Lego()->vtable3c(); Lego()->vtable0x3c();
MxLong lVar8; MxLong lVar8;
do { do {
@ -101,7 +101,7 @@ void IsleApp::Close()
} while (lVar8 == 0); } while (lVar8 == 0);
while (Lego()) { while (Lego()) {
if (Lego()->vtable28(ds) != FALSE) { if (Lego()->DoesEntityExist(ds)) {
break; break;
} }
@ -232,7 +232,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
g_reqEnableRMDevice = 0; g_reqEnableRMDevice = 0;
VideoManager()->EnableRMDevice(); VideoManager()->EnableRMDevice();
g_rmDisabled = 0; g_rmDisabled = 0;
Lego()->vtable3c(); Lego()->vtable0x3c();
} }
if (g_closed) { if (g_closed) {
@ -379,7 +379,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
else if (!valid) { else if (!valid) {
g_rmDisabled = 1; g_rmDisabled = 1;
Lego()->vtable38(); Lego()->StartTimer();
VideoManager()->DisableRMDevice(); VideoManager()->DisableRMDevice();
} }
} }

View file

@ -253,48 +253,49 @@ void LegoOmni::Destroy()
// FIXME: Stub // FIXME: Stub
} }
void LegoOmni::vtable20() void LegoOmni::vtable0x20()
{ {
// FIXME: Stub // FIXME: Stub
} }
void LegoOmni::vtable24(MxDSAction &ds) void LegoOmni::DeleteObject(MxDSAction &ds)
{ {
// FIXME: Stub // FIXME: Stub
} }
MxBool LegoOmni::vtable28(MxDSAction &ds) MxBool LegoOmni::DoesEntityExist(MxDSAction &ds)
{ {
// FIXME: Stub // FIXME: Stub
return TRUE; return TRUE;
} }
void LegoOmni::vtable2c() void LegoOmni::vtable0x2c()
{ {
// FIXME: Stub // FIXME: Stub
} }
void LegoOmni::vtable30() int LegoOmni::vtable0x30(char*, int, MxCore*)
{ {
// FIXME: Stub // FIXME: Stub
} return 0;
}
void LegoOmni::vtable34()
{ void LegoOmni::NotifyCurrentEntity()
// FIXME: Stub {
} // FIXME: Stub
}
void LegoOmni::vtable38()
{ void LegoOmni::StartTimer()
// FIXME: Stub {
} // FIXME: Stub
}
void LegoOmni::vtable3c()
{ void LegoOmni::vtable0x3c()
// FIXME: Stub {
} // FIXME: Stub
}
unsigned char LegoOmni::vtable40()
MxBool LegoOmni::vtable40()
{ {
// FIXME: Stub // FIXME: Stub
return 0; return 0;

View file

@ -36,33 +36,33 @@ class LegoOmni : public MxOmni
LegoOmni(); LegoOmni();
virtual ~LegoOmni(); // vtable+00 virtual ~LegoOmni(); // vtable+00
virtual MxLong Notify(MxParam &p); // vtable+04 virtual MxLong Notify(MxParam &p) override; // vtable+04
// OFFSET: LEGO1 0x10058aa0 // OFFSET: LEGO1 0x10058aa0
inline virtual const char *ClassName() const // vtable+0c inline virtual const char *ClassName() const override // vtable+0c
{ {
// 0x100f671c // 0x100f671c
return "LegoOmni"; return "LegoOmni";
} }
// OFFSET: LEGO1 0x10058ab0 // OFFSET: LEGO1 0x10058ab0
inline virtual MxBool IsA(const char *name) const // vtable+10 inline virtual MxBool IsA(const char *name) const override // vtable+10
{ {
return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name); return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name);
} }
virtual void Init(); // vtable+14 virtual void Init() override; // vtable+14
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p); // vtable+18 virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p) override; // vtable+18
virtual void Destroy(); // vtable+1c virtual void Destroy() override; // vtable+1c
virtual void vtable20(); virtual void vtable0x20() override;
virtual void vtable24(MxDSAction &ds); virtual void DeleteObject(MxDSAction &ds) override;
virtual MxBool vtable28(MxDSAction &ds); virtual MxBool DoesEntityExist(MxDSAction &ds) override;
virtual void vtable2c(); virtual void vtable0x2c() override;
virtual void vtable30(); virtual int vtable0x30(char*, int, MxCore*) override;
virtual void vtable34(); virtual void NotifyCurrentEntity() override;
virtual void vtable38(); virtual void StartTimer() override;
virtual void vtable3c(); virtual void vtable0x3c() override;
virtual unsigned char vtable40(); virtual MxBool vtable40();
LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; } LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; }
LegoSoundManager *GetSoundManager() { return (LegoSoundManager *)m_soundManager;} LegoSoundManager *GetSoundManager() { return (LegoSoundManager *)m_soundManager;}

View file

@ -1,5 +1,7 @@
#include "mxbackgroundaudiomanager.h" #include "mxbackgroundaudiomanager.h"
#include "mxomni.h"
DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150) DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150)
// OFFSET: LEGO1 0x1007ea90 // OFFSET: LEGO1 0x1007ea90

View file

@ -3,6 +3,8 @@
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include "mxomni.h"
DECOMP_SIZE_ASSERT(MxDSAction, 0x94) DECOMP_SIZE_ASSERT(MxDSAction, 0x94)
// GLOBAL OFFSET: LEGO1 0x10101410 // GLOBAL OFFSET: LEGO1 0x10101410
@ -215,6 +217,9 @@ MxLong MxDSAction::GetSomeTimingField()
return this->m_someTimingField; return this->m_someTimingField;
} }
// Win32 defines GetCurrentTime to GetTickCount
#undef GetCurrentTime
// OFFSET: LEGO1 0x100adcd0 // OFFSET: LEGO1 0x100adcd0
MxLong MxDSAction::GetCurrentTime() MxLong MxDSAction::GetCurrentTime()
{ {

View file

@ -2,8 +2,10 @@
#define MXDSACTION_H #define MXDSACTION_H
#include "mxdsobject.h" #include "mxdsobject.h"
#include "mxtypes.h"
#include "mxvector.h" #include "mxvector.h"
#include "mxomni.h"
class MxOmni;
// VTABLE 0x100dc098 // VTABLE 0x100dc098
// SIZE 0x94 // SIZE 0x94
@ -40,7 +42,7 @@ class MxDSAction : public MxDSObject
virtual MxU32 GetSizeOnDisk(); // vtable+18; virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c; virtual void Deserialize(char **p_source, MxS16 p_unk24); // vtable+1c;
virtual MxLong GetDuration(); // vtable+24; virtual MxLong GetDuration(); // vtable+24;
virtual void SetDuration(LONG p_duration); // vtable+28; virtual void SetDuration(MxLong p_duration); // vtable+28;
virtual MxDSAction *Clone(); // vtable+2c; virtual MxDSAction *Clone(); // vtable+2c;
virtual void MergeFrom(MxDSAction &p_dsAction); // vtable+30; virtual void MergeFrom(MxDSAction &p_dsAction); // vtable+30;
virtual MxBool HasId(MxU32 p_objectId); // vtable+34; virtual MxBool HasId(MxU32 p_objectId); // vtable+34;

View file

@ -49,15 +49,16 @@ void MxOmni::vtable0x20()
} }
// OFFSET: LEGO1 0x100b00c0 STUB // OFFSET: LEGO1 0x100b00c0 STUB
void MxOmni::DeleteObject() void MxOmni::DeleteObject(MxDSAction &ds)
{ {
// TODO // TODO
} }
// OFFSET: LEGO1 0x100b09a0 STUB // OFFSET: LEGO1 0x100b09a0 STUB
void MxOmni::DoesEntityExist() MxBool MxOmni::DoesEntityExist(MxDSAction &ds)
{ {
// TODO // TODO
return FALSE;
} }
// OFFSET: LEGO1 0x100b00e0 STUB // OFFSET: LEGO1 0x100b00e0 STUB

View file

@ -2,6 +2,7 @@
#define MXOMNI_H #define MXOMNI_H
#include "mxcriticalsection.h" #include "mxcriticalsection.h"
#include "mxdsaction.h"
#include "mxeventmanager.h" #include "mxeventmanager.h"
#include "mxmusicmanager.h" #include "mxmusicmanager.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
@ -33,13 +34,13 @@ class MxOmni : public MxCore
MxOmni(); MxOmni();
virtual ~MxOmni() override; virtual ~MxOmni() override;
virtual MxLong Notify(MxParam &p); // vtable+04 virtual MxLong Notify(MxParam &p) override; // vtable+04
virtual void Init(); // vtable+14 virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam &p); // vtable+18 virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p); // vtable+18
virtual void Destroy(); // vtable+1c virtual void Destroy(); // vtable+1c
virtual void vtable0x20(); // vtable+20 virtual void vtable0x20(); // vtable+20
virtual void DeleteObject(); // vtable+24 virtual void DeleteObject(MxDSAction &ds); // vtable+24
virtual void DoesEntityExist(); // vtable+28 virtual MxBool DoesEntityExist(MxDSAction &ds); // vtable+28
virtual void vtable0x2c(); // vtable+2c virtual void vtable0x2c(); // vtable+2c
virtual int vtable0x30(char*, int, MxCore*); // vtable+30 virtual int vtable0x30(char*, int, MxCore*); // vtable+30
virtual void NotifyCurrentEntity(); // vtable+34 virtual void NotifyCurrentEntity(); // vtable+34