//
// ButtonSprite::init from 0x3c2a64 to 0x3c2c56 (498 bytes)
//
// 1 xrefs:
// > ButtonSprite::create @ 0x3c2ca0
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:46:32 +0000
//
int __fastcall ButtonSprite::init(
ButtonSprite *this,
cocos2d::CCSprite *a2,
int a3,
int a4,
float a5,
float a6,
bool a7,
cocos2d::CCSprite *a8,
bool a9,
float a10)
{
int v14; // r7
int v15; // r3
const char *v16; // r1
int v17; // r0
int v18; // r8
void (__fastcall *v19)(int, _BYTE *); // r10
int v20; // r0
int v21; // r3
float *v22; // r0
float v23; // s17
float v24; // s17
int v25; // r5
void (__fastcall *v26)(int, _DWORD); // r8
int v27; // r0
int v28; // r5
void (__fastcall *v29)(int, _DWORD); // r8
float v30; // r0
float v31; // s15
int v33; // r5
void (__fastcall *v34)(int, _DWORD); // r8
float *v35; // r0
_BYTE v36[16]; // [sp+Ch] [bp-14h] BYREF
v14 = cocos2d::CCSprite::init(this);
if ( v14 )
{
*((_DWORD *)this + 135) = a2;
*((_DWORD *)this + 127) = 0;
*((float *)this + 130) = a6;
*((_BYTE *)this + 532) = a7;
*((float *)this + 128) = (float)a3;
*((float *)this + 131) = a10;
v15 = *(_DWORD *)this;
*((float *)this + 129) = (float)a4;
(*(void (__fastcall **)(ButtonSprite *, cocos2d::CCSprite *, int))(v15 + 232))(this, a2, 1);
if ( a9 )
{
v20 = cocos2d::CCSprite::create(a8, v16);
v21 = *(_DWORD *)this;
*((_DWORD *)this + 136) = v20;
(*(void (__fastcall **)(ButtonSprite *, int, _DWORD))(v21 + 232))(this, v20, 0);
}
else
{
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v36, 0.0, 0.0, 40.0, 40.0);
v17 = cocos2d::extension::CCScale9Sprite::create(a8, v36);
*((_DWORD *)this + 137) = v17;
v18 = v17;
v19 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v17 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v36, 16.0, 16.0);
v19(v18, v36);
(*(void (__fastcall **)(ButtonSprite *, _DWORD, _DWORD))(*(_DWORD *)this + 232))(this, *((_DWORD *)this + 137), 0);
}
if ( *((float *)this + 128) > 0.0 )
{
v22 = (float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135));
v23 = *((float *)this + 128);
if ( *v22 > v23 )
{
v33 = *((_DWORD *)this + 135);
v34 = *(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v33 + 80);
v35 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v33 + 164))(v33);
v34(v33, v23 / *v35);
}
}
if ( a5 > 0.0
&& *(float *)((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135)) + 4) > a5 )
{
v24 = a5
/ *(float *)((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135)) + 4);
if ( v24 < (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 84))(*((_DWORD *)this + 135)) )
{
v25 = *((_DWORD *)this + 135);
v26 = *(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v25 + 80);
v27 = (*(int (__fastcall **)(int))(*(_DWORD *)v25 + 164))(v25);
v26(v25, a5 / *(float *)(v27 + 4));
}
}
v28 = *((_DWORD *)this + 135);
v29 = *(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v28 + 80);
v30 = (*(float (__fastcall **)(int))(*(_DWORD *)v28 + 84))(v28);
v31 = *((float *)this + 130);
if ( v30 <= v31 )
{
v28 = *((_DWORD *)this + 135);
v31 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v28 + 84))(v28));
}
v29(v28, LODWORD(v31));
ButtonSprite::updateSpriteBGSize(this);
}
return v14;
}