//
// cocos2d::extension::CCControlButton::initWithTitleAndFontNameAndFontSize from 0x180005e20 to 0x180005f22 (258 bytes)
//
// 4 xrefs:
// > ??> @ 0x180024188
// > ??> @ 0x180027fd0
// > ??> @ 0x18002fdf8
// > ??> @ 0x180049564
//
// 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
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall cocos2d::extension::CCControlButton::initWithTitleAndFontNameAndFontSize(
__int64 a1,
__int64 a2,
const char *a3,
float a4)
{
const char *v6; // rcx
struct cocos2d::CCLabelTTF *v7; // rbp
__int64 v8; // rax
cocos2d::CCObject *v9; // rdi
unsigned __int8 v10; // di
unsigned __int64 v11; // rdx
_QWORD *v12; // rcx
cocos2d::extension::CCScale9Sprite *v14; // [rsp+20h] [rbp-48h]
v6 = (const char *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v6 = *(const char **)a2;
v7 = cocos2d::CCLabelTTF::create(v6, a3, a4);
v14 = (cocos2d::extension::CCScale9Sprite *)operator new(0x210u);
v8 = cocos2d::extension::CCScale9Sprite::CCScale9Sprite(v14);
v9 = (cocos2d::CCObject *)v8;
if ( v8 )
{
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v8 + 72LL))(v8) )
{
cocos2d::CCObject::autorelease(v9);
goto LABEL_8;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v9 + 8LL))(v9, 1);
}
v9 = nullptr;
LABEL_8:
v10 = (*(__int64 (__fastcall **)(__int64, struct cocos2d::CCLabelTTF *, cocos2d::CCObject *))(*(_QWORD *)a1 + 1168LL))(
a1,
v7,
v9);
v11 = *(_QWORD *)(a2 + 24);
if ( v11 > 0xF )
{
v12 = *(_QWORD **)a2;
if ( v11 + 1 >= 0x1000 )
{
if ( (unsigned __int64)v12 - *(v12 - 1) - 8 > 0x1F )
invalid_parameter_noinfo_noreturn();
v12 = (_QWORD *)*(v12 - 1);
}
j_j_free(v12);
}
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 15;
*(_BYTE *)a2 = 0;
return v10;
}