Implement/match LegoPathController::FUN_10047b30 (#906)

* Implement/match LegoPathController::FUN_10047b30

* Fix delete
This commit is contained in:
Christian Semmler 2024-05-11 12:57:07 -04:00 committed by GitHub
parent b3d6319656
commit 09394c3512
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 7 deletions

View file

@ -5,22 +5,26 @@
#include "mxatom.h"
#include "mxtypes.h"
class LegoPathController;
// VTABLE: LEGO1 0x100d7d9c
// SIZE 0x0c
class LegoPathStructBase {
public:
LegoPathStructBase() : m_unk0x04(NULL), m_unk0x08(0) {}
LegoPathStructBase() : m_name(NULL), m_unk0x08(0) {}
// FUNCTION: LEGO1 0x10047420
virtual ~LegoPathStructBase()
{
if (m_unk0x04 != NULL) {
delete m_unk0x04;
if (m_name != NULL) {
delete[] m_name;
}
}
friend class LegoPathController;
private:
undefined* m_unk0x04; // 0x04
char* m_name; // 0x04
undefined4 m_unk0x08; // 0x08
};

View file

@ -181,16 +181,37 @@ MxResult LegoPathController::Read(LegoStorage* p_storage)
return SUCCESS;
}
// STUB: LEGO1 0x10047b30
// FUNCTION: LEGO1 0x10047b30
// FUNCTION: BETA10 0x100b7cd6
MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage)
{
// TODO
for (MxS32 i = 0; i < m_numT; i++) {
MxU8 length = 0;
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
return FAILURE;
}
if (length > 0) {
m_unk0x14[i].m_name = new char[length + 1];
if (p_storage->Read(m_unk0x14[i].m_name, length) != SUCCESS) {
return FAILURE;
}
m_unk0x14[i].m_name[length] = '\0';
}
if (p_storage->Read(&m_unk0x14[i].m_unk0x08, sizeof(m_unk0x14[i].m_unk0x08)) != SUCCESS) {
return FAILURE;
}
}
return SUCCESS;
}
// STUB: LEGO1 0x10047c10
// FUNCTION: BETA10 0x1100b7df3
// FUNCTION: BETA10 0x100b7df3
MxResult LegoPathController::FUN_10047c10(LegoStorage* p_storage)
{
// TODO