//
// AccountLayer::onSync from 0x98cfc0 to 0x98d164 (420 bytes)
//
// 3 xrefs:
// > ??> @ 0x4d128
// > AccountLayer::customSetup @ 0x98deec
// > ??> @ 0x1541920
//
// 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 12:57:57 +0000
//
__int64 __fastcall AccountLayer::onSync(AccountLayer *this, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x0
unsigned int TimeLeft; // w0
cocos2d::CCString *v5; // x0
size_t v6; // x0
__int64 v7; // x20
__int64 v9; // x0
char *CString; // [xsp+38h] [xbp+38h]
__int64 v11; // [xsp+40h] [xbp+40h] BYREF
__int64 v12; // [xsp+48h] [xbp+48h]
void *v13; // [xsp+50h] [xbp+50h]
v3 = (GameLevelManager *)GameLevelManager::sharedState(_stack_chk_guard);
TimeLeft = GameLevelManager::getTimeLeft(v3, "sync_account", 30.0);
if ( TimeLeft - 1 > 0x1D )
{
v11 = 0;
v12 = 0;
v13 = nullptr;
std::string::__init(
&v11,
"Do you want to download your account data from the cloud?\n"
"This will merge current data with the saved data.",
0x83u);
v9 = FLAlertLayer::create(
(__int64)this + 632,
(cocos2d::CCLabelBMFont *)"Load Data",
(char *)&v11,
(ButtonSprite *)"Cancel",
(ButtonSprite *)"Load",
300.0);
v7 = v9;
if ( (v11 & 1) != 0 )
{
operator delete(v13);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v7 + 72LL))(v7, 2);
}
else
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 72LL))(v9, 2);
}
}
else
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Please wait %i seconds before attempting to sync your account again.",
(const char *)TimeLeft);
v11 = 0;
CString = (char *)cocos2d::CCString::getCString(v5);
v12 = 0;
v13 = nullptr;
v6 = strlen(CString);
std::string::__init(&v11, CString, v6);
v7 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Too fast",
(char *)&v11,
(ButtonSprite *)"OK",
nullptr,
300.0);
if ( (v11 & 1) != 0 )
operator delete(v13);
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v7 + 1312LL))(v7);
return _stack_chk_guard;
}