Files
isaac-port/generated-src/png_writer.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

122 lines
4.8 KiB
C++

#include "classes.h"
// 009e8d40
void PngWriter::write_end()
{
void *pngPtr;
int compression;
uint32_t *in_ECX;
int *textChunk;
int textOffset;
uint8_t exception [12];
int textIndex;
uint32_t *local_c;
uint8_t crcBytes;
uint8_t local_7;
uint8_t local_6;
uint8_t local_5;
int compression;
uint32_t crc;
local_c = in_ECX;
compression = setjmp3(*in_ECX,0);
if (compression != 0) {
FUN_009e6bd0(local_c + 0x14);
/* WARNING: Subroutine does not return */
_CxxThrowException(exception,GHIDRA_CAST<ThrowInfo *>(&DAT_00bd5cc0));
}
pngPtr = (void *)local_c[0x12];
compression = local_c[0x13];
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pngPtr) + 0x60)) & 4) == 0) {
/* WARNING: Subroutine does not return */
FUN_00a64610();
}
if (compression != 0) {
if (((*GHIDRA_CAST<uint32_t *>((compression + 8)) & 0x200) != 0) && ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pngPtr) + 100)) & 0x10000) == 0)) {
FUN_00a931f0();
}
textIndex = 0;
if (0 < *GHIDRA_CAST<int *>((compression + 0x30))) {
textOffset = 0;
do {
textChunk = GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((compression + 0x38)) + textOffset));
compression = *textChunk;
if (compression < 0) {
if (compression == -1) {
FUN_00a92520(textChunk[2],textChunk[3]);
*GHIDRA_CAST<uint32_t *>((textOffset + *GHIDRA_CAST<int *>((compression + 0x38)))) = 0xfffffffd;
}
}
else {
png_write_zTXt(textChunk[2],textChunk[3],compression);
*GHIDRA_CAST<uint32_t *>((textOffset + *GHIDRA_CAST<int *>((compression + 0x38)))) = 0xfffffffe;
}
textOffset = textOffset + 0x10;
textIndex = textIndex + 1;
} while (textIndex < *GHIDRA_CAST<int *>((compression + 0x30)));
}
}
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pngPtr) + 0x60)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pngPtr) + 0x60)) | 8;
png_write_chunk_header(pngPtr,GHIDRA_CAST<uint8_t *>(&DAT_00c12990),0);
crc = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pngPtr) + 0x108));
local_5 = (uint8_t)crc;
crcBytes = (uint8_t)(GHIDRA_UINT(crc) >> 0x18);
local_7 = (uint8_t)(GHIDRA_UINT(crc) >> 0x10);
local_6 = (uint8_t)(GHIDRA_UINT(crc) >> 8);
if (*(code **)(GHIDRA_CAST<char *>(pngPtr) + 0x4c) == (code *)0x0) {
/* WARNING: Subroutine does not return */
FUN_00a64610();
}
(**(code **)(GHIDRA_CAST<char *>(pngPtr) + 0x4c))(pngPtr,&crcBytes,4);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pngPtr) + 0x60)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pngPtr) + 0x60)) | 0x10;
return;
}
// 009e8ee0
void PngWriter::write_info()
{
int iVar1;
void *pvVar2;
int iVar3;
uint8_t local_14 [12];
void *local_8;
int pngInfo;
local_8 = this;
iVar3 = setjmp3(*GHIDRA_CAST<uint32_t *>(this),0);
pvVar2 = local_8;
if (iVar3 != 0) {
FUN_009e6bd0(GHIDRA_INT(local_8) + 0x50);
/* WARNING: Subroutine does not return */
_CxxThrowException(local_14,GHIDRA_CAST<ThrowInfo *>(&DAT_00bd5cc0));
}
FUN_00a63100(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x10)),*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x14)),
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x18)),*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x1c)),
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x20)),*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x24)),
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_8) + 0x28)));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x1c)) == 3) {
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x2c));
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x30));
if (((iVar3 != iVar1) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 8)) != 0)) &&
(pngInfo = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0xc)), pngInfo != 0)) {
*GHIDRA_CAST<int *>((pngInfo + 0x10)) = iVar3;
*GHIDRA_CAST<uint32_t *>((pngInfo + 8)) = *GHIDRA_CAST<uint32_t *>((pngInfo + 8)) | 8;
*GHIDRA_CAST<short *>((pngInfo + 0x14)) = (short)((iVar1 - iVar3) / 3);
}
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x38));
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x3c));
if (iVar3 != iVar1) {
pngInfo = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0xc));
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 8)) != 0) && (pngInfo != 0)) {
if (iVar3 != 0) {
*GHIDRA_CAST<int *>((pngInfo + 0x4c)) = iVar3;
}
*GHIDRA_CAST<uint32_t *>((pngInfo + 8)) = *GHIDRA_CAST<uint32_t *>((pngInfo + 8)) | 0x10;
*GHIDRA_CAST<short *>((pngInfo + 0x16)) = (short)iVar1 - (short)iVar3;
}
}
}
png_write_info();
return;
}