- item_config, entity_config and mod_manager take over their families as idiomatic classes (std containers, unique_ptr, bitset tear flags). Every big loader reads the imported JSON: entities2.xml gives 1349 entities. - manager.h/.cpp take over Manager (g_manager) and IsaacStartup. Members are the curated subsystems by value. - kage_graphics, kage_input and kage_sound take over KAGE's graphics (shaders, render targets, batches, PNG through stb_image), input (SDL3 keyboard, mouse, gamepads) and sound (SDL3 audio, wav and stb_vorbis ogg, pitch and volume). - source_tree.py: classes inside a namespace block in src/ headers count as taken over, and a still-generated class's vtable slot keeps its stub unless src/ defines that exact method. build/isaac opens the window, sets up GL 4.6, framebuffers and PulseAudio, logs the version, and stops at LuaEngine::Init. 522 functions taken over, boot path 156/615. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1923 lines
76 KiB
C++
1923 lines
76 KiB
C++
#include "classes.h"
|
|
|
|
// 00829670
|
|
RoomConfig::~RoomConfig()
|
|
{
|
|
uint32_t uVar1;
|
|
uint32_t stageIndex;
|
|
RoomConfig *this_00;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t uStack_8;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01ae0;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
|
ExceptionList = &local_10;
|
|
stageIndex = 0;
|
|
this_00 = this;
|
|
do {
|
|
(GHIDRA_CAST<RoomConfig_Stage *>((GHIDRA_CAST<RoomConfig_Stage *>(this_00))))->RoomConfig_Stage::unload();
|
|
stageIndex = stageIndex + 1;
|
|
this_00 = GHIDRA_CAST<RoomConfig *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this_00)) + 0xc4))));
|
|
} while (stageIndex < 0x25);
|
|
FUN_0082e050(uVar1);
|
|
_eh_vector_destructor_iterator_(this + 1,0x1c,0x10,FUN_0069d1f0);
|
|
msvc::vector<28byte_string>::_Tidy();
|
|
_eh_vector_destructor_iterator_(this,0xc4,0x25,RoomConfig_Stage::game_destructor);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00829710
|
|
void RoomConfig::LoadRoomFromXmlFile()
|
|
{
|
|
uint32_t uVar1;
|
|
int *file;
|
|
int iVar2;
|
|
uint8_t *text;
|
|
void *pvVar3;
|
|
uint8_t *in_EDX;
|
|
uint8_t *pbVar4;
|
|
uint8_t xmlDoc [48];
|
|
uint8_t auStack_100ec [65560];
|
|
RoomConfig_Room parsedRoom;
|
|
uint8_t local_74 [20];
|
|
void *local_60;
|
|
uint32_t local_50;
|
|
uint32_t local_4c;
|
|
int local_3c;
|
|
uint32_t local_38;
|
|
void *local_34;
|
|
short local_30;
|
|
uint32_t local_28;
|
|
uint32_t local_24;
|
|
uint32_t local_20;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
|
|
puStack_c = &LAB_00b01b18;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_UINT((local_74 + 0x70));
|
|
ExceptionList = &local_10;
|
|
local_50 = 0;
|
|
local_4c = 0xf;
|
|
local_60 = (void *)0x0;
|
|
local_3c = 0;
|
|
local_38 = 0;
|
|
local_34 = (void *)0x0;
|
|
local_30 = 0;
|
|
local_20 = 0;
|
|
local_24 = 0;
|
|
local_8 = 0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_74)) + 0x0))) = 0;
|
|
local_28 = 0;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((in_EDX + 0x14))) {
|
|
in_EDX = *GHIDRA_CAST<uint8_t **>(in_EDX);
|
|
}
|
|
local_14 = uVar1;
|
|
file = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(in_EDX,GHIDRA_CAST<int *>(0x0));
|
|
if (file == GHIDRA_CAST<int *>(0x0)) {
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[error] Could not open %s\n"));
|
|
FUN_00829920(local_74);
|
|
if (local_4c < 0x10) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
uVar1 = local_4c + 1;
|
|
pvVar3 = local_60;
|
|
if (uVar1 < 0x1000) goto LAB_00829805;
|
|
pvVar3 = *(void **)(GHIDRA_CAST<char *>(local_60) + -4);
|
|
iVar2 = GHIDRA_INT(local_60) - GHIDRA_INT(pvVar3);
|
|
}
|
|
else {
|
|
iVar2 = (**(code **)(*file + 4))(uVar1);
|
|
text = operator_new_tracked(iVar2 + 1);
|
|
(**(code **)(*file + 0x14))(text,1,iVar2);
|
|
text[iVar2] = 0;
|
|
(**(code **)*file)(1);
|
|
FUN_00413b90();
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
|
|
iVar2 = 0x829878;
|
|
pbVar4 = text;
|
|
(GHIDRA_CAST<rapidxml::xml_document *>((xmlDoc)))->rapidxml::xml_document::parse(text);
|
|
pvVar3 = (GHIDRA_CAST<xml_node *>((xmlDoc)))->xml_node::first_node(&DAT_00b1c17c,iVar2,(uint8_t)pbVar4);
|
|
RoomConfigRoom::ParseXml(&parsedRoom,pvVar3,GHIDRA_CAST<RoomConfig_Room *>(local_74));
|
|
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(parsedRoom)) + 0x14))))))->msvc::string::_Tidy_deallocate();
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
|
|
(GHIDRA_CAST<xml_memory_pool *>((auStack_100ec)))->xml_memory_pool::clear();
|
|
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
|
|
tracked_alloc(1,text,0);
|
|
FUN_00829920(local_74);
|
|
if (local_4c < 0x10) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
uVar1 = local_4c + 1;
|
|
pvVar3 = local_60;
|
|
if (uVar1 < 0x1000) goto LAB_00829805;
|
|
pvVar3 = *(void **)(GHIDRA_CAST<char *>(local_60) + -4);
|
|
iVar2 = GHIDRA_INT(local_60) - GHIDRA_INT(pvVar3);
|
|
}
|
|
uVar1 = local_4c + 0x24;
|
|
if (0x1f < iVar2 - 4U) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
LAB_00829805:
|
|
operator_delete(pvVar3,uVar1);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00829a10
|
|
int RoomConfig::get_door_from_position(short posX, int shape)
|
|
{
|
|
int doorSlot;
|
|
uint16_t in_register_00000006;
|
|
int doorSlot;
|
|
int in_EDX;
|
|
|
|
doorSlot = CONCAT22(in_register_00000006,posX);
|
|
doorSlot = -1;
|
|
if ((doorSlot == -1) || (doorSlot == 0xc)) {
|
|
if (in_EDX == 3) {
|
|
return 0;
|
|
}
|
|
if (((doorSlot == -1) || (doorSlot == 0xc)) && (in_EDX == 10)) {
|
|
return 4;
|
|
}
|
|
}
|
|
if (doorSlot == 6) {
|
|
if (in_EDX != -1) {
|
|
if (in_EDX != 0xe) {
|
|
if (in_EDX != 6) {
|
|
if (in_EDX == 7) {
|
|
return 3;
|
|
}
|
|
return -1;
|
|
}
|
|
if (shape == 9) {
|
|
return 1;
|
|
}
|
|
return -1;
|
|
}
|
|
if (shape != 0xb) {
|
|
return 3;
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
if (doorSlot != 0x13) {
|
|
if ((doorSlot == 0xd) || (doorSlot == 0x1a)) {
|
|
if (in_EDX == 3) {
|
|
return 2;
|
|
}
|
|
if (((doorSlot == 0xd) || (doorSlot == 0x1a)) && (in_EDX == 10)) {
|
|
doorSlot = 6;
|
|
}
|
|
}
|
|
return doorSlot;
|
|
}
|
|
if (in_EDX != -1) {
|
|
if (in_EDX != 0xe) {
|
|
if (in_EDX != 6) {
|
|
if (in_EDX == 7) {
|
|
return 7;
|
|
}
|
|
return -1;
|
|
}
|
|
if (shape == 10) {
|
|
return 5;
|
|
}
|
|
return -1;
|
|
}
|
|
if (shape != 0xc) {
|
|
return 7;
|
|
}
|
|
}
|
|
return 5;
|
|
}
|
|
|
|
// 0082a9c0
|
|
void RoomConfig::ResetStageWeights(uint32_t stageId, int mode)
|
|
{
|
|
int roomOffset;
|
|
uint32_t roomIndex;
|
|
int stageModeOffset;
|
|
|
|
if (mode == -1) {
|
|
if ((g_game == GHIDRA_CAST<Game *>(0x0)) || ((g_game->_difficulty != 2 && (g_game->_difficulty != 3)))) {
|
|
mode = 0;
|
|
}
|
|
else {
|
|
mode = 1;
|
|
}
|
|
}
|
|
stageModeOffset = mode * 0x2c + stageId * 0xc4 + 100;
|
|
if ((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8c))))[stageModeOffset + -100] == '\0') {
|
|
LoadStageBinary(this,stageId,mode);
|
|
return;
|
|
}
|
|
roomIndex = 0;
|
|
if (*GHIDRA_CAST<int *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x80))) + stageModeOffset + -100)) != 0) {
|
|
roomOffset = 0;
|
|
do {
|
|
roomOffset = roomOffset + 0x5c;
|
|
roomIndex = roomIndex + 1;
|
|
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x7c))) + stageModeOffset + -100)) + -0x28 + roomOffset)) =
|
|
*(uint32_t *)
|
|
(*GHIDRA_CAST<int *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x7c))) + stageModeOffset + -100)) + -0x2c + roomOffset);
|
|
} while (roomIndex < *GHIDRA_CAST<uint32_t *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x80))) + stageModeOffset + -100)));
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0082aa40
|
|
void RoomConfig::LoadStageBinary(uint32_t Stage, uint32_t Mode)
|
|
{
|
|
int iVar1;
|
|
RoomSet *text;
|
|
uint32_t *puVar2;
|
|
uint8_t *extraout_EAX;
|
|
uint8_t *path;
|
|
int *fileHandle;
|
|
void *pvVar3;
|
|
uint32_t uVar4;
|
|
uint32_t allocSize;
|
|
RoomConfig_Stage *local_EDI_80;
|
|
uint32_t *puVar5;
|
|
int magic;
|
|
int *file;
|
|
uint32_t local_7c;
|
|
uint32_t local_78;
|
|
uint32_t *puStack_74;
|
|
uint8_t isLoaded;
|
|
void *redirectedPath [4];
|
|
uint32_t uStack_5c;
|
|
uint32_t uStack_58;
|
|
void *tmpString;
|
|
char acStack_50 [4];
|
|
char acStack_4c [4];
|
|
char acStack_48 [8];
|
|
uint32_t uStack_40;
|
|
void *basePath [4];
|
|
uint32_t uStack_2c;
|
|
uint32_t uStack_28;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
void *local_14;
|
|
int roomVariant;
|
|
RoomSet *temp_208e6a6609;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((basePath + 0xe));
|
|
local_14 = (void *)0xffffffff;
|
|
puStack_18 = &LAB_00b01c02;
|
|
local_1c = ExceptionList;
|
|
local_24 = __security_cookie ^ GHIDRA_UINT((basePath + 0xb));
|
|
local_7c = Stage;
|
|
local_78 = Mode;
|
|
local_EDI_80 = GHIDRA_CAST<RoomConfig_Stage *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x0))) + Stage * 0xc4));
|
|
if (Mode == 0xffffffff) {
|
|
if ((g_game == GHIDRA_CAST<Game *>(0x0)) || ((g_game->_difficulty != 2 && (g_game->_difficulty != 3)))) {
|
|
local_78 = 0;
|
|
}
|
|
else {
|
|
local_78 = 1;
|
|
}
|
|
}
|
|
temp_208e6a6609 = GHIDRA_CAST<RoomSet *>((GHIDRA_INT(local_EDI_80) + local_78 * 0x2c + 100));
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_EDI_80) + local_78 * 0x2c + 0x74)) == 0) {
|
|
return;
|
|
}
|
|
ExceptionList = &local_1c;
|
|
(GHIDRA_CAST<RoomConfigStage *>((local_EDI_80)))->RoomConfigStage::GetDisplayName(GHIDRA_CAST<std_string *>(&tmpString),0x14);
|
|
local_14 = (void *)0x0;
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[RoomConfig] load stage %d: %s (mode %d)\n"));
|
|
local_14 = (void *)0xffffffff;
|
|
if (0xf < uStack_40) {
|
|
uVar4 = uStack_40 + 1;
|
|
pvVar3 = tmpString;
|
|
if (0xfff < uVar4) {
|
|
pvVar3 = *(void **)(GHIDRA_CAST<char *>(tmpString) + -4);
|
|
uVar4 = uStack_40 + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(tmpString) + (-4 - GHIDRA_INT(pvVar3))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar3,uVar4);
|
|
}
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[5])) + 0x1))));
|
|
uStack_2c = 0;
|
|
uStack_28 = 0xf;
|
|
basePath[0] = (void *)0x0;
|
|
allocSize = uVar4 - 3;
|
|
if (uVar4 < uVar4 - 3) {
|
|
allocSize = uVar4;
|
|
}
|
|
text = temp_208e6a6609;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[6])) + 0x2))))) {
|
|
text = *GHIDRA_CAST<RoomSet **>(temp_208e6a6609);
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(basePath))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(text),allocSize);
|
|
local_14 = (void *)0x1;
|
|
puVar2 = (GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(basePath))))->msvc::string::append(&UNK_00b6cb40,3);
|
|
tmpString = (void *)*puVar2;
|
|
acStack_50 = (char [4])puVar2[1];
|
|
acStack_4c = (char [4])puVar2[2];
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(acStack_48)) + 0x0))) = puVar2[3];
|
|
unique0x0000a400 = *GHIDRA_CAST<uint64_t *>((puVar2 + 4));
|
|
puVar2[4] = 0;
|
|
puVar2[5] = 0xf;
|
|
*GHIDRA_CAST<uint8_t *>(puVar2) = 0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
|
|
if (0xf < uStack_28) {
|
|
uVar4 = uStack_28 + 1;
|
|
pvVar3 = basePath[0];
|
|
if (0xfff < uVar4) {
|
|
pvVar3 = *(void **)(GHIDRA_INT(basePath[0]) + -4);
|
|
uVar4 = uStack_28 + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(basePath[0]) + (-4 - GHIDRA_INT(pvVar3))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar3,uVar4);
|
|
}
|
|
uStack_2c = 0;
|
|
uStack_28 = 0xf;
|
|
basePath[0] = (void *)(GHIDRA_UINT(basePath[0]) & 0xffffff00);
|
|
ModManager::TryRedirectPath
|
|
(GHIDRA_CAST<ModManager *>(&g_manager->_modManager),GHIDRA_CAST<std_string *>(redirectedPath),
|
|
GHIDRA_CAST<std_string *>(&tmpString));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
|
|
path = extraout_EAX;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((extraout_EAX + 0x14))) {
|
|
path = *GHIDRA_CAST<uint8_t **>(extraout_EAX);
|
|
}
|
|
fileHandle = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(path,GHIDRA_CAST<int *>(0x0));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
|
|
file = fileHandle;
|
|
if (0xf < uStack_58) {
|
|
uVar4 = uStack_58 + 1;
|
|
pvVar3 = redirectedPath[0];
|
|
if (0xfff < uVar4) {
|
|
pvVar3 = *(void **)(GHIDRA_INT(redirectedPath[0]) + -4);
|
|
uVar4 = uStack_58 + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedPath[0]) + (-4 - GHIDRA_INT(pvVar3))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar3,uVar4);
|
|
}
|
|
uStack_5c = 0;
|
|
uStack_58 = 0xf;
|
|
redirectedPath[0] = (void *)(GHIDRA_UINT(redirectedPath[0]) & 0xffffff00);
|
|
if (fileHandle != GHIDRA_CAST<int *>(0x0)) {
|
|
(GHIDRA_CAST<RoomConfigMode *>((temp_208e6a6609)))->RoomConfigMode::Clear();
|
|
(**(code **)(*fileHandle + 0x14))(&magic,1,4);
|
|
if (magic == 0x31425453) {
|
|
(**(code **)(*fileHandle + 0x14))(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[9])) + 0x1))),4,1);
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[9])) + 0x1)))) != 0) {
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("allocate %d rooms.\n"));
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[9])) + 0x1))));
|
|
puStack_74 = GHIDRA_CAST<uint32_t *>(0x0);
|
|
allocSize = -GHIDRA_UINT((GHIDRA_INT(((uint64_t)uVar4 * 0x5c >> 0x20)) != 0)) |
|
|
GHIDRA_UINT(((uint64_t)uVar4 * 0x5c));
|
|
puStack_74 = operator_new_tracked(-GHIDRA_UINT((0xfffffffb < allocSize)) | allocSize + 4);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
|
|
if (puStack_74 == GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
puVar5 = GHIDRA_CAST<uint32_t *>(0x0);
|
|
}
|
|
else {
|
|
*puStack_74 = uVar4;
|
|
puVar5 = puStack_74 + 1;
|
|
_eh_vector_constructor_iterator_
|
|
(puVar5,0x5c,uVar4,GHIDRA_CAST<_func_void_void_ptr *>(&UNK_00828b20),RoomConfigRoom::dtor);
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
|
|
*GHIDRA_CAST<uint32_t **>((temp_208e6a6609 + 8)) = puVar5;
|
|
uVar4 = 0;
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[9])) + 0x1)))) != 0) {
|
|
puStack_74 = GHIDRA_CAST<uint32_t *>(0x0);
|
|
do {
|
|
ReadRoom(temp_208e6a6609,uVar4,local_7c,file);
|
|
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((temp_208e6a6609 + 8)) + 4 + GHIDRA_INT(puStack_74))) = local_78;
|
|
RoomSet::GetVariantSet
|
|
(temp_208e6a6609,
|
|
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((temp_208e6a6609 + 8)) + 8 + GHIDRA_INT(puStack_74))));
|
|
VariantRanges::Insert
|
|
(*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((temp_208e6a6609 + 8)) + 0xc + GHIDRA_INT(puStack_74))));
|
|
iVar1 = *GHIDRA_CAST<int *>((temp_208e6a6609 + 8));
|
|
switch(local_7c) {
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
roomVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(puStack_74) + iVar1 + 0xc));
|
|
if ((roomVariant == 0x25b) || (roomVariant == 0x2cc)) {
|
|
puVar5 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(puStack_74) + iVar1 + 0x4c));
|
|
*puVar5 = *puVar5 | 4;
|
|
}
|
|
break;
|
|
case 0x1d:
|
|
case 0x1e:
|
|
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(puStack_74) + iVar1 + 8)) == 1) &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(puStack_74) + iVar1 + 0x10)) == 0x1f)) {
|
|
puVar5 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(puStack_74) + iVar1 + 0x4c));
|
|
*puVar5 = *puVar5 | 2;
|
|
}
|
|
}
|
|
puStack_74 = puStack_74 + 0x17;
|
|
uVar4 = uVar4 + 1;
|
|
} while (uVar4 < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[9])) + 0x1)))));
|
|
}
|
|
fileHandle = file;
|
|
}
|
|
(**(code **)*fileHandle)(1);
|
|
ModManager::LoadModRooms(GHIDRA_CAST<ModManager *>(&g_manager->_modManager),local_7c,local_78);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(temp_208e6a6609[0xd])) + 0x1))) = 1;
|
|
isLoaded = 1;
|
|
goto LAB_0082ae11;
|
|
}
|
|
}
|
|
isLoaded = 0;
|
|
LAB_0082ae11:
|
|
if (0xf < uStack_40) {
|
|
uVar4 = uStack_40 + 1;
|
|
pvVar3 = tmpString;
|
|
if (0xfff < uVar4) {
|
|
pvVar3 = *(void **)(GHIDRA_CAST<char *>(tmpString) + -4);
|
|
uVar4 = uStack_40 + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(tmpString) + (-4 - GHIDRA_INT(pvVar3))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar3,uVar4);
|
|
}
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 0082aea0
|
|
void RoomConfig::ReadRoom(void *stage, int roomIndex, int stageId, void *file)
|
|
{
|
|
uint16_t spawnCount;
|
|
uint32_t uVar1;
|
|
int *roomName;
|
|
uint32_t doorSlot;
|
|
void *pvVar2;
|
|
uint32_t *spawnInit;
|
|
int *nameBuf;
|
|
uint8_t *entryCountPtr;
|
|
char entryCountCopy;
|
|
int entryType;
|
|
int *fileLocal;
|
|
int *room;
|
|
int iVar3;
|
|
int roomSubtype;
|
|
int roomType;
|
|
uint32_t spawnIndex;
|
|
float entryWeight;
|
|
int roomWeight;
|
|
int roomVariant;
|
|
uint16_t entrySubtype [2];
|
|
uint16_t entryVariant [2];
|
|
uint16_t entryTypeRaw [2];
|
|
uint16_t spawnY [2];
|
|
uint16_t spawnX [2];
|
|
int local_24;
|
|
int local_20;
|
|
uint16_t nameLength [3];
|
|
uint8_t roomShape;
|
|
uint8_t roomHeight;
|
|
uint8_t roomWidth;
|
|
uint8_t roomDifficulty;
|
|
uint8_t local_11;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint8_t entryCount;
|
|
|
|
fileLocal = file;
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01c56;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_UINT((nameLength + 0xc));
|
|
ExceptionList = &local_10;
|
|
room = GHIDRA_CAST<int *>((roomIndex * 0x5c + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(stage) + 0x18))));
|
|
*room = stageId;
|
|
(**(code **)(*GHIDRA_CAST<int *>(file) + 0x14))(&roomType,4,1,uVar1);
|
|
(**(code **)(*fileLocal + 0x14))(&roomVariant,4,1);
|
|
(**(code **)(*fileLocal + 0x14))(&roomSubtype,4,1);
|
|
(**(code **)(*fileLocal + 0x14))(&roomDifficulty,1,1);
|
|
(**(code **)(*fileLocal + 0x14))(nameLength,2,1);
|
|
roomName = room + 5;
|
|
if (nameLength[0] == 0) {
|
|
if (0xf < GHIDRA_UINT(room[10])) {
|
|
roomName = GHIDRA_CAST<int *>(*roomName);
|
|
}
|
|
room[9] = 0;
|
|
*GHIDRA_CAST<char *>(roomName) = '\0';
|
|
}
|
|
else {
|
|
uVar1 = GHIDRA_UINT(nameLength[0]);
|
|
if (GHIDRA_UINT(room[9]) < uVar1) {
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(roomName))))->msvc::string::append_n(uVar1 - room[9],0);
|
|
}
|
|
else {
|
|
nameBuf = roomName;
|
|
if (0xf < GHIDRA_UINT(room[10])) {
|
|
nameBuf = GHIDRA_CAST<int *>(*roomName);
|
|
}
|
|
room[9] = uVar1;
|
|
*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(nameBuf) + uVar1)) = '\0';
|
|
}
|
|
if (0xf < GHIDRA_UINT(room[10])) {
|
|
roomName = GHIDRA_CAST<int *>(*roomName);
|
|
}
|
|
(**(code **)(*fileLocal + 0x14))(roomName,1,nameLength[0]);
|
|
}
|
|
(**(code **)(*fileLocal + 0x14))(&roomWeight,4,1);
|
|
(**(code **)(*fileLocal + 0x14))(&roomWidth,1,1);
|
|
(**(code **)(*fileLocal + 0x14))(&roomHeight,1,1);
|
|
(**(code **)(*fileLocal + 0x14))(&roomShape,1,1);
|
|
room[2] = roomType;
|
|
room[0x16] = roomVariant;
|
|
room[3] = roomVariant;
|
|
room[4] = roomSubtype;
|
|
room[0xb] = GHIDRA_UINT(roomDifficulty);
|
|
room[0xd] = roomWeight;
|
|
room[0xc] = roomWeight;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(room) + 0x46)) = roomWidth;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(room) + 0x47)) = roomHeight;
|
|
room[0x12] = GHIDRA_UINT(roomShape);
|
|
room[0x13] = 0;
|
|
(**(code **)(*fileLocal + 0x14))(GHIDRA_INT(&stageId) + 3,1,1);
|
|
(**(code **)(*fileLocal + 0x14))(room + 0x11,2,1);
|
|
spawnCount = *GHIDRA_CAST<uint16_t *>((room + 0x11));
|
|
uVar1 = 0;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(stageId)) + 0x3))) != '\0') {
|
|
do {
|
|
(**(code **)(*fileLocal + 0x14))(&local_24,2,1);
|
|
(**(code **)(*fileLocal + 0x14))(&local_20,2,1);
|
|
(**(code **)(*fileLocal + 0x14))(&local_11,1,1);
|
|
if (local_11 != 0) {
|
|
doorSlot = get_door_from_position((short)local_24,room[0x12]);
|
|
if (-1 < GHIDRA_INT(doorSlot)) {
|
|
if (7 < doorSlot) {
|
|
LAB_0082b2de:
|
|
/* WARNING: Subroutine does not return */
|
|
msvc::bitset::_Xran();
|
|
}
|
|
room[(doorSlot >> 5) + 0xe] = room[(doorSlot >> 5) + 0xe] | 1 << ((uint8_t)doorSlot & 0x1f);
|
|
}
|
|
}
|
|
uVar1 = uVar1 + 1;
|
|
} while (uVar1 < GHIDRA_UINT(stageId) >> 0x18);
|
|
spawnCount = *GHIDRA_CAST<uint16_t *>((room + 0x11));
|
|
}
|
|
if (spawnCount != 0) {
|
|
uVar1 = GHIDRA_UINT(spawnCount);
|
|
pvVar2 = operator_new_tracked(uVar1 * 0x10);
|
|
if (pvVar2 == (void *)0x0) {
|
|
pvVar2 = (void *)0x0;
|
|
}
|
|
else if (uVar1 != 0) {
|
|
spawnInit = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(pvVar2) + 4));
|
|
do {
|
|
spawnInit[-1] = 0;
|
|
*spawnInit = 0;
|
|
*GHIDRA_CAST<uint8_t *>((spawnInit + 1)) = 0;
|
|
spawnInit[2] = 0;
|
|
uVar1 = uVar1 - 1;
|
|
spawnInit = spawnInit + 4;
|
|
} while (uVar1 != 0);
|
|
}
|
|
local_8 = 0xffffffff;
|
|
room[0x10] = GHIDRA_INT(pvVar2);
|
|
spawnIndex = 0;
|
|
if ((short)room[0x11] != 0) {
|
|
local_20 = 0;
|
|
do {
|
|
iVar3 = local_20;
|
|
local_24 = room[0x10];
|
|
(**(code **)(*fileLocal + 0x14))(spawnX,2,1);
|
|
(**(code **)(*fileLocal + 0x14))(spawnY,2,1);
|
|
entryCountPtr = GHIDRA_CAST<uint8_t *>((local_24 + 8 + iVar3));
|
|
(**(code **)(*fileLocal + 0x14))(entryCountPtr,1,1);
|
|
*GHIDRA_CAST<uint16_t *>((iVar3 + local_24)) = spawnX[0];
|
|
*GHIDRA_CAST<uint16_t *>((iVar3 + 2 + local_24)) = spawnY[0];
|
|
entryCount = *GHIDRA_CAST<uint8_t *>((local_24 + 8 + iVar3));
|
|
entryCountCopy = '\0';
|
|
if (entryCount != 0) {
|
|
pvVar2 = operator_new_tracked(GHIDRA_UINT(entryCount) * 0xc);
|
|
entryCountCopy = *GHIDRA_CAST<char *>((iVar3 + 8 + local_24));
|
|
*(void **)(iVar3 + 4 + local_24) = pvVar2;
|
|
}
|
|
uVar1 = 0;
|
|
local_11 = 0;
|
|
if (entryCountCopy != '\0') {
|
|
do {
|
|
iVar3 = *GHIDRA_CAST<int *>((local_20 + 4 + local_24));
|
|
(**(code **)(*GHIDRA_CAST<int *>(file) + 0x14))(entryTypeRaw,2,1);
|
|
(**(code **)(*GHIDRA_CAST<int *>(file) + 0x14))(entryVariant,2,1);
|
|
(**(code **)(*GHIDRA_CAST<int *>(file) + 0x14))(entrySubtype,2,1);
|
|
(**(code **)(*GHIDRA_CAST<int *>(file) + 0x14))(&entryWeight,4,1);
|
|
*GHIDRA_CAST<uint32_t *>((iVar3 + uVar1 * 0xc)) = GHIDRA_UINT(entryTypeRaw[0]);
|
|
*GHIDRA_CAST<uint16_t *>((iVar3 + 4 + uVar1 * 0xc)) = entryVariant[0];
|
|
*GHIDRA_CAST<uint16_t *>((iVar3 + 6 + uVar1 * 0xc)) = entrySubtype[0];
|
|
*GHIDRA_CAST<float *>((iVar3 + 8 + uVar1 * 0xc)) = entryWeight;
|
|
*GHIDRA_CAST<float *>((local_20 + 0xc + local_24)) =
|
|
entryWeight + *GHIDRA_CAST<float *>((local_20 + 0xc + local_24));
|
|
entryType = *GHIDRA_CAST<int *>((iVar3 + uVar1 * 0xc));
|
|
if (entryType == 0x3ca) {
|
|
if ((*GHIDRA_CAST<short *>((iVar3 + 4 + uVar1 * 0xc)) == 2) &&
|
|
(doorSlot = get_door_from_position(*GHIDRA_CAST<short *>((local_20 + local_24)),room[0x12]),
|
|
-1 < GHIDRA_INT(doorSlot))) {
|
|
if (doorSlot < 8) {
|
|
room[(doorSlot >> 5) + 0xf] =
|
|
room[(doorSlot >> 5) + 0xf] | 1 << ((uint8_t)doorSlot & 0x1f);
|
|
entryType = *GHIDRA_CAST<int *>((iVar3 + uVar1 * 0xc));
|
|
goto LAB_0082b280;
|
|
}
|
|
goto LAB_0082b2de;
|
|
}
|
|
}
|
|
else {
|
|
LAB_0082b280:
|
|
if ((entryType == 0x1194) && (*GHIDRA_CAST<short *>((iVar3 + 4 + uVar1 * 0xc)) == 0)) {
|
|
room[0x13] = room[0x13] | 0x80;
|
|
}
|
|
}
|
|
local_11 = local_11 + 1;
|
|
uVar1 = GHIDRA_UINT(local_11);
|
|
} while (local_11 < *entryCountPtr);
|
|
fileLocal = file;
|
|
iVar3 = local_20;
|
|
}
|
|
local_20 = iVar3 + 0x10;
|
|
spawnIndex = spawnIndex + 1;
|
|
} while (spawnIndex < *GHIDRA_CAST<uint16_t *>((room + 0x11)));
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 0082b2f0
|
|
uint8_t RoomConfig::LoadStagesXml(uint8_t *path)
|
|
{
|
|
RoomConfig *destString = this;
|
|
uint8_t bVar1;
|
|
uint32_t uVar2;
|
|
int *file;
|
|
int fileSize;
|
|
uint8_t *text;
|
|
void *node;
|
|
void *pvVar3;
|
|
std_string *rootBuffer;
|
|
uint8_t *strCursor;
|
|
uint8_t *literalCursor;
|
|
char *keyLiteral;
|
|
uint8_t *attrText;
|
|
std_string *destString;
|
|
uint64_t *allocCounter;
|
|
uint32_t *attr;
|
|
bool isLess;
|
|
int stageId;
|
|
std_string stageName;
|
|
std_string playerSpotPath;
|
|
std_string bossSpotPath;
|
|
std_string stageSuffix;
|
|
std_string normalMode;
|
|
std_string greedMode;
|
|
uint8_t xmlDoc [48];
|
|
uint8_t xmlMemoryPool [65564];
|
|
std_string roomsRoot;
|
|
std_string greedRoot;
|
|
std_string concatResult;
|
|
std_string bossGfxRoot;
|
|
void *savedExceptionList;
|
|
uint8_t *puStack_18;
|
|
uint32_t ehState;
|
|
uint64_t oldAllocBytes;
|
|
|
|
ehState = 0xffffffff;
|
|
puStack_18 = &LAB_00b01cdf;
|
|
savedExceptionList = ExceptionList;
|
|
uVar2 = __security_cookie ^ GHIDRA_UINT((xmlMemoryPool + 0x10090));
|
|
ExceptionList = &savedExceptionList;
|
|
file = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(path,GHIDRA_CAST<int *>(0x0));
|
|
if (file == GHIDRA_CAST<int *>(0x0)) {
|
|
bVar1 = 0;
|
|
}
|
|
else {
|
|
fileSize = (**(code **)(*file + 4))(uVar2);
|
|
text = operator_new_tracked(fileSize + 1);
|
|
(**(code **)(*file + 0x14))(text,1,fileSize);
|
|
text[fileSize] = 0;
|
|
(**(code **)*file)(1);
|
|
FUN_00413b90();
|
|
ehState = 0;
|
|
uVar2 = 0x82b3bf;
|
|
attrText = text;
|
|
(GHIDRA_CAST<rapidxml::xml_document *>((xmlDoc)))->rapidxml::xml_document::parse(text);
|
|
bVar1 = (uint8_t)attrText;
|
|
node = (GHIDRA_CAST<xml_node *>((xmlDoc)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("stages"),uVar2,bVar1);
|
|
pvVar3 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_attribute(&DAT_00b66f40,uVar2,bVar1);
|
|
if (pvVar3 == (void *)0x0) {
|
|
attrText = &DAT_00b6cbb4;
|
|
}
|
|
else {
|
|
attrText = &g_xmlNullStr;
|
|
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar3) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar3) + 4));
|
|
}
|
|
}
|
|
roomsRoot._size = 0;
|
|
roomsRoot._capacity = 0xf;
|
|
roomsRoot._buf[0] = '\0';
|
|
roomsRoot._buf[1] = '\0';
|
|
roomsRoot._buf[2] = '\0';
|
|
roomsRoot._buf[3] = '\0';
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
uVar2 = GHIDRA_INT(strCursor) - GHIDRA_INT((attrText + 1));
|
|
(GHIDRA_CAST<msvc::string *>((roomsRoot._buf)))->msvc::string::assign(attrText,uVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
|
|
pvVar3 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_attribute(GHIDRA_CAST<uint8_t *>("greedroot"),GHIDRA_UINT(attrText),(uint8_t)uVar2);
|
|
if (pvVar3 == (void *)0x0) {
|
|
attrText = GHIDRA_CAST<uint8_t *>("rooms/greed/");
|
|
}
|
|
else {
|
|
attrText = &g_xmlNullStr;
|
|
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar3) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar3) + 4));
|
|
}
|
|
}
|
|
greedRoot._size = 0;
|
|
greedRoot._capacity = 0xf;
|
|
greedRoot._buf[0] = '\0';
|
|
greedRoot._buf[1] = '\0';
|
|
greedRoot._buf[2] = '\0';
|
|
greedRoot._buf[3] = '\0';
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
uVar2 = GHIDRA_INT(strCursor) - GHIDRA_INT((attrText + 1));
|
|
(GHIDRA_CAST<msvc::string *>((greedRoot._buf)))->msvc::string::assign(attrText,uVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 2;
|
|
pvVar3 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_attribute(GHIDRA_CAST<uint8_t *>("bossgfxroot"),GHIDRA_UINT(attrText),(uint8_t)uVar2);
|
|
bossGfxRoot._size = 0;
|
|
bossGfxRoot._capacity = 0xf;
|
|
bossGfxRoot._buf[0] = '\0';
|
|
bossGfxRoot._buf[1] = '\0';
|
|
bossGfxRoot._buf[2] = '\0';
|
|
bossGfxRoot._buf[3] = '\0';
|
|
attrText = &g_xmlNullStr;
|
|
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar3) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar3) + 4));
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
uVar2 = GHIDRA_INT(strCursor) - GHIDRA_INT((attrText + 1));
|
|
(GHIDRA_CAST<msvc::string *>((bossGfxRoot._buf)))->msvc::string::assign(attrText,uVar2);
|
|
for (node = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("stage"),GHIDRA_INT(attrText),(uint8_t)uVar2);
|
|
node != (void *)0x0; node = *(void **)(GHIDRA_CAST<char *>(node) + 0x2c)) {
|
|
stageName._size = 0;
|
|
stageName._capacity = 0xf;
|
|
stageName._buf[0] = '\0';
|
|
stageName._buf[1] = '\0';
|
|
stageName._buf[2] = '\0';
|
|
stageName._buf[3] = '\0';
|
|
playerSpotPath._capacity = 0xf;
|
|
playerSpotPath._buf[0] = '\0';
|
|
playerSpotPath._buf[1] = '\0';
|
|
playerSpotPath._buf[2] = '\0';
|
|
playerSpotPath._buf[3] = '\0';
|
|
bossSpotPath._capacity = 0xf;
|
|
bossSpotPath._buf[0] = '\0';
|
|
bossSpotPath._buf[1] = '\0';
|
|
bossSpotPath._buf[2] = '\0';
|
|
bossSpotPath._buf[3] = '\0';
|
|
stageSuffix._size = 0;
|
|
stageSuffix._capacity = 0xf;
|
|
stageSuffix._buf[0] = '\0';
|
|
stageSuffix._buf[1] = '\0';
|
|
stageSuffix._buf[2] = '\0';
|
|
stageSuffix._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 7;
|
|
_eh_vector_constructor_iterator_(&normalMode,0x2c,2,RoomConfigMode::ctor,RoomConfigMode::dtor)
|
|
;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 8;
|
|
attr = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(node) + 0x20));
|
|
if (attr != GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
do {
|
|
attrText = GHIDRA_CAST<uint8_t *>(*attr);
|
|
literalCursor = s_id;
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < *literalCursor;
|
|
if (bVar1 != *literalCursor) {
|
|
LAB_0082b611:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082b616;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < literalCursor[1];
|
|
if (bVar1 != literalCursor[1]) goto LAB_0082b611;
|
|
strCursor = strCursor + 2;
|
|
literalCursor = literalCursor + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082b616:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
stageId = atoi(GHIDRA_CAST<char *>(attrText));
|
|
}
|
|
else {
|
|
literalCursor = s_name;
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < *literalCursor;
|
|
if (bVar1 != *literalCursor) {
|
|
LAB_0082b670:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082b675;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < literalCursor[1];
|
|
if (bVar1 != literalCursor[1]) goto LAB_0082b670;
|
|
literalCursor = literalCursor + 2;
|
|
strCursor = strCursor + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082b675:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
uVar2 = GHIDRA_INT(strCursor) - GHIDRA_INT((attrText + 1));
|
|
destString = &stageName;
|
|
LAB_0082bab2:
|
|
(GHIDRA_CAST<msvc::string *>((destString->_buf)))->msvc::string::assign(attrText,uVar2);
|
|
}
|
|
else {
|
|
literalCursor = &DAT_00b66e0c;
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < *literalCursor;
|
|
if (bVar1 != *literalCursor) {
|
|
LAB_0082b6d4:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082b6d9;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < literalCursor[1];
|
|
if (bVar1 != literalCursor[1]) goto LAB_0082b6d4;
|
|
strCursor = strCursor + 2;
|
|
literalCursor = literalCursor + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082b6d9:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
destString = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((attrText + 1))));
|
|
if (GHIDRA_CAST<std_string *>((0x7fffffff - roomsRoot._size)) < destString) {
|
|
LAB_0082bd57:
|
|
/* WARNING: Subroutine does not return */
|
|
msvc::string::_Xlen();
|
|
}
|
|
rootBuffer = &roomsRoot;
|
|
if (0xf < roomsRoot._capacity) {
|
|
rootBuffer = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(roomsRoot._buf))) + 0x0)));
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((concatResult._buf)))->msvc::string::concat(GHIDRA_INT(destString),destString,GHIDRA_CAST<uint8_t *>(rootBuffer),
|
|
roomsRoot._size,attrText,GHIDRA_UINT(destString));
|
|
(GHIDRA_CAST<msvc::string *>((normalMode._buf)))->msvc::string::_Tidy_deallocate();
|
|
normalMode._buf[0] = concatResult._buf[0];
|
|
normalMode._buf[1] = concatResult._buf[1];
|
|
normalMode._buf[2] = concatResult._buf[2];
|
|
normalMode._buf[3] = concatResult._buf[3];
|
|
normalMode._buf[4] = concatResult._buf[4];
|
|
normalMode._buf[5] = concatResult._buf[5];
|
|
normalMode._buf[6] = concatResult._buf[6];
|
|
normalMode._buf[7] = concatResult._buf[7];
|
|
normalMode._buf[8] = concatResult._buf[8];
|
|
normalMode._buf[9] = concatResult._buf[9];
|
|
normalMode._buf[10] = concatResult._buf[10];
|
|
normalMode._buf[0xb] = concatResult._buf[0xb];
|
|
normalMode._buf[0xc] = concatResult._buf[0xc];
|
|
normalMode._buf[0xd] = concatResult._buf[0xd];
|
|
normalMode._buf[0xe] = concatResult._buf[0xe];
|
|
normalMode._buf[0xf] = concatResult._buf[0xf];
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
destString = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((attrText + 1))));
|
|
if (GHIDRA_CAST<std_string *>((0x7fffffff - greedRoot._size)) < destString) goto LAB_0082bd57;
|
|
rootBuffer = &greedRoot;
|
|
if (0xf < greedRoot._capacity) {
|
|
rootBuffer = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(greedRoot._buf))) + 0x0)));
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((concatResult._buf)))->msvc::string::concat(GHIDRA_INT(destString),destString,GHIDRA_CAST<uint8_t *>(rootBuffer),
|
|
greedRoot._size,attrText,GHIDRA_UINT(destString));
|
|
(GHIDRA_CAST<msvc::string *>((greedMode._buf)))->msvc::string::_Tidy_deallocate();
|
|
greedMode._buf[0] = concatResult._buf[0];
|
|
greedMode._buf[1] = concatResult._buf[1];
|
|
greedMode._buf[2] = concatResult._buf[2];
|
|
greedMode._buf[3] = concatResult._buf[3];
|
|
greedMode._buf[4] = concatResult._buf[4];
|
|
greedMode._buf[5] = concatResult._buf[5];
|
|
greedMode._buf[6] = concatResult._buf[6];
|
|
greedMode._buf[7] = concatResult._buf[7];
|
|
greedMode._buf[8] = concatResult._buf[8];
|
|
greedMode._buf[9] = concatResult._buf[9];
|
|
greedMode._buf[10] = concatResult._buf[10];
|
|
greedMode._buf[0xb] = concatResult._buf[0xb];
|
|
greedMode._buf[0xc] = concatResult._buf[0xc];
|
|
greedMode._buf[0xd] = concatResult._buf[0xd];
|
|
greedMode._buf[0xe] = concatResult._buf[0xe];
|
|
greedMode._buf[0xf] = concatResult._buf[0xf];
|
|
greedMode._size = concatResult._size;
|
|
greedMode._capacity = concatResult._capacity;
|
|
}
|
|
else {
|
|
keyLiteral = "playerspot";
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < (uint8_t)*keyLiteral;
|
|
if (bVar1 != *keyLiteral) {
|
|
LAB_0082b800:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082b805;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < (uint8_t)keyLiteral[1];
|
|
if (bVar1 != keyLiteral[1]) goto LAB_0082b800;
|
|
strCursor = strCursor + 2;
|
|
keyLiteral = keyLiteral + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082b805:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
destString = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((attrText + 1))));
|
|
if (GHIDRA_CAST<std_string *>((0x7fffffff - bossGfxRoot._size)) < destString)
|
|
goto LAB_0082bd57;
|
|
rootBuffer = &bossGfxRoot;
|
|
if (0xf < bossGfxRoot._capacity) {
|
|
rootBuffer = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(bossGfxRoot._buf))) + 0x0)));
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((concatResult._buf)))->msvc::string::concat(GHIDRA_INT(destString),destString,GHIDRA_CAST<uint8_t *>(rootBuffer),
|
|
bossGfxRoot._size,attrText,GHIDRA_UINT(destString));
|
|
if (0xf < playerSpotPath._capacity) {
|
|
uVar2 = playerSpotPath._capacity + 1;
|
|
pvVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)playerSpotPath._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
pvVar3 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(playerSpotPath._buf)) + 0x0))) + -4);
|
|
uVar2 = playerSpotPath._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(playerSpotPath._buf)) + 0x0))) - GHIDRA_INT(pvVar3)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(pvVar3,uVar2);
|
|
}
|
|
playerSpotPath._buf[0] = concatResult._buf[0];
|
|
playerSpotPath._buf[1] = concatResult._buf[1];
|
|
playerSpotPath._buf[2] = concatResult._buf[2];
|
|
playerSpotPath._buf[3] = concatResult._buf[3];
|
|
playerSpotPath._capacity = concatResult._capacity;
|
|
}
|
|
else {
|
|
keyLiteral = "bossspot";
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < (uint8_t)*keyLiteral;
|
|
if (bVar1 != *keyLiteral) {
|
|
LAB_0082b8e6:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082b8eb;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < (uint8_t)keyLiteral[1];
|
|
if (bVar1 != keyLiteral[1]) goto LAB_0082b8e6;
|
|
strCursor = strCursor + 2;
|
|
keyLiteral = keyLiteral + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082b8eb:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
destString = GHIDRA_CAST<std_string *>((strCursor + -GHIDRA_INT((attrText + 1))));
|
|
if (GHIDRA_CAST<std_string *>((0x7fffffff - bossGfxRoot._size)) < destString)
|
|
goto LAB_0082bd57;
|
|
rootBuffer = &bossGfxRoot;
|
|
if (0xf < bossGfxRoot._capacity) {
|
|
rootBuffer = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(bossGfxRoot._buf))) + 0x0)));
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((concatResult._buf)))->msvc::string::concat(GHIDRA_INT(destString),destString,GHIDRA_CAST<uint8_t *>(rootBuffer),
|
|
bossGfxRoot._size,attrText,GHIDRA_UINT(destString));
|
|
if (0xf < bossSpotPath._capacity) {
|
|
uVar2 = bossSpotPath._capacity + 1;
|
|
pvVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)bossSpotPath._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
pvVar3 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossSpotPath._buf)) + 0x0))) + -4);
|
|
uVar2 = bossSpotPath._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossSpotPath._buf)) + 0x0))) - GHIDRA_INT(pvVar3)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(pvVar3,uVar2);
|
|
}
|
|
bossSpotPath._buf[0] = concatResult._buf[0];
|
|
bossSpotPath._buf[1] = concatResult._buf[1];
|
|
bossSpotPath._buf[2] = concatResult._buf[2];
|
|
bossSpotPath._buf[3] = concatResult._buf[3];
|
|
bossSpotPath._capacity = concatResult._capacity;
|
|
}
|
|
else {
|
|
keyLiteral = "music";
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < (uint8_t)*keyLiteral;
|
|
if (bVar1 != *keyLiteral) {
|
|
LAB_0082b9d0:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082b9d5;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < (uint8_t)keyLiteral[1];
|
|
if (bVar1 != keyLiteral[1]) goto LAB_0082b9d0;
|
|
keyLiteral = keyLiteral + 2;
|
|
strCursor = strCursor + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082b9d5:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
atoi(GHIDRA_CAST<char *>(attrText));
|
|
}
|
|
else {
|
|
keyLiteral = "backdrop";
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < (uint8_t)*keyLiteral;
|
|
if (bVar1 != *keyLiteral) {
|
|
LAB_0082ba30:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082ba35;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < (uint8_t)keyLiteral[1];
|
|
if (bVar1 != keyLiteral[1]) goto LAB_0082ba30;
|
|
keyLiteral = keyLiteral + 2;
|
|
strCursor = strCursor + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082ba35:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
atoi(GHIDRA_CAST<char *>(attrText));
|
|
}
|
|
else {
|
|
keyLiteral = "suffix";
|
|
strCursor = &g_xmlNullStr;
|
|
if (attrText != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
strCursor = attrText;
|
|
}
|
|
do {
|
|
bVar1 = *strCursor;
|
|
isLess = bVar1 < (uint8_t)*keyLiteral;
|
|
if (bVar1 != *keyLiteral) {
|
|
LAB_0082ba87:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_0082ba8c;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = strCursor[1];
|
|
isLess = bVar1 < (uint8_t)keyLiteral[1];
|
|
if (bVar1 != keyLiteral[1]) goto LAB_0082ba87;
|
|
strCursor = strCursor + 2;
|
|
keyLiteral = keyLiteral + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_0082ba8c:
|
|
if (uVar2 == 0) {
|
|
attrText = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attr[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
attrText = GHIDRA_CAST<uint8_t *>(attr[1]);
|
|
}
|
|
strCursor = attrText;
|
|
do {
|
|
bVar1 = *strCursor;
|
|
strCursor = strCursor + 1;
|
|
} while (bVar1 != 0);
|
|
uVar2 = GHIDRA_INT(strCursor) - GHIDRA_INT((attrText + 1));
|
|
destString = &stageSuffix;
|
|
goto LAB_0082bab2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} while ((attr[4] != 0) && (attr = GHIDRA_CAST<uint32_t *>(attr[6]), attr != GHIDRA_CAST<uint32_t *>(0x0)));
|
|
}
|
|
RoomConfigStage::operator_assign(&stageId);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 9;
|
|
_eh_vector_destructor_iterator_(&normalMode,0x2c,2,RoomConfigMode::dtor);
|
|
if (0xf < stageSuffix._capacity) {
|
|
uVar2 = stageSuffix._capacity + 1;
|
|
pvVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)stageSuffix._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
pvVar3 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(stageSuffix._buf)) + 0x0))) + -4);
|
|
uVar2 = stageSuffix._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(stageSuffix._buf)) + 0x0))) - GHIDRA_INT(pvVar3)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(pvVar3,uVar2);
|
|
}
|
|
stageSuffix._size = 0;
|
|
stageSuffix._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(stageSuffix._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(stageSuffix._buf)) + 0x0))) & 0xffffff00;
|
|
if (0xf < bossSpotPath._capacity) {
|
|
uVar2 = bossSpotPath._capacity + 1;
|
|
pvVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)bossSpotPath._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
pvVar3 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossSpotPath._buf)) + 0x0))) + -4);
|
|
uVar2 = bossSpotPath._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossSpotPath._buf)) + 0x0))) - GHIDRA_INT(pvVar3)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(pvVar3,uVar2);
|
|
}
|
|
if (0xf < playerSpotPath._capacity) {
|
|
uVar2 = playerSpotPath._capacity + 1;
|
|
pvVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)playerSpotPath._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
pvVar3 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(playerSpotPath._buf)) + 0x0))) + -4);
|
|
uVar2 = playerSpotPath._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(playerSpotPath._buf)) + 0x0))) - GHIDRA_INT(pvVar3)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(pvVar3,uVar2);
|
|
}
|
|
if (0xf < stageName._capacity) {
|
|
uVar2 = stageName._capacity + 1;
|
|
pvVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)stageName._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
pvVar3 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(stageName._buf)) + 0x0))) + -4);
|
|
uVar2 = stageName._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(stageName._buf)) + 0x0))) - GHIDRA_INT(pvVar3)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(pvVar3,uVar2);
|
|
}
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 2;
|
|
if (0xf < bossGfxRoot._capacity) {
|
|
uVar2 = bossGfxRoot._capacity + 1;
|
|
node = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)bossGfxRoot._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
node = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossGfxRoot._buf)) + 0x0))) + -4);
|
|
uVar2 = bossGfxRoot._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossGfxRoot._buf)) + 0x0))) + (-4 - GHIDRA_INT(node))))) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(node,uVar2);
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
|
|
if (0xf < greedRoot._capacity) {
|
|
uVar2 = greedRoot._capacity + 1;
|
|
node = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)greedRoot._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
node = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(greedRoot._buf)) + 0x0))) + -4);
|
|
uVar2 = greedRoot._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(greedRoot._buf)) + 0x0))) - GHIDRA_INT(node)) - 4U) goto LAB_0082bce0;
|
|
}
|
|
operator_delete(node,uVar2);
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0;
|
|
if (0xf < roomsRoot._capacity) {
|
|
uVar2 = roomsRoot._capacity + 1;
|
|
node = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)roomsRoot._buf)) + 0x0)));
|
|
if (0xfff < uVar2) {
|
|
node = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(roomsRoot._buf)) + 0x0))) + -4);
|
|
uVar2 = roomsRoot._capacity + 0x24;
|
|
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(roomsRoot._buf)) + 0x0))) - GHIDRA_INT(node)) - 4U) {
|
|
LAB_0082bce0:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(node,uVar2);
|
|
}
|
|
ehState = 10;
|
|
(GHIDRA_CAST<xml_memory_pool *>((xmlMemoryPool)))->xml_memory_pool::clear();
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocCounter = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if (text != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
uVar2 = *GHIDRA_CAST<uint32_t *>((text + -4));
|
|
oldAllocBytes = *allocCounter;
|
|
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocBytes) < uVar2));
|
|
free(text + -4);
|
|
}
|
|
bVar1 = 1;
|
|
}
|
|
ExceptionList = savedExceptionList;
|
|
return bVar1;
|
|
}
|
|
|
|
// 0082bf00
|
|
uint8_t RoomConfig::LoadCursesXml(uint8_t *path, uint8_t isAppend)
|
|
{
|
|
uint8_t *puVar1;
|
|
uint64_t qVar2;
|
|
uint8_t bVar3;
|
|
uint32_t uVar4;
|
|
uint8_t *pbVar5;
|
|
int *piVar6;
|
|
int iVar7;
|
|
void *node;
|
|
uint8_t ****text;
|
|
uint8_t *expectedAttrChar;
|
|
uint8_t ****ppppbVar8;
|
|
uint64_t *allocCounter;
|
|
uint8_t *pbVar9;
|
|
bool isCharLess;
|
|
uint8_t *pbStack_1007c;
|
|
int curseId;
|
|
uint8_t ****curseName [4];
|
|
uint32_t uStack_10064;
|
|
uint32_t uStack_10060;
|
|
uint8_t xmlDoc [48];
|
|
uint8_t xmlPool [65564];
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint32_t *attribute;
|
|
uint32_t curseCount;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01d2b;
|
|
local_10 = ExceptionList;
|
|
uVar4 = __security_cookie ^ GHIDRA_UINT((xmlPool + 0x10028));
|
|
ExceptionList = &local_10;
|
|
if (isAppend != 0) goto LAB_0082c007;
|
|
pbVar5 = *GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c58))));
|
|
puVar1 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c54)));
|
|
pbVar9 = *GHIDRA_CAST<uint8_t **>(puVar1);
|
|
if (pbVar9 != pbVar5) {
|
|
do {
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((pbVar9 + 4)))))->msvc::string::_Tidy_deallocate();
|
|
pbVar9 = pbVar9 + 0x1c;
|
|
} while (pbVar9 != pbVar5);
|
|
pbVar9 = *GHIDRA_CAST<uint8_t **>(puVar1);
|
|
}
|
|
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c58)))) = pbVar9;
|
|
curseCount = (GHIDRA_INT(pbVar9) - *GHIDRA_CAST<int *>(puVar1)) / 0x1c;
|
|
if (curseCount < 10) {
|
|
if (8 < curseCount) goto LAB_0082c007;
|
|
iVar7 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c5c)))) - *GHIDRA_CAST<int *>(puVar1);
|
|
if (GHIDRA_UINT((iVar7 / 0x1c)) < 9) {
|
|
FUN_0082e650(iVar7,&pbStack_1007c);
|
|
goto LAB_0082c007;
|
|
}
|
|
pbVar5 = GHIDRA_CAST<uint8_t *>(FUN_0082e340(pbVar9,9 - curseCount,pbStack_1007c));
|
|
}
|
|
else {
|
|
pbVar5 = GHIDRA_CAST<uint8_t *>((*GHIDRA_CAST<int *>(puVar1) + 0xfc));
|
|
pbStack_1007c = pbVar5;
|
|
if (pbVar5 != pbVar9) {
|
|
do {
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((pbVar5 + 4)))))->msvc::string::_Tidy_deallocate();
|
|
pbVar5 = pbVar5 + 0x1c;
|
|
} while (pbVar5 != pbVar9);
|
|
pbVar5 = pbStack_1007c;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c58)))) = pbVar5;
|
|
LAB_0082c007:
|
|
piVar6 = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(path,GHIDRA_CAST<int *>(0x0));
|
|
if (piVar6 == GHIDRA_CAST<int *>(0x0)) {
|
|
bVar3 = 0;
|
|
}
|
|
else {
|
|
iVar7 = (**(code **)(*piVar6 + 4))(uVar4);
|
|
pbVar5 = operator_new_tracked(iVar7 + 1);
|
|
pbStack_1007c = pbVar5;
|
|
(**(code **)(*piVar6 + 0x14))(pbVar5,1,iVar7);
|
|
pbVar5[iVar7] = 0;
|
|
(**(code **)*piVar6)(1);
|
|
FUN_00413b90();
|
|
local_8 = 0;
|
|
iVar7 = 0x82c073;
|
|
(GHIDRA_CAST<rapidxml::xml_document *>((xmlDoc)))->rapidxml::xml_document::parse(pbVar5);
|
|
bVar3 = (uint8_t)pbVar5;
|
|
node = (GHIDRA_CAST<xml_node *>((xmlDoc)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("curses"),iVar7,bVar3);
|
|
for (node = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("curse"),iVar7,bVar3); node != (void *)0x0;
|
|
node = *(void **)(GHIDRA_CAST<char *>(node) + 0x2c)) {
|
|
uStack_10064 = 0;
|
|
uStack_10060 = 0xf;
|
|
curseName[0] = GHIDRA_CAST<uint8_t ****>(0x0);
|
|
uVar4 = local_8 >> 8;
|
|
local_8 = CONCAT31((int3)uVar4,1);
|
|
for (attribute = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(node) + 0x20)); attribute != GHIDRA_CAST<uint32_t *>(0x0);
|
|
attribute = GHIDRA_CAST<uint32_t *>(attribute[6])) {
|
|
pbVar5 = GHIDRA_CAST<uint8_t *>(*attribute);
|
|
expectedAttrChar = s_id;
|
|
pbVar9 = &g_xmlNullStr;
|
|
if (pbVar5 != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
pbVar9 = pbVar5;
|
|
}
|
|
do {
|
|
bVar3 = *pbVar9;
|
|
isCharLess = bVar3 < *expectedAttrChar;
|
|
if (bVar3 != *expectedAttrChar) {
|
|
LAB_0082c105:
|
|
uVar4 = -GHIDRA_UINT(isCharLess) | 1;
|
|
goto LAB_0082c10a;
|
|
}
|
|
if (bVar3 == 0) break;
|
|
bVar3 = pbVar9[1];
|
|
isCharLess = bVar3 < expectedAttrChar[1];
|
|
if (bVar3 != expectedAttrChar[1]) goto LAB_0082c105;
|
|
pbVar9 = pbVar9 + 2;
|
|
expectedAttrChar = expectedAttrChar + 2;
|
|
} while (bVar3 != 0);
|
|
uVar4 = 0;
|
|
LAB_0082c10a:
|
|
if (uVar4 == 0) {
|
|
pbVar5 = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attribute[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
pbVar5 = GHIDRA_CAST<uint8_t *>(attribute[1]);
|
|
}
|
|
curseId = atoi(GHIDRA_CAST<char *>(pbVar5));
|
|
}
|
|
else {
|
|
expectedAttrChar = s_name;
|
|
pbVar9 = &g_xmlNullStr;
|
|
if (pbVar5 != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
pbVar9 = pbVar5;
|
|
}
|
|
do {
|
|
bVar3 = *pbVar9;
|
|
isCharLess = bVar3 < *expectedAttrChar;
|
|
if (bVar3 != *expectedAttrChar) {
|
|
LAB_0082c160:
|
|
uVar4 = -GHIDRA_UINT(isCharLess) | 1;
|
|
goto LAB_0082c165;
|
|
}
|
|
if (bVar3 == 0) break;
|
|
bVar3 = pbVar9[1];
|
|
isCharLess = bVar3 < expectedAttrChar[1];
|
|
if (bVar3 != expectedAttrChar[1]) goto LAB_0082c160;
|
|
pbVar9 = pbVar9 + 2;
|
|
expectedAttrChar = expectedAttrChar + 2;
|
|
} while (bVar3 != 0);
|
|
uVar4 = 0;
|
|
LAB_0082c165:
|
|
if (uVar4 == 0) {
|
|
pbVar5 = &g_xmlNullStr;
|
|
if (GHIDRA_CAST<uint8_t *>(attribute[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
pbVar5 = GHIDRA_CAST<uint8_t *>(attribute[1]);
|
|
}
|
|
pbVar9 = pbVar5;
|
|
do {
|
|
bVar3 = *pbVar9;
|
|
pbVar9 = pbVar9 + 1;
|
|
} while (bVar3 != 0);
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(curseName))))->msvc::string::assign(pbVar5,GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar5 + 1)));
|
|
}
|
|
}
|
|
if (attribute[4] == 0) break;
|
|
}
|
|
if (isAppend == 0) {
|
|
iVar7 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c54))));
|
|
*GHIDRA_CAST<int *>((iVar7 + curseId * 0x1c)) = curseId;
|
|
ppppbVar8 = GHIDRA_CAST<uint8_t ****>((iVar7 + 4 + curseId * 0x1c));
|
|
if (GHIDRA_CAST<uint8_t *****>(ppppbVar8) != curseName) {
|
|
text = GHIDRA_CAST<uint8_t ****>(curseName);
|
|
if (0xf < uStack_10060) {
|
|
text = curseName[0];
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(ppppbVar8))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(text),uStack_10064);
|
|
}
|
|
}
|
|
else {
|
|
piVar6 = *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c58))));
|
|
curseId = (GHIDRA_INT(piVar6) - *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c54))))) / 0x1c;
|
|
if (piVar6 == *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c5c))))) {
|
|
FUN_0082e0e0(piVar6,&curseId);
|
|
}
|
|
else {
|
|
*piVar6 = curseId;
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((piVar6 + 1)))))->msvc::string::string(curseName);
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c58)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x1c58)))) + 0x1c;
|
|
}
|
|
}
|
|
local_8 = local_8 & 0xffffff00;
|
|
if (0xf < uStack_10060) {
|
|
uVar4 = uStack_10060 + 1;
|
|
ppppbVar8 = curseName[0];
|
|
if (0xfff < uVar4) {
|
|
ppppbVar8 = GHIDRA_CAST<uint8_t ****>(curseName[0][-1]);
|
|
uVar4 = uStack_10060 + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(curseName[0]) + (-4 - GHIDRA_INT(ppppbVar8))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(ppppbVar8,uVar4);
|
|
}
|
|
}
|
|
local_8 = 2;
|
|
(GHIDRA_CAST<xml_memory_pool *>((xmlPool)))->xml_memory_pool::clear();
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocCounter = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if (pbStack_1007c != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>((pbStack_1007c + -4));
|
|
qVar2 = *allocCounter;
|
|
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar4));
|
|
free(pbStack_1007c + -4);
|
|
}
|
|
bVar3 = 1;
|
|
}
|
|
ExceptionList = local_10;
|
|
return bVar3;
|
|
}
|
|
|
|
// 0082d000
|
|
std_string * RoomConfig::GetStageDisplayName(std_string *outName, int stageId, int language)
|
|
{
|
|
RoomConfigStage::GetDisplayName
|
|
(GHIDRA_CAST<RoomConfig_Stage *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x0))) + stageId * 0xc4)),outName,language);
|
|
return outName;
|
|
}
|
|
|
|
// 0082d030
|
|
uint32_t RoomConfig::GetStageID(uint32_t levelStage, uint32_t stageType, int mode)
|
|
{
|
|
uint32_t uVar1;
|
|
|
|
if (mode == -1) {
|
|
if ((g_game != GHIDRA_CAST<Game *>(0x0)) && ((g_game->_difficulty == 2 || (g_game->_difficulty == 3)))) {
|
|
LAB_0082d065:
|
|
if (levelStage == 7) {
|
|
return 0x19;
|
|
}
|
|
if (levelStage == 6) {
|
|
return 0x18;
|
|
}
|
|
if (levelStage == 5) {
|
|
return 0xe;
|
|
}
|
|
if (stageType == 4) {
|
|
return levelStage * 2 + 0x19;
|
|
}
|
|
if (stageType == 5) {
|
|
return levelStage * 2 + 0x1a;
|
|
}
|
|
return stageType + levelStage * 3 + -2;
|
|
}
|
|
}
|
|
else if (mode == 1) goto LAB_0082d065;
|
|
if (levelStage == 0xd) {
|
|
return 0x23;
|
|
}
|
|
if (8 < GHIDRA_INT(levelStage)) {
|
|
if (levelStage == 9) {
|
|
uVar1 = 0xd;
|
|
if (stageType == 4) {
|
|
uVar1 = 0x24;
|
|
}
|
|
return uVar1;
|
|
}
|
|
if (levelStage == 0xc) {
|
|
return 0x1a;
|
|
}
|
|
return stageType + (levelStage - 3) * 2;
|
|
}
|
|
if (stageType == 4) {
|
|
return (levelStage - 1 & 0xfffffffe) + 0x1b;
|
|
}
|
|
uVar1 = levelStage - 1 >> 1;
|
|
if (stageType == 5) {
|
|
return uVar1 * 2 + 0x1c;
|
|
}
|
|
return stageType + 1 + uVar1 * 3;
|
|
}
|
|
|
|
// 0082d100
|
|
int RoomConfig::GetStageIdByName(std_string *name)
|
|
{
|
|
uint8_t bVar1;
|
|
uint8_t *nameEnd;
|
|
uint32_t *foundNode;
|
|
uint8_t *nameEnd;
|
|
int compareResult;
|
|
void *ptr;
|
|
uint8_t *puVar4;
|
|
uint32_t stageIdx;
|
|
uint8_t *nameMapHead;
|
|
int nameMapSize;
|
|
void *stageName [3];
|
|
uint8_t local_20 [4];
|
|
uint32_t local_1c;
|
|
uint8_t *local_18;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint8_t *foundNode;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01e65;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT((local_20 + 0x1c));
|
|
ExceptionList = &local_10;
|
|
nameMapHead = GHIDRA_CAST<uint8_t *>(0x0);
|
|
nameMapSize = 0;
|
|
nameMapHead = operator_new(0x2c);
|
|
*GHIDRA_CAST<uint8_t **>(nameMapHead) = nameMapHead;
|
|
*GHIDRA_CAST<uint8_t **>((nameMapHead + 4)) = nameMapHead;
|
|
*GHIDRA_CAST<uint8_t **>((nameMapHead + 8)) = nameMapHead;
|
|
*GHIDRA_CAST<uint16_t *>((nameMapHead + 0xc)) = 0x101;
|
|
local_8 = 0;
|
|
if (nameMapSize == 0) {
|
|
stageIdx = 1;
|
|
do {
|
|
nameEnd = (&PTR_DAT_00b1fd50)[stageIdx];
|
|
local_1c = 0;
|
|
local_18 = &DAT_0000000f;
|
|
stageName[0] = (void *)0x0;
|
|
nameEnd = nameEnd;
|
|
do {
|
|
bVar1 = *nameEnd;
|
|
nameEnd = nameEnd + 1;
|
|
} while (bVar1 != 0);
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(stageName))))->msvc::string::assign(nameEnd,GHIDRA_INT(nameEnd) - GHIDRA_INT((nameEnd + 1)));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
|
|
foundNode = GHIDRA_CAST<uint32_t *>(std)::map<msvc::string_int>::operator_index(stageName);
|
|
local_8 = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_8))) + 0x1))) << 8;
|
|
*foundNode = stageIdx;
|
|
if (&DAT_0000000f < local_18) {
|
|
puVar4 = local_18 + 1;
|
|
ptr = stageName[0];
|
|
if (GHIDRA_CAST<uint8_t *>(0xfff) < puVar4) {
|
|
ptr = *(void **)(GHIDRA_INT(stageName[0]) + -4);
|
|
puVar4 = local_18 + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(stageName[0]) + (-4 - GHIDRA_INT(ptr))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(ptr,GHIDRA_UINT(puVar4));
|
|
}
|
|
stageIdx = stageIdx + 1;
|
|
} while (stageIdx < 0x1e);
|
|
}
|
|
puVar4 = nameMapHead;
|
|
msvc::map<msvc::string>::_Find_lower_bound(local_20,name);
|
|
foundNode = local_18;
|
|
if (local_18[0xd] == '\0') {
|
|
nameEnd = local_18 + 0x10;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((local_18 + 0x24))) {
|
|
nameEnd = *GHIDRA_CAST<uint8_t **>(nameEnd);
|
|
}
|
|
foundNode = &name->_size;
|
|
if (0xf < name->_capacity) {
|
|
name = *GHIDRA_CAST<std_string **>(name->_buf);
|
|
}
|
|
compareResult = string_compare(GHIDRA_CAST<uint8_t *>(name),*foundNode,nameEnd,*GHIDRA_CAST<uint32_t *>((local_18 + 0x20)));
|
|
if ((-1 < compareResult) && (foundNode != puVar4)) {
|
|
compareResult = *GHIDRA_CAST<int *>((foundNode + 0x28));
|
|
goto LAB_0082d24b;
|
|
}
|
|
}
|
|
compareResult = 0;
|
|
LAB_0082d24b:
|
|
msvc::map<msvc::string_int>::_Erase_tree(&nameMapHead,*GHIDRA_CAST<uint32_t *>((puVar4 + 4)));
|
|
operator_delete(nameMapHead,0x2c);
|
|
ExceptionList = local_10;
|
|
return compareResult;
|
|
}
|
|
|
|
// 0082d320
|
|
void RoomConfig::ClearGeneratedRooms()
|
|
{
|
|
uint32_t *ptr;
|
|
int *roomListHead;
|
|
void *heap;
|
|
uint64_t *allocatedBytes;
|
|
int entryOffset;
|
|
int *roomNode;
|
|
int entry;
|
|
uint32_t entryIndex;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t uStack_8;
|
|
uint32_t *allocBlock;
|
|
uint32_t allocSize;
|
|
uint32_t *nextNode;
|
|
uint64_t prevAllocatedBytes;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01e90;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("delete %d generated rooms.\n"));
|
|
roomListHead = *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0))));
|
|
roomNode = GHIDRA_CAST<int *>(*roomListHead);
|
|
if (roomNode != roomListHead) {
|
|
heap = g_mainHeap;
|
|
do {
|
|
if ((short)roomNode[0x13] != 0) {
|
|
entryIndex = 0;
|
|
entryOffset = 0;
|
|
do {
|
|
entry = roomNode[0x12] + entryOffset;
|
|
if (*GHIDRA_CAST<char *>((entry + 8)) != '\0') {
|
|
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(heap) + 0x30));
|
|
if (heap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((entry + 4)) != 0) {
|
|
allocBlock = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((entry + 4)) + -4));
|
|
allocSize = *allocBlock;
|
|
prevAllocatedBytes = *allocatedBytes;
|
|
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - allocSize;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < allocSize))
|
|
;
|
|
free(allocBlock);
|
|
heap = g_mainHeap;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((entry + 4)) = 0;
|
|
entryOffset = entryOffset + 0x10;
|
|
*GHIDRA_CAST<uint8_t *>((entry + 8)) = 0;
|
|
entryIndex = entryIndex + 1;
|
|
} while (entryIndex < *GHIDRA_CAST<uint16_t *>((roomNode + 0x13)));
|
|
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(heap) + 0x30));
|
|
if (heap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
if (roomNode[0x12] != 0) {
|
|
allocBlock = GHIDRA_CAST<uint32_t *>((roomNode[0x12] + -4));
|
|
allocSize = *allocBlock;
|
|
prevAllocatedBytes = *allocatedBytes;
|
|
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - allocSize;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < allocSize));
|
|
free(allocBlock);
|
|
heap = g_mainHeap;
|
|
}
|
|
}
|
|
roomNode[0x12] = 0;
|
|
*GHIDRA_CAST<uint16_t *>((roomNode + 0x13)) = 0;
|
|
roomNode = GHIDRA_CAST<int *>(*roomNode);
|
|
roomListHead = *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0))));
|
|
} while (roomNode != roomListHead);
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>(roomListHead[1]) = 0;
|
|
ptr = GHIDRA_CAST<uint32_t *>(*roomListHead);
|
|
while (ptr != GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
nextNode = GHIDRA_CAST<uint32_t *>(*ptr);
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((ptr + 7)))))->msvc::string::_Tidy_deallocate();
|
|
operator_delete(ptr,100);
|
|
ptr = nextNode;
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>(*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0))))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0))));
|
|
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0)))) + 4)) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0))));
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c4)))) = 0;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 0082dac0
|
|
RoomConfig_Room * RoomConfig::make_generated_room(RoomConfig_Room *source)
|
|
{
|
|
uint32_t doorWord;
|
|
void *pvVar1;
|
|
uint32_t *dstSpawn;
|
|
uint32_t uVar2;
|
|
uint32_t doorBit;
|
|
short *srcSpawn;
|
|
uint32_t doorBits;
|
|
int srcEntries;
|
|
int srcSpawnOffset;
|
|
uint32_t entryIndex;
|
|
uint32_t spawnIndex;
|
|
uint32_t doorRemap [8];
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
int dstEntries;
|
|
int newNode;
|
|
char shapeFlag;
|
|
int srcEntries;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01f26;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT((doorRemap + 0xc));
|
|
ExceptionList = &local_10;
|
|
msvc::list<92byte>::resize(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c4)))) + 1);
|
|
srcEntries = source->Shape;
|
|
doorRemap[0] = 2;
|
|
newNode = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c0)))) + 4));
|
|
doorRemap[2] = 0;
|
|
doorRemap[4] = 6;
|
|
*GHIDRA_CAST<int *>((newNode + 0x34)) = source->Difficulty;
|
|
*GHIDRA_CAST<uint32_t *>((newNode + 0x40)) = 0;
|
|
shapeFlag = (&DAT_00b1f8cc)[srcEntries * 8];
|
|
doorRemap[6] = 4;
|
|
doorRemap[1] = GHIDRA_UINT((shapeFlag != '\0')) * 4 + 1;
|
|
doorRemap[3] = GHIDRA_UINT((shapeFlag != '\0')) * 4 + 3;
|
|
doorRemap[5] = GHIDRA_UINT((shapeFlag == '\0')) * 4 + 1;
|
|
uVar2 = 0;
|
|
doorRemap[7] = GHIDRA_UINT((shapeFlag == '\0')) * 4 + 3;
|
|
do {
|
|
doorWord = uVar2 >> 5;
|
|
doorBit = 1 << ((uint8_t)uVar2 & 0x1f);
|
|
doorBits = *GHIDRA_CAST<uint32_t *>((newNode + 0x40 + doorWord * 4));
|
|
if (((&source->Doors)[doorRemap[uVar2] >> 5] & 1 << ((uint8_t)doorRemap[uVar2] & 0x1f)) == 0) {
|
|
doorBits = doorBits & ~doorBit;
|
|
}
|
|
else {
|
|
doorBits = doorBits | doorBit;
|
|
}
|
|
uVar2 = uVar2 + 1;
|
|
*GHIDRA_CAST<uint32_t *>((newNode + 0x40 + doorWord * 4)) = doorBits;
|
|
} while (uVar2 < 8);
|
|
*GHIDRA_CAST<uint8_t *>((newNode + 0x4e)) = source->Width;
|
|
*GHIDRA_CAST<uint8_t *>((newNode + 0x4f)) = source->Height;
|
|
*GHIDRA_CAST<uint32_t *>((newNode + 0x3c)) = 0x3f800000;
|
|
*GHIDRA_CAST<uint32_t *>((newNode + 0x38)) = 0x3f800000;
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((newNode + 0x1c)))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("generated"),9);
|
|
*GHIDRA_CAST<uint32_t *>((newNode + 0x50)) = *GHIDRA_CAST<uint32_t *>((&DAT_00b1f8c8 + srcEntries * 8));
|
|
(GHIDRA_CAST<RoomConfig_Room *>((newNode + 8)))->StageId = source->StageId;
|
|
*GHIDRA_CAST<int *>((newNode + 0x10)) = source->Type;
|
|
*GHIDRA_CAST<int *>((newNode + 0x14)) = source->Variant;
|
|
*GHIDRA_CAST<int *>((newNode + 0x18)) = source->Subtype;
|
|
*GHIDRA_CAST<uint32_t *>((newNode + 0x54)) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((source)) + 0x4c)))) | 0x20;
|
|
uVar2 = GHIDRA_UINT((uint16_t)source->SpawnCount);
|
|
*GHIDRA_CAST<short *>((newNode + 0x4c)) = source->SpawnCount;
|
|
pvVar1 = operator_new_tracked(uVar2 * 0x10);
|
|
if (pvVar1 == (void *)0x0) {
|
|
pvVar1 = (void *)0x0;
|
|
}
|
|
else if (uVar2 != 0) {
|
|
dstSpawn = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(pvVar1) + 4));
|
|
do {
|
|
dstSpawn[-1] = 0;
|
|
*dstSpawn = 0;
|
|
*GHIDRA_CAST<uint8_t *>((dstSpawn + 1)) = 0;
|
|
dstSpawn[2] = 0;
|
|
uVar2 = uVar2 - 1;
|
|
dstSpawn = dstSpawn + 4;
|
|
} while (uVar2 != 0);
|
|
}
|
|
local_8 = 0xffffffff;
|
|
*(void **)(newNode + 0x48) = pvVar1;
|
|
spawnIndex = 0;
|
|
if (source->SpawnCount != 0) {
|
|
dstSpawn = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(pvVar1) + 0xc));
|
|
srcSpawnOffset = 0;
|
|
do {
|
|
srcSpawn = GHIDRA_CAST<short *>((GHIDRA_INT(source->Spawns) + srcSpawnOffset));
|
|
*GHIDRA_CAST<uint16_t *>((dstSpawn + -3)) = ((uint16_t)*GHIDRA_CAST<uint8_t *>((newNode + 0x4e)) - *srcSpawn) + -1;
|
|
*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(dstSpawn) + -10)) = srcSpawn[1];
|
|
*dstSpawn = *GHIDRA_CAST<uint32_t *>((srcSpawn + 6));
|
|
*GHIDRA_CAST<char *>((dstSpawn + -1)) = (char)srcSpawn[4];
|
|
if (*GHIDRA_CAST<uint8_t *>((srcSpawn + 4)) != 0) {
|
|
pvVar1 = operator_new_tracked(GHIDRA_UINT(*GHIDRA_CAST<uint8_t *>((srcSpawn + 4))) * 0xc);
|
|
dstSpawn[-2] = pvVar1;
|
|
entryIndex = 0;
|
|
if ((char)srcSpawn[4] != '\0') {
|
|
srcEntries = 0;
|
|
do {
|
|
srcEntries = *GHIDRA_CAST<int *>((srcSpawn + 2));
|
|
dstEntries = dstSpawn[-2];
|
|
*GHIDRA_CAST<uint64_t *>((dstEntries + srcEntries)) = *GHIDRA_CAST<uint64_t *>((srcEntries + srcEntries));
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<uint64_t *>((dstEntries + srcEntries)) + 1)) =
|
|
*GHIDRA_CAST<uint32_t *>((srcEntries + 8 + srcEntries));
|
|
FUN_0082dd80();
|
|
srcEntries = srcEntries + 0xc;
|
|
entryIndex = entryIndex + 1;
|
|
} while (entryIndex < *GHIDRA_CAST<uint8_t *>((srcSpawn + 4)));
|
|
}
|
|
}
|
|
dstSpawn = dstSpawn + 4;
|
|
srcSpawnOffset = srcSpawnOffset + 0x10;
|
|
spawnIndex = spawnIndex + 1;
|
|
} while (spawnIndex < (uint16_t)source->SpawnCount);
|
|
}
|
|
ExceptionList = local_10;
|
|
return GHIDRA_CAST<RoomConfig_Room *>((newNode + 8));
|
|
}
|