//
// ButtonSprite::init_1 from 0x10005f3a8 to 0x10005f5c8 (544 bytes)
//
// 1 xrefs:
// > ButtonSprite::create_1 @ 0x10005f344
//
// 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
//
bool __fastcall ButtonSprite::init_1(
ButtonSprite *a1,
const char *a2,
int a3,
int a4,
float a5,
bool a6,
const char *a7,
const char *a8,
float a9)
{
_BOOL4 v18; // w20
__n128 v19; // q0
__n128 v20; // q1
__int64 v21; // x28
size_t v22; // x8
void *v23; // x24
size_t v24; // x9
unsigned __int8 v25; // w25
void **v26; // x0
_QWORD *v27; // x1
size_t v28; // x2
_BOOL4 v29; // w26
__n128 v30; // q0
__n128 v31; // q1
__n128 v32; // q1
__n128 v33; // q0
cocos2d::CCLabelBMFont *v34; // x0
cocos2d::extension::CCScale9Sprite *v35; // x22
_QWORD v37[2]; // [xsp+0h] [xbp-90h] BYREF
char v38; // [xsp+17h] [xbp-79h]
void *__p[2]; // [xsp+18h] [xbp-78h] BYREF
unsigned __int8 v40; // [xsp+2Fh] [xbp-61h]
cocos2d::CCRect v41; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v18 = cocos2d::CCSprite::init(a1);
if ( v18 )
{
a1->m_mode = 1;
a1->m_width = (float)a3;
a1->m_minWidth = (float)a4;
a1->m_scale = a5;
a1->m_absolute = a6;
a1->m_height = a9;
v19.n128_u32[0] = 0;
v20.n128_u32[0] = 2.0;
sub_100022980(v19, v20, __p);
sub_1000229D0(&a1->m_textOffset, (double *)__p);
sub_100009900(__p, (char *)a7);
sub_100009900(v37, "bigFont.fnt");
v21 = v38;
v23 = (void *)v37[0];
v22 = v37[1];
v24 = v40;
v25 = v40;
if ( (v40 & 0x80u) == 0 )
{
v26 = __p;
}
else
{
v24 = (size_t)__p[1];
v26 = (void **)__p[0];
}
if ( v38 < 0 )
{
v27 = (_QWORD *)v37[0];
}
else
{
v22 = v38;
v27 = v37;
}
if ( v22 >= v24 )
v28 = v24;
else
v28 = v22;
v29 = v22 == v24;
if ( memcmp(v26, v27, v28) )
v29 = 0;
if ( v21 < 0 )
{
operator delete(v23);
if ( (v40 & 0x80) == 0 )
{
LABEL_15:
if ( !v29 )
{
LABEL_17:
v34 = cocos2d::CCLabelBMFont::create_1("", a7);
a1->m_label = v34;
((void (__fastcall *)(ButtonSprite *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v34, 1);
sub_100022990((float *)__p, 0.0, 0.0, 40.0, 40.0);
v35 = cocos2d::extension::CCScale9Sprite::create(a8, v41);
a1->m_BGSprite = v35;
sub_100022988((float *)__p, 16.0, 16.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v35->setContentSize)(v35, __p);
((void (__fastcall *)(ButtonSprite *, cocos2d::extension::CCScale9Sprite *, _QWORD))a1->addChild_0)(
a1,
a1->m_BGSprite,
0);
ButtonSprite::setString(a1, a2);
return v18;
}
LABEL_16:
v30.n128_u32[0] = 0;
v31.n128_u32[0] = 2.0;
sub_100022980(v30, v31, v37);
v32.n128_u32[0] = HIDWORD(v37[0]);
v33.n128_u32[0] = -1.0;
sub_100022980(v33, v32, __p);
sub_1000229D0(&a1->m_textOffset, (double *)__p);
goto LABEL_17;
}
}
else if ( (v25 & 0x80) == 0 )
{
goto LABEL_15;
}
operator delete(__p[0]);
if ( !v29 )
goto LABEL_17;
goto LABEL_16;
}
return v18;
}