--check: 938/3256 method bodies compile for x86_64 (28.8%), 32-bit layout asserts hold; boot path 3/626 curated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
197 lines
7.6 KiB
C++
197 lines
7.6 KiB
C++
#include "classes.h"
|
|
|
|
// 00828b60
|
|
void RoomConfigMode::ctor()
|
|
{
|
|
void *treeHead;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
|
|
puStack_c = &LAB_00af192d;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
*GHIDRA_CAST<uint32_t *>(this) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0xf;
|
|
*GHIDRA_CAST<uint8_t *>(this) = 0;
|
|
local_8 = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x18)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x1c)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x20)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x24)) = 0;
|
|
treeHead = operator_new(0x18);
|
|
*(void **)treeHead = treeHead;
|
|
*(void **)(GHIDRA_CAST<char *>(treeHead) + 4) = treeHead;
|
|
*(void **)(GHIDRA_CAST<char *>(treeHead) + 8) = treeHead;
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(treeHead) + 0xc)) = 0x101;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x20)) = treeHead;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 0x28)) = 0;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00828c00
|
|
void RoomConfigMode::Clear()
|
|
{
|
|
void *roomMap = this;
|
|
uint32_t *this_00;
|
|
uint64_t qVar1;
|
|
void *pvVar2;
|
|
uint64_t *allocCounter;
|
|
int spawnOffset;
|
|
int spawnEntry;
|
|
int *mapNode;
|
|
int room;
|
|
int *piVar3;
|
|
int roomOffset;
|
|
uint32_t roomIdx;
|
|
uint32_t spawnIdx;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t uStack_8;
|
|
uint32_t *blockHeader;
|
|
uint32_t blockSize;
|
|
uint32_t *entryList;
|
|
char isNil;
|
|
void *nextNode;
|
|
int *parentNode;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b01a70;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(roomMap) + 0x1c)) != 0) {
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("delete %d rooms.\n"));
|
|
roomIdx = 0;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(roomMap) + 0x1c)) != 0) {
|
|
roomOffset = 0;
|
|
pvVar2 = g_mainHeap;
|
|
do {
|
|
room = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(roomMap) + 0x18)) + roomOffset;
|
|
if (*GHIDRA_CAST<short *>((room + 0x44)) != 0) {
|
|
spawnIdx = 0;
|
|
spawnOffset = 0;
|
|
do {
|
|
spawnEntry = *GHIDRA_CAST<int *>((room + 0x40)) + spawnOffset;
|
|
if (*GHIDRA_CAST<char *>((spawnEntry + 8)) != '\0') {
|
|
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(pvVar2) + 0x30));
|
|
if (pvVar2 == (void *)0x0) {
|
|
allocCounter = &g_allocatedBytesNoHeap;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((spawnEntry + 4)) != 0) {
|
|
blockHeader = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((spawnEntry + 4)) + -4));
|
|
blockSize = *blockHeader;
|
|
qVar1 = *allocCounter;
|
|
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - blockSize;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < blockSize));
|
|
free(blockHeader);
|
|
pvVar2 = g_mainHeap;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((spawnEntry + 4)) = 0;
|
|
spawnOffset = spawnOffset + 0x10;
|
|
*GHIDRA_CAST<uint8_t *>((spawnEntry + 8)) = 0;
|
|
spawnIdx = spawnIdx + 1;
|
|
} while (spawnIdx < *GHIDRA_CAST<uint16_t *>((room + 0x44)));
|
|
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(pvVar2) + 0x30));
|
|
if (pvVar2 == (void *)0x0) {
|
|
allocCounter = &g_allocatedBytesNoHeap;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((room + 0x40)) != 0) {
|
|
blockHeader = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((room + 0x40)) + -4));
|
|
blockSize = *blockHeader;
|
|
qVar1 = *allocCounter;
|
|
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - blockSize;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < blockSize));
|
|
free(blockHeader);
|
|
pvVar2 = g_mainHeap;
|
|
}
|
|
uStack_8 = 0xffffffff;
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((room + 0x40)) = 0;
|
|
roomIdx = roomIdx + 1;
|
|
*GHIDRA_CAST<uint16_t *>((room + 0x44)) = 0;
|
|
roomOffset = roomOffset + 0x5c;
|
|
} while (roomIdx < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(roomMap) + 0x1c)));
|
|
}
|
|
pvVar2 = *(void **)(GHIDRA_CAST<char *>(roomMap) + 0x18);
|
|
if (pvVar2 != (void *)0x0) {
|
|
blockHeader = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(pvVar2) + -4));
|
|
uStack_8 = 2;
|
|
_eh_vector_destructor_iterator_(pvVar2,0x5c,*blockHeader,RoomConfigRoom::dtor);
|
|
operator_delete(blockHeader,*blockHeader * 0x5c + 4);
|
|
}
|
|
}
|
|
piVar3 = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(roomMap) + 0x20));
|
|
this_00 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(roomMap) + 0x20));
|
|
mapNode = GHIDRA_CAST<int *>(*piVar3);
|
|
if (mapNode != piVar3) {
|
|
do {
|
|
entryList = GHIDRA_CAST<uint32_t *>(mapNode[5]);
|
|
if (entryList != GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
pvVar2 = (void *)*entryList;
|
|
while (pvVar2 != (void *)0x0) {
|
|
nextNode = *(void **)(GHIDRA_CAST<char *>(pvVar2) + 8);
|
|
operator_delete(pvVar2,0xc);
|
|
pvVar2 = nextNode;
|
|
}
|
|
*entryList = 0;
|
|
operator_delete(entryList,4);
|
|
mapNode[5] = 0;
|
|
}
|
|
piVar3 = GHIDRA_CAST<int *>(mapNode[2]);
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar3) + 0xd)) == '\0') {
|
|
isNil = *GHIDRA_CAST<char *>((*piVar3 + 0xd));
|
|
mapNode = piVar3;
|
|
piVar3 = GHIDRA_CAST<int *>(*piVar3);
|
|
while (isNil == '\0') {
|
|
isNil = *GHIDRA_CAST<char *>((*piVar3 + 0xd));
|
|
mapNode = piVar3;
|
|
piVar3 = GHIDRA_CAST<int *>(*piVar3);
|
|
}
|
|
}
|
|
else {
|
|
isNil = *GHIDRA_CAST<char *>((mapNode[1] + 0xd));
|
|
parentNode = GHIDRA_CAST<int *>(mapNode[1]);
|
|
piVar3 = mapNode;
|
|
while ((mapNode = parentNode, isNil == '\0' && (piVar3 == GHIDRA_CAST<int *>(mapNode[2])))) {
|
|
isNil = *GHIDRA_CAST<char *>((mapNode[1] + 0xd));
|
|
parentNode = GHIDRA_CAST<int *>(mapNode[1]);
|
|
piVar3 = mapNode;
|
|
}
|
|
}
|
|
piVar3 = GHIDRA_CAST<int *>(*this_00);
|
|
} while (mapNode != piVar3);
|
|
}
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(this_00,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)this_00,
|
|
(_Tree_node<unsigned_int,void*> *)piVar3[1]);
|
|
piVar3[1] = GHIDRA_INT(piVar3);
|
|
*piVar3 = GHIDRA_INT(piVar3);
|
|
piVar3[2] = GHIDRA_INT(piVar3);
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(roomMap) + 0x24)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(roomMap) + 0x1c)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(roomMap) + 0x18)) = 0;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(roomMap) + 0x28)) = 0;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00829260
|
|
void RoomConfigMode::dtor()
|
|
{
|
|
char *this;
|
|
char *in_ECX;
|
|
|
|
this = in_ECX + 0x20;
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(this,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)this,
|
|
*(_Tree_node<unsigned_int,void*> **)(*GHIDRA_CAST<int *>((in_ECX + 0x20)) + 4));
|
|
operator_delete(*(void **)this,0x18);
|
|
(GHIDRA_CAST<msvc::string *>((in_ECX)))->msvc::string::_Tidy_deallocate();
|
|
return;
|
|
}
|