//
// ButtonSprite::setString from 0x14003fb50 to 0x14003ff17 (967 bytes)
//
// 13 xrefs:
// > ButtonSprite::init_1 @ 0x14003f554
// > ButtonSprite::updateBGImage @ 0x14003f65b
// > CustomizeObjectLayer::init @ 0x1400a65b5
// > CustomizeObjectLayer::init @ 0x1400a6813
// > CustomizeObjectLayer::textChanged @ 0x1400a9916
// > CustomizeObjectLayer::updateCustomColorLabels @ 0x1400a9bd6
// > EditorUI::setIDPopupClosed @ 0x1400e6ceb
// > EditorUI::setIDPopupClosed @ 0x1400e6e58
// > EditorUI::onResetSpecialFilter @ 0x1400e7491
// > EditorUI::onResetSpecialFilter @ 0x1400e74f4
// > ??> @ 0x140661f98
// > ??> @ 0x140661ff8
// > ??> @ 0x1406c41ac
//
// 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; // r8
cocos2d::CCLabelBMFont *m_label; // rcx
cocos2d::CCLabelBMFont_vtbl *v6; // rbx
float m_width; // xmm6_4
const cocos2d::CCSize *v8; // rbx
float v9; // xmm0_4
const cocos2d::CCSize *v10; // rbx
double v11; // xmm0_8
float m_height; // xmm2_4
cocos2d::extension::CCScale9Sprite_vtbl *v13; // rbx
const cocos2d::CCSize *v14; // rax
ButtonSprite_vtbl *v15; // rbx
float height; // xmm6_4
const cocos2d::CCSize *v17; // rax
const cocos2d::CCSize *v18; // rax
cocos2d::CCLabelBMFont_vtbl *v19; // rbx
const cocos2d::CCSize *v20; // rax
float y; // xmm6_4
float v22; // xmm7_4
const cocos2d::CCSize *v23; // rax
const cocos2d::CCPoint *v24; // rax
cocos2d::extension::CCScale9Sprite_vtbl *v25; // rbx
float v26; // xmm6_4
const cocos2d::CCSize *v27; // rax
const cocos2d::CCPoint *v28; // rax
cocos2d::CCNode *v29; // rax
cocos2d::CCNode *v30; // rbx
cocos2d::CCNode_vtbl *v31; // rdi
const cocos2d::CCSize *v32; // rax
ButtonSprite_vtbl *v33; // rbx
float v34; // xmm6_4
const cocos2d::CCSize *v35; // rax
const cocos2d::CCPoint *v36; // rax
cocos2d::CCPoint v37; // [rsp+70h] [rbp+8h] BYREF
if ( a1->m_mode == 1 )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->setScale_0)(a1->m_label);
a1->m_label->setString(&a1->m_label->cocos2d::CCLabelProtocol, a2);
v4 = -1;
do
++v4;
while ( a2[v4] );
sub_14003CCE0((void **)&a1->m_caption, (void *)a2, v4);
if ( a1->m_width > 0.0 && a1->m_label->getContentSize(a1->m_label)->width > a1->m_width )
{
m_label = a1->m_label;
v6 = m_label->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_label->getContentSize(m_label);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v6->setScale_0)(a1->m_label);
}
if ( a1->m_scale > a1->m_label->getScale(a1->m_label) )
a1->m_label->getScale(a1->m_label);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->setScale_0)(a1->m_label);
if ( a1->m_absolute )
{
m_width = a1->m_width;
}
else
{
v8 = a1->m_label->getContentSize(a1->m_label);
v9 = a1->m_label->getScale(a1->m_label);
m_width = a1->m_minWidth;
if ( m_width <= (float)(v9 * v8->width) )
{
v10 = a1->m_label->getContentSize(a1->m_label);
v11 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label);
m_width = *(float *)&v11 * v10->width;
}
}
m_height = a1->m_label->getContentSize(a1->m_label)->height + 4.0;
if ( a1->m_height != 0.0 )
m_height = a1->m_height;
v13 = a1->m_BGSprite->__vftable;
v14 = (const cocos2d::CCSize *)cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v37, m_width + 16.0, m_height);
v13->setContentSize(a1->m_BGSprite, v14);
v15 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
height = a1->m_BGSprite->getContentSize(a1->m_BGSprite)->height;
v17 = a1->m_BGSprite->getContentSize(a1->m_BGSprite);
v18 = (const cocos2d::CCSize *)cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v37, v17->width, height);
v15->setContentSize(a1, v18);
v19 = a1->m_label->__vftable;
v20 = a1->getContentSize(a1);
y = a1->m_textOffset.y;
v22 = v20->height;
v23 = a1->getContentSize(a1);
v24 = (const cocos2d::CCPoint *)cocos2d::CCPoint::CCPoint(
&v37,
(float)(v23->width * 0.5) + a1->m_textOffset.x,
(float)(v22 * 0.5) + y);
v19->setPosition_0(a1->m_label, v24);
v25 = a1->m_BGSprite->__vftable;
v26 = a1->getContentSize(a1)->height;
v27 = a1->getContentSize(a1);
v28 = (const cocos2d::CCPoint *)cocos2d::CCPoint::CCPoint(&v37, v27->width * 0.5, v26 * 0.5);
v25->setPosition_0(a1->m_BGSprite, v28);
if ( a1->getParent(a1) )
{
v29 = a1->getParent(a1);
if ( _RTDynamicCast(
v29,
0,
&cocos2d::CCNode `RTTI Type Descriptor',
&CCMenuItemSpriteExtra `RTTI Type Descriptor',
0) )
{
v30 = a1->getParent(a1);
v31 = v30->__vftable;
v32 = a1->getContentSize(a1);
v31->setContentSize(v30, v32);
v33 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v34 = a1->getContentSize(a1)->height;
v35 = a1->getContentSize(a1);
v36 = (const cocos2d::CCPoint *)cocos2d::CCPoint::CCPoint(&v37, v35->width * 0.5, v34 * 0.5);
v33->setPosition_0(a1, v36);
}
}
}
}