//
// cocos2d::CCRenderTexture::begin from 0xd6ad08 to 0xd6af08 (512 bytes)
//
// 9 xrefs:
// > cocos2d::extension::CCControlSwitchSprite::needsLayout @ 0xd10fec
// > cocos2d::CCTransitionCrossFade::onEnter @ 0xd61f98
// > cocos2d::CCTransitionCrossFade::onEnter @ 0xd62058
// > cocos2d::CCTransitionProgress::onEnter @ 0xd63420
// > cocos2d::CCRenderTexture::beginWithClear @ 0xd6af50
// > cocos2d::CCRenderTexture::clearDepth @ 0xd6b0cc
// > cocos2d::CCRenderTexture::draw @ 0xd6b16c
// > cocos2d::CCRenderTexture::newCCImage @ 0xd6b340
// > ??> @ 0xd17a0
//
// 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:07:56 +0000
//
__int64 __fastcall cocos2d::CCRenderTexture::begin(cocos2d::CCTexture2D **this)
{
cocos2d::CCDirector *v2; // x0
int *v3; // x21
const cocos2d::CCSize *ContentSizeInPixels; // x0
float v5; // s0
float v6; // s0
float v7; // s9
float v8; // s8
cocos2d::CCConfiguration *v9; // x0
__int64 v10; // x22
_BOOL4 v11; // w21
float v13; // [xsp+40h] [xbp+40h] BYREF
float v14; // [xsp+44h] [xbp+44h]
float v15[2]; // [xsp+48h] [xbp+48h] BYREF
__int64 v16[2]; // [xsp+50h] [xbp+50h] BYREF
void *v17; // [xsp+60h] [xbp+60h]
float v18[16]; // [xsp+68h] [xbp+68h] BYREF
kmGLMatrixMode((__int64 *)((char *)&elf_hash_bucket[1346] + 1));
kmGLPushMatrix();
kmGLMatrixMode((__int64 *)&elf_hash_bucket[1346]);
v2 = (cocos2d::CCDirector *)kmGLPushMatrix();
v3 = (int *)cocos2d::CCDirector::sharedDirector(v2);
cocos2d::CCDirector::setProjection((__int64)v3, v3[79]);
ContentSizeInPixels = (const cocos2d::CCSize *)cocos2d::CCTexture2D::getContentSizeInPixels(*(this + 43));
cocos2d::CCSize::CCSize(&v13, ContentSizeInPixels);
v5 = *((float *)this + 101);
if ( v5 > 0.0 )
v13 = roundf(v5 * v13);
v6 = *((float *)this + 102);
if ( v6 > 0.0 )
v14 = roundf(v6 * v14);
cocos2d::CCDirector::getWinSizeInPixels(v15, (cocos2d::CCDirector *)v3);
v7 = v15[0] / v13;
v8 = v15[1] / v14;
glViewport();
kmMat4OrthographicProjection(v18, -1.0 / v7, 1.0 / v7, -1.0 / v8, 1.0 / v8, -1.0, 1.0);
kmGLMultMatrix(v18);
glGetIntegerv();
v9 = (cocos2d::CCConfiguration *)glBindFramebuffer();
v10 = cocos2d::CCConfiguration::sharedConfiguration(v9);
v16[0] = 0;
v16[1] = 0;
v17 = nullptr;
std::string::__init(v16, "GL_QCOM", 7u);
v11 = cocos2d::CCConfiguration::checkForGLExtension(v10, (char *)v16);
if ( (v16[0] & 1) != 0 )
operator delete(v17);
if ( v11 )
{
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 44) + 104LL))(*(this + 44));
glFramebufferTexture2D();
glClear();
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 43) + 104LL))(*(this + 43));
glFramebufferTexture2D();
}
return _stack_chk_guard;
}