//
// cocos2d::CCTexturePVR::createGLTexture from 0x100415558 to 0x100415728 (464 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x10041592c
//
// 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:04:52 +0000
//
__int64 __fastcall cocos2d::CCTexturePVR::createGLTexture(__int64 a1)
{
GLuint v2; // w0
__int64 v3; // x20
GLint v4; // w2
unsigned __int64 v5; // x20
__int64 v6; // x8
GLenum v7; // w21
GLenum v8; // w22
GLenum v9; // w23
int v10; // w24
__int64 v11; // x25
__int64 v12; // x0
int8x8_t v13; // d1
uint32x2_t v15; // [xsp+10h] [xbp-60h]
if ( !*(_DWORD *)(a1 + 312) )
return 1;
v15 = *(uint32x2_t *)(a1 + 316);
v2 = *(_DWORD *)(a1 + 324);
if ( v2 )
cocos2d::ccGLDeleteTexture(v2);
v3 = 1;
glPixelStorei(0xCF5u, 1);
glGenTextures(1, (GLuint *)(a1 + 324));
cocos2d::ccGLBindTexture2D(*(unsigned int *)(a1 + 324));
if ( *(_DWORD *)(a1 + 312) == 1 )
v4 = 9729;
else
v4 = 9985;
glTexParameteri(0xDE1u, 0x2801u, v4);
glTexParameteri(0xDE1u, 0x2800u, 9729);
glTexParameteri(0xDE1u, 0x2802u, 33071);
glTexParameteri(0xDE1u, 0x2803u, 33071);
if ( *(_DWORD *)(a1 + 312) )
{
v5 = 0;
v6 = *(_QWORD *)(a1 + 336);
v7 = *(_DWORD *)v6;
v8 = *(_DWORD *)(v6 + 4);
v9 = *(_DWORD *)(v6 + 8);
v10 = *(unsigned __int8 *)(v6 + 16);
v11 = a1 + 56;
while ( v10 )
{
v12 = cocos2d::CCConfiguration::sharedConfiguration();
if ( !(unsigned int)cocos2d::CCConfiguration::supportsPVRTC(v12) )
return 0;
glCompressedTexImage2D(0xDE1u, v5, v7, v15.i32[0], v15.i32[1], 0, *(_DWORD *)(v11 + 8), *(const GLvoid **)v11);
if ( v5 )
goto LABEL_14;
LABEL_16:
if ( glGetError() )
return 0;
v13 = (int8x8_t)vcgt_u32(v15, (uint32x2_t)0x100000001LL);
v15 = (uint32x2_t)vsub_s32((int32x2_t)vand_s8((int8x8_t)vshr_n_u32(v15, 1u), v13), (int32x2_t)vmvn_s8(v13));
++v5;
v11 += 16;
if ( v5 >= *(unsigned int *)(a1 + 312) )
return 1;
}
glTexImage2D(0xDE1u, v5, v7, v15.i32[0], v15.i32[1], 0, v8, v9, *(const GLvoid **)v11);
if ( !v5 )
goto LABEL_16;
LABEL_14:
if ( v15.i32[0] == v15.i32[1] )
sub_10008E7D4(v15.u32[0]);
goto LABEL_16;
}
return v3;
}