//
// ButtonSprite::updateSpriteBGSize from 0x56eff8 to 0x56f444 (1100 bytes)
//
// 4 xrefs:
// > ButtonSprite::init @ 0x56f62c
// > ButtonSprite::updateSpriteOffset @ 0x56f8a8
// > ButtonSprite::updateBGImage @ 0x56fd80
// > ??> @ 0xaa430
//
// 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)
{
float m_width; // s11
cocos2d::extension::CCScale9Sprite *m_BGSprite; // x24
void (__fastcall *setContentSize)(cocos2d::extension::CCScale9Sprite *__hidden, const cocos2d::CCSize *); // x25
float v5; // s11
float height; // s12
float v7; // s8
float v8; // s1
const cocos2d::CCSize *v9; // x0
cocos2d::CCSprite *m_subSprite; // x22
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
float v12; // s9
float v13; // s8
float v14; // s9
void *v15; // x22
void (__fastcall *v16)(void *, cocos2d::CCRect *); // x23
const cocos2d::CCSize *v17; // x0
cocos2d::CCNode *v18; // x0
cocos2d::CCNode *v19; // x22
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x23
const cocos2d::CCSize *v21; // x0
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
const cocos2d::CCSize *v23; // x0
float v24; // s8
cocos2d::CCSprite *m_subBGSprite; // x0
__int64 v26; // x0
float m_minWidth; // s9
float width; // s8
float v29; // s11
float v30; // [xsp+70h] [xbp+70h]
float v31; // [xsp+70h] [xbp+70h]
float v32; // [xsp+70h] [xbp+70h]
cocos2d::CCSize v33; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v34; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v35; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCRect v36; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCRect v37; // [xsp+A8h] [xbp+A8h] BYREF
if ( a1->m_absolute )
{
m_width = a1->m_width;
}
else
{
m_minWidth = a1->m_minWidth;
width = a1->m_subSprite->getContentSize(a1->m_subSprite)->width;
if ( m_minWidth < (float)(width * a1->m_subSprite->getScale(a1->m_subSprite)) )
{
v29 = a1->m_subSprite->getContentSize(a1->m_subSprite)->width;
m_width = v29 * a1->m_subSprite->getScale(a1->m_subSprite);
}
else
{
m_width = a1->m_minWidth;
}
}
cocos2d::CCSize::CCSize(&v33);
m_BGSprite = a1->m_BGSprite;
if ( m_BGSprite )
{
setContentSize = m_BGSprite->setContentSize;
v5 = m_width + 8.0;
cocos2d::CCRect::CCRect(&v36, 0.0, 0.0, 40.0, 40.0);
height = v36.size.height;
v7 = a1->m_subSprite->getContentSize(a1->m_subSprite)->height;
if ( height < (float)((float)(v7 * a1->m_subSprite->getScale(a1->m_subSprite)) + 8.0) )
{
v24 = a1->m_subSprite->getContentSize(a1->m_subSprite)->height;
v8 = (float)(v24 * a1->m_subSprite->getScale(a1->m_subSprite)) + 8.0;
}
else
{
cocos2d::CCRect::CCRect(&v37, 0.0, 0.0, 40.0, 40.0);
v8 = v37.size.height;
}
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v35, v5, v8);
setContentSize(m_BGSprite, (const cocos2d::CCSize *)&v35);
v30 = a1->m_BGSprite->getContentSize(a1->m_BGSprite)->width;
v9 = a1->m_BGSprite->getContentSize(a1->m_BGSprite);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v36, v30, v9->height);
cocos2d::CCSize::operator=(&v33, &v36);
}
else
{
m_subBGSprite = a1->m_subBGSprite;
if ( m_subBGSprite )
{
v26 = (__int64)m_subBGSprite->getContentSize(m_subBGSprite);
cocos2d::CCSize::operator=(&v33, v26);
}
}
a1->setContentSize(a1, &v33);
m_subSprite = a1->m_subSprite;
setPosition = m_subSprite->setPosition;
v12 = a1->getContentSize(a1)->width;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 2.0);
v13 = (float)(v34.x + (float)(v12 * 0.5)) + a1->m_spritePosition.x;
v14 = a1->getContentSize(a1)->height;
cocos2d::CCPoint::CCPoint(&v35, 0.0, 2.0);
cocos2d::CCPoint::CCPoint(&v36.origin, v13, (float)(v35.y + (float)(v14 * 0.5)) + a1->m_spritePosition.y);
setPosition(m_subSprite, &v36.origin);
v15 = a1->m_BGSprite;
if ( v15 || (v15 = a1->m_subBGSprite) != nullptr )
{
v16 = *(void (__fastcall **)(void *, cocos2d::CCRect *))(*(_QWORD *)v15 + 184LL);
v31 = a1->getContentSize(a1)->width * 0.5;
v17 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v36.origin, v31, v17->height * 0.5);
v16(v15, &v36);
}
if ( a1->getParent(a1) )
{
v18 = a1->getParent(a1);
if ( v18 )
{
if ( _dynamic_cast(
v18,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'CCMenuItemSpriteExtra,
0) )
{
v19 = a1->getParent(a1);
v20 = v19->setContentSize;
v21 = a1->getContentSize(a1);
v20(v19, v21);
v22 = a1->setPosition;
v32 = a1->getContentSize(a1)->width * 0.5;
v23 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v36.origin, v32, v23->height * 0.5);
v22(a1, &v36.origin);
}
}
}
}