//
// cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite from 0x180005450 to 0x180005854 (1028 bytes)
//
// 4 xrefs:
// > ??> @ 0x1800266c8
// > ??> @ 0x18002a640
// > ??> @ 0x180032408
// > ??> @ 0x18004b498
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:15:35 +0000
//
// Hidden C++ exception states: #wind=1
char __fastcall cocos2d::extension::CCControlButton::initWithLabelAndBackgroundSprite(
cocos2d::extension::CCControlButton *this,
struct cocos2d::CCNode *a2,
struct cocos2d::extension::CCScale9Sprite *a3)
{
__int64 v6; // r14
__int64 v7; // r15
cocos2d::CCObject *v8; // rax
cocos2d::CCObject *v9; // rbx
cocos2d::CCObject *v10; // rcx
cocos2d::CCObject *v11; // rax
cocos2d::CCObject *v12; // rbx
cocos2d::CCObject *v13; // rcx
cocos2d::CCObject *v14; // rax
cocos2d::CCObject *v15; // rbx
cocos2d::CCObject *v16; // rcx
cocos2d::CCObject *v17; // rax
__int64 v18; // rdx
cocos2d::CCObject *v19; // rbx
cocos2d::CCObject *v20; // rcx
__int64 v21; // rbx
__int64 v22; // rax
__int64 v23; // rbx
__int64 v24; // rax
cocos2d::CCObject *v25; // rcx
cocos2d::CCObject *v26; // rcx
__int64 v27; // rdx
__int64 v28; // rdx
_BYTE *v29; // rax
size_t v30; // r8
__int64 v31; // rbx
void *v32; // r8
__int64 v33; // rax
__int64 v34; // rbx
__int64 v35; // rax
__int16 v37; // [rsp+30h] [rbp-88h] BYREF
char v38; // [rsp+32h] [rbp-86h]
_BYTE v39[8]; // [rsp+40h] [rbp-78h] BYREF
void *Block[2]; // [rsp+48h] [rbp-70h] BYREF
__m128i si128; // [rsp+58h] [rbp-60h]
if ( !cocos2d::extension::CCControl::init(this) )
return 0;
v6 = _RTDynamicCast(
a2,
0,
&cocos2d::CCNode `RTTI Type Descriptor',
&cocos2d::CCLabelProtocol `RTTI Type Descriptor',
0);
v7 = _RTDynamicCast(
a2,
0,
&cocos2d::CCNode `RTTI Type Descriptor',
&cocos2d::CCRGBAProtocol `RTTI Type Descriptor',
0);
*((_BYTE *)this + 525) = 1;
v8 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
v9 = v8;
if ( *((cocos2d::CCObject **)this + 66) != v8 )
{
if ( v8 )
cocos2d::CCObject::retain(v8);
v10 = *((cocos2d::CCObject **)this + 66);
if ( v10 )
cocos2d::CCObject::release(v10);
*((_QWORD *)this + 66) = v9;
}
v11 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
v12 = v11;
if ( *((cocos2d::CCObject **)this + 67) != v11 )
{
if ( v11 )
cocos2d::CCObject::retain(v11);
v13 = *((cocos2d::CCObject **)this + 67);
if ( v13 )
cocos2d::CCObject::release(v13);
*((_QWORD *)this + 67) = v12;
}
v14 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
v15 = v14;
if ( *((cocos2d::CCObject **)this + 68) != v14 )
{
if ( v14 )
cocos2d::CCObject::retain(v14);
v16 = *((cocos2d::CCObject **)this + 68);
if ( v16 )
cocos2d::CCObject::release(v16);
*((_QWORD *)this + 68) = v15;
}
v17 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
v19 = v17;
if ( *((cocos2d::CCObject **)this + 69) != v17 )
{
if ( v17 )
cocos2d::CCObject::retain(v17);
v20 = *((cocos2d::CCObject **)this + 69);
if ( v20 )
cocos2d::CCObject::release(v20);
*((_QWORD *)this + 69) = v19;
}
LOBYTE(v18) = 1;
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(*(_QWORD *)this + 920LL))(this, v18);
*((_BYTE *)this + 524) = 0;
*((_BYTE *)this + 512) = 1;
*((_QWORD *)this + 59) = 0;
*((_BYTE *)this + 483) = 1;
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 1080LL))(this);
v21 = *(_QWORD *)this;
v22 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)v39, (const struct cocos2d::CCSize *)&unk_18004A5E0);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(v21 + 1136))(this, v22);
*((_BYTE *)this + 512) = 1;
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, _QWORD))(*(_QWORD *)this + 432LL))(this, 0);
v23 = *(_QWORD *)this;
v24 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 0.5, 0.5);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(v23 + 288))(this, v24);
if ( *((struct cocos2d::CCNode **)this + 61) != a2 )
{
if ( a2 )
cocos2d::CCObject::retain(a2);
v25 = *((cocos2d::CCObject **)this + 61);
if ( v25 )
cocos2d::CCObject::release(v25);
*((_QWORD *)this + 61) = a2;
}
if ( *((struct cocos2d::extension::CCScale9Sprite **)this + 62) != a3 )
{
if ( a3 )
cocos2d::CCObject::retain(a3);
v26 = *((cocos2d::CCObject **)this + 62);
if ( v26 )
cocos2d::CCObject::release(v26);
*((_QWORD *)this + 62) = a3;
}
v37 = -1;
v38 = -1;
(**((void (__fastcall ***)(char *, __int16 *))this + 51))((char *)this + 408, &v37);
LOBYTE(v27) = -1;
(*(void (__fastcall **)(char *, __int64))(*((_QWORD *)this + 51) + 40LL))((char *)this + 408, v27);
LOBYTE(v28) = 1;
(*(void (__fastcall **)(char *, __int64))(*((_QWORD *)this + 51) + 48LL))((char *)this + 408, v28);
v29 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 8LL))(v6);
*(_OWORD *)Block = 0;
si128 = 0;
v30 = -1;
do
++v30;
while ( v29[v30] );
sub_180003520(Block, v29, v30);
v31 = cocos2d::CCString::create(Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v32 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v32 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v32 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v32);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_18002BCB0);
LOBYTE(Block[0]) = 0;
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64, __int64))(*(_QWORD *)this + 1216LL))(
this,
v31,
1);
v33 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 8LL))(v7);
v37 = *(_WORD *)v33;
v38 = *(_BYTE *)(v33 + 2);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int16 *, __int64))(*(_QWORD *)this + 1232LL))(
this,
&v37,
1);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, struct cocos2d::CCNode *, __int64))(*(_QWORD *)this + 1248LL))(
this,
a2,
1);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, struct cocos2d::extension::CCScale9Sprite *, __int64))(*(_QWORD *)this + 1312LL))(
this,
a3,
1);
v34 = *(_QWORD *)this;
v35 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 0.5, 0.5);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *, __int64))(v34 + 1168))(this, v35);
(*(void (__fastcall **)(cocos2d::extension::CCControlButton *))(*(_QWORD *)this + 1080LL))(this);
return 1;
}