//
// cocos2d::CCTexturePVR::createGLTexture from 0x5f6880 to 0x5f69ae (302 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x5f6a88
//
// 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 cocos2d::CCTexturePVR::createGLTexture(cocos2d::CCTexturePVR *a1)
{
unsigned int m_uIndexInArray; // r5
unsigned int m_uUnknown; // r6
unsigned int m_unknown2; // r0
GLint v5; // r2
int m_unknown5; // r3
cocos2d::CCObjectType v7; // r7
cocos2d::CCTexturePVR *v8; // r8
GLenum v9; // r10
int v10; // r9
cocos2d::CCConfiguration *v11; // r0
unsigned int v13; // r1
GLenum format; // [sp+18h] [bp-Ch]
GLenum type; // [sp+1Ch] [bp-8h]
m_uIndexInArray = a1[3].m_uIndexInArray;
m_uUnknown = a1[3].m_uUnknown;
if ( a1[3].m_eObjType )
{
m_unknown2 = a1[3].m_unknown2;
if ( m_unknown2 )
cocos2d::ccGLDeleteTexture(m_unknown2);
glPixelStorei(0xCF5u, 1);
glGenTextures(1, (GLuint *)&a1[3].m_unknown2);
cocos2d::ccGLBindTexture2D(a1[3].m_unknown2);
if ( a1[3].m_eObjType == 1 )
v5 = 9729;
else
v5 = 9985;
glTexParameteri(0xDE1u, 0x2801u, v5);
glTexParameteri(0xDE1u, 0x2800u, 9729);
glTexParameteri(0xDE1u, 0x2802u, 33071);
glTexParameteri(0xDE1u, 0x2803u, 33071);
}
m_unknown5 = a1[3].m_unknown5;
v7 = 0;
v8 = a1;
v9 = *(_DWORD *)m_unknown5;
v10 = *(unsigned __int8 *)(m_unknown5 + 16);
format = *(_DWORD *)(m_unknown5 + 4);
type = *(_DWORD *)(m_unknown5 + 8);
while ( (unsigned int)v7 < a1[3].m_eObjType )
{
if ( v10 )
{
v11 = cocos2d::CCConfiguration::sharedConfiguration();
if ( !cocos2d::CCConfiguration::supportsPVRTC(v11) )
return 0;
}
if ( v10 )
glCompressedTexImage2D(0xDE1u, v7, v9, m_uIndexInArray, m_uUnknown, 0, v8[1].m_uID, v8[1].__vftable);
else
glTexImage2D(0xDE1u, v7, v9, m_uIndexInArray, m_uUnknown, 0, format, type, v8[1].__vftable);
if ( v7 && m_uIndexInArray == m_uUnknown )
cocos2d::ccNextPOT((cocos2d *)m_uIndexInArray, v13);
if ( glGetError() )
return 0;
m_uIndexInArray >>= 1;
++v7;
v8 = (cocos2d::CCTexturePVR *)((char *)v8 + 8);
if ( !m_uIndexInArray )
m_uIndexInArray = 1;
m_uUnknown >>= 1;
if ( !m_uUnknown )
m_uUnknown = 1;
}
return 1;
}