//
// LevelInfoLayer::setupPlatformerStats from 0x14041f3a0 to 0x14041f819 (1145 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::init @ 0x14041cde9
// > ??> @ 0x1409267b0
//
// This function is hookable on this platform (idp: pc, 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 11:32:08 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall LevelInfoLayer::setupPlatformerStats(_QWORD *a1)
{
__int64 v2; // rax
float v3; // xmm6_4
_DWORD *v4; // rax
int v5; // r9d
int v6; // edi
cocos2d::CCString *v7; // rax
const char *v8; // rbx
cocos2d::CCDirector *v9; // rax
float ScreenBottom; // xmm0_4
int v11; // eax
int v12; // r8d
int v13; // r9d
int v14; // r11d
int v15; // r10d
cocos2d::CCString *v16; // rax
char *CString; // rax
size_t v18; // rbx
size_t v19; // r8
void **v20; // rdx
cocos2d::CCString *v21; // rax
char *v22; // rax
void **v23; // rcx
struct cocos2d::CCLabelBMFont *v24; // r14
__int64 v25; // rbx
__int64 v26; // rax
signed int v27; // edx
__m128i *v28; // rax
__int64 v29; // rax
const char *v30; // rcx
cocos2d::CCLabelBMFont *v31; // rdi
__int64 v32; // rax
__int64 v33; // rbx
__int64 v34; // rax
void *v35; // rcx
__int16 v36; // [rsp+38h] [rbp-59h] BYREF
char v37; // [rsp+3Ah] [rbp-57h]
float v38; // [rsp+48h] [rbp-49h] BYREF
_BYTE v39[8]; // [rsp+50h] [rbp-41h] BYREF
void *Block[2]; // [rsp+58h] [rbp-39h] BYREF
__m128i si128; // [rsp+68h] [rbp-29h]
__int128 v42; // [rsp+78h] [rbp-19h] BYREF
__int128 v43; // [rsp+88h] [rbp-9h]
__m128i v44[2]; // [rsp+98h] [rbp+7h] BYREF
v2 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2, &v38);
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365D0);
strcpy((char *)Block, "No Best Time");
BYTE5(Block[1]) = 0;
HIWORD(Block[1]) = 0;
v3 = 0.0;
v4 = (_DWORD *)a1[63];
v5 = v4[354];
v6 = v4[233] - v4[232];
if ( v5 > 0 )
{
v12 = v5 / 1000;
v13 = v5 % 1000;
v14 = v12 % 60;
v15 = v12 / 60 % 60;
if ( v12 / 3600 )
{
v16 = cocos2d::CCString::createWithFormat("%02d:%02d:%02d.%03d", v12 / 3600, v15, v14, v13);
}
else if ( v15 )
{
v16 = cocos2d::CCString::createWithFormat("%02d:%02d.%03d", v15, v14, v13);
}
else
{
v16 = cocos2d::CCString::createWithFormat("%i.%03d", v14, v13);
}
CString = (char *)cocos2d::CCString::getCString(v16);
v18 = -1;
v19 = -1;
do
++v19;
while ( CString[v19] );
sub_1400405A0(Block, CString, v19);
v20 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v20 = (void **)Block[0];
v21 = cocos2d::CCString::createWithFormat("Best Time: %s", (const char *)v20);
v22 = (char *)cocos2d::CCString::getCString(v21);
do
++v18;
while ( v22[v18] );
sub_1400405A0(Block, v22, v18);
}
else
{
if ( (unsigned int)(v6 - 1) <= 0x62 )
{
v7 = cocos2d::CCString::createWithFormat("%i%%", v6);
v8 = cocos2d::CCString::getCString(v7);
v36 = -256;
v37 = 0;
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(0);
ScreenBottom = cocos2d::CCDirector::getScreenBottom(v9);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v38 * 0.5, ScreenBottom + 120.0);
LevelInfoLayer::addProgressBar((_DWORD)a1, v11, v6, (unsigned int)&v36, (__int64)"Best", (__int64)v8);
goto LABEL_23;
}
v3 = -10.0;
}
v23 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v23 = (void **)Block[0];
v24 = cocos2d::CCLabelBMFont::create((const char *)v23, "goldFont.fnt");
(*(void (__fastcall **)(_QWORD *, struct cocos2d::CCLabelBMFont *, __int64))(*a1 + 456LL))(a1, v24, 3);
v25 = *(_QWORD *)v24;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v38 * 0.5, v3 + 145.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v25 + 184))(v24, v26);
cocos2d::CCLabelBMFont::limitLabelWidth(v24, 200.0, 0.60000002, 0.0);
v27 = *(_DWORD *)(a1[63] + 1464LL);
if ( v27 )
{
v28 = GameToolbox::pointsToString(v44, v27);
v29 = sub_140059D70(v28, 0, "Best Points: ", 0xDu);
v42 = 0;
v43 = 0;
v42 = *(_OWORD *)v29;
v43 = *(_OWORD *)(v29 + 16);
*(_QWORD *)(v29 + 16) = 0;
*(_QWORD *)(v29 + 24) = 15;
*(_BYTE *)v29 = 0;
sub_14003D310((__int64)v44);
v30 = (const char *)&v42;
if ( *((_QWORD *)&v43 + 1) > 0xFu )
v30 = (const char *)v42;
v31 = cocos2d::CCLabelBMFont::create(v30, "goldFont.fnt");
(*(void (__fastcall **)(_QWORD *, cocos2d::CCLabelBMFont *, __int64))(*a1 + 456LL))(a1, v31, 3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 0.0, -28.0);
v33 = v32;
v34 = (*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v24 + 200LL))(v24);
cocos2d::CCPoint::operator+(v34, &v36, v33);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int16 *))(*(_QWORD *)v31 + 184LL))(v31, &v36);
cocos2d::CCLabelBMFont::limitLabelWidth(v31, 200.0, 0.60000002, 0.0);
sub_14003D310((__int64)&v42);
}
LABEL_23:
if ( si128.m128i_i64[1] > 0xFuLL )
{
v35 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v35 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v35 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v35);
}
}