//
// ButtonSprite::updateSpriteBGSize from 0x2e30a4 to 0x2e339a (758 bytes)
//
// 3 xrefs:
// > ButtonSprite::init @ 0x2e3558
// > ButtonSprite::updateSpriteOffset @ 0x2e3658
// > ButtonSprite::updateBGImage @ 0x2e39d8
//
// 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; // s17
float m_minWidth; // s17
float width; // s16
float v5; // s17
cocos2d::extension::CCScale9Sprite *m_BGSprite; // r10
void (__fastcall *setContentSize)(cocos2d::extension::CCScale9Sprite *__hidden, const cocos2d::CCSize *); // r11
float height; // s18
float v9; // s17
float v10; // s19
float v11; // s18
float v12; // s16
float v13; // r7
const cocos2d::CCSize *v14; // r0
cocos2d::CCRect *v15; // r1
cocos2d::CCSprite *m_subBGSprite; // r0
cocos2d::CCSprite *m_subSprite; // r6
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
float v19; // s17
float v20; // s17
float v21; // s18
void *v22; // r6
void (__fastcall *v23)(void *, cocos2d::CCRect *); // r7
float v24; // s17
const cocos2d::CCSize *v25; // r0
cocos2d::CCNode *v26; // r0
cocos2d::CCNode *v27; // r6
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r7
const cocos2d::CCSize *v29; // r0
void (__fastcall *v30)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
float v31; // s17
const cocos2d::CCSize *v32; // r0
cocos2d::CCSize v33; // [sp+Ch] [bp-40h] BYREF
cocos2d::CCPoint v34; // [sp+14h] [bp-38h] BYREF
cocos2d::CCPoint v35; // [sp+1Ch] [bp-30h] BYREF
cocos2d::CCRect v36; // [sp+24h] [bp-28h] BYREF
cocos2d::CCRect v37; // [sp+34h] [bp-18h] 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)) )
{
m_width = a1->m_minWidth;
}
else
{
v5 = a1->m_subSprite->getContentSize(a1->m_subSprite)->width;
m_width = v5 * a1->m_subSprite->getScale(a1->m_subSprite);
}
}
cocos2d::CCSize::CCSize(&v33);
m_BGSprite = a1->m_BGSprite;
if ( m_BGSprite )
{
setContentSize = m_BGSprite->setContentSize;
cocos2d::CCRect::CCRect(&v36, 0.0, 0.0, 40.0, 40.0);
height = v36.size.height;
v9 = m_width + 8.0;
v10 = a1->m_subSprite->getContentSize(a1->m_subSprite)->height;
if ( height >= (float)((float)(v10 * a1->m_subSprite->getScale(a1->m_subSprite)) + 8.0) )
{
cocos2d::CCRect::CCRect(&v37, 0.0, 0.0, 40.0, 40.0);
v12 = v37.size.height;
}
else
{
v11 = a1->m_subSprite->getContentSize(a1->m_subSprite)->height;
v12 = (float)(v11 * a1->m_subSprite->getScale(a1->m_subSprite)) + 8.0;
}
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v35, v9, v12);
setContentSize(m_BGSprite, (const cocos2d::CCSize *)&v35);
v13 = a1->m_BGSprite->getContentSize(a1->m_BGSprite)->width;
v14 = a1->m_BGSprite->getContentSize(a1->m_BGSprite);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v36, v13, v14->height);
v15 = &v36;
goto LABEL_13;
}
m_subBGSprite = a1->m_subBGSprite;
if ( m_subBGSprite )
{
v15 = (cocos2d::CCRect *)m_subBGSprite->getContentSize(m_subBGSprite);
LABEL_13:
cocos2d::CCSize::operator=(&v33, v15);
}
a1->setContentSize(a1, &v33);
m_subSprite = a1->m_subSprite;
setPosition = m_subSprite->setPosition;
v19 = a1->getContentSize(a1)->width;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 2.0);
v20 = (float)((float)(v19 * 0.5) + v34.x) + a1->m_spritePosition.x;
v21 = a1->getContentSize(a1)->height;
cocos2d::CCPoint::CCPoint(&v35, 0.0, 2.0);
cocos2d::CCPoint::CCPoint(&v36.origin, v20, (float)((float)(v21 * 0.5) + v35.y) + a1->m_spritePosition.y);
setPosition(m_subSprite, &v36.origin);
v22 = a1->m_BGSprite;
if ( v22 || (v22 = a1->m_subBGSprite) != nullptr )
{
v23 = *(void (__fastcall **)(void *, cocos2d::CCRect *))(*(_DWORD *)v22 + 92);
v24 = a1->getContentSize(a1)->width;
v25 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v36.origin, v24 * 0.5, v25->height * 0.5);
v23(v22, &v36);
}
if ( a1->getParent(a1) )
{
v26 = a1->getParent(a1);
if ( v26 )
{
if ( _dynamic_cast(
v26,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'CCMenuItemSpriteExtra,
0) )
{
v27 = a1->getParent(a1);
v28 = v27->setContentSize;
v29 = a1->getContentSize(a1);
v28(v27, v29);
v30 = a1->setPosition;
v31 = a1->getContentSize(a1)->width;
v32 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v36.origin, v31 * 0.5, v32->height * 0.5);
v30(a1, &v36.origin);
}
}
}
}