fix LegoState::VTable0x1C fake-match & implement LegoFileStream::FUN_10006030 (#217)

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

* Match and relocate FUN_10006030

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Ramen2X 2023-10-17 18:05:31 -04:00 committed by GitHub
parent 476af22b36
commit 7c26a4d2dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 10 deletions

View file

@ -18,16 +18,23 @@ 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 // OFFSET: LEGO1 0x10006030
void LegoState::FUN_10006030(MxString p_str) LegoFileStream *LegoFileStream::FUN_10006030(MxString p_str)
{ {
// TODO const char *data = p_str.GetData();
MxU32 fullLength = strlen(data);
MxU16 limitedLength = fullLength;
Write(&limitedLength, sizeof(limitedLength));
Write(data, (MxS16) fullLength);
return this;
} }

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

@ -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;
}; };