//
// cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite from 0x5a20ac to 0x5a2334 (648 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
//
bool cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite(
cocos2d::extension::CCControlButton *a1,
cocos2d::CCNode *a2,
cocos2d::extension::CCScale9Sprite *a3)
{
_BOOL4 v6; // r11
void *v7; // r10
void *v8; // r9
cocos2d::CCDictionary *v9; // r0
int v10; // r5
cocos2d::CCObject *m_nZOrder; // r0
cocos2d::CCDictionary *v12; // r0
int v13; // r5
cocos2d::CCObject *m_uOrderOfArrival; // r0
cocos2d::CCDictionary *v15; // r0
int v16; // r5
cocos2d::CCObject *m_unknown5; // r0
cocos2d::CCDictionary *v18; // r0
float v19; // r5
float m_fRotationX; // r0
cocos2d::extension::CCControlButton_vtbl *v21; // r2
cocos2d::CCObject *m_nLuaID; // r0
cocos2d::CCObject *m_nTag; // r0
void (__fastcall *setColor)(cocos2d::extension::CCControlButton *__hidden, const cocos2d::ccColor3B *); // r2
char *v25; // r0
const std::string *v26; // r1
cocos2d::CCString *v27; // r10
void (__fastcall *setTitleColorForState)(cocos2d::extension::CCControlButton *__hidden, cocos2d::ccColor3B, unsigned int); // r10
unsigned __int8 *v29; // r0
void (__fastcall *setLabelAnchorPoint)(cocos2d::extension::CCControlButton *__hidden, cocos2d::CCPoint); // r6
void (__fastcall *setPreferredSize)(cocos2d::extension::CCControlButton *__hidden, cocos2d::CCSize); // [sp+4h] [bp-20h]
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+4h] [bp-20h]
cocos2d::CCPoint v34; // [sp+14h] [bp-10h] BYREF
v6 = cocos2d::extension::CCControl::init(a1);
if ( v6 )
{
if ( a2 )
{
v7 = _dynamic_cast(
a2,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCLabelProtocol,
-2);
v8 = _dynamic_cast(
a2,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
}
else
{
v7 = nullptr;
v8 = nullptr;
}
BYTE1(a1[1].m_unknown2) = 1;
v9 = cocos2d::CCDictionary::create();
v10 = (int)v9;
if ( (cocos2d::CCDictionary *)a1[1].m_nZOrder != v9 )
{
if ( v9 )
cocos2d::CCObject::retain(v9);
m_nZOrder = (cocos2d::CCObject *)a1[1].m_nZOrder;
if ( m_nZOrder )
cocos2d::CCObject::release(m_nZOrder);
a1[1].m_nZOrder = v10;
}
v12 = cocos2d::CCDictionary::create();
v13 = (int)v12;
if ( (cocos2d::CCDictionary *)a1[1].m_uOrderOfArrival != v12 )
{
if ( v12 )
cocos2d::CCObject::retain(v12);
m_uOrderOfArrival = (cocos2d::CCObject *)a1[1].m_uOrderOfArrival;
if ( m_uOrderOfArrival )
cocos2d::CCObject::release(m_uOrderOfArrival);
a1[1].m_uOrderOfArrival = v13;
}
v15 = cocos2d::CCDictionary::create();
v16 = (int)v15;
if ( (cocos2d::CCDictionary *)a1[1].m_unknown5 != v15 )
{
if ( v15 )
cocos2d::CCObject::retain(v15);
m_unknown5 = (cocos2d::CCObject *)a1[1].m_unknown5;
if ( m_unknown5 )
cocos2d::CCObject::release(m_unknown5);
a1[1].m_unknown5 = v16;
}
v18 = cocos2d::CCDictionary::create();
v19 = *(float *)&v18;
if ( (cocos2d::CCDictionary *)LODWORD(a1[1].m_fRotationX) != v18 )
{
if ( v18 )
cocos2d::CCObject::retain(v18);
m_fRotationX = a1[1].m_fRotationX;
if ( m_fRotationX != 0.0 )
cocos2d::CCObject::release((cocos2d::CCObject *)LODWORD(m_fRotationX));
a1[1].m_fRotationX = v19;
}
a1->setTouchEnabled(a1, 1);
LOBYTE(a1[1].m_unknown2) = 0;
LOBYTE(a1[1].m_eObjType) = 1;
a1[1].cocos2d::extension::CCControl::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = nullptr;
cocos2d::extension::CCControlButton::setAdjustBackgroundImage(a1, 1);
setPreferredSize = a1->setPreferredSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v34, &stru_AC806C);
((void (__fastcall *)(cocos2d::extension::CCControlButton *, cocos2d::CCPoint *))setPreferredSize)(a1, &v34);
v21 = a1->cocos2d::extension::CCControl::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LOBYTE(a1[1].m_eObjType) = 1;
v21->ignoreAnchorPointForPosition(a1, 0);
setAnchorPoint = a1->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v34, 0.5, 0.5);
setAnchorPoint(a1, &v34);
if ( (cocos2d::CCNode *)a1[1].m_nLuaID != a2 )
{
if ( a2 )
cocos2d::CCObject::retain(a2);
m_nLuaID = (cocos2d::CCObject *)a1[1].m_nLuaID;
if ( m_nLuaID )
cocos2d::CCObject::release(m_nLuaID);
a1[1].m_nLuaID = (int)a2;
}
if ( (cocos2d::extension::CCScale9Sprite *)a1[1].m_nTag != a3 )
{
if ( a3 )
cocos2d::CCObject::retain(a3);
m_nTag = (cocos2d::CCObject *)a1[1].m_nTag;
if ( m_nTag )
cocos2d::CCObject::release(m_nTag);
a1[1].m_nTag = (int)a3;
}
setColor = a1->setColor;
LOWORD(v34.x) = -1;
BYTE2(v34.x) = -1;
setColor(a1, (const cocos2d::ccColor3B *)&v34);
a1->setOpacity(a1, 255u);
a1->setOpacityModifyRGB(a1, 1);
v25 = (char *)(*(int (__fastcall **)(void *))(*(_DWORD *)v7 + 4))(v7);
sub_776584((int)&v34, v25);
v27 = (cocos2d::CCString *)cocos2d::CCString::create((cocos2d::CCString *)&v34, v26);
sub_774008(&v34);
a1->setTitleForState(a1, v27, 1u);
setTitleColorForState = a1->setTitleColorForState;
v29 = (unsigned __int8 *)(*(int (__fastcall **)(void *))(*(_DWORD *)v8 + 4))(v8);
((void (__fastcall *)(cocos2d::extension::CCControlButton *, int, int))setTitleColorForState)(
a1,
*v29 | (v29[1] << 8) | (v29[2] << 16),
1);
a1->setTitleLabelForState(a1, a2, 1u);
a1->setBackgroundSpriteForState(a1, a3, 1u);
setLabelAnchorPoint = a1->setLabelAnchorPoint;
cocos2d::CCPoint::CCPoint(&v34, 0.5, 0.5);
((void (__fastcall *)(cocos2d::extension::CCControlButton *, cocos2d::CCPoint *))setLabelAnchorPoint)(a1, &v34);
a1->needsLayout(a1);
}
return v6;
}