//
// GJAccountManager::backupAccount from 0x1000d2d10 to 0x1000d30fc (1004 bytes)
//
// 1 xrefs:
// > GJAccountManager::onGetAccountBackupURLCompleted @ 0x1000d182f
//
// 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
//
bool __fastcall GJAccountManager::backupAccount(__int64 a1, __int64 a2, __m128 a3)
{
cocos2d::CCObject *DLObject; // rax
cocos2d::CCNode *v5; // rax
__m128 *v6; // r15
MusicDownloadManager *v7; // rax
int v8; // eax
LocalLevelManager *v9; // rax
int v10; // eax
const std::string::value_type *data; // rsi
const std::string::value_type *v12; // rsi
cocos2d::CCString *v13; // rax
const char *CString; // rax
const char *v15; // r14
size_t v16; // rax
size_t v17; // r15
char *v18; // r12
size_t v19; // r13
std::string __str; // [rsp+10h] [rbp-E0h] BYREF
__m128 v22; // [rsp+30h] [rbp-C0h] BYREF
void *v23; // [rsp+40h] [rbp-B0h]
char v24; // [rsp+50h] [rbp-A0h] BYREF
_BYTE v25[23]; // [rsp+51h] [rbp-9Fh] BYREF
std::string v26; // [rsp+68h] [rbp-88h] BYREF
std::string v27; // [rsp+80h] [rbp-70h] BYREF
_QWORD __dst[2]; // [rsp+98h] [rbp-58h] BYREF
void *v29; // [rsp+A8h] [rbp-48h]
std::string v30; // [rsp+B0h] [rbp-40h] BYREF
DLObject = GJAccountManager::getDLObject((GJAccountManager *)a1, "bak_account");
if ( !DLObject )
{
v5 = cocos2d::CCNode::create();
GJAccountManager::addDLToActive((GJAccountManager *)a1, "bak_account", v5);
v6 = (__m128 *)(a1 + 368);
if ( (*(_BYTE *)(a1 + 368) & 1) != 0 )
{
sub_100006B70(&__str, *(const void **)(a1 + 384), *(_QWORD *)(a1 + 376), *(double *)a3.i64);
}
else
{
__str.__r_.__value_.__r.__words[2] = *(_QWORD *)(a1 + 384);
a3 = *v6;
*(__m128 *)&__str.__r_.__value_.__l.0 = *v6;
}
std::string::assign((std::string *)(a1 + 368), "0");
GameManager::sharedState()->m_quickSave = 1;
v7 = MusicDownloadManager::sharedState();
MusicDownloadManager::clearUnusedSongs(v7);
GameManager::sharedState();
GManager::getCompressedSaveString(&v26);
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
v8 = v26.__r_.__value_.__r.__words[1];
else
v8 = *(_BYTE *)&v26.__r_.__value_.__l.0 >> 1;
*(_DWORD *)(a1 + 440) = v8;
GameManager::sharedState()->m_quickSave = 0;
v9 = LocalLevelManager::sharedState();
LocalLevelManager::updateLevelOrder(v9);
LocalLevelManager::sharedState();
GManager::getCompressedSaveString(&v27);
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
v10 = v27.__r_.__value_.__r.__words[1];
else
v10 = *(_BYTE *)&v27.__r_.__value_.__l.0 >> 1;
*(_DWORD *)(a1 + 444) = v10;
std::string::operator=((std::string *)(a1 + 368), &__str);
GameLevelManager::sharedState();
GameLevelManager::getBasePostString(&v30);
std::string::append(&v30, "&saveData=");
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
data = v26.__r_.__value_.__l.__data_;
else
data = v26.__r_.__value_.__s.__data_;
std::string::append(&v30, data);
std::string::append(&v30, ";");
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
v12 = v27.__r_.__value_.__l.__data_;
else
v12 = v27.__r_.__value_.__s.__data_;
std::string::append(&v30, v12);
std::string::append(&v30, "&secret=");
v13 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"9");
CString = cocos2d::CCString::getCString(v13);
std::string::append(&v30, CString);
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_100006B70(&v22, *(const void **)(a2 + 16), *(_QWORD *)(a2 + 8), *(double *)a3.i64);
}
else
{
v23 = *(void **)(a2 + 16);
a3 = *(__m128 *)a2;
v22 = *(__m128 *)a2;
}
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
v15 = v30.__r_.__value_.__l.__data_;
else
v15 = v30.__r_.__value_.__s.__data_;
v16 = strlen(v15);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a3.i64);
v17 = v16;
if ( v16 >= 0x17 )
{
v19 = 26;
if ( (v16 | 7) != 0x17 )
v19 = (v16 | 7) + 1;
v18 = (char *)operator new(v19);
v29 = v18;
__dst[0] = v19 | 1;
__dst[1] = v17;
}
else
{
LOBYTE(__dst[0]) = 2 * v16;
v18 = (char *)__dst + 1;
if ( !v16 )
{
LABEL_31:
v18[v17] = 0;
v24 = 26;
strcpy(v25, "BackupAccount");
GJAccountManager::ProcessHttpRequest((cocos2d::CCObject *)a1, (__int64)&v22, (__int64)__dst, (__int64)&v24, 20);
if ( (v24 & 1) != 0 )
{
operator delete(*(void **)&v25[15]);
if ( (__dst[0] & 1) == 0 )
{
LABEL_33:
if ( (v22.i8[0] & 1) == 0 )
goto LABEL_34;
goto LABEL_43;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_33;
}
operator delete(v29);
if ( (v22.i8[0] & 1) == 0 )
{
LABEL_34:
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_35;
goto LABEL_44;
}
LABEL_43:
operator delete(v23);
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_35:
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_36;
goto LABEL_45;
}
LABEL_44:
operator delete(v30.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_36:
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_37;
goto LABEL_46;
}
LABEL_45:
operator delete(v27.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_37:
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_39:
DLObject = nullptr;
return DLObject == nullptr;
}
LABEL_38:
operator delete(__str.__r_.__value_.__l.__data_);
goto LABEL_39;
}
LABEL_46:
operator delete(v26.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_39;
goto LABEL_38;
}
}
memmove(v18, v15, v17);
goto LABEL_31;
}
return DLObject == nullptr;
}