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,133 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 0091adf0
|
||||
void PersistentGameDataReader::read(PersistentGameData *data)
|
||||
{
|
||||
int *piVar1;
|
||||
undefined4 *newNode;
|
||||
void *node;
|
||||
uint uVar2;
|
||||
std_map *bestiaryMap;
|
||||
void *insertParent;
|
||||
int insertSide;
|
||||
void *foundNode;
|
||||
std_map *local_28;
|
||||
undefined4 local_24;
|
||||
std_map *local_20;
|
||||
undefined4 local_1c;
|
||||
uint i;
|
||||
PersistentGameData *encounterCount;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
PersistentGameData *gameData;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00b0a0b5;
|
||||
local_10 = ExceptionList;
|
||||
ExceptionList = &local_10;
|
||||
piVar1 = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x48));
|
||||
(**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x48)) + 0xc))
|
||||
(0,0,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
|
||||
gameData = data;
|
||||
FUN_0091b650(data->_achievements,0x282);
|
||||
(**(code **)(*piVar1 + 0x14))(gameData->_eventCounters,1,0x82c);
|
||||
FUN_0091b650(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((gameData)) + 0xae8))),0x2dd);
|
||||
(**(code **)(*piVar1 + 0x14))(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((gameData)) + 0xdc8))),1,0x38);
|
||||
FUN_0091b650(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((gameData)) + 0xe00))),7);
|
||||
FUN_0091b650(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((gameData)) + 0xe07))),0x68);
|
||||
(**(code **)(*piVar1 + 0x14))(gameData->_cutsceneCounters,1,0x6c);
|
||||
FUN_0091b650(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((gameData)) + 0xe6f))),0x2e);
|
||||
node = (gameData->_bestiaryEncounters)._head;
|
||||
bestiaryMap = &gameData->_bestiaryEncounters;
|
||||
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
||||
(bestiaryMap,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)bestiaryMap,
|
||||
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(node) + 4));
|
||||
*(void **)(GHIDRA_CAST<char *>(node) + 4) = node;
|
||||
*(void **)node = node;
|
||||
*(void **)(GHIDRA_CAST<char *>(node) + 8) = node;
|
||||
(gameData->_bestiaryEncounters)._size = 0;
|
||||
encounterCount = GHIDRA_CAST<PersistentGameData *>(0x0);
|
||||
(**(code **)(*piVar1 + 0x14))(&encounterCount,1,4);
|
||||
i = 0;
|
||||
if (encounterCount != GHIDRA_CAST<PersistentGameData *>(0x0)) {
|
||||
do {
|
||||
uVar2 = i;
|
||||
local_20 = GHIDRA_CAST<std_map *>(0xffffffff);
|
||||
local_1c = 0xffffffff;
|
||||
(**(code **)(*piVar1 + 0x14))(&local_20,1,8);
|
||||
std::set<int>::find_node(&insertParent,&local_20);
|
||||
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) != '\0') ||
|
||||
(node = foundNode, GHIDRA_INT(local_20) < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(foundNode) + 0x10)))) {
|
||||
if ((gameData->_bestiaryEncounters)._size == 0xaaaaaaa) goto LAB_0091b0e5;
|
||||
node = bestiaryMap->_head;
|
||||
local_8 = 0;
|
||||
local_24 = 0;
|
||||
local_28 = bestiaryMap;
|
||||
newNode = operator_new(0x18);
|
||||
local_8 = 0xffffffff;
|
||||
local_24 = 0;
|
||||
newNode[4] = local_20;
|
||||
newNode[5] = 0;
|
||||
*newNode = node;
|
||||
newNode[1] = node;
|
||||
newNode[2] = node;
|
||||
*GHIDRA_CAST<undefined2 *>((newNode + 3)) = 0;
|
||||
node = (GHIDRA_CAST<std::_Tree *>((bestiaryMap)))->std::_Tree::_Insert_node(insertParent,insertSide,newNode);
|
||||
uVar2 = i;
|
||||
}
|
||||
i = uVar2 + 1;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(node) + 0x14)) = local_1c;
|
||||
} while (i < encounterCount);
|
||||
}
|
||||
gameData = data;
|
||||
bestiaryMap = &data->_bestiaryKills;
|
||||
node = bestiaryMap->_head;
|
||||
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
||||
(bestiaryMap,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)bestiaryMap,
|
||||
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(node) + 4));
|
||||
*(void **)(GHIDRA_CAST<char *>(node) + 4) = node;
|
||||
*(void **)node = node;
|
||||
*(void **)(GHIDRA_CAST<char *>(node) + 8) = node;
|
||||
(gameData->_bestiaryKills)._size = 0;
|
||||
data = GHIDRA_CAST<PersistentGameData *>(0x0);
|
||||
(**(code **)(*piVar1 + 0x14))(&data,1,4);
|
||||
i = 0;
|
||||
if (data != GHIDRA_CAST<PersistentGameData *>(0x0)) {
|
||||
do {
|
||||
uVar2 = i;
|
||||
local_28 = GHIDRA_CAST<std_map *>(0xffffffff);
|
||||
local_24 = 0xffffffff;
|
||||
(**(code **)(*piVar1 + 0x14))(&local_28,1,8);
|
||||
std::set<int>::find_node(&insertParent,&local_28);
|
||||
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) != '\0') ||
|
||||
(node = foundNode, GHIDRA_INT(local_28) < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(foundNode) + 0x10)))) {
|
||||
if ((gameData->_bestiaryKills)._size == 0xaaaaaaa) {
|
||||
LAB_0091b0e5:
|
||||
/* WARNING: Subroutine does not return */
|
||||
FUN_004170d0();
|
||||
}
|
||||
node = bestiaryMap->_head;
|
||||
local_8 = 1;
|
||||
local_1c = 0;
|
||||
local_20 = bestiaryMap;
|
||||
newNode = operator_new(0x18);
|
||||
local_8 = 0xffffffff;
|
||||
local_1c = 0;
|
||||
newNode[4] = local_28;
|
||||
newNode[5] = 0;
|
||||
*newNode = node;
|
||||
newNode[1] = node;
|
||||
newNode[2] = node;
|
||||
*GHIDRA_CAST<undefined2 *>((newNode + 3)) = 0;
|
||||
node = (GHIDRA_CAST<std::_Tree *>((bestiaryMap)))->std::_Tree::_Insert_node(insertParent,insertSide,newNode);
|
||||
uVar2 = i;
|
||||
}
|
||||
i = uVar2 + 1;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(node) + 0x14)) = local_24;
|
||||
} while (i < data);
|
||||
}
|
||||
(**(code **)(*piVar1 + 0xc))(0,2);
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user