//
// AccountLayer::onSync from 0x84a85c to 0x84aa6c (528 bytes)
//
// 3 xrefs:
// > ??> @ 0x344b8
// > AccountLayer::customSetup @ 0x84b9cc
// > ??> @ 0x1229930
//
// 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::onSync(AccountLayer *a1, cocos2d::CCObject *a2)
{
int v2; // w21
GameLevelManager *v3; // x0
unsigned int TimeLeft; // w0
cocos2d::CCString *v5; // x0
char *CString; // x0
FLAlertLayer *v7; // x20
void *v8; // x0
void *v9; // x0
unsigned int *v10; // x2
int v11; // w1
unsigned int *v12; // x2
int v13; // w1
__int64 v14; // [xsp+40h] [xbp+40h] BYREF
v2 = (int)a1;
v3 = GameLevelManager::sharedState();
TimeLeft = GameLevelManager::getTimeLeft(v3, "sync_account", 30.0);
if ( TimeLeft - 1 > 0x1D )
{
sub_D153B8(
(int)&v14,
"Do you want to download your account data from the cloud?\n"
"This will merge current data with the saved data.");
v7 = FLAlertLayer::create(v2 + 632, (__int64)"Load Data", (__int64)&v14);
v9 = (void *)(v14 - 24);
if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v14 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
v7->setTag(v7, 2);
}
else
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Please wait %i seconds before attempting to sync your account again.",
(const char *)TimeLeft);
CString = (char *)cocos2d::CCString::getCString(v5);
sub_D153B8((int)&v14, CString);
v7 = FLAlertLayer::create(0, (__int64)"Too fast", (__int64)&v14);
v8 = (void *)(v14 - 24);
if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v14 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v8);
}
}
v7->show(v7);
}