The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body. src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT, from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra). structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
#include "classes.h"
|
|
|
|
// 00828e50
|
|
void * RoomSet::GetVariantSet(uint type)
|
|
{
|
|
undefined4 *variantSet;
|
|
qword *allocatedBytes;
|
|
uint insertKey;
|
|
undefined4 *insertValue;
|
|
undefined1 local_14 [8];
|
|
RoomSet local_c;
|
|
qword prevAllocatedBytes;
|
|
uint roomType;
|
|
|
|
_Find_lower_bound<>(local_14,&type);
|
|
roomType = type;
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_c) + 0xd)) == '\0') && (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(local_c) + 0x10)) <= type)) &&
|
|
(local_c != this[8])) {
|
|
return *(void **)(GHIDRA_CAST<char *>(local_c) + 0x14);
|
|
}
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
variantSet = malloc(8);
|
|
if (variantSet == GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
FUN_00a23200(0x7fcb9dd6);
|
|
}
|
|
else {
|
|
prevAllocatedBytes = *allocatedBytes;
|
|
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) + 8;
|
|
*variantSet = 8;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) + GHIDRA_UINT((0xfffffff7 < GHIDRA_UINT(prevAllocatedBytes)));
|
|
variantSet = variantSet + 1;
|
|
if (variantSet != GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
*variantSet = 0;
|
|
goto LAB_00828ec0;
|
|
}
|
|
}
|
|
variantSet = GHIDRA_CAST<undefined4 *>(0x0);
|
|
LAB_00828ec0:
|
|
insertKey = roomType;
|
|
insertValue = variantSet;
|
|
std::map<unsigned_int_int>::insert(local_14,&insertKey);
|
|
return variantSet;
|
|
}
|