//
// cocos2d::CCTexturePVR::createGLTexture from 0x1800ad710 to 0x1800ad908 (504 bytes)
//
// 2 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x1800adb98
// > ??> @ 0x1801c21fc
//
// This function is hookable on this platform (idp: pc, 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:22:18 +0000
//
char __fastcall cocos2d::CCTexturePVR::createGLTexture(__int64 a1)
{
unsigned int v2; // ebx
unsigned int height; // edi
cocos2d *v4; // rcx
GLint v5; // r8d
__int64 v6; // rax
__int64 v7; // rsi
unsigned int v8; // r14d
GLenum format; // r12d
GLenum type; // r13d
char v11; // r15
cocos2d::CCConfiguration *v12; // rax
v2 = *(_DWORD *)(a1 + 316);
height = *(_DWORD *)(a1 + 320);
if ( *(_DWORD *)(a1 + 312) )
{
v4 = (cocos2d *)*(unsigned int *)(a1 + 324);
if ( (_DWORD)v4 )
cocos2d::ccGLDeleteTexture(v4);
glPixelStorei(0xCF5u, 1);
glGenTextures(1, (GLuint *)(a1 + 324));
cocos2d::ccGLBindTexture2D((cocos2d *)*(unsigned int *)(a1 + 324));
v5 = 9729;
if ( *(_DWORD *)(a1 + 312) != 1 )
v5 = 9985;
glTexParameteri(0xDE1u, 0x2801u, v5);
glTexParameteri(0xDE1u, 0x2800u, 9729);
glTexParameteri(0xDE1u, 0x2802u, 33071);
glTexParameteri(0xDE1u, 0x2803u, 33071);
}
v6 = *(_QWORD *)(a1 + 336);
v7 = 0;
v8 = *(_DWORD *)v6;
format = *(_DWORD *)(v6 + 4);
type = *(_DWORD *)(v6 + 8);
v11 = *(_BYTE *)(v6 + 16);
if ( !*(_DWORD *)(a1 + 312) )
return 1;
while ( 1 )
{
if ( v11 )
{
v12 = cocos2d::CCConfiguration::sharedConfiguration();
if ( !(unsigned __int8)cocos2d::CCConfiguration::supportsPVRTC(v12) )
return 0;
_glewCompressedTexImage2D(
3553,
(unsigned int)v7,
v8,
v2,
height,
0,
*(_DWORD *)(a1 + 16 * (v7 + 4)),
*(_QWORD *)(a1 + 16LL * (unsigned int)v7 + 56));
}
else
{
glTexImage2D(0xDE1u, v7, v8, v2, height, 0, format, type, *(const GLvoid **)(a1 + 16LL * (unsigned int)v7 + 56));
}
if ( (_DWORD)v7 && v2 == height )
sub_1800992B0(v2);
if ( glGetError() )
break;
v2 >>= 1;
v7 = (unsigned int)(v7 + 1);
height >>= 1;
if ( (unsigned int)v7 >= *(_DWORD *)(a1 + 312) )
return 1;
if ( v2 <= 1 )
v2 = 1;
if ( height <= 1 )
height = 1;
}
return 0;
}