//
// sub_100206820 from 0x100206820 to 0x100206962 (322 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x100285775
//
// 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
//
__int64 __fastcall sub_100206820(__int64 a1, void **a2)
{
cocos2d::CCFileUtils *v2; // rax
__int64 v3; // rax
__int64 v4; // rdx
unsigned int v5; // r14d
void *v6; // rdi
__int64 v8; // r15
Bytef *v9; // r12
size_t v10; // r15
Bytef *v11; // rax
int v12; // r14d
uLongf destLen; // [rsp+0h] [rbp-30h] BYREF
_QWORD v14[5]; // [rsp+8h] [rbp-28h] BYREF
v14[0] = 0;
v2 = cocos2d::CCFileUtils::sharedFileUtils();
v3 = ((__int64 (__fastcall *)(cocos2d::CCFileUtils *, __int64, const char *, _QWORD *))v2->addSearchResolutionsOrder)(
v2,
a1,
"rb",
v14);
v5 = -1;
if ( v3 == 0 || v14[0] == 0 )
return v5;
if ( *(_BYTE *)v3 != 67 || *(_BYTE *)(v3 + 1) != 67 )
goto LABEL_13;
if ( *(_BYTE *)(v3 + 2) != 90 || *(_BYTE *)(v3 + 3) != 33 )
{
if ( *(_BYTE *)(v3 + 2) == 90 && *(_BYTE *)(v3 + 3) == 112 && !*(_WORD *)(v3 + 6) && !*(_WORD *)(v3 + 4) )
{
v8 = v3;
LOBYTE(v4) = v3 == 0 || v14[0] == 0;
sub_100206970(v3 + 12, (unsigned __int64)(v14[0] + 0x3FFFFFFF4LL) >> 2, v4);
v3 = v8;
goto LABEL_17;
}
LABEL_13:
v6 = (void *)v3;
LABEL_14:
operator delete[](v6);
return v5;
}
if ( __ROL2__(*(_WORD *)(v3 + 6), 8) >= 3u || *(_WORD *)(v3 + 4) )
goto LABEL_13;
LABEL_17:
v9 = (Bytef *)v3;
v10 = _byteswap_ulong(*(_DWORD *)(v3 + 12));
v11 = (Bytef *)malloc(v10);
*a2 = v11;
if ( !v11 )
{
v6 = v9;
goto LABEL_14;
}
destLen = v10;
v12 = uncompress(v11, &destLen, v9 + 16, v14[0] - 16LL);
operator delete[](v9);
if ( v12 )
{
free(*a2);
*a2 = nullptr;
LODWORD(v10) = -1;
}
return (unsigned int)v10;
}