//
// cocos2d::extension::CCControlButton::needsLayout from 0xd0d03c to 0xd0d570 (1332 bytes)
//
// 3 xrefs:
// > ??> @ 0x8cab8
// > ??> @ 0x150a990
// > ??> @ 0x1510110
//
// 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:00 +0000
//
__int64 __fastcall cocos2d::extension::CCControlButton::needsLayout(cocos2d::extension::CCControlButton *this)
{
__int64 v2; // x0
__int64 v3; // x0
void (__fastcall *v4)(cocos2d::extension::CCControlButton *, __int64 *); // x22
cocos2d::CCObject *v5; // x0
cocos2d::CCObject *v6; // x0
__int64 v7; // x0
cocos2d::CCObject *v8; // x0
cocos2d::CCObject *v9; // x22
cocos2d::CCObject *v10; // x1
void (__fastcall ***v11)(void *, __int64); // x24
cocos2d::CCString *v12; // x0
void (__fastcall *v13)(void *, __int64); // x22
__int64 CString; // x0
void (__fastcall ***v15)(void *, char *); // x0
__int64 v16; // x22
void (__fastcall *v17)(__int64, __int64 *); // x23
__int64 v18; // x0
cocos2d::CCObject *v19; // x0
cocos2d::CCObject *v20; // x22
cocos2d::CCObject *v21; // x1
void (__fastcall *v22)(cocos2d::CCObject *, __int64 *); // x23
__int64 v23; // x0
long double v24; // q0
cocos2d::CCNode *v25; // x0
__int64 v26; // x22
void (__fastcall *v27)(__int64, __int64 *); // x23
cocos2d::CCNode *v28; // x0
const cocos2d::CCRect *v29; // x2
cocos2d::CCNode *v30; // x0
void (__fastcall *v31)(cocos2d::extension::CCControlButton *, _BYTE *); // x22
__int64 v32; // x22
void (__fastcall *v33)(__int64, _BYTE *); // x23
__int64 v34; // x0
__int64 v35; // x22
void (__fastcall *v36)(__int64, _BYTE *); // x23
__int64 v37; // x0
__int64 v39; // x0
float v40; // [xsp+50h] [xbp+50h]
float v41; // [xsp+50h] [xbp+50h]
float v42; // [xsp+50h] [xbp+50h]
float v43; // [xsp+50h] [xbp+50h]
float v44; // [xsp+68h] [xbp+68h] BYREF
float v45; // [xsp+6Ch] [xbp+6Ch]
_BYTE v46[8]; // [xsp+70h] [xbp+70h] BYREF
_BYTE v47[16]; // [xsp+78h] [xbp+78h] BYREF
_BYTE v48[16]; // [xsp+88h] [xbp+88h] BYREF
__int64 v49; // [xsp+98h] [xbp+98h] BYREF
float v50[2]; // [xsp+A0h] [xbp+A0h] BYREF
if ( !*((_BYTE *)this + 525) )
return _stack_chk_guard;
v2 = *((_QWORD *)this + 61);
if ( v2 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v2 + 344LL))(v2, 0);
v3 = *((_QWORD *)this + 62);
if ( v3 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v3 + 344LL))(v3, 0);
v4 = *(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64 *))(*(_QWORD *)this + 1400LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, (cocos2d::extension::CCControlButton *)((char *)this + 516));
v4(this, &v49);
v5 = *((cocos2d::CCObject **)this + 59);
if ( v5 )
cocos2d::CCObject::release(v5);
v6 = (cocos2d::CCObject *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 1440LL))(
this,
*((unsigned int *)this + 107));
*((_QWORD *)this + 59) = v6;
if ( v6 )
cocos2d::CCObject::retain(v6);
v7 = (*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 1456LL))(
this,
*((unsigned int *)this + 107));
*((_WORD *)this + 240) = v7;
*((_BYTE *)this + 482) = BYTE2(v7);
v8 = (cocos2d::CCObject *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 1472LL))(
this,
*((unsigned int *)this + 107));
v9 = v8;
v10 = *((cocos2d::CCObject **)this + 61);
if ( v10 != v8 )
{
if ( v8 )
{
cocos2d::CCObject::retain(v8);
v10 = *((cocos2d::CCObject **)this + 61);
}
if ( v10 )
cocos2d::CCObject::release(v10);
*((_QWORD *)this + 61) = v9;
}
if ( v9 )
{
v11 = (void (__fastcall ***)(void *, __int64))_dynamic_cast(
v9,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCLabelProtocol,
-2);
if ( !v11
|| (v12 = *((cocos2d::CCString **)this + 59)) == nullptr
|| (v13 = **v11,
CString = cocos2d::CCString::getCString(v12),
v13(v11, CString),
(v9 = *((cocos2d::CCObject **)this + 61)) != nullptr) )
{
v15 = (void (__fastcall ***)(void *, char *))_dynamic_cast(
v9,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
if ( !v15 )
{
v16 = *((_QWORD *)this + 61);
goto LABEL_22;
}
(**v15)(v15, (char *)this + 480);
v16 = *((_QWORD *)this + 61);
if ( v16 )
{
LABEL_22:
v17 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v16 + 184LL);
v40 = *(float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this)
* 0.5;
v18 = (*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v40, *(float *)(v18 + 4) * 0.5);
v17(v16, &v49);
}
}
}
v19 = (cocos2d::CCObject *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 1536LL))(
this,
*((unsigned int *)this + 107));
v20 = v19;
v21 = *((cocos2d::CCObject **)this + 62);
if ( v19 != v21 )
{
if ( v19 )
{
cocos2d::CCObject::retain(v19);
v21 = *((cocos2d::CCObject **)this + 62);
}
if ( v21 )
cocos2d::CCObject::release(v21);
*((_QWORD *)this + 62) = v20;
}
if ( v20 )
{
v22 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v20 + 184LL);
v41 = *(float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this)
* 0.5;
v23 = (*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v41, *(float *)(v23 + 4) * 0.5);
v22(v20, &v49);
}
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v44);
v25 = *((cocos2d::CCNode **)this + 61);
if ( v25 )
{
cocos2d::CCNode::boundingBox(&v49, v25);
*(__n128 *)&v24 = cocos2d::CCSize::operator=(&v44, v50);
}
if ( *((_BYTE *)this + 483) )
{
v26 = *((_QWORD *)this + 62);
if ( v26 )
{
v27 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v26 + 320LL);
cocos2d::CCSize::CCSize(
(cocos2d::CCSize *)&v49,
(float)(2 * *((_DWORD *)this + 141)) + v44,
(float)(2 * *((_DWORD *)this + 140)) + v45);
v27(v26, &v49);
}
}
else
{
v39 = *((_QWORD *)this + 62);
if ( v39 )
{
(*(void (__fastcall **)(__int64 *__return_ptr, long double))(*(_QWORD *)v39 + 1008LL))(&v49, v24);
if ( *(float *)&v49 <= 0.0 )
*(float *)&v49 = v44;
if ( *((float *)&v49 + 1) <= 0.0 )
*((float *)&v49 + 1) = v45;
(*(void (__fastcall **)(_QWORD, __int64 *))(**((_QWORD **)this + 62) + 320LL))(*((_QWORD *)this + 62), &v49);
}
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v47);
v28 = *((cocos2d::CCNode **)this + 61);
if ( v28 )
{
cocos2d::CCNode::boundingBox(&v49, v28);
cocos2d::CCRect::operator=(v47, &v49);
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v48);
v30 = *((cocos2d::CCNode **)this + 62);
if ( v30 )
{
cocos2d::CCNode::boundingBox(&v49, v30);
cocos2d::CCRect::operator=(v48, &v49);
}
cocos2d::extension::CCControlUtils::CCRectUnion(
&v49,
(cocos2d::extension::CCControlUtils *)v47,
(const cocos2d::CCRect *)v48,
v29);
v31 = *(void (__fastcall **)(cocos2d::extension::CCControlButton *, _BYTE *))(*(_QWORD *)this + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v46, v50[0], v50[1]);
v31(this, v46);
v32 = *((_QWORD *)this + 61);
if ( v32 )
{
v33 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v32 + 184LL);
v42 = *(float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this)
* 0.5;
v34 = (*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v42, *(float *)(v34 + 4) * 0.5);
v33(v32, v46);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 61) + 344LL))(*((_QWORD *)this + 61), 1);
}
v35 = *((_QWORD *)this + 62);
if ( v35 )
{
v36 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v35 + 184LL);
v43 = *(float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this)
* 0.5;
v37 = (*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 328LL))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v43, *(float *)(v37 + 4) * 0.5);
v36(v35, v46);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 62) + 344LL))(*((_QWORD *)this + 62), 1);
}
return _stack_chk_guard;
}