fix LegoState::VTable0x1C fake-match, implement LegoFileStream::FUN_10006030

This commit is contained in:
Ramen2X 2023-10-17 16:04:26 -04:00
parent 476af22b36
commit 056c48eb41
4 changed files with 20 additions and 12 deletions

View File

@ -18,16 +18,10 @@ MxBool LegoState::VTable0x18() {
} }
// OFFSET: LEGO1 0x10005fb0 // OFFSET: LEGO1 0x10005fb0
MxResult LegoState::VTable0x1C(LegoState *p_legoState) MxResult LegoState::VTable0x1C(LegoFileStream *p_legoFileStream)
{ {
if (p_legoState->VTable0x14()) { if (p_legoFileStream->IsWriteMode()) {
p_legoState->FUN_10006030(this->ClassName()); p_legoFileStream->FUN_10006030(this->ClassName());
} }
return SUCCESS; return SUCCESS;
} }
// OFFSET: LEGO1 0x10006030 STUB
void LegoState::FUN_10006030(MxString p_str)
{
// TODO
}

View File

@ -5,6 +5,7 @@
#include "mxcore.h" #include "mxcore.h"
#include "mxstring.h" #include "mxstring.h"
#include "legostream.h"
// VTABLE 0x100d46c0 // VTABLE 0x100d46c0
class LegoState : public MxCore class LegoState : public MxCore
@ -27,9 +28,7 @@ class LegoState : public MxCore
virtual MxBool VTable0x14(); // vtable+0x14 virtual MxBool VTable0x14(); // vtable+0x14
virtual MxBool VTable0x18(); // vtable+0x18 virtual MxBool VTable0x18(); // vtable+0x18
virtual MxResult VTable0x1C(LegoState *p_legoState); // vtable+0x1C virtual MxResult VTable0x1C(LegoFileStream *p_legoFileStream); // vtable+0x1C
void FUN_10006030(MxString p_str);
}; };
#endif // LEGOSTATE_H #endif // LEGOSTATE_H

View File

@ -116,6 +116,18 @@ MxResult LegoFileStream::Open(const char* p_filename, OpenFlags p_mode)
return (m_hFile = fopen(p_filename, modeString)) ? SUCCESS : FAILURE; return (m_hFile = fopen(p_filename, modeString)) ? SUCCESS : FAILURE;
} }
// OFFSET: LEGO1 0x10006030
LegoFileStream *LegoFileStream::FUN_10006030(MxString p_str)
{
MxS16 strLength = strlen(p_str.GetData());
const char *strData = p_str.GetData();
Write(&strLength, sizeof(strLength));
Write(strData, strLength);
return this;
}
// OFFSET: LEGO1 0x10099080 // OFFSET: LEGO1 0x10099080
LegoMemoryStream::LegoMemoryStream(char* p_buffer) LegoMemoryStream::LegoMemoryStream(char* p_buffer)
: LegoStream() : LegoStream()

View File

@ -4,6 +4,7 @@
#include "compat.h" #include "compat.h"
#include "decomp.h" #include "decomp.h"
#include "mxtypes.h" #include "mxtypes.h"
#include "mxstring.h"
#include <iosfwd> #include <iosfwd>
@ -55,6 +56,8 @@ class LegoFileStream : public LegoStream
MxResult Open(const char* p_filename, OpenFlags p_mode); MxResult Open(const char* p_filename, OpenFlags p_mode);
LegoFileStream *FUN_10006030(MxString p_str);
private: private:
FILE *m_hFile; FILE *m_hFile;
}; };