Files
isaac-port/generated-src/frame_queue.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d 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>
2026-11-19 21:10:23 -05:00

260 lines
11 KiB
C++

#include "classes.h"
// 00aaa500
void FrameQueue::setSize(int count)
{
byte bVar1;
uint uVar2;
undefined4 *puVar3;
int *node;
std_string *insertedString;
byte *pbVar4;
void *pvVar5;
void *scopeLock;
undefined1 local_14c;
void *frameMem;
int listHead;
int createdCount;
int frameCount;
void *msgPart2;
undefined4 uStack_134;
undefined4 uStack_130;
undefined4 uStack_12c;
undefined8 local_128;
void *msgPart3 [4];
undefined4 msgPart3Size;
uint msgPart3Capacity;
void *createdText [4];
undefined4 createdTextSize;
uint createdTextCapacity;
void *requestedText [4];
undefined4 requestedTextSize;
uint requestedTextCapacity;
void *msgPart1;
undefined4 uStack_d4;
undefined4 uStack_d0;
undefined4 uStack_cc;
undefined8 local_c8;
void *message;
undefined4 uStack_bc;
undefined4 uStack_b8;
undefined4 uStack_b4;
undefined8 local_b0;
byte requestedBuf [64];
byte createdBuf [68];
uint stackCookie;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
undefined4 clip;
puStack_20 = createdBuf + 100;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b14eff;
local_1c = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((createdBuf + 0x58));
ExceptionList = &local_1c;
pvVar5 = *(void **)(GHIDRA_CAST<char *>(this) + 0xc);
frameCount = count;
scopeLock = (void *)0x0;
local_14c = 0;
stackCookie = uVar2;
pbVar4 = createdBuf + 100;
if (pvVar5 != (void *)0x0) {
scopeLock = pvVar5;
(GHIDRA_CAST<Mutex *>((pvVar5)))->Mutex::lock();
pbVar4 = puStack_20;
}
puStack_20 = pbVar4;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) != 0) {
node = GHIDRA_CAST<int *>(**(int **))this;
if (node != *GHIDRA_CAST<int **>(this)) {
do {
if (GHIDRA_CAST<undefined4 *>(node[2]) != GHIDRA_CAST<undefined4 *>(0x0)) {
(*(code *)**GHIDRA_CAST<undefined4 **>(node[2]))(1,uVar2);
}
node = GHIDRA_CAST<int *>(*node);
} while (node != GHIDRA_CAST<int *>(*GHIDRA_CAST<int *>(this)));
}
FUN_00aaac20();
}
createdCount = 0;
if (0 < frameCount) {
do {
clip = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8));
frameMem = operator_new(0x20);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
if (frameMem == (void *)0x0) {
puVar3 = GHIDRA_CAST<undefined4 *>(0x0);
}
else {
puVar3 = GHIDRA_CAST<undefined4 *>(FUN_00aba8b0(clip));
}
local_14 = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_14))) + 0x1))) << 8;
if (puVar3[6] == 0) {
(**(code **)*puVar3)(1);
puVar3 = GHIDRA_CAST<undefined4 *>(0x0);
}
if (puVar3 == GHIDRA_CAST<undefined4 *>(0x0)) {
memset(createdBuf,0,0x40);
sprintf(createdBuf,s__d);
pbVar4 = createdBuf;
createdTextSize = 0;
createdTextCapacity = 0xf;
createdText[0] = (void *)0x0;
do {
bVar1 = *pbVar4;
pbVar4 = pbVar4 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(createdText))))->std::string::assign(createdBuf,GHIDRA_INT(pbVar4) - GHIDRA_INT((createdBuf + 1)));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
memset(requestedBuf,0,0x40);
sprintf(requestedBuf,s__d);
pbVar4 = requestedBuf;
requestedTextSize = 0;
requestedTextCapacity = 0xf;
requestedText[0] = (void *)0x0;
do {
bVar1 = *pbVar4;
pbVar4 = pbVar4 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(requestedText))))->std::string::assign(requestedBuf,GHIDRA_INT(pbVar4) - GHIDRA_INT((requestedBuf + 1)));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
insertedString =
std_string_insert(requestedText,0,GHIDRA_CAST<byte *>("FrameQueue: unable to create "),0x1d);
msgPart1 = *(void **)insertedString->_buf;
uStack_d4 = *GHIDRA_CAST<undefined4 *>((insertedString->_buf + 4));
uStack_d0 = *GHIDRA_CAST<undefined4 *>((insertedString->_buf + 8));
uStack_cc = *GHIDRA_CAST<undefined4 *>((insertedString->_buf + 0xc));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_c8)) + 0x0))) = insertedString->_size;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_c8)) + 0x4))) = insertedString->_capacity;
insertedString->_size = 0;
insertedString->_capacity = 0xf;
insertedString->_buf[0] = '\0';
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
puVar3 = (GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&msgPart1))))->std::string::append(GHIDRA_CAST<byte *>(" frames, out of memory. Created "),
0x20);
msgPart2 = (void *)*puVar3;
uStack_134 = puVar3[1];
uStack_130 = puVar3[2];
uStack_12c = puVar3[3];
local_128 = *GHIDRA_CAST<undefined8 *>((puVar3 + 4));
puVar3[4] = 0;
puVar3[5] = 0xf;
*GHIDRA_CAST<undefined1 *>(puVar3) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(msgPart3))))->std::string::concat_move(GHIDRA_INT(frameMem),&msgPart2,createdText);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 6;
puVar3 = (GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(msgPart3))))->std::string::append(GHIDRA_CAST<byte *>(" frames."),8);
message = (void *)*puVar3;
uStack_bc = puVar3[1];
uStack_b8 = puVar3[2];
uStack_b4 = puVar3[3];
local_b0 = *GHIDRA_CAST<undefined8 *>((puVar3 + 4));
puVar3[4] = 0;
puVar3[5] = 0xf;
*GHIDRA_CAST<undefined1 *>(puVar3) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 7;
(*(code *)PTR_FUN_00c5aa7c)(&message);
if (0xf < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_b0)) + 0x4)))) {
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_b0)) + 0x4))) + 1;
pvVar5 = message;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(message) + -4);
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_b0)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(message) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00aaaa49;
}
operator_delete(pvVar5,uVar2);
}
local_b0 = 0xf00000000;
message = (void *)(GHIDRA_UINT(message) & 0xffffff00);
if (0xf < msgPart3Capacity) {
uVar2 = msgPart3Capacity + 1;
pvVar5 = msgPart3[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(msgPart3[0]) + -4);
uVar2 = msgPart3Capacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(msgPart3[0]) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00aaaa49;
}
operator_delete(pvVar5,uVar2);
}
msgPart3Size = 0;
msgPart3Capacity = 0xf;
msgPart3[0] = (void *)(GHIDRA_UINT(msgPart3[0]) & 0xffffff00);
if (0xf < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_128)) + 0x4)))) {
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_128)) + 0x4))) + 1;
pvVar5 = msgPart2;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(msgPart2) + -4);
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_128)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(msgPart2) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00aaaa49;
}
operator_delete(pvVar5,uVar2);
}
if (0xf < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_c8)) + 0x4)))) {
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_c8)) + 0x4))) + 1;
pvVar5 = msgPart1;
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(msgPart1) + -4);
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_c8)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(msgPart1) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00aaaa49;
}
operator_delete(pvVar5,uVar2);
}
local_c8 = 0xf00000000;
msgPart1 = (void *)(GHIDRA_UINT(msgPart1) & 0xffffff00);
if (0xf < requestedTextCapacity) {
uVar2 = requestedTextCapacity + 1;
pvVar5 = requestedText[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(requestedText[0]) + -4);
uVar2 = requestedTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(requestedText[0]) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00aaaa49;
}
operator_delete(pvVar5,uVar2);
}
requestedTextSize = 0;
requestedTextCapacity = 0xf;
requestedText[0] = (void *)(GHIDRA_UINT(requestedText[0]) & 0xffffff00);
if (0xf < createdTextCapacity) {
uVar2 = createdTextCapacity + 1;
pvVar5 = createdText[0];
if (0xfff < uVar2) {
pvVar5 = *(void **)(GHIDRA_INT(createdText[0]) + -4);
uVar2 = createdTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(createdText[0]) + (-4 - GHIDRA_INT(pvVar5))))) {
LAB_00aaaa49:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar5,uVar2);
}
break;
}
listHead = *GHIDRA_CAST<int *>(this);
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 0x15555555) {
/* WARNING: Subroutine does not return */
std::_Xlength_error("list too long");
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 8;
node = operator_new(0xc);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
node[2] = GHIDRA_INT(puVar3);
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 1;
puVar3 = *GHIDRA_CAST<undefined4 **>((listHead + 4));
*node = listHead;
createdCount = createdCount + 1;
node[1] = GHIDRA_INT(puVar3);
*GHIDRA_CAST<int **>((listHead + 4)) = node;
*puVar3 = node;
} while (createdCount < frameCount);
}
(GHIDRA_CAST<Mutex::ScopeLock *>((&scopeLock)))->Mutex::ScopeLock::~ScopeLock();
ExceptionList = local_1c;
return;
}