//
// ButtonSprite::setString from 0x56f8ac to 0x56fcc0 (1044 bytes)
//
// 11 xrefs:
// > ButtonSprite::updateBGImage @ 0x56fde4
// > ButtonSprite::init @ 0x570028
// > EditorUI::onResetSpecialFilter @ 0x685dbc
// > EditorUI::onResetSpecialFilter @ 0x685de4
// > EditorUI::setIDPopupClosed @ 0x6be774
// > EditorUI::setIDPopupClosed @ 0x6be830
// > CustomizeObjectLayer::updateCustomColorLabels @ 0x8410e4
// > CustomizeObjectLayer::textChanged @ 0x8414b0
// > CustomizeObjectLayer::init @ 0x842ae8
// > CustomizeObjectLayer::init @ 0x842cec
// > ??> @ 0x4f7b8
//
// 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::setString(ButtonSprite *a1, const char *a2)
{
size_t v4; // x0
long double v5; // q0
const cocos2d::CCSize *v6; // x0
float m_width; // s8
cocos2d::CCLabelBMFont *m_label; // x21
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // x22
float *v10; // x0
cocos2d::CCLabelBMFont *v11; // x21
void (__fastcall *v12)(cocos2d::CCLabelBMFont *__hidden, float); // x22
float v13; // s0
float m_scale; // s1
float v15; // s8
const cocos2d::CCSize *v16; // x0
float m_height; // s1
cocos2d::extension::CCScale9Sprite *m_BGSprite; // x22
void (__fastcall *setContentSize)(cocos2d::extension::CCScale9Sprite *__hidden, const cocos2d::CCSize *); // x23
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x22
const cocos2d::CCSize *v21; // x0
cocos2d::CCLabelBMFont *v22; // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
const cocos2d::CCSize *v24; // x0
cocos2d::extension::CCScale9Sprite *v25; // x22
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
const cocos2d::CCSize *v27; // x0
cocos2d::CCNode *v28; // x0
cocos2d::CCNode *v29; // x22
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x23
const cocos2d::CCSize *v31; // x0
void (__fastcall *v32)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
const cocos2d::CCSize *v33; // x0
float m_minWidth; // s9
float width; // s8
float v36; // s8
float v37; // [xsp+50h] [xbp+50h]
float v38; // [xsp+50h] [xbp+50h]
float v39; // [xsp+50h] [xbp+50h]
float v40; // [xsp+50h] [xbp+50h]
cocos2d::CCPoint v41; // [xsp+60h] [xbp+60h] BYREF
if ( a1->m_mode == 1 )
{
a1->m_label->setScale(a1->m_label, 1.0);
a1->m_label->setString(a1->m_label, (const unsigned __int8 *)a2);
v4 = strlen(a2);
sub_D1798C(&a1->m_caption, a2, v4);
*(float *)&v5 = a1->m_width;
if ( *(float *)&v5 > 0.0 )
{
v6 = a1->m_label->getContentSize(a1->m_label);
m_width = a1->m_width;
*(float *)&v5 = v6->width;
if ( v6->width > m_width )
{
m_label = a1->m_label;
setScale = m_label->setScale;
v10 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))m_label->getContentSize)(
m_label,
*(float *)&v5);
setScale(m_label, m_width / *v10);
}
}
v11 = a1->m_label;
v12 = v11->setScale;
v13 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, long double))v11->getScale)(v11, v5);
m_scale = a1->m_scale;
if ( v13 <= m_scale )
{
v11 = a1->m_label;
m_scale = v11->getScale(v11);
}
v12(v11, m_scale);
if ( a1->m_absolute )
{
v15 = a1->m_width;
}
else
{
m_minWidth = a1->m_minWidth;
width = a1->m_label->getContentSize(a1->m_label)->width;
if ( m_minWidth < (float)(width * a1->m_label->getScale(a1->m_label)) )
{
v36 = a1->m_label->getContentSize(a1->m_label)->width;
v15 = v36 * a1->m_label->getScale(a1->m_label);
}
else
{
v15 = a1->m_minWidth;
}
}
v16 = a1->m_label->getContentSize(a1->m_label);
m_height = a1->m_height;
if ( m_height == 0.0 )
m_height = v16->height + 4.0;
m_BGSprite = a1->m_BGSprite;
setContentSize = m_BGSprite->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v41, v15 + 16.0, m_height);
setContentSize(m_BGSprite, (const cocos2d::CCSize *)&v41);
v20 = a1->setContentSize;
v37 = a1->m_BGSprite->getContentSize(a1->m_BGSprite)->width;
v21 = a1->m_BGSprite->getContentSize(a1->m_BGSprite);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v41, v37, v21->height);
v20(a1, (const cocos2d::CCSize *)&v41);
v22 = a1->m_label;
setPosition = v22->setPosition;
v38 = a1->m_textOffset.x + (float)(a1->getContentSize(a1)->width * 0.5);
v24 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v41, v38, a1->m_textOffset.y + (float)(v24->height * 0.5));
setPosition(v22, &v41);
v25 = a1->m_BGSprite;
v26 = v25->setPosition;
v39 = a1->getContentSize(a1)->width * 0.5;
v27 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v41, v39, v27->height * 0.5);
v26(v25, &v41);
if ( a1->getParent(a1) )
{
v28 = a1->getParent(a1);
if ( v28 )
{
if ( _dynamic_cast(
v28,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'CCMenuItemSpriteExtra,
0) )
{
v29 = a1->getParent(a1);
v30 = v29->setContentSize;
v31 = a1->getContentSize(a1);
v30(v29, v31);
v32 = a1->setPosition;
v40 = a1->getContentSize(a1)->width * 0.5;
v33 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v41, v40, v33->height * 0.5);
v32(a1, &v41);
}
}
}
}
}