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,309 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 009f2ee0
|
||||
void VideoPlayer::play(byte *fileName, float volume)
|
||||
{
|
||||
undefined4 *extraout_EAX;
|
||||
undefined4 *pathText;
|
||||
void *allocBlock;
|
||||
int startFrame;
|
||||
byte *copyPtr;
|
||||
uint allocSize;
|
||||
void *redirectedPath [4];
|
||||
uint redirectedPathSize;
|
||||
uint redirectedPathCapacity;
|
||||
void *local_ac [4];
|
||||
uint pathSize;
|
||||
uint pathCapacity;
|
||||
byte fileNameLocal [128];
|
||||
uint local_14;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
byte copyChar;
|
||||
int decoder;
|
||||
Manager *manager;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00b101ab;
|
||||
local_10 = ExceptionList;
|
||||
local_14 = __security_cookie ^ GHIDRA_UINT((fileNameLocal + 0x90));
|
||||
ExceptionList = &local_10;
|
||||
copyPtr = fileName;
|
||||
do {
|
||||
copyChar = *copyPtr;
|
||||
copyPtr = copyPtr + 1;
|
||||
copyPtr[GHIDRA_INT(local_ac) + (0x17 - GHIDRA_INT(fileName))] = copyChar;
|
||||
} while (copyChar != 0);
|
||||
strstr(GHIDRA_CAST<char *>(fileNameLocal),".ogv");
|
||||
manager = g_manager;
|
||||
copyPtr = fileNameLocal;
|
||||
pathSize = 0;
|
||||
pathCapacity = 0xf;
|
||||
local_ac[0] = (void *)0x0;
|
||||
do {
|
||||
copyChar = *copyPtr;
|
||||
copyPtr = copyPtr + 1;
|
||||
} while (copyChar != 0);
|
||||
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(local_ac))))->std::string::assign(fileNameLocal,GHIDRA_INT(copyPtr) - GHIDRA_INT((fileNameLocal + 1)));
|
||||
local_8 = 0;
|
||||
ModManager::TryRedirectPath
|
||||
(&manager->_modManager,GHIDRA_CAST<std_string *>(redirectedPath),GHIDRA_CAST<std_string *>(local_ac));
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
|
||||
pathText = extraout_EAX;
|
||||
if (0xf < GHIDRA_UINT(extraout_EAX[5])) {
|
||||
pathText = GHIDRA_CAST<undefined4 *>(*extraout_EAX);
|
||||
}
|
||||
FUN_00a62910(pathText);
|
||||
local_8 = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_8))) + 0x1))) << 8;
|
||||
if (0xf < redirectedPathCapacity) {
|
||||
allocSize = redirectedPathCapacity + 1;
|
||||
allocBlock = redirectedPath[0];
|
||||
if (0xfff < allocSize) {
|
||||
allocBlock = *(void **)(GHIDRA_INT(redirectedPath[0]) + -4);
|
||||
allocSize = redirectedPathCapacity + 0x24;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedPath[0]) + (-4 - GHIDRA_INT(allocBlock))))) goto LAB_009f3050;
|
||||
}
|
||||
operator_delete(allocBlock,allocSize);
|
||||
}
|
||||
local_8 = -1;
|
||||
redirectedPathSize = 0;
|
||||
redirectedPathCapacity = 0xf;
|
||||
redirectedPath[0] = (void *)(GHIDRA_UINT(redirectedPath[0]) & 0xffffff00);
|
||||
if (0xf < pathCapacity) {
|
||||
allocSize = pathCapacity + 1;
|
||||
allocBlock = local_ac[0];
|
||||
if (0xfff < allocSize) {
|
||||
allocBlock = *(void **)(GHIDRA_INT(local_ac[0]) + -4);
|
||||
allocSize = pathCapacity + 0x24;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_ac[0]) + (-4 - GHIDRA_INT(allocBlock))))) {
|
||||
LAB_009f3050:
|
||||
/* WARNING: Subroutine does not return */
|
||||
_invalid_parameter_noinfo_noreturn();
|
||||
}
|
||||
}
|
||||
operator_delete(allocBlock,allocSize);
|
||||
}
|
||||
decoder = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
if (decoder != 0) {
|
||||
if (volume < 1.0) {
|
||||
if (0.0 < volume) {
|
||||
*GHIDRA_CAST<float *>((decoder + 0x48)) = volume;
|
||||
}
|
||||
else {
|
||||
*GHIDRA_CAST<undefined4 *>((decoder + 0x48)) = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*GHIDRA_CAST<undefined4 *>((decoder + 0x48)) = 0x3f800000;
|
||||
}
|
||||
}
|
||||
decoder = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
if (decoder != 0) {
|
||||
(**(code **)(**GHIDRA_CAST<int **>((decoder + 0x28)) + 0x1c))();
|
||||
FUN_00aaaa90();
|
||||
*GHIDRA_CAST<undefined4 *>((decoder + 0x98)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((decoder + 0x94)) = 0;
|
||||
startFrame = GHIDRA_INT((*GHIDRA_CAST<float *>((decoder + 0x70)) * 0.0));
|
||||
if (startFrame < 0) {
|
||||
startFrame = 0;
|
||||
}
|
||||
else if (*GHIDRA_CAST<int *>((decoder + 0x6c)) < startFrame) {
|
||||
startFrame = *GHIDRA_CAST<int *>((decoder + 0x6c));
|
||||
}
|
||||
*GHIDRA_CAST<int *>((decoder + 0x88)) = startFrame;
|
||||
*GHIDRA_CAST<undefined1 *>((decoder + 0x90)) = 0;
|
||||
*GHIDRA_CAST<undefined1 *>((decoder + 0x74)) = 0;
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) != 0) {
|
||||
(**(code **)(**GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 0x28)) + 0x18))();
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x10)) = 1;
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00a62880
|
||||
void VideoPlayer::unload()
|
||||
{
|
||||
char isLastRef;
|
||||
uint uVar1;
|
||||
undefined4 extraout_ECX;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00af12a0;
|
||||
local_10 = ExceptionList;
|
||||
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
||||
ExceptionList = &local_10;
|
||||
TheoraVideoManager::destroyVideoClip(*(void **)(GHIDRA_CAST<char *>(this) + 4));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>(this) = 0;
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
|
||||
KAGE::SmartPointer<RenderTargetBase>::reset(extraout_ECX);
|
||||
local_8 = 0;
|
||||
if (*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 0xc)) != GHIDRA_CAST<int *>(0x0)) {
|
||||
isLastRef = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 0xc)) + 0xc))(uVar1);
|
||||
if ((isLastRef != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) {
|
||||
(*g_renderTargetReleaseFn)(GHIDRA_INT(this) + 8);
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00a62b10
|
||||
void VideoPlayer::render(undefined1 param_1)
|
||||
{
|
||||
undefined *puVar1;
|
||||
void *pvVar2;
|
||||
int iVar3;
|
||||
uint uVar4;
|
||||
int *frameNode;
|
||||
int in_ECX;
|
||||
int *countNode;
|
||||
undefined4 extraout_ECX;
|
||||
undefined *puVar5;
|
||||
int iVar6;
|
||||
int iVar7;
|
||||
undefined4 texHeight;
|
||||
float10 clockTime;
|
||||
KColor white;
|
||||
void *scopeLock;
|
||||
undefined1 local_24;
|
||||
float local_20;
|
||||
undefined *local_1c;
|
||||
int *frameListHead;
|
||||
int self;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
code *drawFn;
|
||||
int *nextNode;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00b1317d;
|
||||
local_10 = ExceptionList;
|
||||
uVar4 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
||||
puVar1 = *GHIDRA_CAST<undefined **>((in_ECX + 4));
|
||||
if (puVar1 == GHIDRA_CAST<undefined *>(0x0)) {
|
||||
return;
|
||||
}
|
||||
self = in_ECX;
|
||||
ExceptionList = &local_10;
|
||||
local_1c = puVar1;
|
||||
if (*GHIDRA_CAST<int *>((puVar1 + 0x88)) != -1) goto LAB_00a62d83;
|
||||
pvVar2 = *(void **)(*GHIDRA_CAST<int *>((puVar1 + 0x1c)) + 0xc);
|
||||
scopeLock = (void *)0x0;
|
||||
local_24 = 0;
|
||||
if (pvVar2 != (void *)0x0) {
|
||||
scopeLock = pvVar2;
|
||||
(GHIDRA_CAST<Mutex *>((pvVar2)))->Mutex::lock();
|
||||
}
|
||||
local_8 = 0;
|
||||
clockTime = (float10)(**(code **)(**GHIDRA_CAST<int **>((puVar1 + 0x28)) + 4))(uVar4);
|
||||
iVar6 = 0;
|
||||
frameListHead = GHIDRA_CAST<int *>(**GHIDRA_CAST<int **>((puVar1 + 0x1c)));
|
||||
frameNode = GHIDRA_CAST<int *>(*frameListHead);
|
||||
local_20 = (float)*GHIDRA_CAST<int *>((puVar1 + 0x98)) * *GHIDRA_CAST<float *>((puVar1 + 0x58)) + (float)clockTime;
|
||||
countNode = frameNode;
|
||||
puVar5 = puVar1;
|
||||
iVar7 = iVar6;
|
||||
if (frameNode == frameListHead) {
|
||||
LAB_00a62be2:
|
||||
iVar6 = 0;
|
||||
if (frameNode != frameListHead) {
|
||||
while ((iVar3 = frameNode[2], *GHIDRA_CAST<char *>((iVar3 + 8)) != '\0' &&
|
||||
((float)*GHIDRA_CAST<int *>((iVar3 + 0xc)) * *GHIDRA_CAST<float *>((puVar1 + 0x58)) + *GHIDRA_CAST<float *>((iVar3 + 4)) +
|
||||
*GHIDRA_CAST<float *>((puVar5 + 0x5c)) < local_20))) {
|
||||
iVar7 = iVar7 + -1;
|
||||
iVar6 = iVar6 + 1;
|
||||
if ((iVar7 == 1) || (frameNode = GHIDRA_CAST<int *>(*frameNode), frameNode == frameListHead)) break;
|
||||
}
|
||||
if (0 < iVar6) {
|
||||
*GHIDRA_CAST<int *>((puVar5 + 0x9c)) = *GHIDRA_CAST<int *>((puVar5 + 0x9c)) + iVar6;
|
||||
FUN_00aaaae0(iVar6);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
do {
|
||||
nextNode = GHIDRA_CAST<int *>(*countNode);
|
||||
iVar7 = iVar6 + 1;
|
||||
if (*GHIDRA_CAST<char *>((countNode[2] + 8)) == '\0') {
|
||||
iVar7 = iVar6;
|
||||
}
|
||||
countNode = nextNode;
|
||||
iVar6 = iVar7;
|
||||
} while (nextNode != frameListHead);
|
||||
puVar5 = local_1c;
|
||||
if (iVar7 != 1) goto LAB_00a62be2;
|
||||
}
|
||||
iVar7 = 0;
|
||||
if (*GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(**GHIDRA_CAST<undefined4 **>((puVar5 + 0x1c))) + 8)) + 8)) != '\0') {
|
||||
iVar7 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(**GHIDRA_CAST<undefined4 **>((puVar5 + 0x1c))) + 8));
|
||||
}
|
||||
if (((iVar7 != 0) &&
|
||||
(local_20 < (float)*GHIDRA_CAST<int *>((iVar7 + 0xc)) * *GHIDRA_CAST<float *>((puVar5 + 0x58)) + *GHIDRA_CAST<float *>((iVar7 + 4))))
|
||||
&& (puVar5[0x90] != '\0')) {
|
||||
iVar7 = 0;
|
||||
}
|
||||
local_8 = 0xffffffff;
|
||||
(GHIDRA_CAST<Mutex::ScopeLock *>((&scopeLock)))->Mutex::ScopeLock::~ScopeLock();
|
||||
if (iVar7 == 0) {
|
||||
}
|
||||
else {
|
||||
(*(code *)epoxy_glEnable)(0xde1);
|
||||
(*(code *)epoxy_glBindTexture)(0xde1,*GHIDRA_CAST<undefined4 *>((*GHIDRA_CAST<int *>((self + 8)) + 0x58)));
|
||||
local_1c = epoxy_glTexSubImage2D;
|
||||
local_20 = *GHIDRA_CAST<float *>((iVar7 + 0x18));
|
||||
iVar7 = *GHIDRA_CAST<int *>((self + 4));
|
||||
if (iVar7 == 0) {
|
||||
texHeight = 0;
|
||||
iVar6 = 0;
|
||||
}
|
||||
else {
|
||||
texHeight = *GHIDRA_CAST<undefined4 *>((iVar7 + 100));
|
||||
iVar6 = *GHIDRA_CAST<int *>((iVar7 + 0x60)) / 2;
|
||||
if (*GHIDRA_CAST<char *>((iVar7 + 0x40)) == '\0') {
|
||||
iVar6 = *GHIDRA_CAST<int *>((iVar7 + 0x60));
|
||||
}
|
||||
}
|
||||
(*(code *)epoxy_glTexSubImage2D)(0xde1,0,0,0,iVar6,texHeight,0x1907,0x1401,local_20);
|
||||
iVar7 = *GHIDRA_CAST<int *>((self + 4));
|
||||
*GHIDRA_CAST<int *>((iVar7 + 0xa0)) = *GHIDRA_CAST<int *>((iVar7 + 0xa0)) + 1;
|
||||
pvVar2 = *(void **)(*GHIDRA_CAST<int *>((iVar7 + 0x1c)) + 0xc);
|
||||
scopeLock = (void *)0x0;
|
||||
local_24 = 0;
|
||||
if (*GHIDRA_CAST<char *>((iVar7 + 0x90)) == '\0') {
|
||||
if (pvVar2 != (void *)0x0) {
|
||||
scopeLock = pvVar2;
|
||||
(GHIDRA_CAST<Mutex *>((pvVar2)))->Mutex::lock();
|
||||
}
|
||||
local_8 = 1;
|
||||
FUN_00aaaae0(1);
|
||||
*GHIDRA_CAST<undefined1 *>((iVar7 + 0x90)) = 1;
|
||||
local_8 = 0xffffffff;
|
||||
(GHIDRA_CAST<Mutex::ScopeLock *>((&scopeLock)))->Mutex::ScopeLock::~ScopeLock();
|
||||
}
|
||||
else {
|
||||
if (pvVar2 != (void *)0x0) {
|
||||
scopeLock = pvVar2;
|
||||
(GHIDRA_CAST<Mutex *>((pvVar2)))->Mutex::lock();
|
||||
}
|
||||
local_8 = 2;
|
||||
FUN_00aaaae0(1);
|
||||
local_8 = 0xffffffff;
|
||||
(GHIDRA_CAST<Mutex::ScopeLock *>((&scopeLock)))->Mutex::ScopeLock::~ScopeLock();
|
||||
}
|
||||
}
|
||||
LAB_00a62d83:
|
||||
drawFn = *(code **)(**GHIDRA_CAST<int **>((self + 8)) + 0x20);
|
||||
(GHIDRA_CAST<KColor *>((&white)))->KColor::SetFromARGB(0xffffffff);
|
||||
(*drawFn)(¶m_1,extraout_ECX);
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user