Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
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>
This commit is contained in:
1 parent
2ff2d5d87f
commit
3ce74c6e2d
331 files changed
+485
-7835
No files matched your search
@@ -0,0 +1,89 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 00a24fd0
|
||||
void * SaveDataManager::open_file_read(byte *fileName)
|
||||
{
|
||||
byte bVar1;
|
||||
uint flags;
|
||||
int *file;
|
||||
byte *pbVar2;
|
||||
byte isAppendSlash;
|
||||
|
||||
flags = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
if ((flags & 1) == 0) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Save data manager has not been initialized\n"));
|
||||
flags = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
}
|
||||
if ((flags & 2) == 0) {
|
||||
return (void *)0x0;
|
||||
}
|
||||
file = operator_new(0x10);
|
||||
if (file == GHIDRA_CAST<int *>(0x0)) {
|
||||
file = GHIDRA_CAST<int *>(0x0);
|
||||
}
|
||||
else {
|
||||
file[1] = 2;
|
||||
file[2] = 0;
|
||||
*file = GHIDRA_INT(KAGE)::Filesys::File::vftable;
|
||||
file[3] = 0;
|
||||
}
|
||||
isAppendSlash = 0;
|
||||
bVar1 = 0;
|
||||
pbVar2 = GHIDRA_CAST<byte *>((**(code **)(*GHIDRA_CAST<int *>(this) + 0x10))());
|
||||
pbVar2 = path_join(fileName,pbVar2,bVar1,isAppendSlash);
|
||||
if (*(code **)(*file + 0x24) == KAGE::Filesys::File::open) {
|
||||
bVar1 = (GHIDRA_CAST<KAGE::Filesys::File *>((file)))->KAGE::Filesys::File::open(pbVar2);
|
||||
}
|
||||
else {
|
||||
bVar1 = (**(code **)(*file + 0x24))();
|
||||
}
|
||||
if (bVar1 == 0) {
|
||||
(**(code **)*file)(1);
|
||||
file = GHIDRA_CAST<int *>(0x0);
|
||||
}
|
||||
if (pbVar2 != GHIDRA_CAST<byte *>(0x0)) {
|
||||
operator_delete(pbVar2,1);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
// 00a25090
|
||||
void * SaveDataManager::open_file_write(byte *path, int mode)
|
||||
{
|
||||
char isOk;
|
||||
uint uVar1;
|
||||
int *piVar2;
|
||||
|
||||
uVar1 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
if ((uVar1 & 1) == 0) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Save data manager has not been initialized\n"));
|
||||
uVar1 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
}
|
||||
if ((uVar1 & 2) != 0) {
|
||||
isOk = FUN_00a25200(path);
|
||||
if (isOk != '\0') {
|
||||
piVar2 = operator_new(0x10);
|
||||
if (piVar2 == GHIDRA_CAST<int *>(0x0)) {
|
||||
piVar2 = GHIDRA_CAST<int *>(0x0);
|
||||
}
|
||||
else {
|
||||
piVar2[1] = 2;
|
||||
piVar2[2] = 0;
|
||||
*piVar2 = GHIDRA_INT(KAGE)::Filesys::File::vftable;
|
||||
piVar2[3] = 0;
|
||||
}
|
||||
if (*(code **)(*piVar2 + 0x28) == FUN_00a52610) {
|
||||
isOk = FUN_00a52610(path,mode);
|
||||
}
|
||||
else {
|
||||
isOk = (**(code **)(*piVar2 + 0x28))(path,mode);
|
||||
}
|
||||
if (isOk == '\0') {
|
||||
(**(code **)*piVar2)(1);
|
||||
piVar2 = GHIDRA_CAST<int *>(0x0);
|
||||
}
|
||||
return piVar2;
|
||||
}
|
||||
}
|
||||
return (void *)0x0;
|
||||
}
|
||||
Reference in new issue
Block a user