//
// cocos2d::CCImage::saveToFile from 0x5e23dc to 0x5e24a6 (202 bytes)
//
// 2 xrefs:
// > cocos2d::CCRenderTexture::saveToFile @ 0x5d8b2e
// > cocos2d::CCRenderTexture::saveToFile @ 0x5d8b94
//
// 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::saveToFile(cocos2d::CCImage *a1, const char *a2, bool a3)
{
unsigned int i; // r6
int v7; // r11
_BOOL4 v8; // r0
int v10; // [sp+4h] [bp-10h] BYREF
int v11; // [sp+8h] [bp-Ch] BYREF
if ( !a2 )
return 0;
sub_776584((int)&v10, (char *)a2);
if ( *(_DWORD *)(v10 - 12) > 4u )
{
sub_775C20(&v11);
for ( i = 0; i < *(_DWORD *)(v11 - 12); ++i )
{
sub_775170(&v11);
v7 = v11;
sub_775170(&v10);
*(_BYTE *)(v7 + i) = tolower(*(unsigned __int8 *)(v10 + i));
}
if ( sub_7748A0((int)&v11, ".png") == -1 )
{
if ( sub_7748A0((int)&v11, ".jpg") == -1 )
{
LABEL_12:
sub_774008(&v11);
goto LABEL_13;
}
v8 = cocos2d::CCImage::_saveImageToJPG(a1, a2);
}
else
{
v8 = cocos2d::CCImage::_saveImageToPNG(a1, a2, a3);
}
if ( v8 )
{
sub_774008(&v11);
sub_774008(&v10);
return 1;
}
goto LABEL_12;
}
LABEL_13:
sub_774008(&v10);
return 0;
}