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>
78 lines
4.2 KiB
C++
78 lines
4.2 KiB
C++
#include "classes.h"
|
|
|
|
// 009e0500
|
|
void GlitchedItemSet::recalculate()
|
|
{
|
|
uint uVar1;
|
|
int countArray;
|
|
int node;
|
|
int *countInfo;
|
|
Game *game;
|
|
int proceduralItem;
|
|
void *proceduralItems;
|
|
|
|
uVar1 = 0;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc))) {
|
|
do {
|
|
*GHIDRA_CAST<undefined1 *>((uVar1 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)))) = 0;
|
|
uVar1 = uVar1 + 1;
|
|
} while (uVar1 < GHIDRA_UINT((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)))));
|
|
}
|
|
uVar1 = 0;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18))) {
|
|
do {
|
|
*GHIDRA_CAST<undefined1 *>((uVar1 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18)))) = 0;
|
|
uVar1 = uVar1 + 1;
|
|
} while (uVar1 < GHIDRA_UINT((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18)))));
|
|
}
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x24)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x28)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x2c)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x30)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x34)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x38)) = 0;
|
|
game = g_game;
|
|
node = **GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4));
|
|
if (GHIDRA_CAST<int *>(node) != *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4))) {
|
|
do {
|
|
uVar1 = ~*GHIDRA_CAST<uint *>((node + 0x10));
|
|
if (((GHIDRA_INT(*GHIDRA_CAST<uint *>((node + 0x10))) < 0) &&
|
|
(proceduralItems = (game->_proceduralItemManager)._proceduralItems._begin,
|
|
GHIDRA_INT(uVar1) <
|
|
GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(proceduralItems) >> 2)) &&
|
|
(proceduralItem = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(proceduralItems) + uVar1 * 4)), proceduralItem != 0)) {
|
|
countInfo = *GHIDRA_CAST<int **>((proceduralItem + 0x10));
|
|
if (countInfo != GHIDRA_CAST<int *>(0x0)) {
|
|
if (*countInfo == 2) {
|
|
countArray = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18));
|
|
}
|
|
else {
|
|
if (*countInfo == 0) goto LAB_009e05d4;
|
|
countArray = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc));
|
|
}
|
|
*GHIDRA_CAST<char *>((countInfo[1] + countArray)) =
|
|
*GHIDRA_CAST<char *>((countInfo[1] + countArray)) + *GHIDRA_CAST<char *>((node + 0x14));
|
|
}
|
|
LAB_009e05d4:
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x24)) =
|
|
*GHIDRA_CAST<float *>((proceduralItem + 0x14)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x24));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x28)) =
|
|
*GHIDRA_CAST<float *>((proceduralItem + 0x18)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x28));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x2c)) =
|
|
*GHIDRA_CAST<float *>((proceduralItem + 0x1c)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x2c));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x30)) =
|
|
*GHIDRA_CAST<float *>((proceduralItem + 0x20)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x30));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x34)) =
|
|
*GHIDRA_CAST<float *>((proceduralItem + 0x24)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x34));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x38)) =
|
|
*GHIDRA_CAST<float *>((proceduralItem + 0x28)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x38));
|
|
}
|
|
std::
|
|
_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
|
|
::operator++((_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
|
|
*)&node);
|
|
} while (node != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)));
|
|
}
|
|
return;
|
|
}
|