//
// cocos2d::extension::CCControlButton::setTitleBMFontForState from 0xa9bc54 to 0xa9bd9c (328 bytes)
//
// 3 xrefs:
// > ??> @ 0xad700
// > ??> @ 0x11f52b0
// > ??> @ 0x11fa8c0
//
// 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 cocos2d::extension::CCControlButton::setTitleBMFontForState(
cocos2d::extension::CCControlButton *a1,
const char *a2,
unsigned int a3)
{
cocos2d::CCString *v5; // x21
cocos2d::CCString *v6; // x0
void (__fastcall *setTitleLabelForState)(cocos2d::extension::CCControlButton *__hidden, cocos2d::CCNode *, unsigned int); // x21
cocos2d::CCLabelBMFont *v8; // x0
const std::string *v9; // x1
void *v10; // x0
unsigned int *v11; // x2
int v12; // w1
__int64 v13; // [xsp+50h] [xbp+50h] BYREF
v5 = a1->getTitleForState(a1, a3);
if ( !v5 )
{
sub_D153B8((int)&v13, &byte_F288A0);
v5 = (cocos2d::CCString *)cocos2d::CCString::create((cocos2d::CCString *)&v13, v9);
v10 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v13 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v13 - 8);
*(_DWORD *)(v13 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
}
v6 = v5;
setTitleLabelForState = a1->setTitleLabelForState;
cocos2d::CCString::getCString(v6);
v8 = cocos2d::CCLabelBMFont::create();
setTitleLabelForState(a1, v8, a3);
}