//
// cocos2d::extension::CCControlButton::setBackgroundSpriteForState from 0x5a17e4 to 0x5a18f8 (276 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::setBackgroundSpriteForState(
cocos2d::extension::CCControlButton *a1,
cocos2d::extension::CCScale9Sprite *a2,
unsigned int a3)
{
const cocos2d::CCSize *p_m_uReference; // r9
cocos2d::CCNode *v7; // r1
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
void (__fastcall *setPreferredSize)(cocos2d::extension::CCScale9Sprite *__hidden, cocos2d::CCSize); // r10
void (__fastcall *v10)(cocos2d::extension::CCScale9Sprite *__hidden, cocos2d::CCSize); // r10
cocos2d::CCSize v11; // [sp+4h] [bp-18h] BYREF
cocos2d::CCPoint v12; // [sp+Ch] [bp-10h] BYREF
p_m_uReference = (const cocos2d::CCSize *)&a1[1].m_uReference;
cocos2d::CCSize::CCSize(&v11, (const cocos2d::CCSize *)&a1[1].m_uReference);
v7 = (cocos2d::CCNode *)cocos2d::CCDictionary::objectForKey((cocos2d::CCDictionary *)LODWORD(a1[1].m_fRotationX), a3);
if ( v7 )
{
a1->removeChild_0(a1, v7, 1);
cocos2d::CCDictionary::removeObjectForKey((cocos2d::CCDictionary *)LODWORD(a1[1].m_fRotationX), a3);
}
cocos2d::CCDictionary::setObject((cocos2d::CCDictionary *)LODWORD(a1[1].m_fRotationX), a2, a3);
a2->setVisible(a2, 0);
setAnchorPoint = a2->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v12, 0.5, 0.5);
setAnchorPoint(a2, &v12);
a1->addChild(a1, a2);
if ( *(float *)&a1[1].m_uReference != 0.0 || *(float *)&a1[1].m_uAutoReleaseCount != 0.0 )
{
if ( cocos2d::CCSize::equals(&v11, p_m_uReference) )
{
setPreferredSize = a2->setPreferredSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v12, v11.width + 1.0, v11.height + 1.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::CCPoint *))setPreferredSize)(a2, &v12);
}
v10 = a2->setPreferredSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v12, p_m_uReference);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::CCPoint *))v10)(a2, &v12);
}
if ( a1->m_eState == a3 )
a1->needsLayout(a1);
}