//
// cocos2d::CCTexturePVR::unpackPVRv3Data from 0xda9d4c to 0xdaa0b8 (876 bytes)
//
// 2 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0xdaa444
// > ??> @ 0xc9d30
//
// 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 13:08:34 +0000
//
__int64 __fastcall cocos2d::CCTexturePVR::unpackPVRv3Data(
cocos2d::CCTexturePVR *this,
unsigned __int8 *a2,
unsigned int a3)
{
unsigned __int64 v3; // x23
cocos2d::CCConfiguration *v7; // x0
int v8; // w1
char v10; // w0
__int64 v11; // x0
char *v12; // x22
unsigned int v13; // w24
int v14; // w0
int v15; // w3
int v16; // w21
unsigned int v17; // w3
unsigned int v18; // w5
int v19; // w4
int v20; // w1
unsigned int v21; // w20
unsigned int v22; // w19
unsigned int v23; // w3
cocos2d::CCConfiguration *v24; // x0
int v25; // w1
if ( a3 <= 0x33 || bswap32(*(_DWORD *)a2) != 1347834371 )
return 0;
v3 = *((_QWORD *)a2 + 1);
v7 = (cocos2d::CCConfiguration *)cocos2d::CCConfiguration::sharedConfiguration(this);
if ( (unsigned __int8)cocos2d::CCConfiguration::supportsPVRTC(v7) )
v8 = 13;
else
v8 = 9;
if ( v3 == cocos2d::v3_pixel_formathash[0] )
{
v10 = 0;
}
else if ( v3 == qword_154A280 )
{
v10 = 1;
}
else if ( v3 == qword_154A290 )
{
v10 = 2;
}
else if ( v3 == qword_154A2A0 )
{
v10 = 3;
}
else if ( v3 == qword_154A2B0 )
{
v10 = 4;
}
else if ( v3 == qword_154A2C0 )
{
v10 = 5;
}
else if ( v3 == qword_154A2D0 )
{
v10 = 6;
}
else if ( v3 == qword_154A2E0 )
{
v10 = 7;
}
else if ( v3 == qword_154A2F0 )
{
v10 = 8;
}
else
{
if ( v8 == 9 )
return 0;
if ( v3 == qword_154A300 )
{
v10 = 9;
}
else if ( v3 == qword_154A310 )
{
v10 = 10;
}
else if ( v3 == qword_154A320 )
{
v10 = 11;
}
else
{
if ( v3 != qword_154A330 )
return 0;
v10 = 12;
}
}
v11 = cocos2d::v3_pixel_formathash[2 * (v10 & 0xF) + 1];
*((_QWORD *)this + 42) = v11;
*((_BYTE *)this + 328) = *(_BYTE *)(v11 + 17);
v25 = *((_DWORD *)a2 + 1);
*((_BYTE *)this + 330) = 1;
if ( (v25 & 2) != 0 )
*((_BYTE *)this + 329) = 1;
v21 = *((_DWORD *)a2 + 7);
v22 = *((_DWORD *)a2 + 6);
*((_DWORD *)this + 79) = v21;
v12 = (char *)this + 56;
*((_DWORD *)this + 80) = v22;
v13 = 0;
v14 = *((_DWORD *)a2 + 11);
v15 = *((_DWORD *)a2 + 12);
*((_DWORD *)this + 78) = v14;
v16 = v15 + 52;
if ( v14 )
{
do
{
if ( v3 <= 3 )
{
if ( v3 >= 2 )
{
v17 = v21 >> 2;
v18 = v22 >> 2;
v19 = 16;
}
else
{
v17 = v21 >> 3;
v18 = v22 >> 2;
v19 = 32;
}
}
else
{
if ( v3 == 0x808080861726762LL )
{
v24 = (cocos2d::CCConfiguration *)cocos2d::CCConfiguration::sharedConfiguration((cocos2d::CCConfiguration *)0x808080861726762LL);
if ( !(unsigned __int8)cocos2d::CCConfiguration::supportsBGRA8888(v24) )
return 0;
}
v18 = v22;
v17 = v21;
v19 = 1;
}
if ( v17 <= 1 )
v17 = 2;
if ( v18 <= 1 )
v18 = 2;
v20 = *(_DWORD *)(*((_QWORD *)this + 42) + 12LL);
v12 += 16;
*((_QWORD *)v12 - 2) = &a2[v16];
v21 >>= 1;
v22 >>= 1;
++v13;
v23 = v17 * ((unsigned int)(v19 * v20) >> 3) * v18;
if ( v23 > a3 - v16 )
v23 = a3 - v16;
*((_DWORD *)v12 - 2) = v23;
v16 += v23;
if ( !v21 )
v21 = 1;
if ( !v22 )
v22 = 1;
}
while ( v13 < *((_DWORD *)this + 78) );
}
return 1;
}