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>
106 lines
3.4 KiB
C++
106 lines
3.4 KiB
C++
#include "classes.h"
|
|
|
|
// 00a51790
|
|
int KAGE::System::LeaderboardManager::get_result(uint handle)
|
|
{
|
|
int result;
|
|
undefined1 findResult [8];
|
|
int foundNode;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
uint key;
|
|
|
|
key = handle;
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af0eb0;
|
|
local_10 = ExceptionList;
|
|
if (handle == 0) {
|
|
return 0;
|
|
}
|
|
ExceptionList = &local_10;
|
|
(**(code **)(DAT_00c5ab20 + 0xc))(0xffffffff,__security_cookie ^ GHIDRA_UINT((findResult + 0x18)));
|
|
_Find_lower_bound<>(findResult,&handle);
|
|
if (((*GHIDRA_CAST<char *>((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST<uint *>((foundNode + 0x10)) <= key)) &&
|
|
(foundNode != DAT_00c5ab18)) {
|
|
result = *GHIDRA_CAST<int *>((foundNode + 0x14));
|
|
}
|
|
else {
|
|
result = 0;
|
|
}
|
|
local_8 = 0;
|
|
(**(code **)(DAT_00c5ab20 + 0x10))();
|
|
ExceptionList = local_10;
|
|
return result;
|
|
}
|
|
|
|
// 00a51840
|
|
void KAGE::System::LeaderboardManager::release_result(int handle)
|
|
{
|
|
int iVar1;
|
|
void *pvVar2;
|
|
int *mapHead;
|
|
undefined1 foundIter [8];
|
|
int *foundNode;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
iVar1 = handle;
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b122d0;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
if ((((byte)DAT_00c5ab14 & 1) != 0) && (handle != 0)) {
|
|
(**(code **)(DAT_00c5ab20 + 0xc))(0xffffffff,__security_cookie ^ GHIDRA_UINT((foundIter + 0x18)));
|
|
if (iVar1 == -1) {
|
|
handle = *DAT_00c5ab18;
|
|
mapHead = DAT_00c5ab18;
|
|
if (GHIDRA_CAST<int *>(handle) != DAT_00c5ab18) {
|
|
do {
|
|
iVar1 = handle;
|
|
pvVar2 = *(void **)(handle + 0x14);
|
|
if (pvVar2 != (void *)0x0) {
|
|
if (*(void **)(GHIDRA_CAST<char *>(pvVar2) + 4) != (void *)0x0) {
|
|
local_8 = 0;
|
|
tracked_alloc(1,*(void **)(GHIDRA_CAST<char *>(pvVar2) + 4),0);
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 4)) = 0;
|
|
}
|
|
operator_delete(pvVar2,0x18);
|
|
*GHIDRA_CAST<undefined4 *>((iVar1 + 0x14)) = 0;
|
|
mapHead = DAT_00c5ab18;
|
|
}
|
|
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>
|
|
*)&handle);
|
|
} while (GHIDRA_CAST<int *>(handle) != mapHead);
|
|
}
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(&DAT_00c5ab18,
|
|
(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)&DAT_00c5ab18,
|
|
(_Tree_node<unsigned_int,void*> *)mapHead[1]);
|
|
mapHead[1] = GHIDRA_INT(mapHead);
|
|
*mapHead = GHIDRA_INT(mapHead);
|
|
mapHead[2] = GHIDRA_INT(mapHead);
|
|
_DAT_00c5ab1c = 0;
|
|
}
|
|
else {
|
|
_Find_lower_bound<>(foundIter,&handle);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') && (GHIDRA_UINT(foundNode[4]) <= GHIDRA_UINT(iVar1))) &&
|
|
(foundNode != DAT_00c5ab18)) {
|
|
if (foundNode[5] != 0) {
|
|
FUN_008d0bc0(foundNode[5]);
|
|
foundNode[5] = 0;
|
|
}
|
|
pvVar2 = std_tree_extract(&DAT_00c5ab18,foundNode);
|
|
operator_delete(pvVar2,0x18);
|
|
}
|
|
}
|
|
local_8 = 2;
|
|
(**(code **)(DAT_00c5ab20 + 0x10))();
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|