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,40 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 00a9e4f0
|
||||
byte KAGE::Sound::Manager::Init()
|
||||
{
|
||||
char cVar1;
|
||||
undefined4 procAddress;
|
||||
undefined4 procAddress;
|
||||
undefined4 eventType;
|
||||
|
||||
cVar1 = ManagerOpenAL::Init();
|
||||
if (cVar1 == '\0') {
|
||||
return 0;
|
||||
}
|
||||
procAddress = alcGetProcAddress(*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((this->_persistentGameData))) + 0x24)))),
|
||||
"alcDevicePauseSOFT");
|
||||
*GHIDRA_CAST<undefined4 *>((this->_persistentGameData)._achievements) = procAddress;
|
||||
procAddress = alcGetProcAddress(*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((this->_persistentGameData))) + 0x24)))),
|
||||
"alcDeviceResumeSOFT");
|
||||
procAddress = *GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((this->_persistentGameData))) + 0x24))));
|
||||
*GHIDRA_CAST<undefined4 *>(((this->_persistentGameData)._achievements + 4)) = procAddress;
|
||||
procAddress = alcGetProcAddress(procAddress,"alcEventControlSOFT");
|
||||
procAddress = *GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((this->_persistentGameData))) + 0x24))));
|
||||
*GHIDRA_CAST<undefined4 *>(((this->_persistentGameData)._achievements + 8)) = procAddress;
|
||||
procAddress = alcGetProcAddress(procAddress,"alcEventCallbackSOFT");
|
||||
procAddress = *GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((this->_persistentGameData))) + 0x24))));
|
||||
*GHIDRA_CAST<undefined4 *>(((this->_persistentGameData)._achievements + 0xc)) = procAddress;
|
||||
procAddress = alcGetProcAddress(procAddress,"alcReopenDeviceSOFT");
|
||||
*GHIDRA_CAST<undefined4 *>(((this->_persistentGameData)._achievements + 0x10)) = procAddress;
|
||||
LOCK();
|
||||
(this->_persistentGameData)._achievements[0x14] = 0;
|
||||
UNLOCK();
|
||||
cVar1 = alcIsExtensionPresent(0,"ALC_SOFT_system_events");
|
||||
if (cVar1 == '\x01') {
|
||||
eventType = 0x19d6;
|
||||
(**(code **)((this->_persistentGameData)._achievements + 8))(1,&eventType,1);
|
||||
(**(code **)((this->_persistentGameData)._achievements + 0xc))(FUN_00a9e890,this);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 00a7d2a0
|
||||
undefined1 KAGE::Sound::ManagerOpenAL::FUN_00a649b0()
|
||||
{
|
||||
char cVar1;
|
||||
int iVar2;
|
||||
void *sources;
|
||||
HMODULE hModule;
|
||||
int *in_ECX;
|
||||
undefined4 *sourceEntry;
|
||||
uint sourceOffset;
|
||||
WCHAR *lpFilename;
|
||||
char *format;
|
||||
DWORD nSize;
|
||||
undefined4 listenerOrientation;
|
||||
undefined4 uStack_24c;
|
||||
undefined1 *puStack_248;
|
||||
undefined4 uStack_244;
|
||||
undefined4 local_240;
|
||||
undefined4 local_23c;
|
||||
undefined4 contextAttribs;
|
||||
undefined4 uStack_234;
|
||||
undefined4 uStack_230;
|
||||
undefined4 uStack_22c;
|
||||
undefined4 local_228;
|
||||
undefined4 local_224;
|
||||
undefined4 local_220;
|
||||
WCHAR dllPath [260];
|
||||
uint local_14;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00b1456a;
|
||||
local_10 = ExceptionList;
|
||||
local_14 = __security_cookie ^ GHIDRA_UINT((dllPath + 0x10c));
|
||||
ExceptionList = &local_10;
|
||||
iVar2 = alcOpenDevice(0,local_14);
|
||||
in_ECX[0xe] = iVar2;
|
||||
if (iVar2 == 0) {
|
||||
format = "Failed to open OpenAL device\n";
|
||||
}
|
||||
else {
|
||||
contextAttribs = 0x1991;
|
||||
uStack_234 = 0x1402;
|
||||
uStack_230 = 0x1990;
|
||||
uStack_22c = 0x1501;
|
||||
local_228 = 0x19ac;
|
||||
local_224 = 0x19ae;
|
||||
local_220 = 0;
|
||||
iVar2 = alcCreateContext(iVar2,&contextAttribs);
|
||||
in_ECX[0xd] = iVar2;
|
||||
if (iVar2 == 0) {
|
||||
format = "Failed to create OpenAL context\n";
|
||||
}
|
||||
else {
|
||||
cVar1 = alcMakeContextCurrent(iVar2);
|
||||
if (cVar1 == '\0') {
|
||||
format = "Failed to make current OpenAL context\n";
|
||||
}
|
||||
else {
|
||||
alcProcessContext(in_ECX[0xd]);
|
||||
sources = operator_new_tracked(0x300);
|
||||
if (sources == (void *)0x0) {
|
||||
sources = (void *)0x0;
|
||||
}
|
||||
else {
|
||||
iVar2 = 0x40;
|
||||
sourceEntry = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(sources) + 8));
|
||||
do {
|
||||
sourceEntry[-2] = 0;
|
||||
sourceEntry[-1] = 0;
|
||||
*sourceEntry = 0;
|
||||
iVar2 = iVar2 + -1;
|
||||
sourceEntry = sourceEntry + 3;
|
||||
} while (iVar2 != 0);
|
||||
}
|
||||
local_8 = 0xffffffff;
|
||||
sourceOffset = 0;
|
||||
in_ECX[0xf] = GHIDRA_INT(sources);
|
||||
do {
|
||||
cVar1 = (**(code **)(*in_ECX + 0x30))
|
||||
(in_ECX[0xf] + sourceOffset,in_ECX[0xf] + sourceOffset + 4,1);
|
||||
if (cVar1 == '\0') {
|
||||
ExceptionList = local_10;
|
||||
return 0;
|
||||
}
|
||||
sourceOffset = sourceOffset + 0xc;
|
||||
} while (sourceOffset < 0x300);
|
||||
alListener3f(0x1004,0,0,0);
|
||||
listenerOrientation = 0;
|
||||
uStack_24c = 0;
|
||||
puStack_248 = &DAT_bf800000;
|
||||
uStack_244 = 0;
|
||||
local_240 = 0x3f800000;
|
||||
local_23c = 0;
|
||||
alListenerfv(0x100f,&listenerOrientation);
|
||||
cVar1 = (**(code **)(in_ECX[0x10] + 8))(FUN_00a7da80,3,0x1000);
|
||||
if (cVar1 != '\0') {
|
||||
nSize = 0x104;
|
||||
lpFilename = dllPath;
|
||||
hModule = GetModuleHandleW(L"OpenAL32.dll");
|
||||
GetModuleFileNameW(hModule,lpFilename,nSize);
|
||||
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("OpenAL DLL loaded from: %ls\n"));
|
||||
alcGetString(in_ECX[0xe],0x1006);
|
||||
alGetString(0xb001);
|
||||
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("OpenAL AL_VENDOR : %s\n"));
|
||||
alGetString(0xb003);
|
||||
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("OpenAL AL_RENDERER : %s\n"));
|
||||
alGetString(0xb002);
|
||||
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("OpenAL AL_VERSION : %s\n"));
|
||||
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("OpenAL ALC_EXTENSIONS : %s\n"));
|
||||
(**(code **)(in_ECX[4] + 4))();
|
||||
(**(code **)(in_ECX[10] + 4))();
|
||||
in_ECX[1] = in_ECX[1] | 1;
|
||||
g_soundReleaseFn = FUN_00a2bb10;
|
||||
ExceptionList = local_10;
|
||||
return 1;
|
||||
}
|
||||
format = "Failed to start up OpenAL processing thread\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
KAGE_LogMessage(8,GHIDRA_CAST<byte *>(format));
|
||||
ExceptionList = local_10;
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user