//
// ButtonSprite::init_1 from 0x100092c00 to 0x100092e9f (671 bytes)
//
// 1 xrefs:
// > ButtonSprite::create_1 @ 0x100092b91
//
// 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)
{
bool result; // al
double v15; // xmm0_8
size_t v16; // rax
size_t v17; // r13
char *v18; // rbx
size_t v19; // r12
char v20; // bl
void *v21; // r13
size_t v22; // rax
char *v23; // rdi
size_t v24; // rdx
char v25; // r12
cocos2d::CCLabelBMFont *v26; // rax
cocos2d::extension::CCScale9Sprite *v27; // rbx
char v28; // [rsp+8h] [rbp-78h] BYREF
_QWORD __s2[2]; // [rsp+9h] [rbp-77h] BYREF
const char *v30; // [rsp+20h] [rbp-60h]
cocos2d::CCPoint *p_m_textOffset; // [rsp+28h] [rbp-58h]
size_t __dst; // [rsp+30h] [rbp-50h] BYREF
size_t __n; // [rsp+38h] [rbp-48h]
void *__p; // [rsp+40h] [rbp-40h]
const char *v35; // [rsp+48h] [rbp-38h]
bool v36; // [rsp+57h] [rbp-29h]
cocos2d::CCRect v37; // 0:xmm0_8.8,8:xmm1_8.8
*(float *)&v35 = a9;
*(float *)&p_m_textOffset = a5;
v30 = a2;
result = cocos2d::CCSprite::init(a1);
if ( !result )
return result;
v36 = result;
a1->m_mode = 1;
a1->m_width = (float)a3;
a1->m_minWidth = (float)a4;
LODWORD(a1->m_scale) = (_DWORD)p_m_textOffset;
a1->m_absolute = a6;
LODWORD(a1->m_height) = (_DWORD)v35;
sub_10028CBE0(&__dst, 0.0, 2.0);
v15 = sub_10028CC90();
v16 = strlen(a7);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v15);
v17 = v16;
v35 = a7;
p_m_textOffset = &a1->m_textOffset;
if ( v16 >= 0x17 )
{
v19 = 26;
if ( (v16 | 7) != 0x17 )
v19 = (v16 | 7) + 1;
v18 = (char *)operator new(v19);
__p = v18;
__dst = v19 + 1;
a7 = v35;
__n = v17;
}
else
{
LOBYTE(__dst) = 2 * v16;
v18 = (char *)&__dst + 1;
if ( !v16 )
goto LABEL_10;
}
memcpy(v18, a7, v17);
LABEL_10:
v18[v17] = 0;
strcpy((char *)__s2, "bigFont.fnt");
v20 = __dst;
v21 = __p;
if ( (__dst & 1) != 0 )
{
v22 = __n;
v23 = (char *)__p;
}
else
{
v23 = (char *)&__dst + 1;
v22 = (unsigned __int8)__dst >> 1;
}
v24 = 11;
if ( v22 < 0xB )
v24 = v22;
v25 = (v22 == 11) & (memcmp(v23, __s2, v24) == 0);
if ( (v20 & 1) != 0 )
operator delete(v21);
if ( v25 )
{
sub_10028CBE0(&v28, 0.0, 2.0);
sub_10028CBE0(&__dst, -1.0, *(float *)((char *)__s2 + 3));
v15 = sub_10028CC90();
}
v26 = cocos2d::CCLabelBMFont::create_3("", v35);
a1->m_label = v26;
((void (__fastcall *)(ButtonSprite *, cocos2d::CCLabelBMFont *, __int64, double))a1->addChild_0)(a1, v26, 1, v15);
v37.origin = 0;
v37.size = 0;
sub_10028CC00(&__dst, 0.0, 0.0, 40.0, 40.0);
v27 = cocos2d::extension::CCScale9Sprite::create_2(a8, v37);
a1->m_BGSprite = v27;
sub_10028CBF0(&__dst, 16.0, 16.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, size_t *))v27->setContentSize)(v27, &__dst);
((void (__fastcall *)(ButtonSprite *, cocos2d::extension::CCScale9Sprite *, _QWORD))a1->addChild_0)(
a1,
a1->m_BGSprite,
0);
ButtonSprite::setString(a1, v30);
return v36;
}