//
// ClearPlatformerSavesPopup::init from 0x1400a31f0 to 0x1400a396e (1918 bytes)
//
// 5 xrefs:
// > GameSettingsLayer::onCustomButton @ 0x1402c7dc0
// > GameSettingsLayer::onCustomButton @ 0x1402c7dc7
// > GameSettingsLayer::onCustomButton @ 0x1402c7db1
// > ??> @ 0x14071d7a8
// > ??> @ 0x140913124
//
// 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=2
bool __fastcall ClearPlatformerSavesPopup::init(__int64 a1)
{
bool result; // al
__int64 v3; // rcx
__int64 v4; // rax
__int64 v5; // rax
__int64 *v6; // rdi
__int64 v7; // rbx
__int64 v8; // rax
__int64 v9; // rbx
__int64 v10; // rax
struct cocos2d::CCLabelBMFont *v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
struct cocos2d::CCLabelBMFont *v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
struct cocos2d::CCLabelBMFont *v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
struct cocos2d::CCLabelBMFont *v20; // rdi
__int64 v21; // rbx
__int64 v22; // rax
struct cocos2d::CCLabelBMFont *v23; // rdi
__int64 v24; // rbx
__int64 v25; // rax
__int64 v26; // rax
int v27; // eax
cocos2d::CCObject *v28; // rsi
__int64 v29; // rdi
__int64 v30; // rbx
__int64 v31; // rax
__int64 v32; // rax
struct cocos2d::CCSprite *v33; // rax
cocos2d::CCObject *v34; // rsi
__int64 v35; // rdi
__int64 v36; // rbx
__int64 v37; // rax
__int64 v38; // rax
__int64 v39; // rdi
__int64 v40; // rsi
float *v41; // rax
float *v42; // rbx
__int64 v43; // rax
cocos2d::CCMenuItem *ToggleButton; // rax
cocos2d::CCObject *v45; // rbx
cocos2d::CCObject *v46; // rsi
__int64 v47; // rdi
__int64 v48; // rbx
__int64 v49; // rax
__int64 v50; // rax
_BYTE v51[8]; // [rsp+88h] [rbp-39h] BYREF
_BYTE v52[16]; // [rsp+90h] [rbp-31h] BYREF
char v53[16]; // [rsp+A0h] [rbp-21h] BYREF
__int64 v54; // [rsp+B0h] [rbp-11h]
__int64 v55; // [rsp+B8h] [rbp-9h]
float v56; // [rsp+130h] [rbp+6Fh] BYREF
float v57; // [rsp+134h] [rbp+73h]
char v58; // [rsp+138h] [rbp+77h] BYREF
char *v59; // [rsp+140h] [rbp+7Fh] BYREF
result = FLAlertLayer::init_1(a1, 75);
if ( result )
{
*(_BYTE *)(a1 + 596) = 1;
v4 = cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v4, &v56);
*(_DWORD *)(a1 + 648) = 1135869952;
*(_DWORD *)(a1 + 652) = 1132920832;
v5 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v52, 0.0, 0.0, 80.0, 80.0);
v6 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v5);
v7 = *v6;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v59, 360.0, 270.0);
(*(void (__fastcall **)(__int64 *, __int64))(v7 + 312))(v6, v8);
v9 = *v6;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, v57 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v9 + 184))(v6, v10);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v6,
0xFFFFFFFFLL);
v11 = cocos2d::CCLabelBMFont::create("Clear Platformer Saves", (const char *)&qword_140704F78);
v12 = *(_QWORD *)v11;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, (float)((float)(v57 * 0.5) + 135.0) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v12 + 184))(v11, v13);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v11 + 160LL))(v11);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v11);
v14 = cocos2d::CCLabelBMFont::create("Clears the saved checkpoint on all platformer levels.", "goldFont.fnt");
v15 = *(_QWORD *)v14;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, (float)(v57 * 0.5) + 80.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v15 + 184))(v14, v16);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v14 + 160LL))(v14);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v14);
v17 = cocos2d::CCLabelBMFont::create("Stats and best runs are kept.", "goldFont.fnt");
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, (float)(v57 * 0.5) + 62.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v18 + 184))(v17, v19);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v17 + 160LL))(v17);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v17);
v20 = cocos2d::CCLabelBMFont::create(&byte_1406ED6E0, (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 688) = v20;
v21 = *(_QWORD *)v20;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, (float)(v57 * 0.5) + 22.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v21 + 184))(v20, v22);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 688) + 160LL))(*(_QWORD *)(a1 + 688));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 688));
v23 = cocos2d::CCLabelBMFont::create(&byte_1406ED6E0, (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 696) = v23;
v24 = *(_QWORD *)v23;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, (float)(v57 * 0.5) - 8.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v24 + 184))(v23, v25);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 696) + 160LL))(*(_QWORD *)(a1 + 696));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 696));
v26 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v26;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v26, 10);
v27 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v28 = CCMenuItemSpriteExtra::create(v27, 0, a1, (__int64)PagedListPopup::onClose);
*((_DWORD *)v28 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v28);
v29 = *(_QWORD *)v28;
v30 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v59,
(float)((float)(v56 * 0.5) - 180.0) + 5.0,
(float)((float)(v57 * 0.5) + 135.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(v30, v51, v31);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v29 + 184))(v28, v32);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsBtn02_001.png");
LODWORD(v30) = (_DWORD)v33;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v33 + 160LL))(v33);
v34 = CCMenuItemSpriteExtra::create(v30, 0, a1, (__int64)ClearPlatformerSavesPopup::onOptions);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v34);
v35 = *(_QWORD *)v34;
v36 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v59,
(float)((float)(v56 * 0.5) + 180.0) - 20.0,
(float)((float)(v57 * 0.5) + 135.0) - 20.0);
cocos2d::CCNode::convertToNodeSpace(v36, v51, v37);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v35 + 184))(v34, v38);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, (float)(v56 * 0.5) - 68.0, (float)(v57 * 0.5) - 56.0);
v59 = v53;
v54 = 15;
v55 = 15;
strcpy(v53, "Clear Favorites");
v39 = *(_QWORD *)(a1 + 584);
v40 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, 8.0, 0.0);
v42 = v41;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, (const struct cocos2d::CCPoint *)&v58);
ToggleButton = GameToolbox::createToggleButton(
v53,
(__int64)ClearPlatformerSavesPopup::onIncludeFavoritesToggle,
0,
v40,
v43,
a1,
v39,
0.80000001,
0.5,
130.0,
v42,
(const char *)&qword_140704F78,
0,
0,
nullptr);
*(_QWORD *)(a1 + 680) = ToggleButton;
*(_DWORD *)(*((_QWORD *)ToggleButton + 47) + 372LL) = 1065353216;
*(_DWORD *)(*((_QWORD *)ToggleButton + 48) + 372LL) = 1065353216;
CCMenuItemToggler::toggle((__int64)ToggleButton, *((unsigned __int8 *)ToggleButton + 392));
v59 = (char *)operator new(0x2C8u);
v45 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v59);
if ( v45 )
{
if ( ButtonSprite::init_1(
(__int64)v45,
(__int64)"Delete",
60,
0,
1058642330,
0,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v45);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v45 + 8LL))(v45, 1);
LODWORD(v45) = 0;
}
}
v46 = CCMenuItemSpriteExtra::create((int)v45, 0, a1, (__int64)ClearPlatformerSavesPopup::onDelete);
*((_DWORD *)v46 + 93) = 1067030938;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v46);
v47 = *(_QWORD *)v46;
v48 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v56 * 0.5, (float)((float)(v57 * 0.5) - 135.0) + 30.0);
cocos2d::CCNode::convertToNodeSpace(v48, v52, v49);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v47 + 184))(v46, v50);
ClearPlatformerSavesPopup::updateStats(a1);
return 1;
}
return result;
}