//
// cocos2d::extension::CCControlButton::setBackgroundSpriteForState from 0xd0cb40 to 0xd0cd1c (476 bytes)
//
// 3 xrefs:
// > ??> @ 0x928c0
// > ??> @ 0x150aa78
// > ??> @ 0x15101f8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:07:00 +0000
//
__int64 __fastcall cocos2d::extension::CCControlButton::setBackgroundSpriteForState(
cocos2d::CCDictionary **this,
cocos2d::extension::CCScale9Sprite *a2,
unsigned int a3)
{
__int64 v3; // x22
const cocos2d::CCSize *v4; // x23
__int64 v8; // x1
void (__fastcall *v9)(cocos2d::extension::CCScale9Sprite *, _BYTE *); // x26
const cocos2d::CCSize *v11; // x1
void (__fastcall *v12)(cocos2d::extension::CCScale9Sprite *, _BYTE *); // x23
void (__fastcall *v13)(cocos2d::extension::CCScale9Sprite *, _BYTE *); // x25
float v14[2]; // [xsp+58h] [xbp+58h] BYREF
_BYTE v15[8]; // [xsp+60h] [xbp+60h] BYREF
v3 = a3;
v4 = (const cocos2d::CCSize *)(this + 63);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v14, (const cocos2d::CCSize *)(this + 63));
v8 = cocos2d::CCDictionary::objectForKey(*(this + 69), v3);
if ( v8 )
{
(*((void (__fastcall **)(cocos2d::CCDictionary **, __int64, __int64))*this + 69))(this, v8, 1);
cocos2d::CCDictionary::removeObjectForKey(*(this + 69), v3);
}
cocos2d::CCDictionary::setObject(*(this + 69), a2, v3);
(*(void (__fastcall **)(cocos2d::extension::CCScale9Sprite *, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
v9 = *(void (__fastcall **)(cocos2d::extension::CCScale9Sprite *, _BYTE *))(*(_QWORD *)a2 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v15, 0.5, 0.5);
v9(a2, v15);
(*((void (__fastcall **)(cocos2d::CCDictionary **, cocos2d::extension::CCScale9Sprite *))*this + 57))(this, a2);
if ( *((float *)this + 126) == 0.0 && *((float *)this + 127) == 0.0 )
{
if ( a3 != *((_DWORD *)this + 107) )
return _stack_chk_guard;
LABEL_10:
(*((void (__fastcall **)(cocos2d::CCDictionary **))*this + 164))(this);
return _stack_chk_guard;
}
if ( (unsigned __int8)cocos2d::CCSize::equals((cocos2d::CCSize *)v14, v4) )
{
v13 = *(void (__fastcall **)(cocos2d::extension::CCScale9Sprite *, _BYTE *))(*(_QWORD *)a2 + 1016LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v15, v14[0] + 1.0, v14[1] + 1.0);
v13(a2, v15);
}
v11 = v4;
v12 = *(void (__fastcall **)(cocos2d::extension::CCScale9Sprite *, _BYTE *))(*(_QWORD *)a2 + 1016LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v15, v11);
v12(a2, v15);
if ( a3 == *((_DWORD *)this + 107) )
goto LABEL_10;
return _stack_chk_guard;
}