//
// AccountLayer::onBackup from 0x84aa70 to 0x84ad38 (712 bytes)
//
// 3 xrefs:
// > ??> @ 0x3b7a8
// > AccountLayer::customSetup @ 0x84b97c
// > ??> @ 0x1229df0
//
// 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
//
void AccountLayer::onBackup(AccountLayer *a1, cocos2d::CCObject *a2)
{
int v2; // w20
GameStatsManager *v3; // x0
cocos2d::CCString *v4; // x0
char *CString; // x0
FLAlertLayer *v6; // x0
__int64 v7; // x2
FLAlertLayer *v8; // x20
void *v9; // x0
GameLevelManager *v10; // x0
unsigned int TimeLeft; // w0
void *v12; // x0
cocos2d::CCString *v13; // x0
char *v14; // x0
FLAlertLayer *v15; // x0
unsigned int *v16; // x2
int v17; // w1
unsigned int *v18; // x2
unsigned int *v19; // x2
int v20; // w1
__int64 v21; // [xsp+40h] [xbp+40h] BYREF
v2 = (int)a1;
v3 = GameStatsManager::sharedState();
if ( GameStatsManager::getStat(v3, "6") <= 9 )
{
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You need to collect atleast %i stars to enable saving.",
&byte_9[1]);
CString = (char *)cocos2d::CCString::getCString(v4);
sub_D153B8((int)&v21, CString);
v6 = FLAlertLayer::create(0, (__int64)"Collect more", (__int64)&v21);
v7 = v21;
v8 = v6;
v9 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) == &qword_124B6B0 )
goto LABEL_3;
if ( &pthread_create )
{
v18 = (unsigned int *)(v21 - 8);
do
v17 = __ldaxr(v18);
while ( __stlxr(v17 - 1, v18) );
goto LABEL_15;
}
goto LABEL_17;
}
v10 = GameLevelManager::sharedState();
TimeLeft = GameLevelManager::getTimeLeft(v10, "bak_account", 30.0);
if ( TimeLeft - 1 <= 0x1D )
{
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Please wait %i seconds before attempting to back up your account again.",
(const char *)TimeLeft);
v14 = (char *)cocos2d::CCString::getCString(v13);
sub_D153B8((int)&v21, v14);
v15 = FLAlertLayer::create(0, (__int64)"Too Fast", (__int64)&v21);
v7 = v21;
v8 = v15;
v9 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) == &qword_124B6B0 )
goto LABEL_3;
if ( &pthread_create )
{
v16 = (unsigned int *)(v21 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
LABEL_15:
if ( v17 <= 0 )
operator delete(v9);
goto LABEL_3;
}
LABEL_17:
v17 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v17 - 1;
goto LABEL_15;
}
sub_D153B8(
(int)&v21,
"Do you want to save your account data on the cloud?\n"
"This will overwrite previously saved data.");
v8 = FLAlertLayer::create(v2 + 632, (__int64)"Save Data", (__int64)&v21);
v12 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v21 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v21 - 8);
*(_DWORD *)(v21 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v12);
}
ButtonSprite::updateBGImage(v8->m_button1, "GJ_button_06.png");
v8->setTag(v8, 1);
LABEL_3:
v8->show(v8);
}