Files
isaac-port/generated-src/kage/graphics/shader_base.cpp
T
shweetandClaude Opus 5.5 9d4d4f5c64 Build 29: zero-length placeholder structs, generated-src with standard types
--check: 938/3256 method bodies compile for x86_64 (28.8%), 32-bit layout asserts hold; boot path 3/626 curated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:41:34 -05:00

160 lines
6.4 KiB
C++

#include "classes.h"
// 00a149a0
void KAGE::Graphics::ShaderBase::free_uniforms()
{
int iVar1;
uint64_t *allocatedBytes;
uint32_t uVar2;
uint32_t uVar3;
int iVar4;
int *bufferSlot;
code *freeFn;
int iVar5;
int uniformOffset;
uint32_t uniformIndex;
void *local_10;
uint8_t *puStack_c;
uint32_t uStack_8;
uint32_t blockSize;
uint64_t 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<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar3 = *GHIDRA_CAST<uint32_t *>((iVar5 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar3;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar3));
free((void *)(iVar5 + -4));
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) + uVar2 * 8)) = 0;
}
uVar2 = uVar2 + 1;
} while (uVar2 < *GHIDRA_CAST<uint32_t *>((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<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
blockSize = *GHIDRA_CAST<uint32_t *>((iVar4 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - blockSize;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) -
GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < blockSize));
free((void *)(iVar4 + -4));
*GHIDRA_CAST<uint32_t *>((*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<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint32_t *>((iVar4 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((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<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint32_t *>((iVar5 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
freeFn = free_exref;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar2));
free((void *)(iVar5 + -4));
*GHIDRA_CAST<uint32_t *>((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<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint32_t *>((iVar5 + -4));
previousAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(previousAllocatedBytes) < uVar2));
(*freeFn)(iVar5 + -4);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0;
}
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 4)) & 0xfffffffe;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
ExceptionList = local_10;
return;
}