//
// LevelInfoLayer::setupPlatformerStats from 0x7e9ee0 to 0x7ea3fc (1308 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::init @ 0x7ec4e8
// > ??> @ 0xadb78
//
// This function is hookable on this platform (idp: arm, 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 12:54:31 +0000
//
__int64 __fastcall LevelInfoLayer::setupPlatformerStats(LevelInfoLayer *this)
{
cocos2d::CCDirector *v2; // x0
GJGameLevel *v3; // x0
int v4; // w22
int NormalPercent; // w0
const char *v6; // x2
int v7; // w23
float v8; // s8
cocos2d::CCLabelBMFont *v9; // x0
cocos2d::CCLabelBMFont *v10; // x19
void (__fastcall *v11)(cocos2d::CCLabelBMFont *, __int64 *); // x24
GameToolbox *v12; // x0
const char *v14; // x1
__int64 v15; // x2
__int64 v16; // x3
__int64 v17; // x4
cocos2d::CCString *v18; // x0
char *v19; // x0
cocos2d::CCLabelBMFont *v20; // x1
cocos2d::CCString *v21; // x0
char *v22; // x0
size_t v23; // x3
unsigned __int64 v24; // x1
char *v25; // x25
char *v26; // x24
size_t v27; // x3
char v28; // w1
char v29; // w0
cocos2d::CCString *v30; // x0
cocos2d::CCDirector *CString; // x19
float v32; // s8
cocos2d::CCDirector *v33; // x0
float v34; // s0
long double v35; // q0
cocos2d::CCLabelBMFont *v36; // x0
cocos2d::CCLabelBMFont *v37; // x23
void (__fastcall *v38)(cocos2d::CCLabelBMFont *, __int64 *); // x20
__int64 v39; // x24
size_t v40; // [xsp+68h] [xbp+68h]
__int64 v41; // [xsp+78h] [xbp+78h] BYREF
_BYTE v42[8]; // [xsp+80h] [xbp+80h] BYREF
__int64 v43; // [xsp+88h] [xbp+88h] BYREF
__int64 v44[2]; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCLabelBMFont *v45; // [xsp+A0h] [xbp+A0h]
_QWORD v46[2]; // [xsp+A8h] [xbp+A8h] BYREF
void *v47; // [xsp+B8h] [xbp+B8h]
unsigned __int64 v48; // [xsp+C0h] [xbp+C0h] BYREF
size_t v49; // [xsp+C8h] [xbp+C8h]
void *v50; // [xsp+D0h] [xbp+D0h]
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(_stack_chk_guard);
cocos2d::CCDirector::getWinSize(&v41, v2);
v44[0] = 0;
v44[1] = 0;
v45 = nullptr;
std::string::__init(v44, "No Best Time", 0xCu);
v3 = *((GJGameLevel **)this + 63);
v4 = *((_DWORD *)v3 + 324);
NormalPercent = GJGameLevel::getNormalPercent(v3);
v7 = NormalPercent;
if ( NormalPercent > 0 && v4 <= 0 )
{
if ( NormalPercent <= 99 )
{
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%%",
(const char *)(unsigned int)NormalPercent);
CString = (cocos2d::CCDirector *)cocos2d::CCString::getCString(v30);
v32 = *(float *)&v41 * 0.5;
v33 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(CString);
cocos2d::CCDirector::getScreenBottom(v33);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, v32, v34 + 120.0);
LevelInfoLayer::addProgressBar(
(__int64)this,
(__int64)&v43,
v7,
(const char *)&elf_hash_bucket[16194],
(cocos2d::CCLabelBMFont *)"Best",
CString,
v35);
goto LABEL_8;
}
goto LABEL_4;
}
if ( v4 <= 0 )
{
LABEL_4:
v8 = -10.0;
goto LABEL_5;
}
v14 = (const char *)(unsigned int)(v4 / 1000 / 3600);
v15 = (unsigned int)(v4 / 1000 / 60 % 60);
v16 = (unsigned int)(v4 / 1000 % 60);
v17 = (unsigned int)(v4 % 1000);
if ( (unsigned int)v15 | (unsigned int)v14 )
{
if ( (_DWORD)v14 )
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%02d:%02d:%02d.%03d",
v14,
v15,
v16,
v17);
else
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%02d:%02d.%03d",
(const char *)(unsigned int)v15,
(unsigned int)v16,
(unsigned int)v17);
}
else
{
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i.%03d",
(const char *)(unsigned int)v16,
(unsigned int)v17);
}
v19 = (char *)cocos2d::CCString::getCString(v18);
std::string::assign(v44, v19);
v20 = (cocos2d::CCLabelBMFont *)((char *)v44 + 1);
if ( (v44[0] & 1) != 0 )
v20 = v45;
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Best Time: %s",
(const char *)v20);
v22 = (char *)cocos2d::CCString::getCString(v21);
std::string::assign(v44, v22);
v8 = 0.0;
LABEL_5:
v9 = (cocos2d::CCLabelBMFont *)((char *)v44 + 1);
if ( (v44[0] & 1) != 0 )
v9 = v45;
v10 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v9, "goldFont.fnt", v6);
(*(void (__fastcall **)(LevelInfoLayer *, cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)this + 464LL))(this, v10, 3);
v11 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64 *))(*(_QWORD *)v10 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, *(float *)&v41 * 0.5, v8 + 145.0);
v11(v10, &v43);
cocos2d::CCLabelBMFont::limitLabelWidth(v10, 200.0, 0.6, 0.0);
v12 = (GameToolbox *)*(unsigned int *)(*((_QWORD *)this + 63) + 1336LL);
if ( (_DWORD)v12 )
{
GameToolbox::pointsToString(v12, &v48);
if ( (v48 & 1) != 0 )
{
v23 = v49;
v24 = (v48 & 0xFFFFFFFFFFFFFFFELL) - 1;
if ( v24 - v49 > 0xC )
{
v25 = (char *)v50;
LABEL_21:
v26 = "Best Points: ";
if ( v23 )
{
if ( v25 <= "Best Points: " && &v25[v23] > "Best Points: " )
v26 = "";
v40 = v23;
memmove(v25 + 13, v25, v23);
v23 = v40;
}
v27 = v23 + 13;
*(_QWORD *)v25 = *(_QWORD *)v26;
v28 = v26[12];
v29 = v48;
*((_DWORD *)v25 + 2) = *((_DWORD *)v26 + 2);
v25[12] = v28;
if ( (v29 & 1) != 0 )
v49 = v27;
else
LOBYTE(v48) = 2 * v27;
v25[v27] = 0;
goto LABEL_32;
}
}
else
{
v23 = (unsigned __int8)v48 >> 1;
v24 = 22;
v25 = (char *)&v48 + 1;
if ( 22 - v23 > 0xC )
goto LABEL_21;
}
std::string::__grow_by_and_replace((__int64)&v48, v24, v23 + 13 - v24, v23, 0, 0, 0xDu, "Best Points: ");
LABEL_32:
v46[0] = v48;
if ( (v48 & 1) != 0 )
v36 = (cocos2d::CCLabelBMFont *)v50;
else
v36 = (cocos2d::CCLabelBMFont *)((char *)v46 + 1);
v46[1] = v49;
v47 = v50;
v37 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v36, "goldFont.fnt", (const char *)v46);
(*(void (__fastcall **)(LevelInfoLayer *, cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)this + 464LL))(
this,
v37,
3);
v38 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64 *))(*(_QWORD *)v37 + 184LL);
v39 = (*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)v10 + 192LL))(v10);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, 0.0, -28.0);
cocos2d::CCPoint::operator+(&v43, v39);
v38(v37, &v43);
cocos2d::CCLabelBMFont::limitLabelWidth(v37, 200.0, 0.6, 0.0);
if ( (v46[0] & 1) != 0 )
operator delete(v47);
}
LABEL_8:
if ( (v44[0] & 1) != 0 )
operator delete(v45);
return _stack_chk_guard;
}