//
// ButtonSprite::setString from 0x10005f5e4 to 0x10005f988 (932 bytes)
//
// 10 xrefs:
// > CustomizeObjectLayer::init @ 0x10004e27c
// > CustomizeObjectLayer::init @ 0x10004e44c
// > CustomizeObjectLayer::updateCustomColorLabels @ 0x10004fb9c
// > CustomizeObjectLayer::textChanged @ 0x100050c1c
// > ButtonSprite::init_1 @ 0x10005f57c
// > ButtonSprite::updateBGImage @ 0x10005fa40
// > EditorUI::onResetSpecialFilter @ 0x1003e9468
// > EditorUI::onResetSpecialFilter @ 0x1003e9490
// > EditorUI::setIDPopupClosed @ 0x1003e9f00
// > EditorUI::setIDPopupClosed @ 0x1003e9fdc
//
// 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 __fastcall ButtonSprite::setString(ButtonSprite *a1, const char *a2)
{
__int64 v2; // x29
__int64 v3; // x30
__int64 v4; // d8
__int64 v5; // d9
__n128 v8; // q0
float m_width; // s8
cocos2d::CCLabelBMFont *m_label; // x20
float *v11; // x0
cocos2d::CCLabelBMFont *v12; // x20
float v13; // s8
float m_minWidth; // s8
float v15; // s9
float v16; // s8
__int64 v17; // x0
float m_height; // s1
cocos2d::extension::CCScale9Sprite *m_BGSprite; // x20
float v20; // s8
__int64 v21; // x0
cocos2d::CCLabelBMFont *v22; // x20
float v23; // s8
__n128 v24; // q1
__n128 v25; // q0
cocos2d::extension::CCScale9Sprite *v26; // x20
float v27; // s8
__n128 v28; // q1
__n128 v29; // q0
const void *v30; // x0
__int64 v31; // x20
__int64 v32; // x0
float v33; // s8
__n128 v34; // q1
__n128 v35; // q0
int v36; // [xsp+8h] [xbp-38h] BYREF
__int64 v37; // [xsp+10h] [xbp-30h]
__int64 v38; // [xsp+18h] [xbp-28h]
__int64 v39; // [xsp+30h] [xbp-10h]
__int64 v40; // [xsp+38h] [xbp-8h]
if ( a1->m_mode == 1 )
{
v37 = v5;
v38 = v4;
v39 = v2;
v40 = v3;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_label->setScale)(a1->m_label, 1.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_label->setString)(a1->m_label, a2);
std::string::assign((std::string *)&a1->m_caption, a2);
v8.n128_u32[0] = LODWORD(a1->m_width);
if ( v8.n128_f32[0] > 0.0 )
{
v8.n128_u32[0] = *(_DWORD *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
m_width = a1->m_width;
if ( v8.n128_f32[0] > m_width )
{
m_label = a1->m_label;
v11 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))m_label->getContentSize)(
m_label,
v8.n128_f32[0]);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))m_label->setScale)(m_label, m_width / *v11);
}
}
v12 = a1->m_label;
if ( ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __n128))v12->getScale)(v12, v8) <= a1->m_scale )
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v12->setScale)(v12);
if ( a1->m_absolute )
{
v13 = a1->m_width;
}
else
{
m_minWidth = a1->m_minWidth;
v15 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
if ( m_minWidth >= (float)(v15
* ((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label)) )
{
v13 = a1->m_minWidth;
}
else
{
v16 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
v13 = v16 * ((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label);
}
}
v17 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
m_height = a1->m_height;
if ( m_height == 0.0 )
m_height = *(float *)(v17 + 4) + 4.0;
m_BGSprite = a1->m_BGSprite;
sub_100022988((float *)&v36, v13 + 16.0, m_height);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))m_BGSprite->setContentSize)(m_BGSprite, &v36);
v20 = *(float *)((__int64 (__fastcall *)(cocos2d::extension::CCScale9Sprite *))a1->m_BGSprite->getContentSize)(a1->m_BGSprite);
v21 = ((__int64 (__fastcall *)(cocos2d::extension::CCScale9Sprite *))a1->m_BGSprite->getContentSize)(a1->m_BGSprite);
sub_100022988((float *)&v36, v20, *(float *)(v21 + 4));
((void (__fastcall *)(ButtonSprite *, int *))a1->setContentSize)(a1, &v36);
v22 = a1->m_label;
v23 = (float)(*(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) * 0.5) + a1->m_textOffset.x;
v24.n128_f32[0] = (float)(*(float *)(((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) + 4) * 0.5)
+ a1->m_textOffset.y;
v25.n128_f32[0] = v23;
sub_100022980(v25, v24, &v36);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int *))v22->setPosition)(v22, &v36);
v26 = a1->m_BGSprite;
v27 = *(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) * 0.5;
v28.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) + 4) * 0.5;
v29.n128_f32[0] = v27;
sub_100022980(v29, v28, &v36);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))v26->setPosition)(v26, &v36);
if ( ((__int64 (__fastcall *)(ButtonSprite *))a1->getParent)(a1) )
{
v30 = (const void *)((__int64 (__fastcall *)(ButtonSprite *))a1->getParent)(a1);
if ( v30 )
{
if ( __dynamic_cast(
v30,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'CCMenuItemSpriteExtra,
0) )
{
v31 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getParent)(a1);
v32 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v31 + 304LL))(v31, v32);
v33 = *(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) * 0.5;
v34.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) + 4) * 0.5;
v35.n128_f32[0] = v33;
sub_100022980(v35, v34, &v36);
((void (__fastcall *)(ButtonSprite *, int *))a1->setPosition)(a1, &v36);
}
}
}
}
}