//
// cocos2d::CCTexturePVR::unpackPVRv3Data from 0x100370550 to 0x100370720 (464 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x100370ae8
//
// 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::unpackPVRv3Data(cocos2d::CCTexturePVR *a1, unsigned __int8 *a2, unsigned int a3)
{
_BOOL4 v3; // w0
unsigned __int64 v7; // x22
cocos2d::CCConfiguration *v8; // x0
_BOOL4 v9; // w0
__int64 v10; // x9
cocos2d::CCTexturePVR_vtbl **v11; // x8
cocos2d::CCTexturePVR_vtbl *v12; // x8
int v13; // w10
int32x2_t v14; // d8
unsigned __int64 m_uIndexInArray; // x9
int v16; // w10
unsigned __int64 v17; // x23
int v18; // w24
unsigned int *p_m_uID; // x25
uint32x2_t v20; // d0
int v21; // w10
cocos2d::CCConfiguration *v22; // x0
int32x2_t v23; // d0
unsigned __int32 v24; // w10
int8x8_t v25; // d1
if ( a3 >= 0x34 )
{
if ( *(_DWORD *)a2 == 55727696 )
{
v7 = *((_QWORD *)a2 + 1);
v8 = cocos2d::CCConfiguration::sharedConfiguration();
v9 = cocos2d::CCConfiguration::supportsPVRTC(v8);
v10 = 13;
if ( !v9 )
v10 = 9;
v11 = (cocos2d::CCTexturePVR_vtbl **)&off_10084C3E0;
while ( *(v11 - 1) != (cocos2d::CCTexturePVR_vtbl *)v7 )
{
v11 += 2;
if ( !--v10 )
goto LABEL_9;
}
v12 = *v11;
a1[6].__vftable = v12;
LOBYTE(a1[5].m_uOrderOfArrival) = BYTE1(v12->~CCTexturePVR_0);
v13 = *((_DWORD *)a2 + 1);
BYTE2(a1[5].m_uOrderOfArrival) = 1;
if ( (v13 & 2) != 0 )
BYTE1(a1[5].m_uOrderOfArrival) = 1;
v14 = *(int32x2_t *)(a2 + 24);
*(int32x2_t *)&a1[5].m_uUnknown = vrev64_s32(v14);
m_uIndexInArray = *((unsigned int *)a2 + 11);
v16 = *((_DWORD *)a2 + 12);
a1[5].m_uIndexInArray = m_uIndexInArray;
if ( (_DWORD)m_uIndexInArray )
{
v17 = 0;
v18 = v16 + 52;
p_m_uID = &a1[1].m_uID;
do
{
if ( v7 < 2 )
{
v20 = vshl_u32((uint32x2_t)v14, (uint32x2_t)0xFFFFFFFDFFFFFFFELL);
v21 = 32;
}
else if ( v7 - 2 >= 2 )
{
if ( v7 == 0x808080861726762LL )
{
v22 = cocos2d::CCConfiguration::sharedConfiguration();
v3 = cocos2d::CCConfiguration::supportsBGRA8888(v22);
if ( !v3 )
return v3;
v12 = a1[6].__vftable;
m_uIndexInArray = (unsigned int)a1[5].m_uIndexInArray;
}
v21 = 1;
v20 = (uint32x2_t)v14;
}
else
{
v20 = vshr_n_u32((uint32x2_t)v14, 2u);
v21 = 16;
}
v23 = (int32x2_t)vmax_u32(v20, (uint32x2_t)0x200000002LL);
v24 = vmul_lane_s32(v23, v23, 1).u32[0] * ((unsigned int)(HIDWORD(v12->~CCTexturePVR) * v21) >> 3);
if ( a3 - v18 < v24 )
v24 = a3 - v18;
*((_QWORD *)p_m_uID - 1) = &a2[v18];
*p_m_uID = v24;
p_m_uID += 4;
v18 += v24;
v25 = (int8x8_t)vcgt_u32((uint32x2_t)v14, (uint32x2_t)0x100000001LL);
v14 = vsub_s32((int32x2_t)vand_s8((int8x8_t)vshr_n_u32((uint32x2_t)v14, 1u), v25), (int32x2_t)vmvn_s8(v25));
++v17;
}
while ( v17 < m_uIndexInArray );
}
LOBYTE(v3) = 1;
}
else
{
LABEL_9:
LOBYTE(v3) = 0;
}
}
else
{
LOBYTE(v3) = 0;
}
return v3;
}