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,136 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 0092cfb0
|
||||
void SoundEffect::Load()
|
||||
{
|
||||
undefined1 isExtensionMatch;
|
||||
char isLastRef;
|
||||
uint isExtensionMatch;
|
||||
std_string *psVar2;
|
||||
int compareResult;
|
||||
uint uVar3;
|
||||
uint suffixLength;
|
||||
uint capacity;
|
||||
std_string *pathBuffer;
|
||||
SoundEffect *sample;
|
||||
undefined1 loadedSound [4];
|
||||
int *loadedRefCount;
|
||||
SoundEffect *local_34;
|
||||
SoundEffect sampleIndex;
|
||||
std_string *redirectedPath [4];
|
||||
uint pathSize;
|
||||
uint pathCapacity;
|
||||
uint local_14;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
std_string *local_8;
|
||||
|
||||
local_8 = GHIDRA_CAST<std_string *>(0xffffffff);
|
||||
puStack_c = &LAB_00b0ab45;
|
||||
local_10 = ExceptionList;
|
||||
isExtensionMatch = __security_cookie ^ GHIDRA_UINT((redirectedPath + 10));
|
||||
ExceptionList = &local_10;
|
||||
sampleIndex = (SoundEffect)0x0;
|
||||
if (this[100] != (SoundEffect)0x0) {
|
||||
sample = this + 8;
|
||||
local_34 = this;
|
||||
local_14 = isExtensionMatch;
|
||||
do {
|
||||
ModManager::TryRedirectPath
|
||||
(&g_manager->_modManager,GHIDRA_CAST<std_string *>(redirectedPath),GHIDRA_CAST<std_string *>((sample + -6)));
|
||||
capacity = pathCapacity;
|
||||
pathBuffer = redirectedPath[0];
|
||||
local_8 = GHIDRA_CAST<std_string *>(0x0);
|
||||
uVar3 = pathSize - 4;
|
||||
if (pathSize < uVar3) {
|
||||
/* WARNING: Subroutine does not return */
|
||||
FUN_00499950(isExtensionMatch);
|
||||
}
|
||||
suffixLength = 4;
|
||||
if (pathSize - uVar3 < 4) {
|
||||
suffixLength = pathSize - uVar3;
|
||||
}
|
||||
psVar2 = GHIDRA_CAST<std_string *>(redirectedPath);
|
||||
if (0xf < pathCapacity) {
|
||||
psVar2 = redirectedPath[0];
|
||||
}
|
||||
compareResult = string_compare(GHIDRA_CAST<byte *>((psVar2->_buf + uVar3)),suffixLength,&DAT_00b7b1bc,4);
|
||||
if (compareResult == 0) {
|
||||
isExtensionMatch = 1;
|
||||
}
|
||||
else {
|
||||
psVar2 = GHIDRA_CAST<std_string *>(redirectedPath);
|
||||
if (0xf < capacity) {
|
||||
psVar2 = pathBuffer;
|
||||
}
|
||||
(**(code **)(PTR_vftable_00c5aaa0 + 0x24))(loadedSound,psVar2,0,0);
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
|
||||
(GHIDRA_CAST<SoundInstance *>((sample)))->SoundInstance::assign(loadedSound);
|
||||
local_8 = GHIDRA_CAST<std_string *>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2));
|
||||
if (loadedRefCount != GHIDRA_CAST<int *>(0x0)) {
|
||||
isLastRef = (**(code **)(*loadedRefCount + 0xc))();
|
||||
if ((isLastRef != '\0') && (g_soundReleaseFn != (void *)0x0)) {
|
||||
(*g_soundReleaseFn)(loadedSound);
|
||||
}
|
||||
}
|
||||
isExtensionMatch = 0;
|
||||
capacity = pathCapacity;
|
||||
pathBuffer = redirectedPath[0];
|
||||
}
|
||||
local_8 = GHIDRA_CAST<std_string *>(0xffffffff);
|
||||
*GHIDRA_CAST<undefined1 *>((sample + 6)) = isExtensionMatch;
|
||||
if (0xf < capacity) {
|
||||
uVar3 = capacity + 1;
|
||||
psVar2 = pathBuffer;
|
||||
if (0xfff < uVar3) {
|
||||
psVar2 = GHIDRA_CAST<std_string *>(pathBuffer[-1]._capacity);
|
||||
uVar3 = capacity + 0x24;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pathBuffer) + (-4 - GHIDRA_INT(psVar2))))) {
|
||||
/* WARNING: Subroutine does not return */
|
||||
_invalid_parameter_noinfo_noreturn();
|
||||
}
|
||||
}
|
||||
operator_delete(psVar2,uVar3);
|
||||
}
|
||||
sample = sample + 0xe;
|
||||
sampleIndex = (SoundEffect)(GHIDRA_INT(sampleIndex) + 1);
|
||||
this = local_34;
|
||||
} while (GHIDRA_UINT(sampleIndex) < GHIDRA_UINT(local_34[100]));
|
||||
}
|
||||
*GHIDRA_CAST<undefined1 *>((this + 0x66)) = 1;
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0092e830
|
||||
void SoundEffect::move_constructor(void *dst, void *src)
|
||||
{
|
||||
undefined4 uVar1;
|
||||
undefined4 uVar2;
|
||||
undefined4 uVar3;
|
||||
|
||||
*GHIDRA_CAST<undefined4 *>(dst) = *GHIDRA_CAST<undefined4 *>(src);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 4));
|
||||
_eh_vector_copy_constructor_iterator_
|
||||
((void *)(GHIDRA_INT(dst) + 8),(void *)(GHIDRA_INT(src) + 8),0x38,7,FUN_0092eb00,FUN_0092cf10);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 400)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 400));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x194)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x194));
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(dst) + 0x198)) = *GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(src) + 0x198));
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(dst) + 0x199)) = *GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(src) + 0x199));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x19c)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x19c));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1a0)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1b0)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1b4)) = 0;
|
||||
uVar1 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x1a4));
|
||||
uVar2 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x1a8));
|
||||
uVar3 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x1ac));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1a0)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x1a0));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1a4)) = uVar1;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1a8)) = uVar2;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dst) + 0x1ac)) = uVar3;
|
||||
*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(dst) + 0x1b0)) = *GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(src) + 0x1b0));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x1b0)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(src) + 0x1b4)) = 0xf;
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(src) + 0x1a0)) = 0;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user