//
// cocos2d::extension::CCControlButton::setBackgroundSpriteForState from 0xa9af68 to 0xa9b144 (476 bytes)
//
// 3 xrefs:
// > ??> @ 0x6c870
// > ??> @ 0x11f52c8
// > ??> @ 0x11fa8d8
//
// 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)
{
intptr_t v3; // x22
const cocos2d::CCSize *p_m_uIndexInArray; // x23
cocos2d::CCNode *v8; // x1
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
const cocos2d::CCSize *v10; // x1
void (__fastcall *v11)(cocos2d::extension::CCScale9Sprite *__hidden, cocos2d::CCSize); // x23
void (__fastcall *setPreferredSize)(cocos2d::extension::CCScale9Sprite *__hidden, cocos2d::CCSize); // x25
cocos2d::CCSize v13; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v14; // [xsp+60h] [xbp+60h] BYREF
v3 = a3;
p_m_uIndexInArray = (const cocos2d::CCSize *)&a1[1].m_uIndexInArray;
cocos2d::CCSize::CCSize(&v13, (const cocos2d::CCSize *)&a1[1].m_uIndexInArray);
v8 = (cocos2d::CCNode *)cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)&a1[1].m_obPosition.y, v3);
if ( v8 )
{
a1->removeChild_0(a1, v8, 1);
cocos2d::CCDictionary::removeObjectForKey(*(cocos2d::CCDictionary **)&a1[1].m_obPosition.y, v3);
}
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)&a1[1].m_obPosition.y, a2, v3);
a2->setVisible(a2, 0);
setAnchorPoint = a2->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v14, 0.5, 0.5);
setAnchorPoint(a2, &v14);
a1->addChild(a1, a2);
if ( *(float *)&a1[1].m_uIndexInArray == 0.0 && *(float *)&a1[1].m_uUnknown == 0.0 )
{
if ( a3 != a1->m_eState )
return;
LABEL_10:
a1->needsLayout(a1);
return;
}
if ( (unsigned __int8)cocos2d::CCSize::equals(&v13, p_m_uIndexInArray) )
{
setPreferredSize = a2->setPreferredSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v14, v13.width + 1.0, v13.height + 1.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::CCPoint *))setPreferredSize)(a2, &v14);
}
v10 = p_m_uIndexInArray;
v11 = a2->setPreferredSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v14, v10);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::CCPoint *))v11)(a2, &v14);
if ( a3 == a1->m_eState )
goto LABEL_10;
}