//
// cocos2d::CCImage::_initWithJpgData from 0x7eb79c to 0x7eb8b2 (278 bytes)
//
// 1 xrefs:
// > cocos2d::CCImage::initWithImageData @ 0x7ebcb6
//
// 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:00:59 +0000
//
int __fastcall cocos2d::CCImage::_initWithJpgData(cocos2d::CCImage *this, void *a2, int a3)
{
int v3; // r0
int v4; // r3
int v5; // r0
unsigned int i; // r3
char v7; // r1
int v10; // [sp+8h] [bp-388h]
int v11; // [sp+Ch] [bp-384h]
void *v14; // [sp+18h] [bp-378h] BYREF
void (__fastcall __noreturn *v15[33])(int *); // [sp+1Ch] [bp-374h] BYREF
jmp_buf env; // [sp+A0h] [bp-2F0h] BYREF
_DWORD v17[10]; // [sp+1A0h] [bp-1F0h] BYREF
int v18; // [sp+1C8h] [bp-1C8h]
int v19; // [sp+1CCh] [bp-1C4h]
int v20; // [sp+210h] [bp-180h]
unsigned int v21; // [sp+214h] [bp-17Ch]
int v22; // [sp+21Ch] [bp-174h]
unsigned int v23; // [sp+22Ch] [bp-164h]
v14 = nullptr;
v10 = 0;
v11 = 0;
v3 = jpeg_std_error(v15);
v15[0] = sub_7EB5E2;
v17[0] = v3;
if ( setjmp(env) )
{
jpeg_destroy_decompress(v17);
}
else
{
jpeg_CreateDecompress(v17);
jpeg_mem_src(v17, a2, a3);
jpeg_read_header(v17, 1);
if ( v18 != 2 )
{
if ( (v18 & 0xFFFFFFFD) == 1 )
v19 = 2;
jpeg_start_decompress(v17);
v4 = v20;
v5 = v22;
*((_WORD *)this + 26) = v20;
*((_WORD *)this + 27) = v21;
*((_BYTE *)this + 64) = 0;
*((_BYTE *)this + 65) = 0;
*((_DWORD *)this + 14) = 8;
v14 = (void *)operator new[](v5 * v4);
*((_DWORD *)this + 15) = operator new[](v22 * v20 * v21);
while ( v23 < v21 )
{
jpeg_read_scanlines(v17, &v14, 1);
for ( i = 0; i < v20 * v22; ++i )
{
v7 = *((_BYTE *)v14 + i);
*(_BYTE *)(*((_DWORD *)this + 15) + v10++) = v7;
}
}
jpeg_destroy_decompress(v17);
v11 = 1;
}
}
if ( v14 )
operator delete[](v14);
return v11;
}