//
// cocos2d::extension::CCControlButton::setBackgroundSpriteForState from 0x100354830 to 0x100354988 (344 bytes)
//
// 2 xrefs:
// > ??> @ 0x100916210
// > ??> @ 0x100947958
//
// 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::setBackgroundSpriteForState(
cocos2d::extension::CCControlButton *a1,
cocos2d::extension::CCScale9Sprite *a2,
unsigned int a3)
{
float *p_m_uIndexInArray; // r12
cocos2d::CCObject *v5; // rax
__int64 v6; // [rsp+8h] [rbp-38h] BYREF
_QWORD v7[6]; // [rsp+10h] [rbp-30h] BYREF
p_m_uIndexInArray = (float *)&a1[1].m_uIndexInArray;
sub_10028CFC0(v7, &a1[1].m_uIndexInArray);
v5 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)&a1[1].m_obPosition.y, a3);
if ( v5 )
{
((void (__fastcall *)(cocos2d::extension::CCControlButton *, cocos2d::CCObject *, __int64))a1->removeChild_0)(
a1,
v5,
1);
cocos2d::CCDictionary::removeObjectForKey(*(cocos2d::CCDictionary **)&a1[1].m_obPosition.y, a3);
}
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)&a1[1].m_obPosition.y, a2, a3);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, _QWORD))a2->setVisible)(a2, 0);
sub_10028CBE0((float *)&v6, 0.5, 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64 *))a2->setAnchorPoint)(a2, &v6);
((void (__fastcall *)(cocos2d::extension::CCControlButton *, cocos2d::extension::CCScale9Sprite *))a1->addChild)(
a1,
a2);
if ( *(float *)&a1[1].m_uIndexInArray != 0.0 || *(float *)&a1[1].m_uUnknown != 0.0 )
{
if ( sub_10028D0C0((float *)v7, p_m_uIndexInArray) )
{
sub_10028CBF0((float *)&v6, *(float *)v7 + 1.0, *((float *)v7 + 1) + 1.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64 *))a2->setPreferredSize)(a2, &v6);
}
sub_10028CFC0(&v6, p_m_uIndexInArray);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64 *))a2->setPreferredSize)(a2, &v6);
}
if ( a1->m_eState == a3 )
((void (__fastcall *)(cocos2d::extension::CCControlButton *))a1->needsLayout)(a1);
}