//
// GJSmartBlockPreview::addChance from 0x100429530 to 0x1004296ce (414 bytes)
//
// 2 xrefs:
// > BrowseSmartKeyLayer::init @ 0x1004eb166
// > BrowseSmartKeyLayer::updateChanceValues @ 0x1004ebf14
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GJSmartBlockPreview::addChance(GJSmartBlockPreview *a1, int a2, int a3)
{
cocos2d::CCLabelBMFont *m_infoLabel; // r12
double v6; // xmm0_8
cocos2d::CCString *v7; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v9; // rax
cocos2d::CCLabelBMFont *v10; // rdi
std::string::pointer data; // rsi
std::string v12; // [rsp+0h] [rbp-40h] BYREF
if ( !a1->m_infoLabel )
{
v9 = cocos2d::CCLabelBMFont::create_3(" ", "bigFont.fnt");
a1->m_infoLabel = v9;
((void (__fastcall *)(GJSmartBlockPreview *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v9);
m_infoLabel = a1->m_infoLabel;
if ( a3 )
goto LABEL_3;
LABEL_6:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))m_infoLabel->setVisible)(m_infoLabel, 0);
return;
}
m_infoLabel = a1->m_infoLabel;
if ( !a3 )
goto LABEL_6;
LABEL_3:
sub_10028CBE0((float *)&v12, 45.0, -15.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))m_infoLabel->setPosition)(m_infoLabel, &v12);
v6 = 0.0;
memset(&v12, 0, sizeof(v12));
if ( a2 )
{
v6 = (float)((float)((float)a2 / (float)a3) * 100.0);
v7 = (cocos2d::CCString *)sub_1007AB580("%i (%.1f%%)", *(_BYTE *)&v12.__r_.__value_.__l.0);
CString = cocos2d::CCString::getCString(v7);
std::string::assign(&v12, CString);
}
else
{
std::string::assign(&v12, "0");
}
v10 = a1->m_infoLabel;
if ( (*(_BYTE *)&v12.__r_.__value_.__s.0 & 1) != 0 )
data = v12.__r_.__value_.__l.__data_;
else
data = v12.__r_.__value_.__s.__data_;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer, double))v10->setString)(v10, data, v6);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_infoLabel, 100.0, 0.80000001, 0.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))a1->m_infoLabel->setVisible)(a1->m_infoLabel, 1);
if ( (*(_BYTE *)&v12.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v12.__r_.__value_.__l.__data_);
}