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:
shweetandClaude Opus 5.5 committed 2026-11-19 21:10:23 -05:00
1 parent 2ff2d5d87f
commit 3ce74c6e2d
331 files changed
+485 -7835

No files matched your search

@@ -0,0 +1,36 @@
#include "classes.h"
// 00a67fe0
KAGE::Graphics::GraphicsBufferObject::GraphicsBufferObject()
{
uint uVar1;
undefined4 *countedArray;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00b1329c;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0;
local_8 = 0;
*GHIDRA_CAST<undefined ***>(this) = vftable;
FUN_00a68360(uVar1);
countedArray = operator_new_tracked(0x18);
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
if (countedArray == GHIDRA_CAST<undefined4 *>(0x0)) {
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
ExceptionList = local_10;
return this;
}
*countedArray = 1;
_eh_vector_constructor_iterator_
(countedArray + 1,0x14,1,GHIDRA_CAST<_func_void_void_ptr *>(&LAB_00a67fa0),
GHIDRA_CAST<_func_void_void_ptr *>(&LAB_00a67fd0));
*GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(this) + 4)) = countedArray + 1;
ExceptionList = local_10;
return this;
}
@@ -0,0 +1,65 @@
#include "classes.h"
// 00a12430
void KAGE::Graphics::ImageBase::set_palette(undefined4 param_1, uint param_2)
{
char cVar1;
void *pvVar2;
int *in_ECX;
int *extraout_ECX;
int *piVar3;
undefined **stream;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b10b9d;
local_10 = ExceptionList;
ExceptionList = &local_10;
cVar1 = (**(code **)(*in_ECX + 8))(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
if (cVar1 == '\0') {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Attempting to set palette on an image that isn\'t indexed\n"));
}
if (0x100 < param_2) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Specified palette is larger than 256 texels in size\n"));
}
sprintf(&DAT_00c943d8,GHIDRA_CAST<byte *>("%s - Palette"));
if (GHIDRA_CAST<int *>(in_ECX[0xb]) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(in_ECX[0xb]) + 0x34))(1);
in_ECX[0xb] = 0;
}
pvVar2 = operator_new(0x60);
if (pvVar2 == (void *)0x0) {
piVar3 = GHIDRA_CAST<int *>(0x0);
}
else {
FUN_00a69950();
*extraout_ECX = GHIDRA_INT(ImagePalette)::vftable;
extraout_ECX[2] = extraout_ECX[2] | 4;
extraout_ECX[3] = extraout_ECX[3];
piVar3 = extraout_ECX;
}
in_ECX[0xb] = GHIDRA_INT(piVar3);
stream = Filesys::BufferedStream::vftable;
local_8 = 0;
cVar1 = (**(code **)(*piVar3 + 0x38))(&stream,&DAT_00c943d8);
if ((cVar1 == '\0') && (GHIDRA_CAST<int *>(in_ECX[0xb]) != GHIDRA_CAST<int *>(0x0))) {
(**(code **)(*GHIDRA_CAST<int *>(in_ECX[0xb]) + 0x34))(1);
in_ECX[0xb] = 0;
}
piVar3 = GHIDRA_CAST<int *>(in_ECX[0xb]);
if ((piVar3[0xc] != 0) || (piVar3[0xd] != 0)) {
(**(code **)(*piVar3 + 0x44))(0,0);
piVar3[0xc] = 0;
piVar3[0xd] = 0;
piVar3 = GHIDRA_CAST<int *>(in_ECX[0xb]);
}
if ((piVar3[0xe] != 1) || (piVar3[0xf] != 1)) {
(**(code **)(*piVar3 + 0x48))(1,1);
piVar3[0xe] = 1;
piVar3[0xf] = 1;
}
ExceptionList = local_10;
return;
}
+236
View File
@@ -0,0 +1,236 @@
#include "classes.h"
// 00a18aa0
KAGE::Graphics::Manager::Manager()
{
void *local_10;
undefined *puStack_c;
undefined4 local_8;
puStack_c = &DAT_00b11133;
local_10 = ExceptionList;
ExceptionList = &local_10;
g_graphicsManager_flags = 0;
local_8 = 0;
DAT_00c798e0 = ManagerBase::vftable;
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c798e8))))->KColor::SetFromARGB(0xffffffff);
g_graphicsManager_blendMode[1] = 1;
DAT_00c798fc = &DAT_bf800000;
if ((g_graphicsManager_flags & 4) == 0) {
g_graphicsManager_blendMode[1] = 6;
}
g_graphicsManager_blendMode[0] = 0;
g_graphicsManager_blendMode[2] = 7;
g_graphicsManager_blendMode[3] = 1;
g_graphicsManager_blendMode[4] = 7;
_DAT_00c79914 = GHIDRA_CAST<undefined4 *>(0x0);
_DAT_00c79918 = 0;
_DAT_00c7991c = 0;
_DAT_00c79920 = 0;
_DAT_00c79924 = 0;
_DAT_00c79914 = operator_new(8);
_DAT_00c79914[1] = 0;
*_DAT_00c79914 = &DAT_00c79914;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
_DAT_00c7994c = GHIDRA_CAST<undefined4 *>(0x0);
DAT_00c79950 = 0;
DAT_00c79954 = 0;
DAT_00c79958 = 0;
DAT_00c7995c = 0;
_DAT_00c7994c = operator_new(8);
_DAT_00c7994c[1] = 0;
*_DAT_00c7994c = &DAT_00c7994c;
_DAT_00c79960 = 0;
DAT_00c79964 = 0;
DAT_00c79968 = 0;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
DAT_00c7996c = (void *)0x0;
DAT_00c79970 = 0;
DAT_00c7996c = operator_new(0x18);
*(void **)DAT_00c7996c = DAT_00c7996c;
*(void **)(GHIDRA_CAST<char *>(DAT_00c7996c) + 4) = DAT_00c7996c;
*(void **)(GHIDRA_CAST<char *>(DAT_00c7996c) + 8) = DAT_00c7996c;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(DAT_00c7996c) + 0xc)) = 0x101;
g_graphicsManager_flags = g_graphicsManager_flags | 0x12;
DAT_00c79974 = 0;
_DAT_00c79978 = 1;
DAT_00c79988 = 0;
DAT_00c79984 = 0;
DAT_00c79928 = 0;
DAT_00c7992c = 0;
uRam00c79930 = 0;
uRam00c79934 = 0;
DAT_00c7997c = 0x44f00000;
_DAT_00c79938 = 0;
uRam00c7993c = 0;
uRam00c79940 = 0;
uRam00c79944 = 0;
DAT_00c79980 = 0x44870000;
_DAT_00c7998c = 0;
_DAT_00c79990 = 0;
_DAT_00c79994 = 0xffffffff;
_DAT_00c79998 = 0xffffffff;
local_8 = 4;
DAT_00c798e0 = vftable;
g_glfwWindow = (void *)0x0;
DAT_00c799a4 = 0;
DAT_00c799a0 = 0;
DAT_00c799ac = 0;
DAT_00c799a8 = 0;
DAT_00c799b4 = 0;
DAT_00c799b0 = 0;
DAT_00c799b8 = (void *)0x0;
_DAT_00c799bc = 0;
DAT_00c799b8 = operator_new(0x10);
*(void **)DAT_00c799b8 = DAT_00c799b8;
*(void **)(GHIDRA_CAST<char *>(DAT_00c799b8) + 4) = DAT_00c799b8;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 5;
_DAT_00c799c0 = (void *)0x0;
_DAT_00c799c4 = 0;
_DAT_00c799c0 = operator_new(0x10);
*(void **)_DAT_00c799c0 = _DAT_00c799c0;
*(void **)(GHIDRA_CAST<char *>(_DAT_00c799c0) + 4) = _DAT_00c799c0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 6;
_DAT_00c799c8 = (void *)0x0;
_DAT_00c799cc = 0;
_DAT_00c799c8 = operator_new(0x10);
*(void **)_DAT_00c799c8 = _DAT_00c799c8;
*(void **)(GHIDRA_CAST<char *>(_DAT_00c799c8) + 4) = _DAT_00c799c8;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),7);
DAT_00c799d0 = (void *)0x0;
_DAT_00c799d4 = 0;
DAT_00c799d0 = operator_new(0x10);
*(void **)DAT_00c799d0 = DAT_00c799d0;
*(void **)(GHIDRA_CAST<char *>(DAT_00c799d0) + 4) = DAT_00c799d0;
g_graphicsManager_flags = g_graphicsManager_flags | 0x200;
ExceptionList = local_10;
return &DAT_00c798e0;
}
// 00a18e90
undefined1 KAGE::Graphics::Manager::FUN_00a649b0()
{
char cVar1;
int iVar2;
HWND hwnd;
uint windowStyle;
uint uVar3;
int *in_ECX;
KColor clearColor;
char *indexedTextureShaderSource;
undefined4 local_40;
char *local_3c;
undefined4 local_38;
char *colorTextureShaderSource;
undefined4 local_30;
char *local_2c;
undefined4 local_28;
char *colorShaderSource;
undefined4 local_20;
char *local_1c;
undefined4 local_18;
void *bufferObject;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b11164;
local_10 = ExceptionList;
ExceptionList = &local_10;
DAT_00c7de7c = FUN_00a19dd0;
iVar2 = glfwInit(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
if (iVar2 != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("GLFW failed to initialize\n"));
}
FUN_00a19450(&DAT_00c79a34);
in_ECX[0x32] = DAT_00c79a34;
in_ECX[0x33] = DAT_00c79a38;
cVar1 = DAT_00c79a3c;
uVar3 = in_ECX[1] | 0x400;
if (DAT_00c79a3c == '\0') {
uVar3 = in_ECX[1] & 0xfffffbff;
}
in_ECX[1] = uVar3;
if (in_ECX[0x2f] != 0) {
iVar2 = -0x10;
hwnd = (HWND)FUN_00a5f090(in_ECX[0x2f]);
windowStyle = GetWindowLongA(hwnd,iVar2);
uVar3 = windowStyle & 0xfffeffff;
if (cVar1 != '\0') {
uVar3 = windowStyle | 0x10000;
}
iVar2 = -0x10;
hwnd = (HWND)FUN_00a5f090();
SetWindowLongA(hwnd,iVar2,uVar3);
}
cVar1 = KAGE_Graphics::create_window();
if (cVar1 == '\0') {
ExceptionList = local_10;
return 0;
}
iVar2 = in_ECX[0x2f];
if (iVar2 == 0) {
_wassert(L"window != NULL",
L"C:\\nicalis\\builderbob\\projects\\KAGE\\Source\\Platforms\\PC\\Shared\\Source\\External\\gl\\GLFW_3.4\\src\\window.c"
,0x333);
}
if (_glfw == 0) {
_glfwInputError(0x10001,0);
}
else if (*GHIDRA_CAST<int *>((iVar2 + 0x40)) == 0) {
(*DAT_00c73748)(iVar2);
if (*GHIDRA_CAST<int *>((iVar2 + 0x14)) != 0) {
(*DAT_00c73754)(iVar2);
}
}
colorShaderSource =
"\n\nattribute\tvec3\t\t\tPosition;\nattribute\tvec4\t\t\tColor;\n\nvarying\t\tvec4\t\t\tColor0;\n\nuniform\t\tmat4\t\t\tTransform;\n\nvoid\t\tmain( void )\n{\n\tColor0 = Color;\n\tgl_Position = Transform * vec4( Position.xyz, 1.0 );\n}\n\n"
;
local_20 = 0xca;
local_1c =
"\n\n#ifndef GL_ES\n\t#define lowp\n#endif\n\nvarying\t\tlowp vec4\t\tColor0;\n\nvoid\t\tmain( void )\n{\n\tgl_FragColor = Color0;\n\tif( gl_FragColor.a == 0.0 )\t\tdiscard;\n}\n\n"
;
local_18 = 0x9a;
FUN_00a13fa0("KAGE_ColorShader",&PTR_s_Position_00c0f8c0,&colorShaderSource);
colorTextureShaderSource =
"\n\nattribute\tvec3\t\t\tPosition;\nattribute\tvec4\t\t\tColor;\nattribute\tvec2\t\t\tTexCoord;\n\nvarying\t\tvec4\t\t\tColor0;\nvarying\t\tvec2\t\t\tTexCoord0;\n\nuniform\t\tmat4\t\t\tTransform;\n\nvoid\t\tmain( void )\n{\n\tgl_Position = Transform * vec4( Position.xyz, 1.0 );\n\tColor0 = Color;\n\tTexCoord0 = TexCoord;\n}\n\n"
;
local_30 = 0x117;
local_2c =
"\n\n#ifndef GL_ES\n\t#define lowp\n\t#define highp\n#endif\n\nvarying\t\tlowp vec4\t\tColor0;\nvarying\t\thighp vec2\t\tTexCoord0;\n\nuniform\t\tsampler2D\t\tTexture0;\n\nvoid\t\tmain( void )\n{\n\tgl_FragColor = texture2D( Texture0, TexCoord0 ) * Color0;\n\tif( gl_FragColor.a == 0.0 )\t\tdiscard;\n}\n\n"
;
local_28 = 0x10b;
FUN_00a13fa0("KAGE_ColorTextureShader",&PTR_s_Position_00c0f8f0,&colorTextureShaderSource);
indexedTextureShaderSource =
"\n\nattribute\tvec3\t\t\tPosition;\nattribute\tvec4\t\t\tColor;\nattribute\tvec2\t\t\tTexCoord;\n\nvarying\t\tvec4\t\t\tColor0;\nvarying\t\tvec2\t\t\tTexCoord0;\n\nuniform\t\tmat4\t\t\tTransform;\n\nvoid\t\tmain( void )\n{\n\tgl_Position = Transform * vec4( Position.xyz, 1.0 );\n\tColor0 = Color;\n\tTexCoord0 = TexCoord;\n}\n\n"
;
local_40 = 0x117;
local_3c =
"\n\n#ifndef GL_ES\n\t#define lowp\n\t#define highp\n#endif\n\nvarying\t\tlowp vec4\t\tColor0;\nvarying\t\thighp vec2\t\tTexCoord0;\n\nuniform\t\tsampler2D\t\tTexture0;\nuniform\t\tsampler2D\t\tTexture1;\n\nvoid\t\tmain( void )\n{\n\tvec4\tPaletteIndex = texture2D( Texture0, TexCoord0 );\n\tvec4\tOutputColor = texture2D( Texture1, PaletteIndex.xy ) * Color0;\n\tif( OutputColor.w == 0.0 )\t\tdiscard;\n\tgl_FragColor = OutputColor;\n}\n\n"
;
local_38 = 0x186;
FUN_00a13fa0("KAGE_IndexedTextureShader",&PTR_s_Position_00c0f8f0,&indexedTextureShaderSource);
(**(code **)(*in_ECX + 0x78))();
(**(code **)(*in_ECX + 0x18))(0,1);
bufferObject = operator_new(0x10);
local_8 = 0;
if (bufferObject == (void *)0x0) {
DAT_00c7367c = (void *)0x0;
}
else {
DAT_00c7367c = GraphicsBufferObject::GraphicsBufferObject(bufferObject);
}
local_8 = 0xffffffff;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(DAT_00c7367c) + 0xc)) = 1;
(GHIDRA_CAST<KColor *>((&clearColor)))->KColor::SetFromARGB(0xff000000);
(**(code **)(*in_ECX + 0x58))(clearColor._red,clearColor._green,clearColor._blue);
_DAT_00c379b4 = _DAT_00c379b4 | 1;
(**(code **)(DAT_00c37990 + 4))();
_DAT_00c37984 = _DAT_00c37984 | 1;
in_ECX[1] = in_ECX[1] | 1;
g_imageReleaseFn = FUN_00a12240;
g_renderTargetReleaseFn = FUN_00a12240;
ExceptionList = local_10;
return 1;
}
+159
View File
@@ -0,0 +1,159 @@
#include "classes.h"
// 00a149a0
void KAGE::Graphics::ShaderBase::free_uniforms()
{
int iVar1;
qword *allocatedBytes;
uint uVar2;
uint uVar3;
int iVar4;
int *bufferSlot;
code *freeFn;
int iVar5;
int uniformOffset;
uint uniformIndex;
void *local_10;
undefined1 *puStack_c;
undefined4 uStack_8;
uint blockSize;
qword previousAllocatedBytes;
uStack_8 = 0xffffffff;
puStack_c = &LAB_00b10d90;
local_10 = ExceptionList;
ExceptionList = &local_10;
uVar2 = 0;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) != 0) {
do {
iVar5 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) + uVar2 * 8));
if (iVar5 != 0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar3 = *GHIDRA_CAST<uint *>((iVar5 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar3;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar3));
free((void *)(iVar5 + -4));
*GHIDRA_CAST<undefined4 *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) + uVar2 * 8)) = 0;
}
uVar2 = uVar2 + 1;
} while (uVar2 < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x10)));
}
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x38));
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x34));
uniformIndex = 0;
iVar1 = iVar5 - iVar4 >> 0x1f;
if ((iVar5 - iVar4) / 0x18 + iVar1 != iVar1) {
uniformOffset = 0;
do {
iVar5 = uniformOffset + iVar4;
iVar1 = *GHIDRA_CAST<int *>((iVar5 + 0xc));
uVar3 = 0;
uVar2 = *GHIDRA_CAST<int *>((uniformOffset + 0x10 + iVar4)) - iVar1 >> 2;
if (uVar2 != 0) {
do {
if ((7 < *GHIDRA_CAST<int *>((iVar5 + 8))) &&
(iVar4 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar5 + 0xc)) + uVar3 * 4)), iVar4 != 0)) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
blockSize = *GHIDRA_CAST<uint *>((iVar4 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - blockSize;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) -
GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < blockSize));
free((void *)(iVar4 + -4));
*GHIDRA_CAST<undefined4 *>((*GHIDRA_CAST<int *>((iVar5 + 0xc)) + uVar3 * 4)) = 0;
}
uVar3 = uVar3 + 1;
} while (uVar3 < uVar2);
iVar1 = *GHIDRA_CAST<int *>((iVar5 + 0xc));
}
uniformIndex = uniformIndex + 1;
uniformOffset = uniformOffset + 0x18;
*GHIDRA_CAST<int *>((iVar5 + 0x10)) = iVar1;
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x38));
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x34));
} while (uniformIndex < GHIDRA_UINT(((iVar5 - iVar4) / 0x18)));
}
if (iVar4 != iVar5) {
do {
FID_conflict__Tidy((void *)(iVar4 + 0xc));
iVar4 = iVar4 + 0x18;
} while (iVar4 != iVar5);
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x34));
}
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x38)) = iVar4;
iVar5 = 8;
bufferSlot = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x14));
do {
iVar4 = *bufferSlot;
if (iVar4 != 0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint *>((iVar4 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar2));
free((void *)(iVar4 + -4));
*bufferSlot = 0;
}
bufferSlot = bufferSlot + 1;
iVar5 = iVar5 + -1;
} while (iVar5 != 0);
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 8));
if (iVar5 == 0) {
freeFn = free_exref;
}
else {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint *>((iVar5 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
freeFn = free_exref;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar2));
free((void *)(iVar5 + -4));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
}
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc));
if (iVar5 != 0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint *>((iVar5 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar2));
(*freeFn)(iVar5 + -4);
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0;
}
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 4)) = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 4)) & 0xfffffffe;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
ExceptionList = local_10;
return;
}