//
// ButtonSprite::updateSpriteBGSize from 0x14003f6d0 to 0x14003fb4b (1147 bytes)
//
// 19 xrefs:
// > ButtonSprite::init @ 0x14003f195
// > ButtonSprite::updateBGImage @ 0x14003f672
// > EditorUI::getSpriteButton @ 0x1400e2a1d
// > EditorUI::createCustomItems @ 0x1400e4a1f
// > EditorUI::createCustomItems @ 0x1400e4ac9
// > EditorUI::createCustomItems @ 0x1400e4b7b
// > EditorUI::createCustomItems @ 0x1400e4c2c
// > EditorUI::setupDeleteMenu @ 0x1400e52b3
// > EditorUI::setupDeleteMenu @ 0x1400e542b
// > EditorUI::setupDeleteMenu @ 0x1400e57ae
// > InfoLayer::getSpriteButton @ 0x1402bca81
// > LeaderboardsLayer::setupTabs @ 0x1402c2e63
// > LevelLeaderboard::getSpriteButton @ 0x140301da2
// > MusicBrowser::init @ 0x140339021
// > MusicBrowser::init @ 0x140339183
// > SFXBrowser::init @ 0x14047f04f
// > ??> @ 0x140661f64
// > ??> @ 0x140661f78
// > ??> @ 0x1406c4188
//
// 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 ButtonSprite::updateSpriteBGSize(ButtonSprite *a1)
{
cocos2d::CCSprite **p_m_subSprite; // r14
float m_width; // xmm6_4
float *v4; // rbx
float v5; // xmm0_4
float *v6; // rbx
double v7; // xmm0_8
__int64 v8; // rdi
__int64 v9; // rbx
float v10; // xmm0_4
__int64 v11; // rbx
cocos2d::extension::CCScale9Sprite_vtbl *v12; // rbx
const cocos2d::CCSize *v13; // rax
float height; // xmm6_4
const cocos2d::CCSize *v15; // rax
__int64 v16; // rax
cocos2d::CCSprite **p_m_subBGSprite; // rdi
cocos2d::CCSprite *m_subBGSprite; // rcx
__int64 v19; // rax
cocos2d::CCSprite_vtbl *v20; // rbx
float v21; // xmm10_4
__int64 v22; // rax
float y; // xmm8_4
float v24; // xmm7_4
float width; // xmm9_4
float v26; // xmm9_4
const cocos2d::CCPoint *v27; // rax
cocos2d::extension::CCScale9Sprite *m_BGSprite; // rbx
void (__fastcall **v29)(cocos2d::extension::CCScale9Sprite *, _QWORD); // rbx
float v30; // xmm6_4
const cocos2d::CCSize *v31; // rax
__int64 v32; // rax
cocos2d::extension::CCScale9Sprite *v33; // rcx
float v34; // xmm6_4
const cocos2d::CCSize *v35; // rax
cocos2d::CCNode *v36; // rax
cocos2d::CCNode *v37; // rbx
cocos2d::CCNode_vtbl *v38; // rdi
const cocos2d::CCSize *v39; // rax
ButtonSprite_vtbl *v40; // rbx
float v41; // xmm6_4
const cocos2d::CCSize *v42; // rax
const cocos2d::CCPoint *v43; // rax
cocos2d::CCRect v44; // [rsp+30h] [rbp-A8h] BYREF
cocos2d::CCRect v45; // [rsp+40h] [rbp-98h] BYREF
cocos2d::CCSize v46; // [rsp+E0h] [rbp+8h] BYREF
cocos2d::CCPoint v47; // [rsp+E8h] [rbp+10h] BYREF
cocos2d::CCPoint v48; // [rsp+F0h] [rbp+18h] BYREF
cocos2d::CCPoint v49; // [rsp+F8h] [rbp+20h] BYREF
p_m_subSprite = &a1->m_subSprite;
if ( a1->m_absolute )
{
m_width = a1->m_width;
}
else
{
v4 = (float *)(*p_m_subSprite)->getContentSize(*p_m_subSprite);
v5 = (*p_m_subSprite)->getScale(*p_m_subSprite);
m_width = a1->m_minWidth;
if ( m_width <= (float)(v5 * *v4) )
{
v6 = (float *)(*p_m_subSprite)->getContentSize(*p_m_subSprite);
v7 = ((double (__fastcall *)(cocos2d::CCSprite *))(*p_m_subSprite)->getScale)(*p_m_subSprite);
m_width = *(float *)&v7 * *v6;
}
}
cocos2d::CCSize::CCSize(&v46);
if ( a1->m_BGSprite )
{
v8 = cocos2d::CCRect::CCRect(&v44, 0.0, 0.0, 40.0, 40.0);
v9 = (__int64)(*p_m_subSprite)->getContentSize(*p_m_subSprite);
if ( *(float *)(v8 + 12) <= (float)((float)((*p_m_subSprite)->getScale(*p_m_subSprite) * *(float *)(v9 + 4)) + 8.0) )
{
v11 = (__int64)(*p_m_subSprite)->getContentSize(*p_m_subSprite);
v10 = (float)((*p_m_subSprite)->getScale(*p_m_subSprite) * *(float *)(v11 + 4)) + 8.0;
}
else
{
v10 = *(float *)(cocos2d::CCRect::CCRect(&v45, 0.0, 0.0, 40.0, 40.0) + 12LL);
}
v12 = a1->m_BGSprite->__vftable;
v13 = (const cocos2d::CCSize *)cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v47, m_width + 8.0, v10);
v12->setContentSize(a1->m_BGSprite, v13);
height = a1->m_BGSprite->getContentSize(a1->m_BGSprite)->height;
v15 = a1->m_BGSprite->getContentSize(a1->m_BGSprite);
v16 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v47, v15->width, height);
cocos2d::CCSize::operator=(&v46, v16);
p_m_subBGSprite = &a1->m_subBGSprite;
}
else
{
p_m_subBGSprite = &a1->m_subBGSprite;
m_subBGSprite = a1->m_subBGSprite;
if ( m_subBGSprite )
{
v19 = (__int64)m_subBGSprite->getContentSize(m_subBGSprite);
cocos2d::CCSize::operator=(&v46, v19);
}
}
a1->setContentSize(a1, &v46);
v20 = (*p_m_subSprite)->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v21 = a1->getContentSize(a1)->height;
v22 = cocos2d::CCPoint::CCPoint(&v47, 0.0, 2.0);
y = a1->m_spritePosition.y;
v24 = *(float *)(v22 + 4);
width = a1->getContentSize(a1)->width;
v26 = (float)((float)(width * 0.5) + *(float *)cocos2d::CCPoint::CCPoint(&v48, 0.0, 2.0)) + a1->m_spritePosition.x;
v27 = (const cocos2d::CCPoint *)cocos2d::CCPoint::CCPoint(&v49, v26, (float)((float)(v21 * 0.5) + v24) + y);
v20->setPosition_0(*p_m_subSprite, v27);
m_BGSprite = a1->m_BGSprite;
if ( m_BGSprite )
{
v29 = (void (__fastcall **)(cocos2d::extension::CCScale9Sprite *, _QWORD))m_BGSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v30 = a1->getContentSize(a1)->height;
v31 = a1->getContentSize(a1);
v32 = cocos2d::CCPoint::CCPoint(&v47, v31->width * 0.5, v30 * 0.5);
v33 = a1->m_BGSprite;
}
else
{
if ( !*p_m_subBGSprite )
goto LABEL_17;
v29 = (void (__fastcall **)(cocos2d::extension::CCScale9Sprite *, _QWORD))(*p_m_subBGSprite)->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v34 = a1->getContentSize(a1)->height;
v35 = a1->getContentSize(a1);
v32 = cocos2d::CCPoint::CCPoint(&v47, v35->width * 0.5, v34 * 0.5);
v33 = (cocos2d::extension::CCScale9Sprite *)*p_m_subBGSprite;
}
v29[23](v33, v32);
LABEL_17:
if ( a1->getParent(a1) )
{
v36 = a1->getParent(a1);
if ( _RTDynamicCast(
v36,
0,
&cocos2d::CCNode `RTTI Type Descriptor',
&CCMenuItemSpriteExtra `RTTI Type Descriptor',
0) )
{
v37 = a1->getParent(a1);
v38 = v37->__vftable;
v39 = a1->getContentSize(a1);
v38->setContentSize(v37, v39);
v40 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v41 = a1->getContentSize(a1)->height;
v42 = a1->getContentSize(a1);
v43 = (const cocos2d::CCPoint *)cocos2d::CCPoint::CCPoint(&v47, v42->width * 0.5, v41 * 0.5);
v40->setPosition_0(a1, v43);
}
}
}