//
// GJAccountManager::loginAccount from 0x845bec to 0x846004 (1048 bytes)
//
// 2 xrefs:
// > AccountLoginLayer::onSubmit @ 0x851ec4
// > ??> @ 0x8d888
//
// 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
//
__int64 __fastcall GJAccountManager::loginAccount(GJAccountManager *a1, _QWORD *a2, _QWORD *a3)
{
_BOOL4 isDLActive; // w1
__int64 result; // x0
double v8; // d0
cocos2d::CCString *v9; // x0
char *CString; // x0
cocos2d::CCString *v11; // x0
size_t v12; // x0
char *v13; // x24
char *v14; // x0
char *v15; // x0
char *v16; // x0
char *v17; // x0
char *v18; // x0
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
unsigned int *v27; // x1
int v28; // w2
const char *v29; // [xsp+48h] [xbp+48h]
char *v30; // [xsp+70h] [xbp+70h] BYREF
char *v31; // [xsp+78h] [xbp+78h] BYREF
const char *v32; // [xsp+80h] [xbp+80h] BYREF
const char *v33; // [xsp+88h] [xbp+88h] BYREF
const char *v34; // [xsp+90h] [xbp+90h] BYREF
isDLActive = GJAccountManager::isDLActive(a1, "login_account");
result = 0;
if ( !isDLActive )
{
GJAccountManager::addDLToActive(a1, "login_account");
GameManager::sharedState();
*(_QWORD *)&v8 = sub_D18D28(&v30).n128_u64[0];
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"udid=%s&userName=%s&gjp2=%s",
v30,
*a2,
*a3,
v8);
CString = (char *)cocos2d::CCString::getCString(v9);
sub_D153B8((int)&v31, CString);
sub_D15FD4(&v31, "&secret=", 8);
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfv",
"3899",
103,
99,
"9");
v29 = cocos2d::CCString::getCString(v11);
v12 = strlen(v29);
sub_D15FD4(&v31, v29, v12);
v13 = v31;
sub_D153B8((int)&v32, "https://www.boomlings.com/database/accounts/loginGJAccount.php");
sub_D153B8((int)&v33, v13);
sub_D153B8((int)&v34, "LoginAccount");
GJAccountManager::ProcessHttpRequest(a1, &v32, &v33, &v34, 23);
v14 = (char *)(v34 - 24);
if ( v34 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v34 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v14);
}
v15 = (char *)(v33 - 24);
if ( v33 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v33 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v33 - 2);
*((_DWORD *)v33 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v15);
}
v16 = (char *)(v32 - 24);
if ( v32 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v32 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v32 - 2);
*((_DWORD *)v32 - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v16);
}
v17 = v31 - 24;
if ( v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v31 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v17);
}
v18 = v30 - 24;
if ( v30 - 24 == (char *)&qword_124B6B0 )
return 1;
if ( &pthread_create )
{
v19 = (unsigned int *)(v30 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v20 - 1;
}
if ( v20 > 0 )
{
return 1;
}
else
{
operator delete(v18);
return 1;
}
}
return result;
}