//
// sub_1002DBB28 from 0x1002dbb28 to 0x1002dbbe0 (184 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x1004158b4
//
// 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:02:45 +0000
//
__int64 __fastcall sub_1002DBB28(const char *a1, void **a2)
{
gzFile v3; // x0
gzFile_s *v4; // x21
unsigned int v5; // w22
char *v6; // x0
__int64 v7; // x20
size_t v8; // x23
unsigned int v9; // w0
v3 = gzopen(a1, "rb");
if ( !v3 )
return 0xFFFFFFFFLL;
v4 = v3;
v5 = 0x80000;
v6 = (char *)malloc(0x80000u);
v7 = 0;
LODWORD(v8) = 0x80000;
while ( 1 )
{
*a2 = v6;
v9 = gzread(v4, &v6[(unsigned int)v7], v5);
if ( (v9 & 0x80000000) != 0 )
{
LABEL_7:
free(*a2);
*a2 = nullptr;
return 0xFFFFFFFFLL;
}
if ( !v9 )
break;
v7 = v9 + (unsigned int)v7;
if ( v9 < v5 )
break;
v8 = (unsigned int)v8 + 2 * v5;
v6 = (char *)realloc(*a2, v8);
v5 *= 2;
if ( !v6 )
goto LABEL_7;
}
gzclose(v4);
return v7;
}