//
// AutoBackupPopup::onRestore from 0xc531b4 to 0xc53480 (716 bytes)
//
// 3 xrefs:
// > ??> @ 0xc7d20
// > AutoBackupPopup::buildRows @ 0xc57f84
// > ??> @ 0x1545d78
//
// 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:10 +0000
//
__int64 __fastcall AutoBackupPopup::onRestore(AutoBackupPopup *this, cocos2d::CCObject *a2)
{
int v3; // w0
__int64 v4; // x1
LocalLevelManager *v5; // x0
cocos2d::CCArray **v6; // x0
cocos2d::CCNotificationCenter *v7; // x0
int v8; // w22
cocos2d::CCNotificationCenter *v9; // x23
cocos2d::CCObject *v10; // x21
char *v11; // x20
char *v12; // x0
__int64 v14; // x0
char *v15; // x20
void *v16; // [xsp+48h] [xbp+48h] BYREF
char *v17; // [xsp+50h] [xbp+50h]
char *v18; // [xsp+58h] [xbp+58h]
__int64 v19[2]; // [xsp+60h] [xbp+60h] BYREF
void *v20; // [xsp+70h] [xbp+70h]
v3 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
if ( (v3 & 0x80000000) == 0 )
{
v4 = *((_QWORD *)this + 106);
if ( v3 < (int)((*((_QWORD *)this + 107) - v4) >> 7) )
{
std::operator+((__int64)this + 800, v4 + ((__int64)v3 << 7), (unsigned __int64 *)v19);
v16 = (void *)operator new(0x18u);
v18 = (char *)v16 + 24;
std::string::basic_string((unsigned __int64)v16, v19);
v5 = (LocalLevelManager *)((char *)v16 + 24);
v17 = (char *)v16 + 24;
if ( (v19[0] & 1) != 0 )
operator delete(v20);
v6 = (cocos2d::CCArray **)LocalLevelManager::sharedState(v5);
v7 = (cocos2d::CCNotificationCenter *)LocalLevelManager::importLevelsFromPaths(
v6,
(unsigned __int8 **)&v16,
*((_DWORD *)this + 198));
v8 = (int)v7;
if ( (int)v7 <= 0 )
{
v19[0] = 0;
v19[1] = 0;
v20 = nullptr;
std::string::__init(v19, "Could not read this backup.", 0x1Bu);
v14 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (char *)v19, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 1312LL))(v14);
if ( (v19[0] & 1) != 0 )
operator delete(v20);
v15 = (char *)v16;
if ( v16 )
{
v12 = v17;
if ( v16 != v17 )
{
do
{
v17 = v12 - 24;
std::string::~string((__int64)(v12 - 24));
v12 = v17;
}
while ( v15 != v17 );
v12 = (char *)v16;
}
goto LABEL_10;
}
}
else
{
v9 = (cocos2d::CCNotificationCenter *)cocos2d::CCNotificationCenter::sharedNotificationCenter(v7);
v10 = (cocos2d::CCObject *)operator new(0x40u);
cocos2d::CCObject::CCObject(v10);
*((_DWORD *)v10 + 14) = v8;
*(_QWORD *)v10 = &off_1428350;
cocos2d::CCObject::autorelease(v10);
cocos2d::CCNotificationCenter::postNotification(v9, "LevelsImportedNotification", v10);
(*(void (__fastcall **)(AutoBackupPopup *, _QWORD))(*(_QWORD *)this + 1360LL))(this, 0);
v11 = (char *)v16;
if ( v16 )
{
v12 = v17;
if ( v16 != v17 )
{
do
{
v17 = v12 - 24;
std::string::~string((__int64)(v12 - 24));
v12 = v17;
}
while ( v11 != v17 );
v12 = (char *)v16;
}
LABEL_10:
operator delete(v12);
}
}
}
}
return _stack_chk_guard;
}