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>
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#include "classes.h"
|
|
|
|
// 0041c770
|
|
void shared_ptr::assign(void *other)
|
|
{
|
|
char isOk;
|
|
undefined4 otherPtr;
|
|
int *otherRefCount;
|
|
|
|
*GHIDRA_CAST<undefined4 *>(this) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
|
|
otherRefCount = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(other) + 4));
|
|
otherPtr = *GHIDRA_CAST<undefined4 *>(other);
|
|
if (otherRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
isOk = (**(code **)(*otherRefCount + 4))();
|
|
if (isOk != '\0') {
|
|
if (*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4)) != GHIDRA_CAST<int *>(0x0)) {
|
|
isOk = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4)) + 0xc))();
|
|
if ((isOk != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) {
|
|
(*g_renderTargetReleaseFn)(this);
|
|
}
|
|
}
|
|
*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 4)) = otherRefCount;
|
|
*GHIDRA_CAST<undefined4 *>(this) = otherPtr;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 007090c0
|
|
void shared_ptr::operator_assign(void *other)
|
|
{
|
|
char isLastRef;
|
|
uint swapWord;
|
|
undefined4 *extraout_EAX;
|
|
undefined1 tmp [4];
|
|
int *tmpCtrl;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
undefined4 swapWord;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af0cf0;
|
|
local_10 = ExceptionList;
|
|
swapWord = __security_cookie ^ GHIDRA_UINT((tmp + 0x18));
|
|
ExceptionList = &local_10;
|
|
assign(tmp,other);
|
|
swapWord = extraout_EAX[1];
|
|
extraout_EAX[1] = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = swapWord;
|
|
swapWord = *extraout_EAX;
|
|
*extraout_EAX = *GHIDRA_CAST<undefined4 *>(this);
|
|
*GHIDRA_CAST<undefined4 *>(this) = swapWord;
|
|
local_8 = 0;
|
|
if (tmpCtrl != GHIDRA_CAST<int *>(0x0)) {
|
|
isLastRef = (**(code **)(*tmpCtrl + 0xc))(swapWord);
|
|
if ((isLastRef != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) {
|
|
(*g_renderTargetReleaseFn)(tmp);
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|