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>
62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#include "classes.h"
|
|
|
|
// 00aaae20
|
|
Mutex::ScopeLock::~ScopeLock()
|
|
{
|
|
undefined4 *puVar1;
|
|
uint uVar2;
|
|
byte *msgEnd;
|
|
void *ptr;
|
|
void *logString [4];
|
|
undefined4 logSize;
|
|
uint logCapacity;
|
|
byte msgBuf [1024];
|
|
uint local_14;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 uStack_8;
|
|
byte ch;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b14f90;
|
|
local_10 = ExceptionList;
|
|
uVar2 = __security_cookie ^ GHIDRA_UINT((msgBuf + 0x410));
|
|
ExceptionList = &local_10;
|
|
puVar1 = *GHIDRA_CAST<undefined4 **>(this);
|
|
if (puVar1 != GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
*GHIDRA_CAST<undefined1 *>((puVar1 + 1)) = 0;
|
|
local_14 = uVar2;
|
|
LeaveCriticalSection((LPCRITICAL_SECTION)*puVar1);
|
|
*GHIDRA_CAST<undefined4 *>(this) = 0;
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 4)) != '\0') {
|
|
memset(msgBuf,0,0x400);
|
|
sprintf(msgBuf,GHIDRA_CAST<byte *>("WARNING: \'<0x%p>\' has been scope-unlocked automatically!"));
|
|
msgEnd = msgBuf;
|
|
logString[0] = (void *)0x0;
|
|
logSize = 0;
|
|
logCapacity = 0xf;
|
|
do {
|
|
ch = *msgEnd;
|
|
msgEnd = msgEnd + 1;
|
|
} while (ch != 0);
|
|
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(logString))))->std::string::assign(msgBuf,GHIDRA_INT(msgEnd) - GHIDRA_INT((msgBuf + 1)));
|
|
(*(code *)PTR_FUN_00c5aa7c)(logString,uVar2);
|
|
if (0xf < logCapacity) {
|
|
uVar2 = logCapacity + 1;
|
|
ptr = logString[0];
|
|
if (0xfff < uVar2) {
|
|
ptr = *(void **)(GHIDRA_INT(logString[0]) + -4);
|
|
uVar2 = logCapacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(logString[0]) + (-4 - GHIDRA_INT(ptr))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(ptr,uVar2);
|
|
}
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|