//
// png_set_longjmp_fn from 0x86128c to 0x8612fc (112 bytes)
//
// 2 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0x7eb93a
// > cocos2d::CCImage::_saveImageToPNG @ 0x7ebe30
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:02:43 +0000
//
_DWORD *__fastcall png_set_longjmp_fn(_DWORD *a1, int a2, unsigned int a3)
{
_DWORD *v4; // r3
int v7; // r1
int v9; // r0
if ( a1 )
{
v4 = (_DWORD *)a1[65];
if ( v4 )
{
v7 = a1[66];
if ( !v7 )
{
if ( v4 != a1 )
png_error((int)a1, "Libpng jmp_buf still allocated");
v7 = 256;
}
if ( v7 == a3 )
goto LABEL_5;
png_warning((int)a1, "Application jmp_buf size changed");
return nullptr;
}
a1[66] = 0;
if ( a3 > 0x100 )
{
v9 = png_malloc_warn(a1, a3);
a1[65] = v9;
if ( !v9 )
return nullptr;
a1[66] = a3;
v4 = (_DWORD *)v9;
}
else
{
a1[65] = a1;
v4 = a1;
}
LABEL_5:
a1[64] = a2;
return v4;
}
return nullptr;
}