Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
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>
This commit is contained in:
1 parent
2ff2d5d87f
commit
3ce74c6e2d
331 files changed
+485
-7835
No files matched your search
@@ -0,0 +1,90 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 0041c490
|
||||
void EntityPartition::query_box(EntityList_EL *outList, Vector *position, Vector *extent)
|
||||
{
|
||||
float *pfVar1;
|
||||
int iVar2;
|
||||
float *pfVar3;
|
||||
void *isSeen;
|
||||
int resultSize;
|
||||
qword *allocatedBytes;
|
||||
int iVar4;
|
||||
int iVar5;
|
||||
int iVar6;
|
||||
uint uVar7;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 uStack_8;
|
||||
float cellSize;
|
||||
int column;
|
||||
int entityIndex;
|
||||
float extentX;
|
||||
qword oldAllocated;
|
||||
float posXCopy;
|
||||
|
||||
uStack_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00af1690;
|
||||
local_10 = ExceptionList;
|
||||
ExceptionList = &local_10;
|
||||
if (*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>(this) + 0xd4)) != 0) {
|
||||
isSeen = operator_new_tracked(*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>(this) + 0xd4)));
|
||||
memset(isSeen,0,*GHIDRA_CAST<size_t *>((*GHIDRA_CAST<int *>(this) + 0xd4)));
|
||||
extentX = extent->x;
|
||||
pfVar3 = &position->x;
|
||||
pfVar1 = &position->y;
|
||||
cellSize = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x14));
|
||||
posXCopy = position->x;
|
||||
position = GHIDRA_CAST<Vector *>(GHIDRA_INT(((position->y - extent->y) / cellSize)));
|
||||
iVar5 = GHIDRA_INT(((extent->y + *pfVar1) / cellSize));
|
||||
iVar6 = GHIDRA_INT(((*pfVar3 - extentX) / cellSize));
|
||||
if (GHIDRA_INT(position) <= iVar5) {
|
||||
column = iVar6;
|
||||
do {
|
||||
for (; column <= GHIDRA_INT(((extentX + posXCopy) / cellSize)); column = column + 1) {
|
||||
iVar4 = column + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) * GHIDRA_INT(position);
|
||||
if ((-1 < iVar4) &&
|
||||
(iVar4 < (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18))) / 0xa4)) {
|
||||
uVar7 = 0;
|
||||
iVar4 = iVar4 * 0xa4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18));
|
||||
if (*GHIDRA_CAST<int *>((iVar4 + 0xa0)) != 0) {
|
||||
do {
|
||||
iVar2 = *GHIDRA_CAST<int *>((iVar4 + uVar7 * 4));
|
||||
entityIndex = *GHIDRA_CAST<int *>((iVar2 + 0x24));
|
||||
if (*GHIDRA_CAST<char *>((entityIndex + GHIDRA_INT(isSeen))) == '\0') {
|
||||
resultSize = outList->_size;
|
||||
if (GHIDRA_UINT(outList->_capacity) < resultSize + 1U) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
||||
resultSize = outList->_size;
|
||||
}
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outList->_data) + resultSize * 4)) = iVar2;
|
||||
outList->_size = outList->_size + 1;
|
||||
*GHIDRA_CAST<undefined1 *>((entityIndex + GHIDRA_INT(isSeen))) = 1;
|
||||
}
|
||||
uVar7 = uVar7 + 1;
|
||||
} while (uVar7 < *GHIDRA_CAST<uint *>((iVar4 + 0xa0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
position = GHIDRA_CAST<Vector *>((GHIDRA_INT(&position->x) + 1));
|
||||
column = iVar6;
|
||||
} while (GHIDRA_INT(position) <= iVar5);
|
||||
}
|
||||
if (g_mainHeap == (void *)0x0) {
|
||||
allocatedBytes = &g_allocatedBytesNoHeap;
|
||||
}
|
||||
else {
|
||||
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
||||
}
|
||||
if (isSeen != (void *)0x0) {
|
||||
uVar7 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(isSeen) + -4));
|
||||
oldAllocated = *allocatedBytes;
|
||||
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar7;
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar7));
|
||||
free((void *)(GHIDRA_INT(isSeen) + -4));
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user