//
// AccountLayer::onBackup from 0x14007e020 to 0x14007e3a9 (905 bytes)
//
// 2 xrefs:
// > AccountLayer::customSetup @ 0x14007da22
// > ??> @ 0x1406c68d0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=3
void AccountLayer::onBackup(AccountLayer *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // rcx
cocos2d::CCString *v4; // rax
const char *v5; // rax
size_t v6; // r8
__int64 v7; // rax
FLAlertLayer *v8; // rbx
GameLevelManager *v9; // rcx
int TimeLeft; // eax
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // r8
__int64 v14; // rax
int v15; // ebx
__int64 v16; // rax
__int128 v17; // [rsp+50h] [rbp+7h] BYREF
__int64 v18; // [rsp+60h] [rbp+17h]
__int64 v19; // [rsp+68h] [rbp+1Fh]
_BYTE v20[48]; // [rsp+70h] [rbp+27h] BYREF
void *v21; // [rsp+C0h] [rbp+77h]
void *v22; // [rsp+C0h] [rbp+77h]
v3 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v21 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v3 = (GameStatsManager *)qword_1406C2EE8;
}
if ( GameStatsManager::getStat(v3, "6") >= 10 )
{
v9 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v22 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v9 = (GameLevelManager *)qword_1406C2EC0;
}
TimeLeft = GameLevelManager::getTimeLeft(v9, "bak_account", 30.0);
if ( (unsigned int)(TimeLeft - 1) > 0x1D )
{
v15 = (_DWORD)a1 + 632;
if ( !a1 )
v15 = 0;
v17 = 0;
v18 = 0;
v19 = 15;
*(_QWORD *)&v17 = sub_14003AA10(0x80u);
v18 = 118;
v19 = 127;
strcpy(
(char *)v17,
"Do you want to save your account data on the cloud?\n"
"This will overwrite previously saved data.");
v16 = sub_14003BDB0((__int64)v20, (__int64)&v17);
v8 = FLAlertLayer::create(
v15,
(int)"Save Data",
v16,
(__int64)"Cancel",
(__int64)"Save",
1133903872,
0,
0,
1065353216);
sub_14003A830((__int64)&v17);
ButtonSprite::updateBGImage(v8->m_button1, "GJ_button_06.png");
v8->setTag(v8, 1);
}
else
{
v11 = cocos2d::CCString::createWithFormat(
"Please wait %i seconds before attempting to back up your account again.",
TimeLeft);
CString = cocos2d::CCString::getCString(v11);
v17 = 0;
v18 = 0;
v19 = 0;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003A930(&v17, CString, v13);
v14 = sub_14003BDB0((__int64)v20, (__int64)&v17);
v8 = FLAlertLayer::create(0, (int)"Too Fast", v14, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003A830((__int64)&v17);
}
}
else
{
v4 = cocos2d::CCString::createWithFormat(
"You need to collect atleast %i stars to enable saving.",
10);
v5 = cocos2d::CCString::getCString(v4);
v17 = 0;
v18 = 0;
v19 = 0;
v6 = -1;
do
++v6;
while ( v5[v6] );
sub_14003A930(&v17, v5, v6);
v7 = sub_14003BDB0((__int64)v20, (__int64)&v17);
v8 = FLAlertLayer::create(0, (int)"Collect more", v7, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003A830((__int64)&v17);
}
v8->show(v8);
}