//
// png_image_begin_read_from_file from 0xbd61e8 to 0xbd62c8 (224 bytes)
//
// 1 xrefs:
// > ??> @ 0x63eb8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall png_image_begin_read_from_file(__int64 a1, char *filename)
{
const char *v2; // x1
FILE *v4; // x20
__int64 v5; // x3
char v6; // w4
int *v7; // x0
char *v8; // x1
if ( !a1 )
return 0;
if ( *(_DWORD *)(a1 + 8) == 1 )
{
if ( !filename )
{
v2 = "png_image_begin_read_from_file: invalid argument";
return png_image_error(a1, (__int64)v2);
}
v4 = fopen(filename, "rb");
if ( !v4 )
{
v7 = (int *)__errno();
v8 = strerror(*v7);
return png_image_error(a1, (__int64)v8);
}
if ( (unsigned int)sub_BD5DF0((_QWORD *)a1) )
{
v5 = *(_QWORD *)a1;
v6 = *(_BYTE *)(*(_QWORD *)a1 + 40LL);
*(_QWORD *)(**(_QWORD **)a1 + 320LL) = v4;
*(_BYTE *)(v5 + 40) = v6 | 2;
return png_safe_execute(a1, sub_BD3718, a1);
}
fclose(v4);
return 0;
}
v2 = "png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION";
return png_image_error(a1, (__int64)v2);
}