//
// cocos2d::CCImage::initWithImageData from 0x5e1e62 to 0x5e1f26 (196 bytes)
//
// 7 xrefs:
// > cocos2d::CCRenderTexture::newCCImage @ 0x5d8a9e
// > sub_5D8C44 @ 0x5d8c7a
// > cocos2d::CCParticleSystem::initWithDictionary @ 0x5dcc5a
// > cocos2d::CCImage::initWithImageFileThreadSafe @ 0x5e1f6e
// > cocos2d::CCImage::initWithImageFile @ 0x5e1ff8
// > cocos2d::CCSprite::setTexture @ 0x5e6860
// > cocos2d::VolatileTexture::reloadAllTextures @ 0x5f58de
//
// 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
//
bool cocos2d::CCImage::initWithImageData(
cocos2d::CCImage *a1,
void *a2,
int a3,
cocos2d::CCImage::EImageFormat a4,
int a5,
int a6,
int a7,
int a8)
{
int v9; // r3
bool v10; // zf
if ( !a2 || a3 <= 0 )
return 0;
switch ( a4 )
{
case kFmtPng:
return cocos2d::CCImage::_initWithPngData(a1, a2, a3);
case kFmtJpg:
return cocos2d::CCImage::_initWithJpgData(a1, a2, a3);
case kFmtTiff:
return cocos2d::CCImage::_initWithTiffData(a1, a2, a3);
case kFmtRawData:
return cocos2d::CCImage::_initWithRawData(a1, a2, a3, a5, a6, a7, 0);
}
if ( a3 <= 8 )
{
if ( a3 <= 2 )
return 0;
}
else if ( *(unsigned __int8 *)a2 == 137
&& *((_BYTE *)a2 + 1) == 80
&& *((_BYTE *)a2 + 2) == 78
&& *((_BYTE *)a2 + 3) == 71
&& *((_BYTE *)a2 + 4) == 13
&& *((_BYTE *)a2 + 5) == 10
&& *((_BYTE *)a2 + 6) == 26
&& *((_BYTE *)a2 + 7) == 10 )
{
return cocos2d::CCImage::_initWithPngData(a1, a2, a3);
}
v9 = *(unsigned __int8 *)a2;
if ( v9 == 73 )
{
v10 = *((_BYTE *)a2 + 1) == 73;
goto LABEL_26;
}
if ( v9 == 77 )
{
v10 = *((_BYTE *)a2 + 1) == 77;
LABEL_26:
if ( v10 )
return cocos2d::CCImage::_initWithTiffData(a1, a2, a3);
return 0;
}
if ( v9 == 255 && *((unsigned __int8 *)a2 + 1) == 216 )
return cocos2d::CCImage::_initWithJpgData(a1, a2, a3);
return 0;
}