//
// ClearPlatformerSavesPopup::updateStats from 0x1400a3970 to 0x1400a3e92 (1314 bytes)
//
// 4 xrefs:
// > ClearPlatformerSavesPopup::init @ 0x1400a3941
// > ClearPlatformerSavesPopup::onIncludeFavoritesToggle @ 0x1400a3eb0
// > ClearPlatformerSavesPopup::FLAlert_Clicked @ 0x1400a42e6
// > ??> @ 0x140913130
//
// 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:26:07 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall ClearPlatformerSavesPopup::updateStats(__int64 a1)
{
char v2; // bl
cocos2d::CCString *v3; // rax
const char *CString; // rax
size_t v5; // rbx
size_t v6; // r8
cocos2d::CCString *v7; // rax
float v8; // xmm0_4
cocos2d::CCString *v9; // rax
void **v10; // r9
const char *v11; // r8
cocos2d::CCString *v12; // rax
const char *v13; // rdi
void *v14; // r8
cocos2d::CCString *v15; // rax
const char *v16; // rax
cocos2d::CCString *v17; // rax
float v18; // xmm0_4
cocos2d::CCString *v19; // rax
void **v20; // rdx
void (__fastcall **v21)(__int64, const char *); // rdi
__int64 v22; // rbx
cocos2d::CCString *v23; // rax
const char *v24; // rax
void *v25; // rcx
int v26; // [rsp+30h] [rbp-50h] BYREF
int v27; // [rsp+34h] [rbp-4Ch] BYREF
size_t v28; // [rsp+38h] [rbp-48h] BYREF
size_t v29; // [rsp+40h] [rbp-40h] BYREF
void *Block[2]; // [rsp+50h] [rbp-30h] BYREF
__int64 v31; // [rsp+60h] [rbp-20h]
unsigned __int64 v32; // [rsp+68h] [rbp-18h]
v26 = 0;
v28 = 0;
v2 = *(_BYTE *)(a1 + 672);
if ( !*(_QWORD *)&qword_14090BFB0 )
{
Block[0] = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(Block[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
v26 = 0;
v28 = 0;
Block[0] = &v26;
Block[1] = &v28;
sub_1402742B0(v2 != 0, Block);
if ( v28 >= 0x400 )
{
if ( v28 >= 0x100000 )
{
if ( (v28 & 0x8000000000000000uLL) != 0LL )
v8 = (float)(int)(v28 & 1 | (v28 >> 1)) + (float)(int)(v28 & 1 | (v28 >> 1));
else
v8 = (float)(int)v28;
v9 = cocos2d::CCString::createWithFormat("%.2f MB", (float)(v8 * 0.00000095367432));
CString = cocos2d::CCString::getCString(v9);
*(_OWORD *)Block = 0;
v31 = 0;
v32 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( CString[v6] );
}
else
{
v7 = cocos2d::CCString::createWithFormat("%.1f KB", (float)((float)(int)v28 * 0.0009765625));
CString = cocos2d::CCString::getCString(v7);
*(_OWORD *)Block = 0;
v31 = 0;
v32 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( CString[v6] );
}
}
else
{
v3 = cocos2d::CCString::createWithFormat("%zu B", v28);
CString = cocos2d::CCString::getCString(v3);
*(_OWORD *)Block = 0;
v31 = 0;
v32 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( CString[v6] );
}
sub_14003D230(Block, CString, v6);
v10 = Block;
if ( v32 > 0xF )
v10 = (void **)Block[0];
v11 = (const char *)&unk_14070D03C;
if ( v26 == 1 )
v11 = &byte_1406ED6E0;
v12 = cocos2d::CCString::createWithFormat("%i save%s - %s", v26, v11, (const char *)v10);
v13 = cocos2d::CCString::getCString(v12);
if ( v32 > 0xF )
{
v14 = Block[0];
if ( v32 + 1 >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
v31 = 0;
v32 = 15;
LOBYTE(Block[0]) = 0;
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 688) + 360LL))(*(_QWORD *)(a1 + 688) + 360LL, v13);
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(a1 + 688), 280.0, 0.60000002, 0.30000001);
v27 = 0;
v29 = 0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
Block[0] = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(Block[0]);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
v27 = 0;
v29 = 0;
Block[0] = &v27;
Block[1] = &v29;
sub_1402742B0(2, Block);
if ( v29 >= 0x400 )
{
if ( v29 >= 0x100000 )
{
if ( (v29 & 0x8000000000000000uLL) != 0LL )
v18 = (float)(int)(v29 & 1 | (v29 >> 1)) + (float)(int)(v29 & 1 | (v29 >> 1));
else
v18 = (float)(int)v29;
v19 = cocos2d::CCString::createWithFormat("%.2f MB", (float)(v18 * 0.00000095367432));
v16 = cocos2d::CCString::getCString(v19);
*(_OWORD *)Block = 0;
v31 = 0;
v32 = 0;
do
++v5;
while ( v16[v5] );
}
else
{
v17 = cocos2d::CCString::createWithFormat("%.1f KB", (float)((float)(int)v29 * 0.0009765625));
v16 = cocos2d::CCString::getCString(v17);
*(_OWORD *)Block = 0;
v31 = 0;
v32 = 0;
do
++v5;
while ( v16[v5] );
}
}
else
{
v15 = cocos2d::CCString::createWithFormat("%zu B", v29);
v16 = cocos2d::CCString::getCString(v15);
*(_OWORD *)Block = 0;
v31 = 0;
v32 = 0;
do
++v5;
while ( v16[v5] );
}
sub_14003D230(Block, v16, v5);
v20 = Block;
if ( v32 > 0xF )
v20 = (void **)Block[0];
v21 = *(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 696) + 360LL);
v22 = *(_QWORD *)(a1 + 696);
v23 = cocos2d::CCString::createWithFormat("Favorites: %s", (const char *)v20);
v24 = cocos2d::CCString::getCString(v23);
(*v21)(v22 + 360, v24);
if ( v32 > 0xF )
{
v25 = Block[0];
if ( v32 + 1 >= 0x1000 )
{
v25 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v25 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v25);
}
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(a1 + 696), 280.0, 0.40000001, 0.30000001);
}