//
// png_read_image from 0xe4b8f8 to 0xe4b9bc (196 bytes)
//
// 3 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0xd7d188
// > png_read_png @ 0xe4c170
// > ??> @ 0xcdc30
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:10:08 +0000
//
__int64 __fastcall png_read_image(__int64 result, __int64 a2)
{
__int64 v2; // x21
int v4; // w23
unsigned int v5; // w20
int v6; // w22
__int64 i; // x19
void *v8; // x1
v2 = result;
if ( result )
{
if ( (*(_DWORD *)(result + 360) & 0x40) != 0 )
{
if ( *(_BYTE *)(result + 684) && (*(_DWORD *)(result + 364) & 2) == 0 )
{
png_warning(result, "Interlace handling should be turned on when using png_read_image");
*(_DWORD *)(v2 + 568) = *(_DWORD *)(v2 + 564);
}
result = png_set_interlace_handling(v2);
v4 = result;
}
else
{
v4 = png_set_interlace_handling(result);
result = png_start_read_image(v2);
}
v5 = *(_DWORD *)(v2 + 564);
v6 = 0;
if ( v4 > 0 )
{
do
{
for ( i = 0; v5 > (unsigned int)i; result = png_read_row(v2, v8, nullptr) )
v8 = *(void **)(a2 + 8 * i++);
++v6;
}
while ( v6 != v4 );
}
}
return result;
}