//
// ButtonSprite::updateSpriteBGSize from 0x3c2754 to 0x3c2a52 (766 bytes)
//
// 3 xrefs:
// > ButtonSprite::init @ 0x3c2c16
// > ButtonSprite::updateSpriteOffset @ 0x3c2d20
// > ButtonSprite::updateBGImage @ 0x3c315c
//
// 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
//
void *__fastcall ButtonSprite::updateSpriteBGSize(ButtonSprite *this)
{
float v2; // s17
float v3; // s17
float v4; // s16
float v5; // s17
float v6; // s18
float v7; // s19
float v8; // s18
float v9; // s14
int v10; // r7
void (__fastcall *v11)(int, _BYTE *); // r10
float v12; // r2
float v13; // r7
int v14; // r0
_BYTE *v15; // r1
int v16; // r0
int v17; // r6
void (__fastcall *v18)(int, _BYTE *); // r7
float v19; // s17
float v20; // s17
float v21; // s18
int v22; // r6
void (__fastcall *v23)(int, _BYTE *); // r7
float v24; // s17
int v25; // r0
void *result; // r0
int v27; // r6
void (__fastcall *v28)(int, int); // r7
int v29; // r0
int (__fastcall *v30)(ButtonSprite *, _BYTE *); // r6
float v31; // s17
int v32; // r0
_BYTE v33[8]; // [sp+Ch] [bp-34h] BYREF
float v34[2]; // [sp+14h] [bp-2Ch] BYREF
_BYTE v35[4]; // [sp+1Ch] [bp-24h] BYREF
float v36; // [sp+20h] [bp-20h]
float v37; // [sp+28h] [bp-18h]
_BYTE v38[12]; // [sp+2Ch] [bp-14h] BYREF
float v39; // [sp+38h] [bp-8h]
if ( *((_BYTE *)this + 532) )
{
v2 = *((float *)this + 128);
}
else
{
v3 = *((float *)this + 129);
v4 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135));
if ( v3 >= (float)(v4 * (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 84))(*((_DWORD *)this + 135))) )
{
v2 = *((float *)this + 129);
}
else
{
v5 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135));
v2 = v5 * (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 84))(*((_DWORD *)this + 135));
}
}
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v33);
if ( *((_DWORD *)this + 137) )
{
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v35, 0.0, 0.0, 40.0, 40.0);
v6 = v37;
v7 = *(float *)((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135)) + 4);
if ( v6 >= (float)((float)(v7
* (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 84))(*((_DWORD *)this + 135)))
+ 8.0) )
{
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v38, 0.0, 0.0, 40.0, 40.0);
v9 = v39;
}
else
{
v8 = *(float *)((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 164))(*((_DWORD *)this + 135)) + 4);
v9 = (float)(v8 * (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 135) + 84))(*((_DWORD *)this + 135)))
+ 8.0;
}
v10 = *((_DWORD *)this + 137);
v11 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v10 + 160);
if ( *((float *)this + 131) == 0.0 )
v12 = v9;
else
v12 = *((float *)this + 131);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v38, v2 + 8.0, v12);
v11(v10, v38);
v13 = *(float *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 137) + 164))(*((_DWORD *)this + 137));
v14 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 137) + 164))(*((_DWORD *)this + 137));
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v38, v13, *(float *)(v14 + 4));
v15 = v38;
goto LABEL_16;
}
v16 = *((_DWORD *)this + 136);
if ( v16 )
{
v15 = (_BYTE *)(*(int (__fastcall **)(int))(*(_DWORD *)v16 + 164))(v16);
LABEL_16:
cocos2d::CCSize::operator=(v33, v15);
}
(*(void (__fastcall **)(ButtonSprite *, _BYTE *))(*(_DWORD *)this + 160))(this, v33);
v17 = *((_DWORD *)this + 135);
v18 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v17 + 92);
v19 = *(float *)(*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v34, 0.0, 2.0);
v20 = (float)((float)(v19 * 0.5) + v34[0]) + *((float *)this + 140);
v21 = *(float *)((*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this) + 4);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35, 0.0, 2.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v20, (float)((float)(v21 * 0.5) + v36) + *((float *)this + 141));
v18(v17, v38);
v22 = *((_DWORD *)this + 137);
if ( v22 || (v22 = *((_DWORD *)this + 136)) != 0 )
{
v23 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v22 + 92);
v24 = *(float *)(*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this);
v25 = (*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v24 * 0.5, *(float *)(v25 + 4) * 0.5);
v23(v22, v38);
}
result = (void *)(*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 256))(this);
if ( result )
{
result = (void *)(*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 256))(this);
if ( result )
{
result = _dynamic_cast(
result,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'CCMenuItemSpriteExtra,
0);
if ( result )
{
v27 = (*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 256))(this);
v28 = *(void (__fastcall **)(int, int))(*(_DWORD *)v27 + 160);
v29 = (*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this);
v28(v27, v29);
v30 = *(int (__fastcall **)(ButtonSprite *, _BYTE *))(*(_DWORD *)this + 92);
v31 = *(float *)(*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this);
v32 = (*(int (__fastcall **)(ButtonSprite *))(*(_DWORD *)this + 164))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v31 * 0.5, *(float *)(v32 + 4) * 0.5);
return (void *)v30(this, v38);
}
}
}
return result;
}