//
// ButtonSprite::init from 0x14003ef60 to 0x14003f1b6 (598 bytes)
//
// 18 xrefs:
// > ButtonSprite::create @ 0x14003ef22
// > LevelCell::loadCustomLevelCell @ 0x1400aeb93
// > LevelCell::loadCustomLevelCell @ 0x1400aed8f
// > LevelCell::loadCustomLevelCell @ 0x1400aeea1
// > EditorUI::menuItemFromObjectString @ 0x14010e899
// > FRequestProfilePage::init @ 0x14013dfdb
// > InfoLayer::getSpriteButton @ 0x1402bca37
// > LeaderboardsLayer::setupTabs @ 0x1402c2e08
// > LevelBrowserLayer::init @ 0x1402c9842
// > MessagesProfilePage::init @ 0x140336bd8
// > MusicBrowser::init @ 0x140338fd3
// > MusicBrowser::init @ 0x140339135
// > SetupAreaMoveTriggerPopup::addAreaDefaultControls @ 0x14040d72b
// > SetupSpawnPopup::init @ 0x14045e977
// > SetupSpawnPopup::init @ 0x14045ea9e
// > SFXBrowser::init @ 0x14047f001
// > SFXBrowser::init @ 0x14047f152
// > ??> @ 0x1406c4158
//
// 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 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
ButtonSprite_vtbl *v13; // rax
struct cocos2d::CCRect *v14; // rax
cocos2d::extension::CCScale9Sprite *v15; // rax
cocos2d::extension::CCScale9Sprite_vtbl *v16; // rbx
const cocos2d::CCSize *v17; // rax
cocos2d::CCSprite *v18; // rax
ButtonSprite_vtbl *v19; // r9
cocos2d::CCSprite *m_subSprite; // rcx
cocos2d::CCSprite_vtbl *v21; // rbx
float v22; // xmm6_4
cocos2d::CCSprite *v23; // rcx
cocos2d::CCSprite_vtbl *v24; // rbx
cocos2d::CCRect v25; // [rsp+30h] [rbp-38h] BYREF
result = cocos2d::CCSprite::init(a1);
if ( result )
{
a1->m_mode = 0;
a1->m_minWidth = 0.0;
v13 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_absolute = 1;
a1->m_width = (float)a3;
a1->m_scale = a6;
a1->m_subSprite = a2;
v13->addChild_0(a1, a2, 1);
if ( a9 )
{
v18 = cocos2d::CCSprite::create(a8);
v19 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_subBGSprite = v18;
v19->addChild_0(a1, v18, 0);
}
else
{
v14 = (struct cocos2d::CCRect *)cocos2d::CCRect::CCRect(&v25, 0.0, 0.0, 40.0, 40.0);
v15 = cocos2d::extension::CCScale9Sprite::create(a8, v14);
a1->m_BGSprite = v15;
v16 = v15->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v17 = (const cocos2d::CCSize *)cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v25, 16.0, 16.0);
v16->setContentSize(a1->m_BGSprite, v17);
a1->addChild_0(a1, a1->m_BGSprite, 0);
}
if ( a1->m_width > 0.0 && a1->m_subSprite->getContentSize(a1->m_subSprite)->width > a1->m_width )
{
m_subSprite = a1->m_subSprite;
v21 = m_subSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_subSprite->getContentSize(m_subSprite);
((void (__fastcall *)(cocos2d::CCSprite *))v21->setScale_0)(a1->m_subSprite);
}
if ( a5 > 0.0 && a1->m_subSprite->getContentSize(a1->m_subSprite)->height > a5 )
{
v22 = a5 / a1->m_subSprite->getContentSize(a1->m_subSprite)->height;
if ( a1->m_subSprite->getScale(a1->m_subSprite) > v22 )
{
v23 = a1->m_subSprite;
v24 = v23->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v23->getContentSize(v23);
((void (__fastcall *)(cocos2d::CCSprite *))v24->setScale_0)(a1->m_subSprite);
}
}
a1->m_subSprite->getScale(a1->m_subSprite);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_subSprite->setScale_0)(a1->m_subSprite);
ButtonSprite::updateSpriteBGSize(a1);
return 1;
}
return result;
}