//
// cocos2d::CCTexturePVR::initWithContentsOfFile from 0x100415728 to 0x100415994 (620 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexture2D::initWithPVRFile @ 0x1001ab778
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 11:04:52 +0000
//
__int64 __fastcall cocos2d::CCTexturePVR::initWithContentsOfFile(__int64 a1, 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
void **v16; // x22
__int64 v17; // x8
char *v18; // x21
void **v19; // x0
char *v20; // x0
__int64 v22; // x0
__int64 v23; // x19
void **__s; // [xsp+8h] [xbp-58h] BYREF
unsigned __int64 v26; // [xsp+10h] [xbp-50h]
char v27; // [xsp+1Fh] [xbp-41h]
unsigned int v28; // [xsp+24h] [xbp-3Ch] BYREF
void *__p; // [xsp+28h] [xbp-38h] BYREF
__p = nullptr;
v28 = 0;
sub_100009900(&__s, a2);
for ( i = 0; ; i = v5 + 1 )
{
v5 = i;
v6 = v27;
if ( v27 < 0 )
break;
if ( i >= v27 )
{
p_s = (void **)&__s;
v11 = v27;
goto LABEL_13;
}
LABEL_6:
v7 = __s;
if ( v27 >= 0 )
v7 = (void **)&__s;
v8 = __tolower(*((char *)v7 + v5));
if ( v27 >= 0 )
v9 = (void **)&__s;
else
v9 = __s;
*((_BYTE *)v9 + v5) = v8;
}
v11 = v26;
if ( v26 > 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_1002DBBE0((__int64)a2, &__p);
LABEL_40:
v28 = 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 )
v16 = (void **)&__s;
else
v16 = __s;
if ( (int)v6 >= 0 )
v17 = v6;
else
v17 = v26;
if ( v17 >= 3 )
{
v18 = (char *)v16 + v17;
v19 = v16;
do
{
v20 = (char *)memchr(v19, 46, v17 - 2);
if ( !v20 )
break;
if ( *(_WORD *)v20 == 26414 && v20[2] == 122 )
{
if ( v20 != v18 && v20 - (char *)v16 != -1 )
{
v15 = sub_1002DBB28(a2, &__p);
goto LABEL_40;
}
break;
}
v19 = (void **)(v20 + 1);
v17 = v18 - (char *)v19;
}
while ( v18 - (char *)v19 >= 3 );
}
v22 = cocos2d::CCFileUtils::sharedFileUtils();
__p = (void *)(*(__int64 (__fastcall **)(__int64, char *, const char *, unsigned int *))(*(_QWORD *)v22 + 32LL))(
v22,
a2,
"rb",
&v28);
if ( (v28 & 0x80000000) != 0 )
{
LABEL_51:
cocos2d::CCObject::release((_DWORD *)a1);
v23 = 0;
goto LABEL_52;
}
LABEL_43:
*(_QWORD *)(a1 + 336) = 0;
*(_QWORD *)(a1 + 312) = 0;
*(_QWORD *)(a1 + 320) = 0;
*(_DWORD *)(a1 + 328) = 0;
if ( (cocos2d::CCTexturePVR::unpackPVRv2Data(a1, (__int64)__p) & 1) == 0
&& !(unsigned int)cocos2d::CCTexturePVR::unpackPVRv3Data(a1, (__int64)__p, v28)
|| (cocos2d::CCTexturePVR::createGLTexture(a1) & 1) == 0 )
{
if ( __p )
{
operator delete[](__p);
__p = nullptr;
}
goto LABEL_51;
}
if ( __p )
{
operator delete[](__p);
__p = nullptr;
}
v23 = 1;
LABEL_52:
if ( v27 < 0 )
operator delete(__s);
return v23;
}