//
// ClearPlatformerSavesPopup::onDelete from 0x1400a4000 to 0x1400a423e (574 bytes)
//
// 2 xrefs:
// > ClearPlatformerSavesPopup::init @ 0x1400a38b9
// > ??> @ 0x140913148
//
// 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
void __fastcall ClearPlatformerSavesPopup::onDelete(__int64 a1)
{
const char *v2; // rdx
size_t v3; // r8
__int64 v4; // rcx
int v5; // r12d
void **v6; // r14
char *v7; // rsi
unsigned __int64 v8; // r15
__int64 v9; // rbx
unsigned __int64 v10; // rdi
__int64 v11; // rax
__int64 *v12; // rbx
char *v13; // rax
__int128 v14; // [rsp+50h] [rbp-49h] BYREF
unsigned __int64 v15; // [rsp+60h] [rbp-39h]
__int64 v16; // [rsp+68h] [rbp-31h]
__int128 *v17; // [rsp+70h] [rbp-29h]
char v18[32]; // [rsp+80h] [rbp-19h] BYREF
void *Src[2]; // [rsp+A0h] [rbp+7h] BYREF
unsigned __int64 v20; // [rsp+B0h] [rbp+17h]
unsigned __int64 v21; // [rsp+B8h] [rbp+1Fh]
v2 = "This will clear platformer saves on all non-favorite levels.\nContinue?";
if ( *(_BYTE *)(a1 + 672) )
v2 = "This will clear all platformer saves, including favorites.\nContinue?";
*(_OWORD *)Src = 0;
v20 = 0;
v21 = 0;
v3 = -1;
do
++v3;
while ( v2[v3] );
sub_14003D230(Src, v2, v3);
v5 = a1 + 664;
if ( !a1 )
v5 = 0;
v14 = 0;
v15 = 0;
v16 = 0;
v6 = Src;
v7 = (char *)Src[0];
v8 = v21;
if ( v21 > 0xF )
v6 = (void **)Src[0];
v9 = 0x7FFFFFFFFFFFFFFFLL;
v10 = v20;
if ( v20 > 0x7FFFFFFFFFFFFFFFLL )
sub_140009D90(v4);
if ( v20 > 0xF )
{
if ( (v20 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v9 = v20 | 0xF;
if ( (v20 | 0xF) < 0x16 )
v9 = 22;
}
*(_QWORD *)&v14 = sub_14003D460(v9 + 1);
v15 = v10;
v16 = v9;
memcpy((void *)v14, v6, v10 + 1);
}
else
{
v15 = v20;
v16 = 15;
v14 = *(_OWORD *)v6;
}
v17 = &v14;
v11 = sub_14003F4F0((__int64)v18, (__int64)&v14);
v12 = (__int64 *)FLAlertLayer::create(
v5,
(int)"Confirm",
v11,
(__int64)"Cancel",
(__int64)"Delete",
1136525312,
0,
0,
1065353216);
sub_14003D310((__int64)&v14);
(*(void (__fastcall **)(__int64 *, __int64))(*v12 + 64))(v12, 1);
ButtonSprite::updateBGImage(v12[77], "GJ_button_06.png");
(*(void (__fastcall **)(__int64 *))(*v12 + 1064))(v12);
if ( v8 > 0xF )
{
v13 = v7;
if ( v8 + 1 >= 0x1000 )
{
v7 = *((char **)v7 - 1);
if ( (unsigned __int64)(v13 - v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
}