//
// cocos2d::extension::CCControlButton::needsLayout from 0x180006d50 to 0x180007330 (1504 bytes)
//
// 6 xrefs:
// > ??> @ 0x180024118
// > ??> @ 0x180027f60
// > ??> @ 0x18002d90c
// > ??> @ 0x18002d9ac
// > ??> @ 0x18002fdf8
// > ??> @ 0x1800496e4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall cocos2d::extension::CCControlButton::needsLayout(cocos2d::extension::CCControlButton *this)
{
__int64 v2; // rcx
__int64 v3; // rcx
__int64 v4; // rbx
__int64 v5; // rax
cocos2d::CCObject *v6; // rcx
cocos2d::CCObject *v7; // rax
__int64 v8; // rax
__int64 v9; // rdx
cocos2d::CCObject *v10; // rax
cocos2d::CCObject *v11; // rcx
cocos2d::CCObject *v12; // rbx
cocos2d::CCObject *v13; // rcx
void (__fastcall ***v14)(_QWORD, const char *); // rax
void (__fastcall ***v15)(_QWORD, const char *); // rsi
cocos2d::CCString *v16; // rcx
void (__fastcall **v17)(_QWORD, const char *); // rbx
const char *CString; // rax
void (__fastcall ***v19)(_QWORD, char *); // rax
__int64 *v20; // rbx
__int64 v21; // rbx
float v22; // xmm6_4
float *v23; // rax
__int64 v24; // rax
cocos2d::CCObject *v25; // rbx
cocos2d::CCObject *v26; // rax
cocos2d::CCObject *v27; // rcx
__int64 v28; // rbx
float v29; // xmm6_4
float *v30; // rax
__int64 v31; // rax
__int64 v32; // rcx
__int64 v33; // rax
__int64 *v34; // rcx
__int64 v35; // rbx
__int64 v36; // rax
__int64 v37; // rcx
__int64 v38; // rax
__int64 v39; // rcx
__int64 v40; // rax
float MinX; // xmm0_4
float v42; // xmm9_4
float MinY; // xmm0_4
float v44; // xmm8_4
float MaxX; // xmm0_4
float v46; // xmm7_4
float MaxY; // xmm0_4
float v48; // xmm6_4
__int64 v49; // rax
__int64 v50; // rax
__int64 v51; // rbx
__int64 v52; // rax
__int64 *v53; // rbx
__int64 v54; // rbx
float v55; // xmm6_4
float *v56; // rax
__int64 v57; // rax
__int64 v58; // rdx
__int64 *v59; // rbx
__int64 v60; // rbx
float v61; // xmm6_4
float *v62; // rax
__int64 v63; // rax
__int64 v64; // rdx
_BYTE v65[16]; // [rsp+38h] [rbp-49h] BYREF
_BYTE v66[16]; // [rsp+48h] [rbp-39h] BYREF
_BYTE v67[8]; // [rsp+58h] [rbp-29h] BYREF
float v68[2]; // [rsp+60h] [rbp-21h] BYREF
_BYTE v69[8]; // [rsp+68h] [rbp-19h] BYREF
float v70; // [rsp+E8h] [rbp+67h] BYREF
float v71; // [rsp+ECh] [rbp+6Bh]
float v72; // [rsp+F0h] [rbp+6Fh] BYREF
float v73; // [rsp+F4h] [rbp+73h]
if ( *((_BYTE *)this + 525) )
{
v2 = *((_QWORD *)this + 61);
if ( v2 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v2 + 320LL))(v2, 0);
v3 = *((_QWORD *)this + 62);
if ( v3 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v3 + 320LL))(v3, 0);
v4 = *(_QWORD *)this;
v5 = cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v70,
(cocos2d::extension::CCControlButton *)((char *)this + 516));
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(v4 + 1152))(this, v5);
v6 = *((cocos2d::CCObject **)this + 59);
if ( v6 )
cocos2d::CCObject::release(v6);
v7 = (cocos2d::CCObject *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 1192LL))(
this,
*((unsigned int *)this + 109));
*((_QWORD *)this + 59) = v7;
if ( v7 )
cocos2d::CCObject::retain(v7);
v8 = (*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, float *, _QWORD))(*(_QWORD *)this + 1208LL))(
this,
&v70,
*((unsigned int *)this + 109));
v9 = *((unsigned int *)this + 109);
*((_WORD *)this + 240) = *(_WORD *)v8;
*((_BYTE *)this + 482) = *(_BYTE *)(v8 + 2);
v10 = (cocos2d::CCObject *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(*(_QWORD *)this + 1224LL))(
this,
v9);
v11 = *((cocos2d::CCObject **)this + 61);
v12 = v10;
if ( v11 != v10 )
{
if ( v10 )
cocos2d::CCObject::retain(v10);
v13 = *((cocos2d::CCObject **)this + 61);
if ( v13 )
cocos2d::CCObject::release(v13);
*((_QWORD *)this + 61) = v12;
v11 = v12;
}
v14 = (void (__fastcall ***)(_QWORD, const char *))_RTDynamicCast(
v11,
0,
&cocos2d::CCNode `RTTI Type Descriptor',
&cocos2d::CCLabelProtocol `RTTI Type Descriptor',
0);
v15 = v14;
if ( v14 )
{
v16 = *((cocos2d::CCString **)this + 59);
if ( v16 )
{
v17 = *v14;
CString = cocos2d::CCString::getCString(v16);
(*v17)(v15, CString);
}
}
v19 = (void (__fastcall ***)(_QWORD, char *))_RTDynamicCast(
*((_QWORD *)this + 61),
0,
&cocos2d::CCNode `RTTI Type Descriptor',
&cocos2d::CCRGBAProtocol `RTTI Type Descriptor',
0);
if ( v19 )
(**v19)(v19, (char *)this + 480);
v20 = *((__int64 **)this + 61);
if ( v20 )
{
v21 = *v20;
v22 = *(float *)((*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this)
+ 4);
v23 = (float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this);
v24 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, *v23 * 0.5, v22 * 0.5);
(*(void (__fastcall **)(_QWORD, __int64))(v21 + 184))(*((_QWORD *)this + 61), v24);
}
v25 = (cocos2d::CCObject *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 1288LL))(
this,
*((unsigned int *)this + 109));
v26 = *((cocos2d::CCObject **)this + 62);
if ( v26 != v25 )
{
if ( v25 )
cocos2d::CCObject::retain(v25);
v27 = *((cocos2d::CCObject **)this + 62);
if ( v27 )
cocos2d::CCObject::release(v27);
*((_QWORD *)this + 62) = v25;
v26 = v25;
}
if ( v26 )
{
v28 = *(_QWORD *)v26;
v29 = *(float *)((*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this)
+ 4);
v30 = (float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this);
v31 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, *v30 * 0.5, v29 * 0.5);
(*(void (__fastcall **)(_QWORD, __int64))(v28 + 184))(*((_QWORD *)this + 62), v31);
}
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v72);
v32 = *((_QWORD *)this + 61);
if ( v32 )
{
v33 = cocos2d::CCNode::boundingBox(v32, v69);
cocos2d::CCSize::operator=(&v72, v33 + 8);
}
v34 = *((__int64 **)this + 62);
if ( v34 )
{
if ( *((_BYTE *)this + 483) )
{
v35 = *v34;
v36 = cocos2d::CCSize::CCSize(
(cocos2d::CCSize *)&v70,
(float)(2 * *((_DWORD *)this + 141)) + v72,
(float)(2 * *((_DWORD *)this + 140)) + v73);
(*(void (__fastcall **)(_QWORD, __int64))(v35 + 296))(*((_QWORD *)this + 62), v36);
}
else
{
(*(void (__fastcall **)(__int64 *, float *))(*v34 + 872))(v34, &v70);
if ( v70 <= 0.0 )
v70 = v72;
if ( v71 <= 0.0 )
v71 = v73;
(*(void (__fastcall **)(_QWORD, float *))(**((_QWORD **)this + 62) + 296LL))(*((_QWORD *)this + 62), &v70);
}
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65);
v37 = *((_QWORD *)this + 61);
if ( v37 )
{
v38 = cocos2d::CCNode::boundingBox(v37, v69);
cocos2d::CCRect::operator=(v65, v38);
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v66);
v39 = *((_QWORD *)this + 62);
if ( v39 )
{
v40 = cocos2d::CCNode::boundingBox(v39, v69);
cocos2d::CCRect::operator=(v66, v40);
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v67);
MinX = cocos2d::CCRect::getMinX((cocos2d::CCRect *)v65);
v42 = fminf(MinX, cocos2d::CCRect::getMinX((cocos2d::CCRect *)v66));
MinY = cocos2d::CCRect::getMinY((cocos2d::CCRect *)v65);
v44 = fminf(MinY, cocos2d::CCRect::getMinY((cocos2d::CCRect *)v66));
MaxX = cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v65);
v46 = fmaxf(MaxX, cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v66));
MaxY = cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v65);
v48 = fmaxf(MaxY, cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v66));
v49 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, v42, v46);
cocos2d::CCPoint::operator=(v67, v49);
v50 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v70, v46 - v42, v48 - v44);
cocos2d::CCSize::operator=(v68, v50);
v51 = *(_QWORD *)this;
v52 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v70, v68[0], v68[1]);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(v51 + 296))(this, v52);
v53 = *((__int64 **)this + 61);
if ( v53 )
{
v54 = *v53;
v55 = *(float *)((*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this)
+ 4);
v56 = (float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this);
v57 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, *v56 * 0.5, v55 * 0.5);
(*(void (__fastcall **)(_QWORD, __int64))(v54 + 184))(*((_QWORD *)this + 61), v57);
LOBYTE(v58) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 61) + 320LL))(*((_QWORD *)this + 61), v58);
}
v59 = *((__int64 **)this + 62);
if ( v59 )
{
v60 = *v59;
v61 = *(float *)((*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this)
+ 4);
v62 = (float *)(*(__int64 (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 304LL))(this);
v63 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, *v62 * 0.5, v61 * 0.5);
(*(void (__fastcall **)(_QWORD, __int64))(v60 + 184))(*((_QWORD *)this + 62), v63);
LOBYTE(v64) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 62) + 320LL))(*((_QWORD *)this + 62), v64);
}
}
}