//
// ButtonSprite::init from 0x100092370 to 0x1000925f6 (646 bytes)
//
// 1 xrefs:
// > ButtonSprite::create @ 0x100092304
//
// 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
//
bool __fastcall ButtonSprite::init(
ButtonSprite *a1,
cocos2d::CCSprite *a2,
int a3,
int a4,
float a5,
float a6,
bool a7,
const char *a8,
bool a9)
{
bool result; // al
cocos2d::CCSprite *v13; // rax
cocos2d::extension::CCScale9Sprite *v14; // r14
float v15; // xmm0_4
cocos2d::CCSprite *m_subSprite; // r14
cocos2d::CCSprite_vtbl *v17; // rax
float *v18; // rax
float v19; // xmm0_4
__int64 v20; // rax
float v21; // xmm0_4
cocos2d::CCSprite *v22; // r14
__int64 v23; // rax
cocos2d::CCSprite *v24; // r14
double v25; // xmm0_8
_BYTE v26[16]; // [rsp+4h] [rbp-4Ch] BYREF
float v27; // [rsp+14h] [rbp-3Ch]
const char *v28; // [rsp+18h] [rbp-38h]
float v29; // [rsp+20h] [rbp-30h]
bool v30; // [rsp+27h] [rbp-29h]
cocos2d::CCRect v31; // 0:xmm0_8.8,8:xmm1_8.8
v28 = a8;
v27 = a6;
v29 = a5;
result = cocos2d::CCSprite::init(a1);
if ( !result )
return result;
v30 = result;
a1->m_mode = 0;
a1->m_width = (float)a3;
a1->m_minWidth = (float)a4;
a1->m_scale = v27;
a1->m_absolute = a7;
a1->m_subSprite = a2;
((void (__fastcall *)(ButtonSprite *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, a2, 1);
if ( !a9 )
{
v31.origin = 0;
v31.size = 0;
sub_10028CC00(v26, 0.0, 0.0, 40.0, 40.0);
v14 = cocos2d::extension::CCScale9Sprite::create_2(v28, v31);
a1->m_BGSprite = v14;
sub_10028CBF0(v26, 16.0, 16.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, _BYTE *))v14->setContentSize)(v14, v26);
((void (__fastcall *)(ButtonSprite *, cocos2d::extension::CCScale9Sprite *, _QWORD))a1->addChild_0)(
a1,
a1->m_BGSprite,
0);
if ( a1->m_width <= 0.0 )
goto LABEL_8;
LABEL_6:
v15 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_subSprite->getContentSize)(a1->m_subSprite);
if ( v15 > a1->m_width )
{
m_subSprite = a1->m_subSprite;
v17 = m_subSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
*(float *)&v28 = a1->m_width;
v18 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *, float, double))v17->getContentSize)(
m_subSprite,
v15,
0.0);
((void (__fastcall *)(cocos2d::CCSprite *, float))m_subSprite->setScale)(m_subSprite, *(float *)&v28 / *v18);
}
goto LABEL_8;
}
v13 = cocos2d::CCSprite::create_1(v28);
a1->m_subBGSprite = v13;
((void (__fastcall *)(ButtonSprite *, cocos2d::CCSprite *, _QWORD))a1->addChild_0)(a1, v13, 0);
if ( a1->m_width > 0.0 )
goto LABEL_6;
LABEL_8:
if ( v29 > 0.0 )
{
v19 = *(float *)(((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_subSprite->getContentSize)(a1->m_subSprite) + 4);
if ( v19 > v29 )
{
v20 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_subSprite->getContentSize)(a1->m_subSprite);
*(float *)&v28 = v29 / *(float *)(v20 + 4);
v21 = ((float (__fastcall *)(cocos2d::CCSprite *))a1->m_subSprite->getScale)(a1->m_subSprite);
if ( v21 > *(float *)&v28 )
{
v22 = a1->m_subSprite;
v23 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v22->getContentSize)(v22);
((void (__fastcall *)(cocos2d::CCSprite *, float))v22->setScale)(v22, v29 / *(float *)(v23 + 4));
}
}
}
v24 = a1->m_subSprite;
v25 = ((double (__fastcall *)(cocos2d::CCSprite *))v24->getScale)(v24);
if ( *(float *)&v25 <= a1->m_scale )
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_subSprite->getScale)(a1->m_subSprite);
((void (__fastcall *)(cocos2d::CCSprite *))v24->setScale)(v24);
ButtonSprite::updateSpriteBGSize(a1);
return v30;
}