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>
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
#include "classes.h"
|
|
|
|
// 00aaaf50
|
|
void Mutex::lock()
|
|
{
|
|
byte bVar1;
|
|
uint uVar2;
|
|
byte *messageEnd;
|
|
void *allocBase;
|
|
void *message [4];
|
|
undefined4 messageSize;
|
|
uint messageCapacity;
|
|
byte buffer [1024];
|
|
uint local_14;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b14fd0;
|
|
local_10 = ExceptionList;
|
|
uVar2 = __security_cookie ^ GHIDRA_UINT((buffer + 0x410));
|
|
ExceptionList = &local_10;
|
|
local_14 = uVar2;
|
|
EnterCriticalSection(*GHIDRA_CAST<LPCRITICAL_SECTION *>(this));
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 4)) == '\0') {
|
|
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 4)) = 1;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
memset(buffer,0,0x400);
|
|
sprintf(buffer,GHIDRA_CAST<byte *>("WARNING: \'<0x%p>\' is deadlocked!"));
|
|
messageEnd = buffer;
|
|
messageSize = 0;
|
|
messageCapacity = 0xf;
|
|
message[0] = (void *)0x0;
|
|
do {
|
|
bVar1 = *messageEnd;
|
|
messageEnd = messageEnd + 1;
|
|
} while (bVar1 != 0);
|
|
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(message))))->std::string::assign(buffer,GHIDRA_INT(messageEnd) - GHIDRA_INT((buffer + 1)));
|
|
local_8 = 0;
|
|
(*(code *)PTR_FUN_00c5aa7c)(message,uVar2);
|
|
if (0xf < messageCapacity) {
|
|
uVar2 = messageCapacity + 1;
|
|
allocBase = message[0];
|
|
if (0xfff < uVar2) {
|
|
allocBase = *(void **)(GHIDRA_INT(message[0]) + -4);
|
|
uVar2 = messageCapacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(message[0]) + (-4 - GHIDRA_INT(allocBase))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(allocBase,uVar2);
|
|
}
|
|
do {
|
|
Sleep(1);
|
|
} while( true );
|
|
}
|