//
// GJAccountManager::syncAccount from 0x1402028c0 to 0x140202b27 (615 bytes)
//
// 2 xrefs:
// > GJAccountManager::onGetAccountSyncURLCompleted @ 0x140202819
// > ??> @ 0x1406ccb4c
//
// 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
//
// Hidden C++ exception states: #wind=6
char __fastcall GJAccountManager::syncAccount(GJAccountManager *a1, __int64 a2)
{
__int64 v4; // rbx
void *v5; // rcx
__int64 v7; // rcx
cocos2d::CCString *v8; // rax
const char *CString; // rax
cocos2d::CCString *v10; // rax
char *v11; // rax
size_t v12; // rbx
size_t v13; // r8
_QWORD *v14; // rdx
const char *v15; // rax
void *v16; // [rsp+40h] [rbp-69h]
__int128 v17; // [rsp+48h] [rbp-61h] BYREF
__int64 v18; // [rsp+58h] [rbp-51h]
__int64 v19; // [rsp+60h] [rbp-49h]
__int128 *v20; // [rsp+68h] [rbp-41h]
_BYTE v21[32]; // [rsp+78h] [rbp-31h] BYREF
__int64 v22; // [rsp+98h] [rbp-11h]
void *Block[2]; // [rsp+A0h] [rbp-9h] BYREF
__int64 v24; // [rsp+B0h] [rbp+7h]
unsigned __int64 v25; // [rsp+B8h] [rbp+Fh]
_QWORD Src[4]; // [rsp+C0h] [rbp+17h] BYREF
v22 = a2;
*(_OWORD *)Block = 0;
v24 = 0;
v25 = 0;
sub_14003A930(Block, "sync_account", 0xCu);
v4 = cocos2d::CCDictionary::objectForKey(a1->m_activeDownloads, Block);
if ( v25 > 0xF )
{
v5 = Block[0];
if ( v25 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v5);
}
if ( v4 )
{
sub_14003A830(a2);
return 0;
}
else
{
GJAccountManager::addDLToActive(a1, "sync_account");
if ( !qword_1406C2EC0 )
{
v16 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
GameLevelManager::getBasePostString(v7, Src);
v8 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfv", "3899", 103, 99, "9");
CString = cocos2d::CCString::getCString(v8);
v10 = cocos2d::CCString::createWithFormat("&secret=%s", CString);
v11 = (char *)cocos2d::CCString::getCString(v10);
v12 = -1;
v13 = -1;
do
++v13;
while ( v11[v13] );
sub_140041270(Src, v11, v13);
v20 = &v17;
v24 = 11;
v25 = 15;
Block[0] = (void *)0x6F636341636E7953LL;
Block[1] = (void *)7630453;
v14 = Src;
if ( Src[3] > 0xFu )
v14 = (_QWORD *)Src[0];
v17 = 0;
v18 = 0;
v19 = 0;
do
++v12;
while ( *((_BYTE *)v14 + v12) );
sub_14003A930(&v17, v14, v12);
v15 = (const char *)sub_14003BDB0((__int64)v21, a2);
GJAccountManager::ProcessHttpRequest(a1, v15, (const char *)&v17, (const char *)Block, 21);
sub_14003A830((__int64)Src);
sub_14003A830(a2);
return 1;
}
}