//
// cocos2d::extension::CCControlButton::needsLayout from 0x5a1a0c to 0x5a1dc8 (956 bytes)
//
// 0 xrefs:
//
// 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 cocos2d::extension::CCControlButton::needsLayout(cocos2d::extension::CCControlButton *a1)
{
int m_nLuaID; // r0
int m_nTag; // r0
void (__fastcall *setLabelAnchorPoint)(cocos2d::extension::CCControlButton *__hidden, cocos2d::CCPoint); // r8
cocos2d::CCObject *v5; // r0
cocos2d::extension::CCControlButton_vtbl *v6; // r0
int v7; // r0
cocos2d::CCControlState m_eState; // r1
cocos2d::extension::CCControlButton_vtbl *v9; // r3
cocos2d::CCObject *v10; // r0
int v11; // r8
cocos2d::CCObject *v12; // r0
const void *v13; // r0
void (__fastcall ***v14)(void *, const char *); // r8
cocos2d::CCString *v15; // r0
void (__fastcall *v16)(void *, const char *); // r9
const char *CString; // r0
const void *v18; // r0
void (__fastcall ***v19)(void *, unsigned int *); // r0
int v20; // r6
void (__fastcall *v21)(int, cocos2d::CCRect *); // r8
float width; // s16
const cocos2d::CCSize *v23; // r0
cocos2d::extension::CCScale9Sprite *v24; // r0
int v25; // r6
cocos2d::CCObject *v26; // r0
int v27; // r6
void (__fastcall *v28)(int, cocos2d::CCRect *); // r8
float v29; // s16
const cocos2d::CCSize *v30; // r0
cocos2d::CCNode *v31; // r1
int v32; // r6
void (__fastcall *v33)(int, cocos2d::CCRect *); // r8
int v34; // r0
cocos2d::CCNode *v35; // r1
cocos2d::CCNode *v36; // r1
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r6
int v38; // r6
void (__fastcall *v39)(int, cocos2d::CCPoint *); // r8
float v40; // s16
const cocos2d::CCSize *v41; // r0
int v42; // r6
void (__fastcall *v43)(int, cocos2d::CCPoint *); // r8
float v44; // s16
const cocos2d::CCSize *v45; // r0
cocos2d::CCSize v46; // [sp+Ch] [bp-48h] BYREF
cocos2d::CCPoint v47; // [sp+14h] [bp-40h] BYREF
cocos2d::CCRect v48; // [sp+1Ch] [bp-38h] BYREF
cocos2d::CCRect v49; // [sp+2Ch] [bp-28h] BYREF
cocos2d::CCRect v50; // [sp+3Ch] [bp-18h] BYREF
if ( BYTE1(a1[1].m_unknown2) )
{
m_nLuaID = a1[1].m_nLuaID;
if ( m_nLuaID )
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)m_nLuaID + 164))(m_nLuaID, 0);
m_nTag = a1[1].m_nTag;
if ( m_nTag )
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)m_nTag + 164))(m_nTag, 0);
setLabelAnchorPoint = a1->setLabelAnchorPoint;
cocos2d::CCPoint::CCPoint(&v50.origin, (const cocos2d::CCPoint *)&a1[1].m_uIndexInArray);
((void (__fastcall *)(cocos2d::extension::CCControlButton *, cocos2d::CCRect *))setLabelAnchorPoint)(a1, &v50);
v5 = (cocos2d::CCObject *)a1[1].cocos2d::extension::CCControl::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v5 )
cocos2d::CCObject::release(v5);
v6 = (cocos2d::extension::CCControlButton_vtbl *)a1->getTitleForState(a1, a1->m_eState);
a1[1].cocos2d::extension::CCControl::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = v6;
if ( v6 )
cocos2d::CCObject::retain((cocos2d::CCObject *)v6);
v7 = ((int (__fastcall *)(cocos2d::extension::CCControlButton *, cocos2d::CCControlState))a1->getTitleColorForState)(
a1,
a1->m_eState);
m_eState = a1->m_eState;
BYTE1(a1[1].m_uID) = BYTE1(v7);
v9 = a1->cocos2d::extension::CCControl::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LOBYTE(a1[1].m_uID) = v7;
BYTE2(a1[1].m_uID) = BYTE2(v7);
v10 = v9->getTitleLabelForState(a1, m_eState);
v11 = (int)v10;
if ( (cocos2d::CCObject *)a1[1].m_nLuaID != v10 )
{
if ( v10 )
cocos2d::CCObject::retain(v10);
v12 = (cocos2d::CCObject *)a1[1].m_nLuaID;
if ( v12 )
cocos2d::CCObject::release(v12);
a1[1].m_nLuaID = v11;
}
v13 = (const void *)a1[1].m_nLuaID;
if ( v13 )
{
v14 = (void (__fastcall ***)(void *, const char *))_dynamic_cast(
v13,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCLabelProtocol,
-2);
if ( v14 )
{
v15 = (cocos2d::CCString *)a1[1].cocos2d::extension::CCControl::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v15 )
{
v16 = **v14;
CString = cocos2d::CCString::getCString(v15);
v16(v14, CString);
}
}
}
v18 = (const void *)a1[1].m_nLuaID;
if ( v18 )
{
v19 = (void (__fastcall ***)(void *, unsigned int *))_dynamic_cast(
v18,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
if ( v19 )
(**v19)(v19, &a1[1].m_uID);
}
v20 = a1[1].m_nLuaID;
if ( v20 )
{
v21 = *(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v20 + 92);
width = a1->getContentSize(a1)->width;
v23 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v50.origin, width * 0.5, v23->height * 0.5);
v21(v20, &v50);
}
v24 = a1->getBackgroundSpriteForState(a1, a1->m_eState);
v25 = (int)v24;
if ( (cocos2d::extension::CCScale9Sprite *)a1[1].m_nTag != v24 )
{
if ( v24 )
cocos2d::CCObject::retain(v24);
v26 = (cocos2d::CCObject *)a1[1].m_nTag;
if ( v26 )
cocos2d::CCObject::release(v26);
a1[1].m_nTag = v25;
}
v27 = a1[1].m_nTag;
if ( v27 )
{
v28 = *(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v27 + 92);
v29 = a1->getContentSize(a1)->width;
v30 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v50.origin, v29 * 0.5, v30->height * 0.5);
v28(v27, &v50);
}
cocos2d::CCSize::CCSize(&v46);
v31 = (cocos2d::CCNode *)a1[1].m_nLuaID;
if ( v31 )
{
cocos2d::CCNode::boundingBox(&v50, v31);
cocos2d::CCSize::operator=(&v46, &v50.size);
}
v32 = a1[1].m_nTag;
if ( HIBYTE(a1[1].m_uID) )
{
if ( v32 )
{
v33 = *(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v32 + 152);
cocos2d::CCSize::CCSize(
(cocos2d::CCSize *)&v50,
(float)(2 * LODWORD(a1[1].m_fScaleX)) + v46.width,
(float)(2 * LODWORD(a1[1].m_fRotationY)) + v46.height);
v33(v32, &v50);
}
}
else if ( v32 )
{
(*(void (__fastcall **)(cocos2d::CCRect *, int))(*(_DWORD *)v32 + 496))(&v50, a1[1].m_nTag);
v34 = a1[1].m_nTag;
if ( v50.origin.x <= 0.0 )
v50.origin.x = v46.width;
if ( v50.origin.y <= 0.0 )
v50.origin.y = v46.height;
(*(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v34 + 152))(v34, &v50);
}
cocos2d::CCRect::CCRect(&v48);
v35 = (cocos2d::CCNode *)a1[1].m_nLuaID;
if ( v35 )
{
cocos2d::CCNode::boundingBox(&v50, v35);
cocos2d::CCRect::operator=(&v48, &v50);
}
cocos2d::CCRect::CCRect(&v49);
v36 = (cocos2d::CCNode *)a1[1].m_nTag;
if ( v36 )
{
cocos2d::CCNode::boundingBox(&v50, v36);
cocos2d::CCRect::operator=(&v49, &v50);
}
cocos2d::extension::CCControlUtils::CCRectUnion(&v50, &v48, &v49);
setContentSize = a1->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v47, v50.size.width, v50.size.height);
setContentSize(a1, (const cocos2d::CCSize *)&v47);
v38 = a1[1].m_nLuaID;
if ( v38 )
{
v39 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v38 + 92);
v40 = a1->getContentSize(a1)->width;
v41 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v47, v40 * 0.5, v41->height * 0.5);
v39(v38, &v47);
(*(void (__fastcall **)(int, int))(*(_DWORD *)a1[1].m_nLuaID + 164))(a1[1].m_nLuaID, 1);
}
v42 = a1[1].m_nTag;
if ( v42 )
{
v43 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v42 + 92);
v44 = a1->getContentSize(a1)->width;
v45 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v47, v44 * 0.5, v45->height * 0.5);
v43(v42, &v47);
(*(void (__fastcall **)(int, int))(*(_DWORD *)a1[1].m_nTag + 164))(a1[1].m_nTag, 1);
}
}
}