//
// cocos2d::CCTexturePVR::unpackPVRv2Data from 0x5f653c to 0x5f66d6 (410 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x5f6a80
//
// 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::unpackPVRv2Data(cocos2d::CCTexturePVR *a1, unsigned __int8 *a2, unsigned int a3)
{
unsigned int v5; // r3
_BOOL4 v6; // r4
cocos2d::CCConfiguration *v7; // r0
int v8; // r6
unsigned int v9; // r1
cocos2d *v10; // r5
unsigned int v11; // r1
cocos2d *v12; // r5
cocos2d::CCConfiguration *v13; // r0
int v14; // r4
int v15; // r12
char *v16; // r5
int v17; // r3
unsigned int v18; // r4
unsigned int v19; // r5
int v20; // r2
unsigned int v21; // r11
int v22; // r10
unsigned int v23; // r1
unsigned int v24; // r2
int v25; // r3
cocos2d::CCConfiguration *v26; // r0
unsigned int v27; // r3
unsigned int v28; // r3
cocos2d::CCObjectType m_eObjType; // r2
char *v30; // r0
cocos2d::CCObjectType v31; // r2
unsigned __int8 *v32; // r1
unsigned int v33; // r9
v5 = *((_DWORD *)a2 + 11);
if ( (unsigned __int8)v5 == 80 && BYTE1(v5) == 86 && BYTE2(v5) == 82 && HIBYTE(v5) == 33 )
{
v7 = cocos2d::CCConfiguration::sharedConfiguration();
v8 = *((_DWORD *)a2 + 4);
v6 = cocos2d::CCConfiguration::supportsNPOT(v7);
if ( v6
|| (v10 = *((cocos2d **)a2 + 2), v10 == (cocos2d *)cocos2d::ccNextPOT(v10, v9))
&& (v12 = *((cocos2d **)a2 + 1), v12 == (cocos2d *)cocos2d::ccNextPOT(v12, v11)) )
{
v13 = cocos2d::CCConfiguration::sharedConfiguration();
v14 = 0;
if ( cocos2d::CCConfiguration::supportsPVRTC(v13) )
v15 = 11;
else
v15 = 9;
while ( 1 )
{
v16 = (char *)&unk_A2CDC0 + 16 * v14;
if ( *(_QWORD *)v16 == (unsigned __int8)v8 )
break;
if ( ++v14 == v15 )
goto LABEL_2;
}
v17 = *((_DWORD *)v16 + 2);
v18 = *((_DWORD *)a2 + 2);
a1[3].m_eObjType = 0;
a1[3].m_unknown5 = v17;
a1[3].m_uIndexInArray = v18;
v19 = *((_DWORD *)a2 + 1);
v20 = *((_DWORD *)a2 + 10);
a1[3].m_uUnknown = v19;
LOBYTE(a1[3].m_nZOrder) = v20 != 0;
v33 = *((_DWORD *)a2 + 5);
v21 = 0;
v22 = *(_DWORD *)(v17 + 12);
a1[3].m_uOrderOfArrival = *(_DWORD *)(v17 + 20);
while ( 1 )
{
if ( v21 >= v33 )
{
LOBYTE(v6) = 1;
return v6;
}
switch ( (unsigned __int8)v8 )
{
case 0x19u:
v23 = v18 >> 2;
v24 = v19 >> 2;
v25 = 16;
break;
case 0x1Au:
v26 = cocos2d::CCConfiguration::sharedConfiguration();
if ( !cocos2d::CCConfiguration::supportsBGRA8888(v26) )
goto LABEL_2;
break;
case 0x18u:
v23 = v18 >> 3;
v24 = v19 >> 2;
v25 = 32;
break;
default:
v24 = v19;
v23 = v18;
v25 = 1;
break;
}
v27 = v22 * v25;
if ( v23 <= 1 )
v23 = 2;
if ( v24 <= 1 )
v24 = 2;
v28 = (v27 >> 3) * v23 * v24;
m_eObjType = a1[3].m_eObjType;
v30 = (char *)a1 + 8 * m_eObjType;
v31 = m_eObjType + 1;
if ( v28 >= v33 - v21 )
v28 = v33 - v21;
v18 >>= 1;
*((_DWORD *)v30 + 14) = v28;
if ( !v18 )
v18 = 1;
v19 >>= 1;
v32 = &a2[v21 + 52];
v21 += v28;
*((_DWORD *)v30 + 13) = v32;
if ( !v19 )
v19 = 1;
a1[3].m_eObjType = v31;
}
}
}
else
{
LABEL_2:
LOBYTE(v6) = 0;
}
return v6;
}