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>
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
#include "classes.h"
|
|
|
|
// 00a23ae0
|
|
void UserProfile::find_or_create()
|
|
{
|
|
int existingProfile;
|
|
undefined1 emplaceResult [8];
|
|
undefined4 keyIdLow;
|
|
undefined4 keyIdHigh;
|
|
undefined4 local_10;
|
|
undefined4 local_c;
|
|
char isLockHeld;
|
|
void *profileLock;
|
|
|
|
if (*GHIDRA_CAST<int *>(this) == 0 && *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 0) {
|
|
return;
|
|
}
|
|
existingProfile = FUN_00a23bb0();
|
|
if (existingProfile == 0) {
|
|
if ((DAT_00c5aa74 & 1) == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Trying to lock mutex that has not been initialized"));
|
|
}
|
|
profileLock = g_userProfileLock;
|
|
EnterCriticalSection(g_userProfileLock);
|
|
isLockHeld = *GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(profileLock) + 0x18));
|
|
while (isLockHeld != '\0') {
|
|
Sleep(1000);
|
|
isLockHeld = *GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(profileLock) + 0x18));
|
|
}
|
|
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(profileLock) + 0x18)) = 1;
|
|
keyIdLow = *GHIDRA_CAST<undefined4 *>(this);
|
|
keyIdHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4));
|
|
local_10 = keyIdLow;
|
|
local_c = keyIdHigh;
|
|
std::map<u64_UserProfile>::try_emplace(emplaceResult,&keyIdLow);
|
|
if ((DAT_00c5aa74 & 1) == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Trying to unlock mutex that has not been initialized"));
|
|
}
|
|
profileLock = g_userProfileLock;
|
|
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(g_userProfileLock) + 0x18)) = 0;
|
|
LeaveCriticalSection(profileLock);
|
|
FUN_00a23bb0();
|
|
}
|
|
return;
|
|
}
|