mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-29 11:06:05 -05:00
Implement/match InfocenterState::InfocenterState (#515)
* Implement LegoState::Shuffle * Remove unused params * Move ctor * Asm generate hotfix --------- Co-authored-by: MS <disinvite@users.noreply.github.com>
This commit is contained in:
parent
fce90ed8d8
commit
a7acf8c607
9 changed files with 167 additions and 50 deletions
|
@ -146,6 +146,15 @@ class Infocenter : public LegoWorld {
|
||||||
c_leaveInfoCenterDialogue3 = 564,
|
c_leaveInfoCenterDialogue3 = 564,
|
||||||
c_leaveInfoCenterDialogue4 = 565,
|
c_leaveInfoCenterDialogue4 = 565,
|
||||||
|
|
||||||
|
c_unk566 = 566,
|
||||||
|
c_unk567 = 567,
|
||||||
|
c_unk568 = 568,
|
||||||
|
|
||||||
|
c_unk569 = 569,
|
||||||
|
c_unk570 = 570,
|
||||||
|
c_unk571 = 571,
|
||||||
|
c_unk572 = 572,
|
||||||
|
|
||||||
c_registerToContinueDialogue = 573,
|
c_registerToContinueDialogue = 573,
|
||||||
|
|
||||||
c_bricksterDialogue = 574,
|
c_bricksterDialogue = 574,
|
||||||
|
|
|
@ -30,9 +30,9 @@ class InfocenterState : public LegoState {
|
||||||
|
|
||||||
inline MxS16 GetInfocenterBufferSize() { return sizeof(m_buffer) / sizeof(m_buffer[0]); }
|
inline MxS16 GetInfocenterBufferSize() { return sizeof(m_buffer) / sizeof(m_buffer[0]); }
|
||||||
inline MxStillPresenter* GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; }
|
inline MxStillPresenter* GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; }
|
||||||
inline StateStruct& GetUnknown0x08() { return m_unk0x08; }
|
inline Shuffle& GetUnknown0x08() { return m_unk0x08; }
|
||||||
inline StateStruct& GetUnknown0x14() { return m_unk0x14; }
|
inline Shuffle& GetUnknown0x14() { return m_unk0x14; }
|
||||||
inline StateStruct& GetUnknown0x68() { return m_unk0x68; }
|
inline Shuffle& GetUnknown0x68() { return m_unk0x68; }
|
||||||
inline MxU32 GetUnknown0x74() { return m_unk0x74; }
|
inline MxU32 GetUnknown0x74() { return m_unk0x74; }
|
||||||
|
|
||||||
inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; }
|
inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; }
|
||||||
|
@ -41,11 +41,11 @@ class InfocenterState : public LegoState {
|
||||||
// InfocenterState::`scalar deleting destructor'
|
// InfocenterState::`scalar deleting destructor'
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StateStruct m_unk0x08; // 0x08
|
Shuffle m_unk0x08; // 0x08
|
||||||
StateStruct m_unk0x14; // 0x14
|
Shuffle m_unk0x14; // 0x14
|
||||||
StateStruct m_unk0x20[3]; // 0x20
|
Shuffle m_unk0x20[3]; // 0x20
|
||||||
StateStruct m_unk0x44[3]; // 0x44
|
Shuffle m_unk0x44[3]; // 0x44
|
||||||
StateStruct m_unk0x68; // 0x68
|
Shuffle m_unk0x68; // 0x68
|
||||||
MxU32 m_unk0x74; // 0x74
|
MxU32 m_unk0x74; // 0x74
|
||||||
MxStillPresenter* m_buffer[7]; // 0x78
|
MxStillPresenter* m_buffer[7]; // 0x78
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,23 +45,45 @@ class LegoState : public MxCore {
|
||||||
// LegoState::`scalar deleting destructor'
|
// LegoState::`scalar deleting destructor'
|
||||||
|
|
||||||
// SIZE 0x0c
|
// SIZE 0x0c
|
||||||
struct StateStruct {
|
class Shuffle {
|
||||||
void* m_unk0x00; // 0x00
|
public:
|
||||||
undefined2 m_unk0x04; // 0x04
|
|
||||||
undefined2 m_unk0x06; // 0x06
|
|
||||||
MxU16 m_unk0x08; // 0x08
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10017c00
|
// FUNCTION: LEGO1 0x10017c00
|
||||||
StateStruct()
|
Shuffle()
|
||||||
{
|
{
|
||||||
m_unk0x04 = 0;
|
m_objectIds = NULL;
|
||||||
m_unk0x00 = NULL;
|
m_length = 0;
|
||||||
m_unk0x06 = 0;
|
m_unk0x06 = 0;
|
||||||
m_unk0x08 = 0;
|
m_unk0x08 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Shuffle(MxU32* p_objectIds, MxU16 p_length)
|
||||||
|
{
|
||||||
|
m_objectIds = p_objectIds;
|
||||||
|
m_length = p_length;
|
||||||
|
m_unk0x06 = 0;
|
||||||
|
m_unk0x08 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x10071800
|
||||||
|
Shuffle& operator=(const Shuffle& p_shuffle)
|
||||||
|
{
|
||||||
|
m_objectIds = p_shuffle.m_objectIds;
|
||||||
|
m_length = p_shuffle.m_length;
|
||||||
|
m_unk0x08 = p_shuffle.m_unk0x08;
|
||||||
|
m_unk0x06 = p_shuffle.m_unk0x06;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
MxU32 FUN_10014d00();
|
MxU32 FUN_10014d00();
|
||||||
MxBool FUN_10014de0(MxU32 p_objectId);
|
MxBool FUN_10014de0(MxU32 p_objectId);
|
||||||
|
|
||||||
|
inline void SetUnknown0x08(MxU16 p_unk0x08) { m_unk0x08 = p_unk0x08; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
MxU32* m_objectIds; // 0x00
|
||||||
|
MxU16 m_length; // 0x04
|
||||||
|
undefined2 m_unk0x06; // 0x06
|
||||||
|
MxU16 m_unk0x08; // 0x08
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class LegoVehicleBuildState : public LegoState {
|
||||||
// LegoVehicleBuildState::`scalar deleting destructor'
|
// LegoVehicleBuildState::`scalar deleting destructor'
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StateStruct m_unk0x08[4]; // 0x08
|
Shuffle m_unk0x08[4]; // 0x08
|
||||||
|
|
||||||
// This can be one of the following:
|
// This can be one of the following:
|
||||||
// * LegoRaceCarBuildState
|
// * LegoRaceCarBuildState
|
||||||
|
|
|
@ -36,9 +36,9 @@ class RadioState : public LegoState {
|
||||||
MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId);
|
MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StateStruct m_unk0x08[3]; // 0x08
|
Shuffle m_unk0x08[3]; // 0x08
|
||||||
MxS16 m_unk0x2c; // 0x2c
|
MxS16 m_unk0x2c; // 0x2c
|
||||||
MxBool m_active; // 0x2e
|
MxBool m_active; // 0x2e
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RADIOSTATE_H
|
#endif // RADIOSTATE_H
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#include "legostate.h"
|
#include "legostate.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(LegoState, 0x08)
|
DECOMP_SIZE_ASSERT(LegoState, 0x08)
|
||||||
DECOMP_SIZE_ASSERT(LegoState::StateStruct, 0x0c)
|
DECOMP_SIZE_ASSERT(LegoState::Shuffle, 0x0c)
|
||||||
|
|
||||||
// STUB: LEGO1 0x10014d00
|
// STUB: LEGO1 0x10014d00
|
||||||
MxU32 LegoState::StateStruct::FUN_10014d00()
|
MxU32 LegoState::Shuffle::FUN_10014d00()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10014de0
|
// STUB: LEGO1 0x10014de0
|
||||||
MxBool LegoState::StateStruct::FUN_10014de0(MxU32 p_objectId)
|
MxBool LegoState::Shuffle::FUN_10014de0(MxU32 p_objectId)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1,11 +1,110 @@
|
||||||
#include "infocenterstate.h"
|
#include "infocenterstate.h"
|
||||||
|
|
||||||
|
#include "infocenter.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(InfocenterState, 0x94);
|
DECOMP_SIZE_ASSERT(InfocenterState, 0x94);
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f76a8
|
||||||
|
Infocenter::InfomainScript g_unk0x100f76a8[14] = {
|
||||||
|
Infocenter::c_clickOnObjectsGuidanceDialogue,
|
||||||
|
Infocenter::c_arrowNavigationGuidanceDialogue,
|
||||||
|
Infocenter::c_elevatorGuidanceDialogue,
|
||||||
|
Infocenter::c_radioGuidanceDialogue,
|
||||||
|
Infocenter::c_exitGuidanceDialogue1,
|
||||||
|
Infocenter::c_goOutsideGuidanceDialogue,
|
||||||
|
Infocenter::c_experimentGuidanceDialogue,
|
||||||
|
Infocenter::c_returnBackGuidanceDialogue1,
|
||||||
|
Infocenter::c_bricksterWarningDialogue,
|
||||||
|
Infocenter::c_infomanHiccup,
|
||||||
|
Infocenter::c_infomanSneeze,
|
||||||
|
Infocenter::c_infomanLaughs,
|
||||||
|
Infocenter::c_newGameGuidanceDialogue,
|
||||||
|
Infocenter::c_returnBackGuidanceDialogue3
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f76e0
|
||||||
|
Infocenter::InfomainScript g_unk0x100f76e0[6] = {
|
||||||
|
Infocenter::c_bricksterWarningDialogue,
|
||||||
|
Infocenter::c_newGameGuidanceDialogue,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue1,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue5,
|
||||||
|
Infocenter::c_exitGuidanceDialogue2
|
||||||
|
// Zero-terminated
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f76f8
|
||||||
|
Infocenter::InfomainScript g_unk0x100f76f8[6] = {
|
||||||
|
Infocenter::c_returnBackGuidanceDialogue2,
|
||||||
|
Infocenter::c_reenterInfoCenterDialogue1,
|
||||||
|
Infocenter::c_reenterInfoCenterDialogue2,
|
||||||
|
Infocenter::c_reenterInfoCenterDialogue3,
|
||||||
|
Infocenter::c_reenterInfoCenterDialogue4
|
||||||
|
// Zero-terminated
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7710
|
||||||
|
Infocenter::InfomainScript g_unk0x100f7710[4] = {
|
||||||
|
Infocenter::c_bricksterEscapedDialogue1,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue2,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue3,
|
||||||
|
// Zero-terminated
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7720
|
||||||
|
Infocenter::InfomainScript g_unk0x100f7720[4] = {
|
||||||
|
Infocenter::c_bricksterEscapedDialogue4,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue5,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue6,
|
||||||
|
Infocenter::c_bricksterEscapedDialogue7
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7730
|
||||||
|
Infocenter::InfomainScript g_unk0x100f7730[4] = {
|
||||||
|
Infocenter::c_leaveInfoCenterDialogue1,
|
||||||
|
Infocenter::c_leaveInfoCenterDialogue2,
|
||||||
|
Infocenter::c_leaveInfoCenterDialogue3,
|
||||||
|
Infocenter::c_leaveInfoCenterDialogue4
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7740
|
||||||
|
Infocenter::InfomainScript g_unk0x100f7740[4] =
|
||||||
|
{Infocenter::c_unk569, Infocenter::c_unk570, Infocenter::c_unk571, Infocenter::c_unk572};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7750
|
||||||
|
Infocenter::InfomainScript g_unk0x100f7750[4] = {
|
||||||
|
Infocenter::c_unk566,
|
||||||
|
Infocenter::c_unk567,
|
||||||
|
Infocenter::c_unk568,
|
||||||
|
// Zero-terminated
|
||||||
|
};
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x100f7760
|
||||||
|
Infocenter::InfomainScript g_unk0x100f7760[2] = {Infocenter::c_bricksterDialogue, Infocenter::c_bricksterLaughs};
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10071600
|
// FUNCTION: LEGO1 0x10071600
|
||||||
InfocenterState::InfocenterState()
|
InfocenterState::InfocenterState()
|
||||||
{
|
{
|
||||||
// TODO
|
m_unk0x08 = LegoState::Shuffle((MxU32*) g_unk0x100f76a8, sizeof(g_unk0x100f76a8) / sizeof(g_unk0x100f76a8[0]));
|
||||||
|
|
||||||
|
m_unk0x14 = LegoState::Shuffle((MxU32*) g_unk0x100f76e0, sizeof(g_unk0x100f76e0) / sizeof(g_unk0x100f76e0[0]) - 1);
|
||||||
|
|
||||||
|
m_unk0x20[0] =
|
||||||
|
LegoState::Shuffle((MxU32*) g_unk0x100f76f8, sizeof(g_unk0x100f76f8) / sizeof(g_unk0x100f76f8[0]) - 1);
|
||||||
|
|
||||||
|
m_unk0x20[1] =
|
||||||
|
LegoState::Shuffle((MxU32*) g_unk0x100f7710, sizeof(g_unk0x100f7710) / sizeof(g_unk0x100f7710[0]) - 1);
|
||||||
|
|
||||||
|
m_unk0x20[2] = LegoState::Shuffle((MxU32*) g_unk0x100f7720, sizeof(g_unk0x100f7720) / sizeof(g_unk0x100f7720[0]));
|
||||||
|
|
||||||
|
m_unk0x44[0] = LegoState::Shuffle((MxU32*) g_unk0x100f7730, sizeof(g_unk0x100f7730) / sizeof(g_unk0x100f7730[0]));
|
||||||
|
|
||||||
|
m_unk0x44[1] = LegoState::Shuffle((MxU32*) g_unk0x100f7740, sizeof(g_unk0x100f7740) / sizeof(g_unk0x100f7740[0]));
|
||||||
|
|
||||||
|
m_unk0x44[2] =
|
||||||
|
LegoState::Shuffle((MxU32*) g_unk0x100f7750, sizeof(g_unk0x100f7750) / sizeof(g_unk0x100f7750[0]) - 1);
|
||||||
|
|
||||||
|
m_unk0x68 = LegoState::Shuffle((MxU32*) g_unk0x100f7760, sizeof(g_unk0x100f7760) / sizeof(g_unk0x100f7760[0]));
|
||||||
|
|
||||||
memset(m_buffer, 0, sizeof(m_buffer));
|
memset(m_buffer, 0, sizeof(m_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,32 +53,14 @@ RadioState::RadioState()
|
||||||
MxS32 random = rand();
|
MxS32 random = rand();
|
||||||
m_unk0x2c = random % 3;
|
m_unk0x2c = random % 3;
|
||||||
|
|
||||||
// TODO: Most likely inline function
|
m_unk0x08[0] = LegoState::Shuffle((MxU32*) g_unk0x100f3218, sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]));
|
||||||
|
m_unk0x08[0].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0])));
|
||||||
|
|
||||||
m_unk0x08[0].m_unk0x04 = sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]);
|
m_unk0x08[1] = LegoState::Shuffle((MxU32*) g_unk0x100f3230, sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]));
|
||||||
m_unk0x08[0].m_unk0x00 = g_unk0x100f3218;
|
m_unk0x08[1].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0])));
|
||||||
m_unk0x08[0].m_unk0x08 = 0;
|
|
||||||
m_unk0x08[0].m_unk0x06 = 0;
|
|
||||||
|
|
||||||
random = rand();
|
m_unk0x08[2] = LegoState::Shuffle((MxU32*) g_unk0x100f3268, sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]));
|
||||||
|
m_unk0x08[2].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0])));
|
||||||
m_unk0x08[1].m_unk0x08 = 0;
|
|
||||||
m_unk0x08[1].m_unk0x06 = 0;
|
|
||||||
m_unk0x08[1].m_unk0x04 = sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]);
|
|
||||||
m_unk0x08[1].m_unk0x00 = g_unk0x100f3230;
|
|
||||||
|
|
||||||
m_unk0x08[0].m_unk0x08 = (MxU32) random % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]));
|
|
||||||
random = rand();
|
|
||||||
|
|
||||||
m_unk0x08[2].m_unk0x08 = 0;
|
|
||||||
m_unk0x08[2].m_unk0x06 = 0;
|
|
||||||
m_unk0x08[2].m_unk0x04 = sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]);
|
|
||||||
m_unk0x08[2].m_unk0x00 = g_unk0x100f3268;
|
|
||||||
|
|
||||||
m_unk0x08[1].m_unk0x08 = (MxU32) random % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]));
|
|
||||||
random = rand();
|
|
||||||
|
|
||||||
m_unk0x08[2].m_unk0x08 = (MxU32) random % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]));
|
|
||||||
|
|
||||||
m_active = FALSE;
|
m_active = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
import re
|
import re
|
||||||
from typing import Callable, List, Optional, Tuple
|
from typing import Callable, List, Optional, Tuple
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from isledecomp.bin import InvalidVirtualAddressError
|
||||||
from capstone import Cs, CS_ARCH_X86, CS_MODE_32
|
from capstone import Cs, CS_ARCH_X86, CS_MODE_32
|
||||||
|
|
||||||
disassembler = Cs(CS_ARCH_X86, CS_MODE_32)
|
disassembler = Cs(CS_ARCH_X86, CS_MODE_32)
|
||||||
|
@ -55,7 +56,11 @@ def is_relocated(self, addr: int) -> bool:
|
||||||
|
|
||||||
def float_replace(self, addr: int, data_size: int) -> Optional[str]:
|
def float_replace(self, addr: int, data_size: int) -> Optional[str]:
|
||||||
if callable(self.float_lookup):
|
if callable(self.float_lookup):
|
||||||
float_str = self.float_lookup(addr, data_size)
|
try:
|
||||||
|
float_str = self.float_lookup(addr, data_size)
|
||||||
|
except InvalidVirtualAddressError:
|
||||||
|
# probably caused by reading an invalid instruction
|
||||||
|
return None
|
||||||
if float_str is not None:
|
if float_str is not None:
|
||||||
return f"{float_str} (FLOAT)"
|
return f"{float_str} (FLOAT)"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue