//
// GJAccountManager::backupAccount from 0x1000a1800 to 0x1000a1c04 (1028 bytes)
//
// 1 xrefs:
// > GJAccountManager::onGetAccountBackupURLCompleted @ 0x10009fe0f
//
// This function is hookable on this platform (idp: pc, 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:20:14 +0000
//
bool __fastcall GJAccountManager::backupAccount(__int64 a1, __int128 *a2)
{
__int64 DLObject; // rax
__int64 v5; // rax
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // rdx
double v9; // xmm0_8
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rdx
__int64 v13; // rax
__int64 v14; // rsi
__int64 v15; // rdx
int v16; // eax
double v17; // xmm0_8
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rsi
__int64 v21; // rdx
int v22; // eax
double v23; // xmm0_8
__int64 v24; // rax
const std::string::value_type *data; // rsi
const std::string::value_type *v26; // rsi
__int64 v27; // rax
const std::string::value_type *CString; // rax
const char *v29; // r14
size_t v30; // rax
size_t v31; // r15
char *v32; // r12
size_t v33; // r13
std::string __str; // [rsp+10h] [rbp-E0h] BYREF
__int128 v36; // [rsp+30h] [rbp-C0h] BYREF
void *v37; // [rsp+40h] [rbp-B0h]
char v38; // [rsp+50h] [rbp-A0h] BYREF
_BYTE v39[23]; // [rsp+51h] [rbp-9Fh] BYREF
std::string v40; // [rsp+68h] [rbp-88h] BYREF
std::string v41; // [rsp+80h] [rbp-70h] BYREF
_QWORD __dst[2]; // [rsp+98h] [rbp-58h] BYREF
void *v43; // [rsp+A8h] [rbp-48h]
std::string v44; // [rsp+B0h] [rbp-40h] BYREF
DLObject = GJAccountManager::getDLObject(a1, "bak_account");
if ( !DLObject )
{
v5 = cocos2d::CCNode::create(a1);
GJAccountManager::addDLToActive(a1, "bak_account", v5);
if ( (*(_BYTE *)(a1 + 368) & 1) != 0 )
sub_10001AD30(&__str, *(const void **)(a1 + 384), *(_QWORD *)(a1 + 376));
else
__str = *(std::string *)(a1 + 368);
std::string::assign((std::string *)(a1 + 368), "0");
GameManager::sharedState(a1 + 368, "0", v6);
*(_BYTE *)(v7 + 346) = 1;
*(_QWORD *)&v9 = GameManager::sharedState(a1 + 368, "0", v8).u64[0];
*(_BYTE *)(v10 + 440) = 1;
v11 = MusicDownloadManager::sharedState(a1 + 368);
MusicDownloadManager::clearUnusedSongs(v11, v9);
GameManager::sharedState(v11, "0", v12);
v14 = v13;
GManager::getCompressedSaveString(&v40);
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
v16 = v40.__r_.__value_.__r.__words[1];
else
v16 = *(_BYTE *)&v40.__r_.__value_.__l.0 >> 1;
*(_DWORD *)(a1 + 440) = v16;
*(_QWORD *)&v17 = GameManager::sharedState(&v40, v14, v15).u64[0];
*(_BYTE *)(v18 + 346) = 0;
v19 = LocalLevelManager::sharedState(v17);
LocalLevelManager::updateLevelOrder(v19);
v20 = LocalLevelManager::sharedState(v17);
GManager::getCompressedSaveString(&v41);
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) != 0 )
v22 = v41.__r_.__value_.__r.__words[1];
else
v22 = *(_BYTE *)&v41.__r_.__value_.__l.0 >> 1;
*(_DWORD *)(a1 + 444) = v22;
*(_QWORD *)&v23 = GameManager::sharedState(&v41, v20, v21).u64[0];
*(_BYTE *)(v24 + 440) = 0;
std::string::operator=((std::string *)(a1 + 368), &__str);
GameLevelManager::sharedState(v23);
GameLevelManager::getBasePostString(&v44);
std::string::append(&v44, "&saveData=");
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
data = v40.__r_.__value_.__l.__data_;
else
data = v40.__r_.__value_.__s.__data_;
std::string::append(&v44, data);
std::string::append(&v44, ";");
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) != 0 )
v26 = v41.__r_.__value_.__l.__data_;
else
v26 = v41.__r_.__value_.__s.__data_;
std::string::append(&v44, v26);
std::string::append(&v44, "&secret=");
v27 = sub_10088E820("%c%s%s%c%c%s", (char)"9");
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v27);
std::string::append(&v44, CString);
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_10001AD30(&v36, *((const void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
v37 = *((void **)a2 + 2);
v36 = *a2;
}
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) != 0 )
v29 = v44.__r_.__value_.__l.__data_;
else
v29 = v44.__r_.__value_.__s.__data_;
v30 = strlen(v29);
if ( v30 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v31 = v30;
if ( v30 >= 0x17 )
{
v33 = 26;
if ( (v30 | 7) != 0x17 )
v33 = (v30 | 7) + 1;
v32 = (char *)operator new(v33);
v43 = v32;
__dst[0] = v33 | 1;
__dst[1] = v31;
}
else
{
LOBYTE(__dst[0]) = 2 * v30;
v32 = (char *)__dst + 1;
if ( !v30 )
{
LABEL_31:
v32[v31] = 0;
v38 = 26;
strcpy(v39, "BackupAccount");
GJAccountManager::ProcessHttpRequest(a1, (__int64)&v36, (__int64)__dst, (__int64)&v38, 22);
if ( (v38 & 1) != 0 )
{
operator delete(*(void **)&v39[15]);
if ( (__dst[0] & 1) == 0 )
{
LABEL_33:
if ( (v36 & 1) == 0 )
goto LABEL_34;
goto LABEL_43;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_33;
}
operator delete(v43);
if ( (v36 & 1) == 0 )
{
LABEL_34:
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_35;
goto LABEL_44;
}
LABEL_43:
operator delete(v37);
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_35:
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_36;
goto LABEL_45;
}
LABEL_44:
operator delete(v44.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_36:
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_37;
goto LABEL_46;
}
LABEL_45:
operator delete(v41.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_37:
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_39:
DLObject = 0;
return DLObject == 0;
}
LABEL_38:
operator delete(__str.__r_.__value_.__l.__data_);
goto LABEL_39;
}
LABEL_46:
operator delete(v40.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_39;
goto LABEL_38;
}
}
memmove(v32, v29, v31);
goto LABEL_31;
}
return DLObject == 0;
}