//
// cocos2d::extension::CCControlButton::setBackgroundSpriteForState from 0x180006b90 to 0x180006d02 (370 bytes)
//
// 4 xrefs:
// > ??> @ 0x180024200
// > ??> @ 0x180028048
// > ??> @ 0x18002fdf8
// > ??> @ 0x1800496cc
//
// 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::CCDictionary **this,
struct cocos2d::extension::CCScale9Sprite *a2,
unsigned int a3)
{
struct cocos2d::CCObject *v6; // rax
__int64 v7; // r8
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rbx
__int64 v11; // rax
__int64 v12; // rbx
__int64 v13; // rax
float v14; // [rsp+40h] [rbp+8h] BYREF
float v15; // [rsp+44h] [rbp+Ch]
char v16; // [rsp+48h] [rbp+10h] BYREF
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v14, (const struct cocos2d::CCSize *)(this + 63));
v6 = cocos2d::CCDictionary::objectForKey(*(this + 69), a3);
if ( v6 )
{
LOBYTE(v7) = 1;
(*((void (__fastcall **)(cocos2d::CCDictionary **, struct cocos2d::CCObject *, __int64))*this + 65))(this, v6, v7);
cocos2d::CCDictionary::removeObjectForKey(*(this + 69), a3);
}
cocos2d::CCDictionary::setObject(*(this + 69), a2, a3);
(*(void (__fastcall **)(struct cocos2d::extension::CCScale9Sprite *, _QWORD))(*(_QWORD *)a2 + 320LL))(a2, 0);
v8 = *(_QWORD *)a2;
v9 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v16, 0.5, 0.5);
(*(void (__fastcall **)(struct cocos2d::extension::CCScale9Sprite *, __int64))(v8 + 272))(a2, v9);
(*((void (__fastcall **)(cocos2d::CCDictionary **, struct cocos2d::extension::CCScale9Sprite *))*this + 56))(this, a2);
if ( *((float *)this + 126) != 0.0 || *((float *)this + 127) != 0.0 )
{
if ( cocos2d::CCSize::equals((cocos2d::CCSize *)&v14, (const struct cocos2d::CCSize *)(this + 63)) )
{
v10 = *(_QWORD *)a2;
v11 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v16, v14 + 1.0, v15 + 1.0);
(*(void (__fastcall **)(struct cocos2d::extension::CCScale9Sprite *, __int64))(v10 + 880))(a2, v11);
}
v12 = *(_QWORD *)a2;
v13 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v16, (const struct cocos2d::CCSize *)(this + 63));
(*(void (__fastcall **)(struct cocos2d::extension::CCScale9Sprite *, __int64))(v12 + 880))(a2, v13);
}
if ( *((_DWORD *)this + 109) == a3 )
(*((void (__fastcall **)(cocos2d::CCDictionary **))*this + 133))(this);
}