//
// GJSmartBlockPreview::addChance from 0x9d63c0 to 0x9d65a8 (488 bytes)
//
// 3 xrefs:
// > BrowseSmartKeyLayer::init @ 0x9e0a48
// > BrowseSmartKeyLayer::updateChanceValues @ 0x9e1c18
// > ??> @ 0x50760
//
// 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 GJSmartBlockPreview::addChance(GJSmartBlockPreview *a1, int a2, int a3)
{
cocos2d::CCLabelBMFont *m_infoLabel; // x25
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCString *v8; // x0
size_t v9; // x0
__n128 v10; // q0
char *v11; // x0
unsigned int *v12; // x20
int v13; // w1
const char *CString; // [xsp+58h] [xbp+58h]
char *v15; // [xsp+70h] [xbp+70h] BYREF
GJSmartBlockPreview::createInfoLabel(a1);
if ( a3 )
{
m_infoLabel = a1->m_infoLabel;
setPosition = m_infoLabel->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v15, 45.0, -15.0);
setPosition(m_infoLabel, (const cocos2d::CCPoint *)&v15);
v15 = &byte_124B6C8;
if ( a2 )
{
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i (%.1f%%)",
(const char *)(unsigned int)a2,
(float)((float)((float)a2 / (float)a3) * 100.0));
CString = cocos2d::CCString::getCString(v8);
v9 = strlen(CString);
v10 = sub_D1798C(&v15, CString, v9);
}
else
{
v10 = sub_D1798C(&v15, "0", 1);
}
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *, long double))a1->m_infoLabel->setString)(
a1->m_infoLabel,
v15,
*(long double *)&v10);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_infoLabel, 100.0, 0.8, 0.0);
a1->m_infoLabel->setVisible(a1->m_infoLabel, 1);
v11 = v15 - 24;
if ( v15 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v15 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)v15 - 2);
*((_DWORD *)v15 - 2) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v11);
}
}
else
{
a1->m_infoLabel->setVisible(a1->m_infoLabel, 0);
}
}