//
// GJAccountManager::onBackupAccountCompleted from 0x581b9c to 0x581cfc (352 bytes)
//
// 1 xrefs:
// > GJAccountManager::handleIt @ 0x583754
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:52:54 +0000
//
GameLevelManager *__fastcall GJAccountManager::onBackupAccountCompleted(int *a1, int a2)
{
_BOOL4 v4; // r7
GameLevelManager *result; // r0
int (*v6)(void); // r3
cocos2d::CCString *v7; // r0
const char *CString; // r0
const char *v9; // r8
size_t v10; // r0
unsigned int v11; // r8
void (__fastcall ***v12)(_DWORD); // r0
const char *v13; // r0
int v14; // r5
int (__fastcall *v15)(int, int, int); // r6
const char *v16; // r0
int v17; // r0
GameLevelManager *v18; // r0
float v19; // r2
int v20; // r3
LocalLevelManager *TimeStamp; // r0
cocos2d::CCArray **v22; // r0
int v23; // [sp+0h] [bp-14h] BYREF
int v24; // [sp+4h] [bp-10h]
int v25; // [sp+8h] [bp-Ch]
GJAccountManager::removeDLFromActive((GJAccountManager *)a1, "bak_account");
v23 = 0;
v24 = 0;
v25 = 0;
std::string::__init(&v23, "-1", 2u);
v4 = sub_58125C((unsigned __int8 *)a2, (unsigned __int8 *)&v23);
std::string::~string((int)&v23);
if ( v4 )
{
result = (GameLevelManager *)a1[79];
if ( !result )
return result;
v6 = *(int (**)(void))(*(_DWORD *)result + 4);
return (GameLevelManager *)v6();
}
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)0xFFFFFFFE);
CString = (const char *)cocos2d::CCString::getCString(v7);
v23 = 0;
v24 = 0;
v25 = 0;
v9 = CString;
v10 = strlen(CString);
std::string::__init(&v23, v9, v10);
v11 = sub_58125C((unsigned __int8 *)a2, (unsigned __int8 *)&v23);
std::string::~string((int)&v23);
if ( v11 )
{
std::string::assign(a1 + 84, (char *)&unk_B6B226);
v12 = (void (__fastcall ***)(_DWORD))a1[78];
if ( v12 )
(**v12)(v12);
result = (GameLevelManager *)a1[79];
if ( result )
{
v6 = *(int (**)(void))(*(_DWORD *)result + 4);
return (GameLevelManager *)v6();
}
}
else
{
v23 = 0;
v24 = 0;
v25 = 0;
std::string::__init(&v23, a1i2r3e45s789g, 1u);
if ( !sub_58125C((unsigned __int8 *)a2, (unsigned __int8 *)&v23) )
{
if ( (*(_BYTE *)a2 & 1) != 0 )
v13 = *(const char **)(a2 + 8);
else
v13 = (const char *)(a2 + 1);
v11 = (unsigned int)atoi(v13) >> 31;
}
result = (GameLevelManager *)std::string::~string((int)&v23);
if ( v11 )
{
v14 = a1[79];
if ( v14 )
{
v15 = *(int (__fastcall **)(int, int, int))(*(_DWORD *)v14 + 4);
if ( (*(_BYTE *)a2 & 1) != 0 )
v16 = *(const char **)(a2 + 8);
else
v16 = (const char *)(a2 + 1);
v17 = atoi(v16);
return (GameLevelManager *)v15(v14, -3, v17);
}
}
else
{
v18 = (GameLevelManager *)GameLevelManager::sharedState(result);
TimeStamp = (LocalLevelManager *)GameLevelManager::makeTimeStamp(v18, "bak_account", v19, v20);
v22 = (cocos2d::CCArray **)LocalLevelManager::sharedState(TimeStamp);
LocalLevelManager::markLevelsAsUnmodified(v22);
result = (GameLevelManager *)a1[79];
if ( result )
return (GameLevelManager *)(**(int (__fastcall ***)(GameLevelManager *))result)(result);
}
}
return result;
}