//
// cocos2d::CCRenderTexture::newCCImage from 0x7e0d70 to 0x7e0e7e (270 bytes)
//
// 3 xrefs:
// > cocos2d::CCRenderTexture::listenToBackground @ 0x7e0e98
// > cocos2d::CCRenderTexture::saveToFile @ 0x7e0eea
// > cocos2d::CCRenderTexture::saveToFile @ 0x7e0f20
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:00:49 +0000
//
cocos2d::CCTexture2D *__fastcall cocos2d::CCRenderTexture::newCCImage(cocos2d::CCRenderTexture *this, int a2)
{
cocos2d::CCTexture2D *result; // r0
float *ContentSizeInPixels; // r0
GLsizei v6; // r5
GLsizei v7; // s15
cocos2d::CCImage *v8; // r4
char *v9; // r10
char *pixels; // r8
int v11; // r9
size_t v12; // r12
char *v13; // r3
GLsizei v14; // r11
char *v15; // r0
size_t v16; // [sp+1Ch] [bp-8h]
result = *((cocos2d::CCTexture2D **)this + 70);
if ( result )
{
ContentSizeInPixels = (float *)cocos2d::CCTexture2D::getContentSizeInPixels(result);
v6 = (int)*ContentSizeInPixels;
v7 = (int)ContentSizeInPixels[1];
v8 = (cocos2d::CCImage *)operator new(0x48u);
cocos2d::CCImage::CCImage(v8);
v9 = (char *)operator new[](4 * v7 * v6);
pixels = (char *)operator new[](4 * v7 * v6);
cocos2d::CCRenderTexture::begin(this);
glPixelStorei(0xD05u, 1);
glReadPixels(0, 0, v6, v7, 0x1908u, 0x1401u, pixels);
cocos2d::CCRenderTexture::end(this);
if ( a2 )
{
v11 = 0;
v12 = 4 * v6;
v13 = v9;
v14 = 0;
while ( 1 )
{
v11 -= 4 * v6;
if ( v14 >= v7 )
break;
v16 = v12;
++v14;
v15 = (char *)memcpy(v13, &pixels[4 * v6 + 4 * v6 * (v7 - 1) + v11], v12);
v12 = v16;
v13 = &v15[v16];
}
cocos2d::CCImage::initWithImageData(v8, v9, 4 * v7 * v6, 4, v6, v7, 8);
}
else
{
cocos2d::CCImage::initWithImageData(v8, pixels, 4 * v7 * v6, 4, v6, v7, 8);
}
operator delete[](v9);
operator delete[](pixels);
return v8;
}
return result;
}