//
// cocos2d::extension::CCControlSwitchSprite::initWithMaskSprite from 0x7aa2dc to 0x7aa52c (592 bytes)
//
// 1 xrefs:
// > cocos2d::extension::CCControlSwitch::initWithMaskSprite @ 0x7aa67a
//
// 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:01 +0000
//
int __fastcall cocos2d::extension::CCControlSwitchSprite::initWithMaskSprite(
cocos2d::extension::CCControlSwitchSprite *this,
cocos2d::CCSprite *a2,
cocos2d::CCSprite *a3,
cocos2d::CCSprite *a4,
cocos2d::CCSprite *a5,
cocos2d::CCLabelTTF *a6,
cocos2d::CCLabelTTF *a7)
{
cocos2d::CCTexture2D *v11; // r0
int v12; // r11
float v13; // s16
float v14; // s15
cocos2d::CCSprite *v15; // r3
cocos2d::CCObject *v16; // r0
cocos2d::CCObject *v17; // r0
cocos2d::CCObject *v18; // r0
cocos2d::CCObject *v19; // r0
cocos2d::CCObject *v20; // r0
cocos2d::CCObject *v21; // r0
cocos2d::CCObject *v22; // r5
cocos2d::CCObject *v23; // r0
cocos2d::CCGLProgram *v24; // r5
cocos2d::CCGLProgram *v25; // r0
cocos2d::CCGLProgram *v26; // r0
cocos2d::CCGLProgram *v27; // r0
cocos2d::CCGLProgram *v28; // r0
cocos2d::CCGLProgram *v29; // r0
int UniformLocation; // r0
int v31; // r3
int v32; // r0
int v33; // r3
int v34; // r1
void (__fastcall *v35)(cocos2d::extension::CCControlSwitchSprite *, _BYTE *); // r6
_BYTE v37[8]; // [sp+Ch] [bp-10h] BYREF
v11 = (cocos2d::CCTexture2D *)(*(int (__fastcall **)(cocos2d::CCSprite *))(*(_DWORD *)a2 + 536))(a2);
v12 = cocos2d::CCSprite::initWithTexture(this, v11);
if ( v12 )
{
*((_DWORD *)this + 129) = 0;
v13 = *(float *)(*(int (__fastcall **)(cocos2d::CCSprite *))(*(_DWORD *)a5 + 164))(a5) * 0.5;
v14 = *(float *)(*(int (__fastcall **)(cocos2d::CCSprite *))(*(_DWORD *)a3 + 164))(a3);
*((_DWORD *)this + 128) = *((_DWORD *)this + 129);
v15 = *((cocos2d::CCSprite **)this + 134);
*((float *)this + 130) = v13 - v14;
if ( v15 != a3 )
{
cocos2d::CCObject::retain(a3);
v16 = *((cocos2d::CCObject **)this + 134);
if ( v16 )
cocos2d::CCObject::release(v16);
*((_DWORD *)this + 134) = a3;
}
if ( *((cocos2d::CCSprite **)this + 135) != a4 )
{
if ( a4 )
cocos2d::CCObject::retain(a4);
v17 = *((cocos2d::CCObject **)this + 135);
if ( v17 )
cocos2d::CCObject::release(v17);
*((_DWORD *)this + 135) = a4;
}
if ( *((cocos2d::CCSprite **)this + 136) != a5 )
{
cocos2d::CCObject::retain(a5);
v18 = *((cocos2d::CCObject **)this + 136);
if ( v18 )
cocos2d::CCObject::release(v18);
*((_DWORD *)this + 136) = a5;
}
if ( *((cocos2d::CCLabelTTF **)this + 137) != a6 )
{
if ( a6 )
cocos2d::CCObject::retain(a6);
v19 = *((cocos2d::CCObject **)this + 137);
if ( v19 )
cocos2d::CCObject::release(v19);
*((_DWORD *)this + 137) = a6;
}
if ( *((cocos2d::CCLabelTTF **)this + 138) != a7 )
{
if ( a7 )
cocos2d::CCObject::retain(a7);
v20 = *((cocos2d::CCObject **)this + 138);
if ( v20 )
cocos2d::CCObject::release(v20);
*((_DWORD *)this + 138) = a7;
}
(*(void (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *, _DWORD))(*(_DWORD *)this + 228))(
this,
*((_DWORD *)this + 136));
v21 = (cocos2d::CCObject *)(*(int (__fastcall **)(cocos2d::CCSprite *))(*(_DWORD *)a2 + 536))(a2);
v22 = v21;
if ( *((cocos2d::CCObject **)this + 131) != v21 )
{
if ( v21 )
cocos2d::CCObject::retain(v21);
v23 = *((cocos2d::CCObject **)this + 131);
if ( v23 )
cocos2d::CCObject::release(v23);
*((_DWORD *)this + 131) = v22;
}
v24 = (cocos2d::CCGLProgram *)operator new(0x68u);
cocos2d::CCGLProgram::CCGLProgram(v24);
cocos2d::CCGLProgram::initWithVertexShaderByteArray(
v24,
cocos2d::ccPositionTextureColor_vert[0],
cocos2d::ccExSwitchMask_frag[0]);
(*(void (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *, cocos2d::CCGLProgram *))(*(_DWORD *)this + 332))(
this,
v24);
cocos2d::CCObject::release(v24);
v25 = (cocos2d::CCGLProgram *)(*(int (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(*(_DWORD *)this + 328))(this);
cocos2d::CCGLProgram::addAttribute(v25, "a_position", 0);
v26 = (cocos2d::CCGLProgram *)(*(int (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(*(_DWORD *)this + 328))(this);
cocos2d::CCGLProgram::addAttribute(v26, "a_color", 1u);
v27 = (cocos2d::CCGLProgram *)(*(int (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(*(_DWORD *)this + 328))(this);
cocos2d::CCGLProgram::addAttribute(v27, "a_texCoord", 2u);
v28 = (cocos2d::CCGLProgram *)(*(int (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(*(_DWORD *)this + 328))(this);
cocos2d::CCGLProgram::link(v28);
v29 = (cocos2d::CCGLProgram *)(*(int (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(*(_DWORD *)this + 328))(this);
cocos2d::CCGLProgram::updateUniforms(v29);
(*(void (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(*(_DWORD *)this + 328))(this);
UniformLocation = glGetUniformLocation();
v31 = *(_DWORD *)this;
*((_DWORD *)this + 132) = UniformLocation;
(*(void (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *))(v31 + 328))(this);
v32 = glGetUniformLocation();
v33 = *(_DWORD *)this;
v34 = *((_DWORD *)this + 131);
*((_DWORD *)this + 133) = v32;
v35 = *(void (__fastcall **)(cocos2d::extension::CCControlSwitchSprite *, _BYTE *))(v33 + 160);
(*(void (__fastcall **)(_BYTE *))(*(_DWORD *)v34 + 72))(v37);
v35(this, v37);
cocos2d::extension::CCControlSwitchSprite::needsLayout(this);
}
return v12;
}