//
// ButtonSprite::setString from 0x100092ea0 to 0x10009327a (986 bytes)
//
// 10 xrefs:
// > EditorUI::onResetSpecialFilter @ 0x100032031
// > EditorUI::onResetSpecialFilter @ 0x10003205a
// > EditorUI::setIDPopupClosed @ 0x1000332db
// > EditorUI::setIDPopupClosed @ 0x1000333a2
// > ButtonSprite::init_1 @ 0x100092e82
// > ButtonSprite::updateBGImage @ 0x10009337e
// > CustomizeObjectLayer::init @ 0x1001f5f3e
// > CustomizeObjectLayer::init @ 0x1001f6167
// > CustomizeObjectLayer::updateCustomColorLabels @ 0x1001f7bcd
// > CustomizeObjectLayer::textChanged @ 0x1001f94f5
//
// 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)
{
cocos2d::CCLabelBMFont *m_label; // r14
cocos2d::CCLabelBMFont_vtbl *v3; // rax
float *v4; // rax
cocos2d::CCLabelBMFont *v5; // r14
double v6; // xmm0_8
float m_minWidth; // xmm0_4
__m128 v8; // xmm0
__m128 v9; // xmm2
__m128 v10; // xmm1
cocos2d::extension::CCScale9Sprite *m_BGSprite; // r14
__int64 v12; // rax
cocos2d::CCLabelBMFont *v13; // r14
__int64 v14; // rax
cocos2d::extension::CCScale9Sprite *v15; // r14
__int64 v16; // rax
const void *v17; // rax
__int64 v18; // r14
__int64 v19; // rax
__int64 v20; // rax
float v21; // [rsp-30h] [rbp-30h]
int v22; // [rsp-2Ch] [rbp-2Ch] BYREF
float m_width; // [rsp-24h] [rbp-24h]
if ( a1->m_mode == 1 )
{
((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);
if ( a1->m_width > 0.0
&& *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label) > a1->m_width )
{
m_label = a1->m_label;
v3 = m_label->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_width = a1->m_width;
v4 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v3->getContentSize)(m_label);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))m_label->setScale)(m_label, m_width / *v4);
}
v5 = a1->m_label;
v6 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v5->getScale)(v5);
if ( *(float *)&v6 <= a1->m_scale )
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v5->setScale)(v5);
if ( a1->m_absolute )
{
m_minWidth = a1->m_width;
}
else
{
m_width = a1->m_minWidth;
v21 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
if ( (float)(((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label) * v21) <= m_width )
{
m_minWidth = a1->m_minWidth;
}
else
{
m_width = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
m_minWidth = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label) * m_width;
}
}
m_width = m_minWidth;
v8 = (__m128)*(unsigned int *)(((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label)
+ 4);
v8.f32[0] = v8.f32[0] + 4.0;
v9.i32[0] = LODWORD(a1->m_height);
v10 = _mm_cmpneq_ss((__m128)0LL, v9);
m_BGSprite = a1->m_BGSprite;
sub_10028CBF0(&v22, m_width + 16.0, COERCE_FLOAT(v10.i32[0] & v9.i32[0] | _mm_andnot_ps(v10, v8).u32[0]));
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))m_BGSprite->setContentSize)(m_BGSprite, &v22);
m_width = *(float *)((__int64 (__fastcall *)(cocos2d::extension::CCScale9Sprite *))a1->m_BGSprite->getContentSize)(a1->m_BGSprite);
v12 = ((__int64 (__fastcall *)(cocos2d::extension::CCScale9Sprite *))a1->m_BGSprite->getContentSize)(a1->m_BGSprite);
sub_10028CBF0(&v22, m_width, *(float *)(v12 + 4));
((void (__fastcall *)(ButtonSprite *, int *))a1->setContentSize)(a1, &v22);
v13 = a1->m_label;
m_width = (float)(*(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) * 0.5)
+ a1->m_textOffset.x;
v14 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1);
sub_10028CBE0(&v22, m_width, (float)(*(float *)(v14 + 4) * 0.5) + a1->m_textOffset.y);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int *))v13->setPosition)(v13, &v22);
v15 = a1->m_BGSprite;
m_width = *(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) * 0.5;
v16 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1);
sub_10028CBE0(&v22, m_width, *(float *)(v16 + 4) * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))v15->setPosition)(v15, &v22);
if ( ((__int64 (__fastcall *)(ButtonSprite *))a1->getParent)(a1) )
{
v17 = (const void *)((__int64 (__fastcall *)(ButtonSprite *))a1->getParent)(a1);
if ( v17 )
{
if ( __dynamic_cast(
v17,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'CCMenuItemSpriteExtra,
0) )
{
v18 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getParent)(a1);
v19 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v18 + 304LL))(v18, v19);
m_width = *(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1) * 0.5;
v20 = ((__int64 (__fastcall *)(ButtonSprite *))a1->getContentSize)(a1);
sub_10028CBE0(&v22, m_width, 0.5 * *(float *)(v20 + 4));
((void (__fastcall *)(ButtonSprite *, int *))a1->setPosition)(a1, &v22);
}
}
}
}
}