//
// GJSmartBlockPreview::addChance from 0x1000093e4 to 0x100009534 (336 bytes)
//
// 2 xrefs:
// > BrowseSmartKeyLayer::init @ 0x100072e4c
// > BrowseSmartKeyLayer::updateChanceValues @ 0x100073a5c
//
// 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)
{
__n128 v6; // q0
__n128 v7; // q1
cocos2d::CCLabelBMFont *m_infoLabel; // x22
cocos2d::CCString *v9; // x0
const char *CString; // x0
std::string *v11; // x1
std::string v12; // [xsp+18h] [xbp-38h] BYREF
cocos2d::CCPoint v13; // 0:kr00_8.8
GJSmartBlockPreview::createInfoLabel(a1);
m_infoLabel = a1->m_infoLabel;
if ( a3 )
{
v6.n128_u32[0] = 1110704128;
v7.n128_u32[0] = -15.0;
v13 = sub_100022980(v6, v7);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *, float, float))m_infoLabel->setPosition)(
m_infoLabel,
&v12,
v13.x,
v13.y);
memset(&v12, 0, sizeof(v12));
if ( a2 )
{
v9 = (cocos2d::CCString *)sub_100268F4C("%i (%.1f%%)", a2, (float)((float)((float)a2 / (float)a3) * 100.0));
CString = cocos2d::CCString::getCString(v9);
std::string::assign(&v12, CString);
}
else
{
std::string::assign(&v12, "0");
}
if ( (v12.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v11 = &v12;
else
v11 = (std::string *)v12.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_infoLabel->setString)(a1->m_infoLabel, v11);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_infoLabel, 100.0, 0.8, 0.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))a1->m_infoLabel->setVisible)(a1->m_infoLabel, 1);
if ( SHIBYTE(v12.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v12.__r_.__value_.__l.__data_);
}
else
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))m_infoLabel->setVisible)(a1->m_infoLabel, 0);
}
}