//
// cocos2d::CCTexturePVR::initWithContentsOfFile from 0x1003708f0 to 0x100370b5c (620 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexture2D::initWithPVRFile @ 0x10012dd74
//
// 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 __fastcall cocos2d::CCTexturePVR::initWithContentsOfFile(cocos2d::CCTexturePVR *a1, const char *a2)
{
unsigned int i; // w8
unsigned __int64 v5; // x23
__int64 v6; // x21
void **v7; // x8
char v8; // w0
void **v9; // x8
void **p_s; // x22
unsigned __int64 v11; // x8
char *v12; // x23
void **v13; // x0
char *v14; // x0
unsigned int v15; // w0
unsigned int v16; // w2
void **v17; // x22
__int64 v18; // x8
char *v19; // x21
void **v20; // x0
char *v21; // x0
cocos2d::CCFileUtils *v23; // x0
bool v24; // w19
void **__s; // [xsp+8h] [xbp-58h] BYREF
unsigned __int64 v27; // [xsp+10h] [xbp-50h]
char v28; // [xsp+1Fh] [xbp-41h]
unsigned int v29; // [xsp+24h] [xbp-3Ch] BYREF
void *__p; // [xsp+28h] [xbp-38h] BYREF
__p = nullptr;
v29 = 0;
sub_100009900(&__s, (char *)a2);
for ( i = 0; ; i = v5 + 1 )
{
v5 = i;
v6 = v28;
if ( v28 < 0 )
break;
if ( i >= v28 )
{
p_s = (void **)&__s;
v11 = v28;
goto LABEL_13;
}
LABEL_6:
v7 = __s;
if ( v28 >= 0 )
v7 = (void **)&__s;
v8 = __tolower(*((char *)v7 + v5));
if ( v28 >= 0 )
v9 = (void **)&__s;
else
v9 = __s;
*((_BYTE *)v9 + v5) = v8;
}
v11 = v27;
if ( v27 > v5 )
goto LABEL_6;
p_s = __s;
LABEL_13:
if ( v11 >= 4 )
{
v12 = (char *)p_s + v11;
v13 = p_s;
do
{
v14 = (char *)memchr(v13, 46, v11 - 3);
if ( !v14 )
break;
if ( *(_DWORD *)v14 == 2053333806 )
{
if ( v14 == v12 || v14 - (char *)p_s == -1 )
break;
v15 = sub_10023EB6C((__int64)a2, &__p);
LABEL_40:
v29 = v15;
if ( (v15 & 0x80000000) == 0 )
goto LABEL_43;
goto LABEL_51;
}
v13 = (void **)(v14 + 1);
v11 = v12 - (char *)v13;
}
while ( v12 - (char *)v13 > 3 );
}
if ( (int)v6 >= 0 )
v17 = (void **)&__s;
else
v17 = __s;
if ( (int)v6 >= 0 )
v18 = v6;
else
v18 = v27;
if ( v18 >= 3 )
{
v19 = (char *)v17 + v18;
v20 = v17;
do
{
v21 = (char *)memchr(v20, 46, v18 - 2);
if ( !v21 )
break;
if ( *(_WORD *)v21 == 26414 && v21[2] == 122 )
{
if ( v21 != v19 && v21 - (char *)v17 != -1 )
{
v15 = sub_10023EAB4(a2, &__p);
goto LABEL_40;
}
break;
}
v20 = (void **)(v21 + 1);
v18 = v19 - (char *)v20;
}
while ( v19 - (char *)v20 >= 3 );
}
v23 = cocos2d::CCFileUtils::sharedFileUtils();
__p = (void *)((__int64 (__fastcall *)(cocos2d::CCFileUtils *, const char *, const char *, unsigned int *))v23->addSearchResolutionsOrder)(
v23,
a2,
"rb",
&v29);
if ( (v29 & 0x80000000) != 0 )
{
LABEL_51:
cocos2d::CCObject::release(a1);
v24 = 0;
goto LABEL_52;
}
LABEL_43:
a1[6].__vftable = nullptr;
*(_QWORD *)&a1[5].m_uIndexInArray = 0;
*(_QWORD *)&a1[5].m_unknown2 = 0;
a1[5].m_uOrderOfArrival = 0;
if ( !cocos2d::CCTexturePVR::unpackPVRv2Data(a1, (unsigned __int8 *)__p, v16)
&& !cocos2d::CCTexturePVR::unpackPVRv3Data(a1, (unsigned __int8 *)__p, v29)
|| !cocos2d::CCTexturePVR::createGLTexture(a1) )
{
if ( __p )
{
operator delete[](__p);
__p = nullptr;
}
goto LABEL_51;
}
if ( __p )
{
operator delete[](__p);
__p = nullptr;
}
v24 = 1;
LABEL_52:
if ( v28 < 0 )
operator delete(__s);
return v24;
}