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>
93 lines
3.2 KiB
C++
93 lines
3.2 KiB
C++
#include "classes.h"
|
|
|
|
// 009c6c90
|
|
void PreloadManager::load_group(std_string *groupName)
|
|
{
|
|
uint uVar1;
|
|
uint uVar2;
|
|
std_string *psVar3;
|
|
char cVar4;
|
|
byte *path;
|
|
void *pvVar5;
|
|
uint *puVar6;
|
|
byte *pbVar7;
|
|
undefined1 auStackY_cc [128];
|
|
int *imageRefCount;
|
|
undefined1 loadedImage [4];
|
|
int *loadedImageRefCount;
|
|
undefined1 swapImage [4];
|
|
int *swapImageRefCount;
|
|
void *entryImage;
|
|
int *entryImageRefCount;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
psVar3 = groupName;
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b0f05d;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
std::map<std::string>::find();
|
|
if ((groupName != *GHIDRA_CAST<std_string **>(this)) && ((char)groupName[1]._size == '\0')) {
|
|
pbVar7 = GHIDRA_CAST<byte *>(groupName[2]._capacity);
|
|
if (pbVar7 != *GHIDRA_CAST<byte **>(groupName[3]._buf)) {
|
|
groupName = GHIDRA_CAST<std_string *>((pbVar7 + 0x1c));
|
|
do {
|
|
path = pbVar7;
|
|
if (0xf < groupName[-1]._size) {
|
|
path = *GHIDRA_CAST<byte **>(pbVar7);
|
|
}
|
|
pvVar5 = Manager::LoadImage(loadedImage,path);
|
|
local_8 = 0;
|
|
puVar6 = (GHIDRA_CAST<KAGE::SmartPointer *>((swapImage)))->KAGE::SmartPointer::operator_assign(pvVar5);
|
|
uVar1 = puVar6[1];
|
|
puVar6[1] = *GHIDRA_CAST<uint *>(groupName->_buf);
|
|
uVar2 = groupName[-1]._capacity;
|
|
*GHIDRA_CAST<uint *>(groupName->_buf) = uVar1;
|
|
uVar1 = *puVar6;
|
|
*puVar6 = uVar2;
|
|
groupName[-1]._capacity = uVar1;
|
|
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
|
|
if (swapImageRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar4 = (**(code **)(*swapImageRefCount + 0xc))();
|
|
if ((cVar4 != '\0') && (g_imageReleaseFn != (void *)0x0)) {
|
|
(*g_imageReleaseFn)();
|
|
}
|
|
}
|
|
local_8 = 2;
|
|
if (loadedImageRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar4 = (**(code **)(*loadedImageRefCount + 0xc))();
|
|
if ((cVar4 != '\0') && (g_imageReleaseFn != (void *)0x0)) {
|
|
(*g_imageReleaseFn)();
|
|
}
|
|
}
|
|
local_8 = 0xffffffff;
|
|
pvVar5 = (void *)0x0;
|
|
imageRefCount = GHIDRA_CAST<int *>(0x0);
|
|
entryImageRefCount = *GHIDRA_CAST<int **>(groupName->_buf);
|
|
entryImage = (void *)groupName[-1]._capacity;
|
|
if (entryImageRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar4 = (**(code **)(*entryImageRefCount + 4))();
|
|
if (cVar4 != '\0') {
|
|
if (imageRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar4 = (**(code **)(*imageRefCount + 0xc))();
|
|
if ((cVar4 != '\0') && (g_imageReleaseFn != (void *)0x0)) {
|
|
(*g_imageReleaseFn)(auStackY_cc + 0x84);
|
|
}
|
|
}
|
|
pvVar5 = entryImage;
|
|
imageRefCount = entryImageRefCount;
|
|
}
|
|
}
|
|
TextureCache::Add(pvVar5,imageRefCount);
|
|
pbVar7 = pbVar7 + 0x20;
|
|
groupName = GHIDRA_CAST<std_string *>((groupName[1]._buf + 8));
|
|
} while (pbVar7 != *GHIDRA_CAST<byte **>(psVar3[3]._buf));
|
|
}
|
|
*GHIDRA_CAST<undefined1 *>(&psVar3[1]._size) = 1;
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|