//
// GJSmartBlockPreview::addChance from 0x1403bccf0 to 0x1403bceea (506 bytes)
//
// 3 xrefs:
// > BrowseSmartKeyLayer::init @ 0x1405f13e9
// > BrowseSmartKeyLayer::updateChanceValues @ 0x1405f205a
// > ??> @ 0x140923e4c
//
// 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 11:31:27 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall GJSmartBlockPreview::addChance(cocos2d::CCLabelBMFont **a1, int a2, int a3)
{
struct cocos2d::CCLabelBMFont *v6; // rax
cocos2d::CCLabelBMFont *v7; // rsi
__int64 v8; // rbx
__int64 v9; // rax
unsigned __int64 v10; // rax
cocos2d::CCString *v11; // rax
char *CString; // rax
size_t v13; // r8
void **v14; // rdx
__int64 v15; // rdx
void *v16; // rcx
_BYTE v17[8]; // [rsp+30h] [rbp-58h] BYREF
void *Block[2]; // [rsp+38h] [rbp-50h] BYREF
__int64 v19; // [rsp+48h] [rbp-40h]
unsigned __int64 v20; // [rsp+50h] [rbp-38h]
if ( !a1[44] )
{
v6 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_140704F78);
a1[44] = v6;
(*((void (__fastcall **)(cocos2d::CCLabelBMFont **, struct cocos2d::CCLabelBMFont *))*a1 + 58))(a1, v6);
}
v7 = a1[44];
if ( a3 )
{
v8 = *(_QWORD *)v7;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, 45.0, -15.0);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64))(v8 + 184))(v7, v9);
*(_OWORD *)Block = 0;
v19 = 0;
v10 = 15;
v20 = 15;
LOBYTE(Block[0]) = 0;
if ( a2 )
{
v11 = cocos2d::CCString::createWithFormat(
"%i (%.1f%%)",
(unsigned int)a2,
(float)((float)((float)a2 / (float)a3) * 100.0));
CString = (char *)cocos2d::CCString::getCString(v11);
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_1400405A0(Block, CString, v13);
v10 = v20;
}
else
{
v19 = 1;
LOWORD(Block[0]) = 48;
}
v14 = Block;
if ( v10 > 0xF )
v14 = (void **)Block[0];
(**((void (__fastcall ***)(__int64, void **))a1[44] + 45))((__int64)a1[44] + 360, v14);
cocos2d::CCLabelBMFont::limitLabelWidth(a1[44], 100.0, 0.80000001, 0.0);
LOBYTE(v15) = 1;
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)a1[44] + 336LL))(a1[44], v15);
if ( v20 > 0xF )
{
v16 = Block[0];
if ( v20 + 1 >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
}
else
{
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, _QWORD))(*(_QWORD *)v7 + 336LL))(a1[44], 0);
}
}