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>
100 lines
2.4 KiB
C++
100 lines
2.4 KiB
C++
#include "classes.h"
|
|
|
|
// 00413bf0
|
|
void * xml_node::first_attribute(byte *name, uint nameSize, byte isCaseSensitive)
|
|
{
|
|
byte *attrName;
|
|
byte *nameEnd;
|
|
int iVar1;
|
|
undefined4 *attr;
|
|
byte *attrNameEnd;
|
|
byte ch;
|
|
|
|
if (name == GHIDRA_CAST<byte *>(0x0)) {
|
|
return *(void **)(GHIDRA_CAST<char *>(this) + 0x20);
|
|
}
|
|
ch = *name;
|
|
nameEnd = name;
|
|
while (ch != 0) {
|
|
nameEnd = nameEnd + 1;
|
|
ch = *nameEnd;
|
|
}
|
|
attr = *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(this) + 0x20));
|
|
do {
|
|
if (attr == GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
return (void *)0x0;
|
|
}
|
|
attrName = GHIDRA_CAST<byte *>(*attr);
|
|
if (attrName == GHIDRA_CAST<byte *>(0x0)) {
|
|
iVar1 = 0;
|
|
attrName = &g_xmlNullStr;
|
|
}
|
|
else {
|
|
iVar1 = attr[2];
|
|
}
|
|
if (iVar1 == GHIDRA_INT(nameEnd) - GHIDRA_INT(name)) {
|
|
attrNameEnd = attrName + iVar1;
|
|
if (attrNameEnd <= attrName) {
|
|
return attr;
|
|
}
|
|
iVar1 = GHIDRA_INT(name) - GHIDRA_INT(attrName);
|
|
while (*attrName == attrName[iVar1]) {
|
|
attrName = attrName + 1;
|
|
if (attrNameEnd <= attrName) {
|
|
return attr;
|
|
}
|
|
}
|
|
}
|
|
attr = GHIDRA_CAST<undefined4 *>(attr[6]);
|
|
} while( true );
|
|
}
|
|
|
|
// 00413c70
|
|
void * xml_node::first_node(byte *name, int nameSize, byte isCaseSensitive)
|
|
{
|
|
byte *childName;
|
|
byte *nameEnd;
|
|
int iVar1;
|
|
byte ch;
|
|
undefined4 *child;
|
|
byte *childNameEnd;
|
|
|
|
if (name == GHIDRA_CAST<byte *>(0x0)) {
|
|
return *(void **)(GHIDRA_CAST<char *>(this) + 0x18);
|
|
}
|
|
ch = *name;
|
|
nameEnd = name;
|
|
while (ch != 0) {
|
|
nameEnd = nameEnd + 1;
|
|
ch = *nameEnd;
|
|
}
|
|
child = *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(this) + 0x18));
|
|
do {
|
|
if (child == GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
return (void *)0x0;
|
|
}
|
|
childName = GHIDRA_CAST<byte *>(*child);
|
|
if (childName == GHIDRA_CAST<byte *>(0x0)) {
|
|
iVar1 = 0;
|
|
childName = &g_xmlNullStr;
|
|
}
|
|
else {
|
|
iVar1 = child[2];
|
|
}
|
|
if (iVar1 == GHIDRA_INT(nameEnd) - GHIDRA_INT(name)) {
|
|
childNameEnd = childName + iVar1;
|
|
if (childNameEnd <= childName) {
|
|
return child;
|
|
}
|
|
iVar1 = GHIDRA_INT(name) - GHIDRA_INT(childName);
|
|
while (*childName == childName[iVar1]) {
|
|
childName = childName + 1;
|
|
if (childNameEnd <= childName) {
|
|
return child;
|
|
}
|
|
}
|
|
}
|
|
child = GHIDRA_CAST<undefined4 *>(child[0xb]);
|
|
} while( true );
|
|
}
|