//
// cocos2d::extension::CCControlButton::setTitleTTFForState from 0xa9bb08 to 0xa9bc54 (332 bytes)
//
// 3 xrefs:
// > ??> @ 0x93b10
// > ??> @ 0x11f5290
// > ??> @ 0x11fa8a0
//
// 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::setTitleTTFForState(
cocos2d::extension::CCControlButton *a1,
const char *a2,
unsigned int a3)
{
cocos2d::CCString *v6; // x21
cocos2d::CCString *v7; // x0
void (__fastcall *setTitleLabelForState)(cocos2d::extension::CCControlButton *__hidden, cocos2d::CCNode *, unsigned int); // x21
cocos2d::CCLabelTTF *CString; // x0
const char *v10; // x2
__int64 v11; // x0
const std::string *v12; // x1
void *v13; // x0
unsigned int *v14; // x2
int v15; // w1
__int64 v16; // [xsp+50h] [xbp+50h] BYREF
v6 = a1->getTitleForState(a1, a3);
if ( !v6 )
{
sub_D153B8((int)&v16, &byte_F288A0);
v6 = (cocos2d::CCString *)cocos2d::CCString::create((cocos2d::CCString *)&v16, v12);
v13 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v16 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v13);
}
}
v7 = v6;
setTitleLabelForState = a1->setTitleLabelForState;
CString = (cocos2d::CCLabelTTF *)cocos2d::CCString::getCString(v7);
v11 = cocos2d::CCLabelTTF::create(CString, a2, v10, 12.0);
setTitleLabelForState(a1, (cocos2d::CCNode *)v11, a3);
}