//
// LevelInfoLayer::setupPlatformerStats from 0x10002783c to 0x100027b3c (768 bytes)
//
// 1 xrefs:
// > LevelInfoLayer::init @ 0x100024f04
//
// 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 LevelInfoLayer::setupPlatformerStats(LevelInfoLayer *a1)
{
cocos2d::CCDirector *v2; // x0
unsigned int m_bestTime; // w10
unsigned int v4; // w11
cocos2d::CCString *v5; // x0
int v6; // w8
const char *CString; // x0
std::string *v8; // x8
cocos2d::CCString *v9; // x0
const char *v10; // x0
unsigned __int32 v11; // s8
std::string *v12; // x0
cocos2d::CCLabelBMFont *v13; // x20
__n128 v14; // q0
__n128 v15; // q1
std::string *v16; // x0
__int128 v17; // q0
void **v18; // x0
cocos2d::CCLabelBMFont *v19; // x21
float32x2_t *v20; // x19
__n128 v21; // q0
__n128 v22; // q1
double v23; // d0
float32x2_t v24; // [xsp+20h] [xbp-90h] BYREF
std::string v25; // [xsp+28h] [xbp-88h] BYREF
void *__p[2]; // [xsp+40h] [xbp-70h] BYREF
signed __int64 v27; // [xsp+50h] [xbp-60h]
std::string v28; // [xsp+60h] [xbp-50h] BYREF
float v29; // [xsp+78h] [xbp-38h]
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v2);
sub_100009900(&v28, "No Best Time");
m_bestTime = a1->m_level->m_bestTime;
if ( (int)m_bestTime < 1 )
{
v6 = 1124532224;
}
else
{
v4 = (unsigned __int16)(m_bestTime / 0xEA60) % 0x3Cu;
if ( m_bestTime > 0x36EE7F || v4 )
{
if ( m_bestTime > 0x36EE7F )
v5 = (cocos2d::CCString *)sub_100268F4C(
"%02d:%02d:%02d.%03d",
m_bestTime / 0x36EE80,
v4,
m_bestTime / 0x3E8
- 60 * ((71582789 * (unsigned __int64)(m_bestTime / 0x3E8)) >> 32),
m_bestTime % 0x3E8);
else
v5 = (cocos2d::CCString *)sub_100268F4C(
"%02d:%02d.%03d",
(unsigned __int16)(m_bestTime / 0xEA60) % 0x3Cu,
m_bestTime / 0x3E8
- 60 * ((71582789 * (unsigned __int64)(m_bestTime / 0x3E8)) >> 32),
m_bestTime % 0x3E8);
}
else
{
v5 = (cocos2d::CCString *)sub_100268F4C(
"%i.%03d",
m_bestTime / 0x3E8 - 60 * ((71582789 * (unsigned __int64)(m_bestTime / 0x3E8)) >> 32),
m_bestTime % 0x3E8);
}
CString = cocos2d::CCString::getCString(v5);
std::string::assign(&v28, CString);
if ( (v28.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v8 = &v28;
else
v8 = (std::string *)v28.__r_.__value_.__r.__words[0];
v9 = (cocos2d::CCString *)sub_100268F4C("Best Time: %s", (const char *)v8);
v10 = cocos2d::CCString::getCString(v9);
std::string::assign(&v28, v10);
v6 = 1125187584;
}
v11 = v6;
if ( (v28.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v12 = &v28;
else
v12 = (std::string *)v28.__r_.__value_.__r.__words[0];
v13 = cocos2d::CCLabelBMFont::create_1((const char *)v12, "goldFont.fnt");
v14 = ((__n128 (__fastcall *)(LevelInfoLayer *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v13, 3);
v14.n128_f32[0] = v29 * 0.5;
v15.n128_u32[0] = v11;
sub_100022980(v14, v15, __p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v13->setPosition)(v13, __p);
cocos2d::CCLabelBMFont::limitLabelWidth(v13, 200.0, 0.6, 0.0);
if ( a1->m_level->m_bestPoints )
{
GameToolbox::pointsToString(&v25);
v16 = std::string::insert(&v25, 0, "Best Points: ");
v17 = *(_OWORD *)&v16->__r_.__value_.__l.__data_;
v27 = v16->__r_.__value_.__r.__words[2];
*(_OWORD *)__p = v17;
v16->__r_.__value_.__l.__size_ = 0;
v16->__r_.__value_.__r.__words[2] = 0;
v16->__r_.__value_.__r.__words[0] = 0;
if ( SHIBYTE(v25.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v25.__r_.__value_.__l.__data_);
if ( v27 >= 0 )
v18 = __p;
else
v18 = (void **)__p[0];
v19 = cocos2d::CCLabelBMFont::create_1((const char *)v18, "goldFont.fnt");
((void (__fastcall *)(LevelInfoLayer *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v19, 3);
v20 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v13->getPosition)(v13);
v21.n128_u32[0] = 0;
v22.n128_u32[0] = -28.0;
sub_100022980(v21, v22, &v24);
*(float32x2_t *)&v23 = sub_1000229DC(v20, &v24, (float32x2_t *)&v25);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *, double))v19->setPosition)(v19, &v25, v23);
cocos2d::CCLabelBMFont::limitLabelWidth(v19, 200.0, 0.6, 0.0);
if ( SHIBYTE(v27) < 0 )
operator delete(__p[0]);
}
if ( SHIBYTE(v28.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v28.__r_.__value_.__l.__data_);
}