//
// GJSmartBlockPreview::addChance from 0xb0ffdc to 0xb10184 (424 bytes)
//
// 3 xrefs:
// > BrowseSmartKeyLayer::updateChanceValues @ 0xb164d8
// > BrowseSmartKeyLayer::init @ 0xb1818c
// > ??> @ 0x70300
//
// This function is hookable on this platform (idp: arm, 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 13:01:28 +0000
//
__int64 __fastcall GJSmartBlockPreview::addChance(GJSmartBlockPreview *this, int a2, const char *a3)
{
int v5; // w21
__int64 v6; // x24
void (__fastcall *v7)(__int64, _BYTE *); // x25
cocos2d::CCString *v8; // x0
char *CString; // x0
_BYTE v11[8]; // [xsp+68h] [xbp+68h] BYREF
__int64 v12[2]; // [xsp+70h] [xbp+70h] BYREF
void *v13; // [xsp+80h] [xbp+80h]
v5 = (int)a3;
GJSmartBlockPreview::createInfoLabel((__int64 *)this, _stack_chk_guard, a3);
if ( v5 )
{
v6 = *((_QWORD *)this + 43);
v7 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v6 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v11, 45.0, -15.0);
v7(v6, v11);
v12[0] = 0;
v12[1] = 0;
v13 = nullptr;
if ( a2 )
{
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i (%.1f%%)",
(const char *)(unsigned int)a2,
(float)((float)((float)a2 / (float)v5) * 100.0));
CString = (char *)cocos2d::CCString::getCString(v8);
std::string::assign(v12, CString);
}
else
{
std::string::assign(v12, "0");
}
(*(void (**)(void))(**((_QWORD **)this + 43) + 928LL))();
cocos2d::CCLabelBMFont::limitLabelWidth(*((cocos2d::CCLabelBMFont **)this + 43), 100.0, 0.8, 0.0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 43) + 344LL))(*((_QWORD *)this + 43), 1);
if ( (v12[0] & 1) != 0 )
operator delete(v13);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 43) + 344LL))(*((_QWORD *)this + 43), 0);
}
return _stack_chk_guard;
}