implement MxControlPresenter::ParseExtra (#477)

* MxControlPresenter::ParseExtra

* Update mxcontrolpresenter.h

* fix loop

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-21 12:45:40 -05:00 committed by GitHub
parent 7b0d4dd502
commit 05bc94f030
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 64 additions and 8 deletions

View file

@ -41,12 +41,12 @@ class MxControlPresenter : public MxCompositePresenter {
MxBool FUN_10044480(undefined4, undefined4*);
void FUN_10044540(undefined2);
undefined2 m_unk0x4c; // 0x4c
MxS16 m_unk0x4e; // 0x4e
MxBool m_unk0x50; // 0x50
undefined2 m_unk0x52; // 0x52
undefined2 m_unk0x54; // 0x54
undefined4* m_unk0x58; // 0x58
undefined2 m_unk0x4c; // 0x4c
MxS16 m_unk0x4e; // 0x4e
MxBool m_unk0x50; // 0x50
undefined2 m_unk0x52; // 0x52
undefined2 m_unk0x54; // 0x54
MxS16* m_unk0x58; // 0x58
};
// SYNTHETIC: LEGO1 0x100440f0

View file

@ -1,10 +1,27 @@
#include "mxcontrolpresenter.h"
#include "define.h"
#include "mxticklemanager.h"
#include "mxutil.h"
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
// GLOBAL: LEGO1 0x10102064
// STRING: LEGO1 0x10101fec
const char* g_style = "STYLE";
// GLOBAL: LEGO1 0x10102068
// STRING: LEGO1 0x10101fe4
const char* g_grid = "GRID";
// GLOBAL: LEGO1 0x1010206c
// STRING: LEGO1 0x10101fe0
const char* g_map = "MAP";
// GLOBAL: LEGO1 0x10102074
// STRING: LEGO1 0x10101fd0
const char* g_toggle = "TOGGLE";
// FUNCTION: LEGO1 0x10043f50
MxControlPresenter::MxControlPresenter()
{
@ -109,10 +126,49 @@ void MxControlPresenter::ReadyTickle()
ProgressTickleState(e_repeating);
}
// STUB: LEGO1 0x10044640
// FUNCTION: LEGO1 0x10044640
void MxControlPresenter::ParseExtra()
{
// TODO
char result[256];
MxU16 len = m_action->GetExtraLength();
if (len) {
char buffer[256];
memcpy(buffer, m_action->GetExtraData(), m_action->GetExtraLength());
buffer[len] = 0;
if (KeyValueStringParse(result, g_style, buffer)) {
char* str = strtok(result, g_parseExtraTokens);
if (!strcmpi(str, g_toggle)) {
m_unk0x4c = 1;
}
else if (!strcmpi(str, g_grid)) {
m_unk0x4c = 2;
m_unk0x52 = atoi(strtok(NULL, g_parseExtraTokens));
m_unk0x54 = atoi(strtok(NULL, g_parseExtraTokens));
}
else if (!strcmpi(str, g_map)) {
m_unk0x4c = 3;
str = strtok(NULL, g_parseExtraTokens);
if (str) {
MxS16 count = atoi(str);
m_unk0x58 = new MxS16[count + 1];
*m_unk0x58 = count;
for (MxS16 i = 1; i <= count; i++) {
m_unk0x58[i] = atoi(strtok(NULL, g_parseExtraTokens));
}
}
}
else {
m_unk0x4c = 0;
}
}
if (KeyValueStringParse(result, g_strVISIBILITY, buffer)) {
if (!strcmpi(result, "FALSE")) {
Enable(FALSE);
}
}
}
}
// FUNCTION: LEGO1 0x10044820