//
// cocos2d::CCTexture2D::initWithData from 0xda2cb4 to 0xda2f30 (636 bytes)
//
// 7 xrefs:
// > cocos2d::CCGridBase::initWithSize @ 0xd4ed4c
// > cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0xd6a8f8
// > cocos2d::CCRenderTexture::initWithWidthAndHeight @ 0xd6a998
// > cocos2d::CCTexture2D::initPremultipliedATextureWithImage @ 0xda3158
// > cocos2d::CCTexture2D::initPremultipliedATextureWithImage @ 0xda3190
// > cocos2d::VolatileTexture::reloadAllTextures @ 0xda6bb4
// > ??> @ 0x57388
//
// 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 13:08:30 +0000
//
__int64 __fastcall cocos2d::CCTexture2D::initWithData(
__int64 a1,
__int64 a2,
unsigned int a3,
unsigned int a4,
unsigned int a5,
float *a6)
{
int v11; // w1
unsigned int v12; // w0
cocos2d *v13; // x0
cocos2d::CCShaderCache *v14; // x0
float v15; // s0
void (__fastcall *v16)(__int64, __int64); // x20
cocos2d::CCShaderCache *v17; // x0
__int64 v18; // x0
v11 = 24;
if ( a3 != 1 )
v11 = cocos2d::CCTexture2D::bitsPerPixelForFormat(a1, a3);
v12 = (v11 * a4) >> 3;
if ( (v12 & 7) != 0 && (v12 & 3) != 0 && ((v11 * a4) & 8) == 0 )
{
glPixelStorei();
v13 = (cocos2d *)*(unsigned int *)(a1 + 72);
if ( !(_DWORD)v13 )
goto LABEL_7;
}
else
{
glPixelStorei();
v13 = (cocos2d *)*(unsigned int *)(a1 + 72);
if ( !(_DWORD)v13 )
goto LABEL_7;
}
cocos2d::ccGLDeleteTexture(v13);
*(_DWORD *)(a1 + 72) = 0;
LABEL_7:
glGenTextures();
cocos2d::ccGLBindTexture2D((cocos2d *)*(unsigned int *)(a1 + 72));
glTexParameteri();
glTexParameteri();
glTexParameteri();
glTexParameteri();
switch ( a3 )
{
case 0u:
case 1u:
case 2u:
case 3u:
case 4u:
case 5u:
case 6u:
case 7u:
glTexImage2D();
break;
default:
break;
}
cocos2d::CCSize::operator=((float *)(a1 + 84), a6);
*(_DWORD *)(a1 + 68) = a5;
*(_DWORD *)(a1 + 60) = a3;
*(_DWORD *)(a1 + 64) = a4;
v14 = *(cocos2d::CCShaderCache **)a1;
*(float *)(a1 + 76) = *a6 / (float)a4;
v15 = a6[1];
*(_BYTE *)(a1 + 92) = 0;
*(_BYTE *)(a1 + 93) = 0;
*(float *)(a1 + 80) = v15 / (float)a5;
v16 = *((void (__fastcall **)(__int64, __int64))v14 + 20);
v17 = (cocos2d::CCShaderCache *)cocos2d::CCShaderCache::sharedShaderCache(v14);
v18 = cocos2d::CCShaderCache::programForKey(v17, "ShaderPositionTexture");
v16(a1, v18);
return 1;
}