Merge branch 'master' into mxdsselectaction

This commit is contained in:
Christian Semmler 2023-09-30 10:14:38 -04:00
commit 0505390be4
14 changed files with 148 additions and 16 deletions

View File

@ -65,6 +65,7 @@ add_library(lego1 SHARED
LEGO1/legoentity.cpp LEGO1/legoentity.cpp
LEGO1/legoentitypresenter.cpp LEGO1/legoentitypresenter.cpp
LEGO1/legoflctexturepresenter.cpp LEGO1/legoflctexturepresenter.cpp
LEGO1/legofullscreenmovie.cpp
LEGO1/legogamestate.cpp LEGO1/legogamestate.cpp
LEGO1/legohideanimpresenter.cpp LEGO1/legohideanimpresenter.cpp
LEGO1/legoinputmanager.cpp LEGO1/legoinputmanager.cpp

View File

@ -3,6 +3,9 @@
#include "legoomni.h" #include "legoomni.h"
#include "legoutil.h" #include "legoutil.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoBackgroundColor, 0x30)
const char *g_delimiter = "\t"; const char *g_delimiter = "\t";
const char *g_set = "set"; const char *g_set = "set";

View File

@ -3,11 +3,13 @@
#include "mxvariable.h" #include "mxvariable.h"
// VTABLE 0x100d74a8
// SIZE 0x30
class LegoBackgroundColor : public MxVariable class LegoBackgroundColor : public MxVariable
{ {
public: public:
__declspec(dllexport) LegoBackgroundColor(const char *p_key, const char *p_value); __declspec(dllexport) LegoBackgroundColor(const char *p_key, const char *p_value);
void SetValue(const char *p_colorString); virtual void SetValue(const char *p_colorString) override;
private: private:
float h; float h;

View File

@ -0,0 +1,41 @@
#include "legofullscreenmovie.h"
#include "mxtypes.h"
#include "legoomni.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24)
// 0x100f3be8
const char *g_str_enable = "enable";
// 0x100f3bf4
const char *g_str_disable = "disable";
// OFFSET: LEGO1 0x1003c500
LegoFullScreenMovie::LegoFullScreenMovie(const char *p_key, const char *p_value)
{
m_key = p_key;
m_key.ToUpperCase();
SetValue(p_value);
}
// OFFSET: LEGO1 0x1003c5c0
void LegoFullScreenMovie::SetValue(const char *p_option)
{
m_value = p_option;
m_value.ToLowerCase();
LegoVideoManager *videomanager = VideoManager();
if (videomanager) {
if (!strcmp(m_value.GetData(), g_str_enable)) {
videomanager->EnableFullScreenMovie(TRUE);
return;
}
if (!strcmp(m_value.GetData(), g_str_disable)) {
videomanager->EnableFullScreenMovie(FALSE);
return;
}
}
}

View File

@ -0,0 +1,15 @@
#ifndef LEGOFULLSCREENMOVIE_H
#define LEGOFULLSCREENMOVIE_H
#include "mxvariable.h"
// VTABLE 0x100d74b8
// SIZE 0x24
class LegoFullScreenMovie : public MxVariable
{
public:
LegoFullScreenMovie(const char *p_key, const char *p_value);
virtual void SetValue(const char *p_option) override;
};
#endif // LEGOFULLSCREENMOVIE_H

View File

@ -1,10 +1,26 @@
#include "legogamestate.h" #include "legogamestate.h"
#include "legoomni.h" #include "legoomni.h"
#include "decomp.h"
// Based on the highest dword offset (0x42c) referenced in the constructor.
// There may be other members that come after.
DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
// OFFSET: LEGO1 0x10039550 // OFFSET: LEGO1 0x10039550
LegoGameState::LegoGameState() LegoGameState::LegoGameState()
{ {
// TODO // TODO
m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68");
VariableTable()->SetVariable(m_backgroundColor);
m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundcolor", "set 56 54 68");
VariableTable()->SetVariable(m_tempBackgroundColor);
m_fullScreenMovie = new LegoFullScreenMovie("fsmovie", "disable");
VariableTable()->SetVariable(m_fullScreenMovie);
VariableTable()->SetVariable("lightposition", "2");
SerializeScoreHistory(1);
} }
// OFFSET: LEGO1 0x10039720 // OFFSET: LEGO1 0x10039720

View File

@ -1,8 +1,12 @@
#ifndef LEGOGAMESTATE_H #ifndef LEGOGAMESTATE_H
#define LEGOGAMESTATE_H #define LEGOGAMESTATE_H
#include "decomp.h"
#include "mxtypes.h" #include "mxtypes.h"
#include "legobackgroundcolor.h"
#include "legofullscreenmovie.h"
// SIZE 0x430 (at least)
class LegoGameState class LegoGameState
{ {
public: public:
@ -15,7 +19,12 @@ class LegoGameState
__declspec(dllexport) void SetSavePath(char *p); __declspec(dllexport) void SetSavePath(char *p);
private: private:
char *m_savePath; char *m_savePath; // 0x0
undefined m_unk04[20];
LegoBackgroundColor *m_backgroundColor; // 0x18
LegoBackgroundColor *m_tempBackgroundColor; // 0x1c
LegoFullScreenMovie *m_fullScreenMovie; // 0x20
undefined m_unk24[1036];
}; };
#endif // LEGOGAMESTATE_H #endif // LEGOGAMESTATE_H

View File

@ -27,8 +27,14 @@ int LegoVideoManager::DisableRMDevice()
return 0; return 0;
} }
// OFFSET: LEGO1 0x1007c300
void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable)
{
EnableFullScreenMovie(p_enable, TRUE);
}
// OFFSET: LEGO1 0x1007c310 STUB // OFFSET: LEGO1 0x1007c310 STUB
void LegoVideoManager::EnableFullScreenMovie(unsigned char a, unsigned char b) void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale)
{ {
// TODO // TODO
} }

View File

@ -16,7 +16,8 @@ class LegoVideoManager : public MxVideoManager
__declspec(dllexport) int EnableRMDevice(); __declspec(dllexport) int EnableRMDevice();
__declspec(dllexport) int DisableRMDevice(); __declspec(dllexport) int DisableRMDevice();
__declspec(dllexport) void EnableFullScreenMovie(unsigned char a, unsigned char b); void EnableFullScreenMovie(MxBool p_enable);
__declspec(dllexport) void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale);
__declspec(dllexport) void MoveCursor(int x, int y); __declspec(dllexport) void MoveCursor(int x, int y);
inline Lego3DManager *Get3DManager() { return this->m_3dManager; } inline Lego3DManager *Get3DManager() { return this->m_3dManager; }

View File

@ -2,6 +2,8 @@
#include "mxthread.h" #include "mxthread.h"
DECOMP_SIZE_ASSERT(MxDiskStreamProvider, 0x60);
// OFFSET: LEGO1 0x100d0f30 // OFFSET: LEGO1 0x100d0f30
MxResult MxDiskStreamProviderThread::Run() MxResult MxDiskStreamProviderThread::Run()
{ {
@ -15,7 +17,9 @@ MxResult MxDiskStreamProviderThread::Run()
// OFFSET: LEGO1 0x100d0f70 // OFFSET: LEGO1 0x100d0f70
MxDiskStreamProvider::MxDiskStreamProvider() MxDiskStreamProvider::MxDiskStreamProvider()
{ {
// TODO this->m_pFile = NULL;
this->m_remainingWork = 0;
this->m_unk35 = 0;
} }
// OFFSET: LEGO1 0x100d1240 // OFFSET: LEGO1 0x100d1240
@ -31,7 +35,7 @@ MxResult MxDiskStreamProvider::WaitForWorkToComplete()
while (m_remainingWork != 0) while (m_remainingWork != 0)
{ {
m_busySemaphore.Wait(INFINITE); m_busySemaphore.Wait(INFINITE);
if (m_unk1 != 0) if (m_unk35 != 0)
PerformWork(); PerformWork();
} }
return SUCCESS; return SUCCESS;

View File

@ -1,6 +1,7 @@
#ifndef MXDISKSTREAMPROVIDER_H #ifndef MXDISKSTREAMPROVIDER_H
#define MXDISKSTREAMPROVIDER_H #define MXDISKSTREAMPROVIDER_H
#include "decomp.h"
#include "mxstreamprovider.h" #include "mxstreamprovider.h"
#include "mxthread.h" #include "mxthread.h"
#include "mxcriticalsection.h" #include "mxcriticalsection.h"
@ -22,6 +23,32 @@ class MxDiskStreamProviderThread : public MxThread
MxDiskStreamProvider *m_target; MxDiskStreamProvider *m_target;
}; };
// TODO
struct MxDiskStreamListNode {
MxDiskStreamListNode *m_unk00;
MxDiskStreamListNode *m_unk04;
undefined4 m_unk08;
};
// TODO
struct MxDiskStreamList {
inline MxDiskStreamList() {
undefined unk;
this->m_unk00 = unk;
MxDiskStreamListNode *node = new MxDiskStreamListNode();
node->m_unk00 = node;
node->m_unk04 = node;
this->m_head = node;
this->m_count = 0;
}
undefined m_unk00;
MxDiskStreamListNode *m_head;
MxU32 m_count;
};
// VTABLE 0x100dd138 // VTABLE 0x100dd138
class MxDiskStreamProvider : public MxStreamProvider class MxDiskStreamProvider : public MxStreamProvider
{ {
@ -48,14 +75,12 @@ class MxDiskStreamProvider : public MxStreamProvider
void PerformWork(); void PerformWork();
private: private:
MxDiskStreamProviderThread m_thread; MxDiskStreamProviderThread m_thread; // 0x10
MxSemaphore m_busySemaphore; MxSemaphore m_busySemaphore; // 0x2c
byte m_remainingWork; undefined m_remainingWork; // 0x34
byte m_unk1; undefined m_unk35; // 0x35
MxCriticalSection m_criticalSection; MxCriticalSection m_criticalSection; // 0x38
byte unk2[4]; MxDiskStreamList m_list;
void* unk3;
void *unk4;
}; };
#endif // MXDISKSTREAMPROVIDER_H #endif // MXDISKSTREAMPROVIDER_H

View File

@ -8,6 +8,11 @@
class MxStreamProvider : public MxCore class MxStreamProvider : public MxCore
{ {
public: public:
inline MxStreamProvider() {
this->m_pLookup = NULL;
this->m_pFile = NULL;
}
// OFFSET: LEGO1 0x100d07e0 // OFFSET: LEGO1 0x100d07e0
inline virtual const char *ClassName() const override // vtable+0x0c inline virtual const char *ClassName() const override // vtable+0x0c
{ {
@ -20,7 +25,7 @@ class MxStreamProvider : public MxCore
return !strcmp(name, MxStreamProvider::ClassName()) || MxCore::IsA(name); return !strcmp(name, MxStreamProvider::ClassName()) || MxCore::IsA(name);
} }
private: protected:
void *m_pLookup; void *m_pLookup;
MxDSFile* m_pFile; MxDSFile* m_pFile;
}; };

View File

@ -1,5 +1,8 @@
#include "mxvariable.h" #include "mxvariable.h"
#include "mxstring.h" #include "mxstring.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxVariable, 0x24)
// OFFSET: LEGO1 0x1003bea0 // OFFSET: LEGO1 0x1003bea0
MxString *MxVariable::GetValue() MxString *MxVariable::GetValue()

View File

@ -4,7 +4,8 @@
#include "mxstring.h" #include "mxstring.h"
#include "mxcore.h" #include "mxcore.h"
//VTABLE: 0x100d74a8 // VTABLE 0x100d7498
// SIZE 0x24
class MxVariable class MxVariable
{ {
public: public: