//
// cocos2d::CCTexturePVR::initWithContentsOfFile from 0x5f69b0 to 0x5f6ad8 (296 bytes)
//
// 2 xrefs:
// > cocos2d::CCTexture2D::initWithPVRFile @ 0x5f3966
// > cocos2d::CCTexturePVR::create @ 0x5f6afc
//
// 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::CCTexturePVR::initWithContentsOfFile(cocos2d::CCTexturePVR *a1, const char *a2)
{
unsigned int v3; // r5
int v5; // r9
unsigned __int8 **v6; // r2
int v7; // r3
unsigned int v8; // r0
unsigned __int8 **v9; // r2
cocos2d::CCFileUtils *v10; // r0
unsigned int v11; // r2
_BOOL4 GLTexture; // r5
unsigned __int8 *v14; // [sp+8h] [bp-14h] BYREF
unsigned int v15; // [sp+Ch] [bp-10h] BYREF
int v16; // [sp+10h] [bp-Ch] BYREF
v3 = 0;
v14 = nullptr;
v15 = 0;
sub_776584((int)&v16, (char *)a2);
while ( v3 < *(_DWORD *)(v16 - 12) )
{
sub_775170(&v16);
v5 = v16;
sub_775170(&v16);
*(_BYTE *)(v5 + v3) = tolower(*(unsigned __int8 *)(v16 + v3));
++v3;
}
if ( sub_7748A0((int)&v16, ".ccz") != -1 )
{
v8 = cocos2d::ZipUtils::ccInflateCCZFile((cocos2d::ZipUtils *)a2, (char *)&v14, v6, v7);
LABEL_8:
v15 = v8;
goto LABEL_10;
}
if ( sub_7748A0((int)&v16, ".gz") != -1 )
{
v8 = cocos2d::ZipUtils::ccInflateGZipFile((cocos2d::ZipUtils *)a2, (char *)&v14, v9);
goto LABEL_8;
}
v10 = cocos2d::CCFileUtils::sharedFileUtils();
v14 = (unsigned __int8 *)((int (__fastcall *)(cocos2d::CCFileUtils *, const char *, const char *, unsigned int *))v10->addSearchResolutionsOrder)(
v10,
a2,
"rb",
&v15);
LABEL_10:
v11 = v15;
if ( (v15 & 0x80000000) != 0 )
{
LABEL_11:
LOBYTE(GLTexture) = 0;
cocos2d::CCObject::release(a1);
goto LABEL_19;
}
a1[3].m_eObjType = 0;
a1[3].m_unknown2 = 0;
a1[3].m_uUnknown = 0;
a1[3].m_uIndexInArray = 0;
a1[3].m_unknown5 = 0;
LOBYTE(a1[3].m_nZOrder) = 0;
BYTE2(a1[3].m_nZOrder) = 0;
BYTE1(a1[3].m_nZOrder) = 0;
HIBYTE(a1[3].m_nZOrder) = 0;
if ( !cocos2d::CCTexturePVR::unpackPVRv2Data(a1, v14, v11) && !cocos2d::CCTexturePVR::unpackPVRv3Data(a1, v14, v15)
|| !(GLTexture = cocos2d::CCTexturePVR::createGLTexture(a1)) )
{
if ( v14 )
{
operator delete[](v14);
v14 = nullptr;
}
goto LABEL_11;
}
if ( v14 )
{
operator delete[](v14);
v14 = nullptr;
}
LABEL_19:
sub_774008(&v16);
return GLTexture;
}