//
// AutoBackupOptionsPopup::onPrune from 0xc58b5c to 0xc58e10 (692 bytes)
//
// 3 xrefs:
// > ??> @ 0xa4098
// > AutoBackupOptionsPopup::init @ 0xc56c98
// > ??> @ 0x1544910
//
// 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 13:05:13 +0000
//
__int64 __fastcall AutoBackupOptionsPopup::onPrune(AutoBackupOptionsPopup *this, cocos2d::CCObject *a2)
{
unsigned int BackupCap; // w24
const char *v4; // x1
char *v5; // x2
char *v6; // x23
cocos2d::CCString *v7; // x0
const char *CString; // x0
size_t v9; // x0
__int64 v10; // x20
void (__fastcall *v12)(AutoBackupOptionsPopup *, __int64, __int64); // x24
__int64 v13; // x0
char *v14; // [xsp+48h] [xbp+48h]
const char *v15; // [xsp+48h] [xbp+48h]
const char *v16; // [xsp+48h] [xbp+48h]
__int64 v17; // [xsp+58h] [xbp+58h] BYREF
size_t v18; // [xsp+60h] [xbp+60h]
void *v19; // [xsp+68h] [xbp+68h]
__int64 v20; // [xsp+70h] [xbp+70h] BYREF
size_t v21; // [xsp+78h] [xbp+78h]
void *v22; // [xsp+80h] [xbp+80h]
BackupCap = AutoSaveSettingsLayer::getBackupCap(_stack_chk_guard);
AutoBackupPopup::backupDirectory(&v17);
v20 = 0;
v21 = 0;
v22 = nullptr;
std::string::__init(&v20, &byte_11B8890, 0);
v4 = (const char *)(unsigned int)AutoBackupPopup::pruneBackups((char *)&v17, BackupCap, (unsigned __int8 *)&v20, 1u);
if ( (v20 & 1) != 0 )
{
v16 = v4;
operator delete(v22);
v4 = v16;
}
if ( (v17 & 1) != 0 )
{
v15 = v4;
operator delete(v19);
v4 = v15;
if ( (_DWORD)v15 )
goto LABEL_5;
}
else if ( (_DWORD)v4 )
{
LABEL_5:
if ( (_DWORD)v4 == 1 )
v5 = &byte_11B8890;
else
v5 = "s";
v6 = (char *)this + 1016;
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Delete %i old backup%s?\n"
"Keeps the newest %i for each level.",
v4,
v5,
BackupCap);
CString = (const char *)cocos2d::CCString::getCString(v7);
v17 = 0;
v14 = (char *)CString;
v18 = 0;
v19 = nullptr;
v9 = strlen(CString);
std::string::__init(&v17, v14, v9);
v20 = 0;
v21 = 0;
v22 = nullptr;
if ( (v17 & 1) != 0 )
{
std::string::__init(&v20, v19, v18);
}
else
{
v22 = v19;
v20 = v17;
v21 = v18;
}
v10 = FLAlertLayer::create(
(__int64)v6,
(cocos2d::CCLabelBMFont *)"Prune Backups",
(char *)&v20,
(ButtonSprite *)"Back",
(ButtonSprite *)"Prune",
0,
380.0,
0.0,
1.0);
if ( (v20 & 1) != 0 )
operator delete(v22);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 72LL))(v10, 1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 1312LL))(v10);
goto LABEL_12;
}
v12 = *(void (__fastcall **)(AutoBackupOptionsPopup *, __int64, __int64))(*(_QWORD *)this + 464LL);
v17 = 0;
v18 = 0;
v19 = nullptr;
std::string::__init(&v17, "Nothing to prune", 0x10u);
v20 = 0;
v21 = 0;
v22 = nullptr;
std::string::__init(&v20, &byte_11B8890, 0);
v13 = TextAlertPopup::create((char *)&v17, 150, (char *)&v20, 0.5, 0.6);
v12(this, v13, 100);
if ( (v20 & 1) != 0 )
operator delete(v22);
LABEL_12:
if ( (v17 & 1) != 0 )
operator delete(v19);
return _stack_chk_guard;
}