//
// GJAccountManager::loginAccount from 0x140200b00 to 0x140200f51 (1105 bytes)
//
// 2 xrefs:
// > AccountLoginLayer::onSubmit @ 0x14007cf09
// > ??> @ 0x1406ccaec
//
// 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=8
char __fastcall GJAccountManager::loginAccount(GJAccountManager *a1, const char *a2, const char *a3)
{
__int64 v6; // rbx
void *v7; // rcx
__int64 v9; // rdx
const char *v10; // r9
const char *v11; // r8
const char *v12; // rdx
cocos2d::CCString *v13; // rax
const char *CString; // rax
size_t v15; // rbx
size_t v16; // r8
__int64 v17; // rcx
_QWORD *v18; // rax
_QWORD *v19; // rax
__int64 v20; // rdx
cocos2d::CCString *v21; // rax
char *v22; // rax
size_t v23; // r8
cocos2d::CCString *v24; // rax
char *v25; // rax
size_t v26; // r8
void **v27; // rdx
void *v28; // rcx
char *v29; // [rsp+40h] [rbp-C0h] BYREF
char v30[14]; // [rsp+48h] [rbp-B8h] BYREF
__int16 v31; // [rsp+56h] [rbp-AAh]
__int64 v32; // [rsp+58h] [rbp-A8h]
__int64 v33; // [rsp+60h] [rbp-A0h]
__int128 v34; // [rsp+68h] [rbp-98h] BYREF
__int64 v35; // [rsp+78h] [rbp-88h]
__int64 v36; // [rsp+80h] [rbp-80h]
__int128 *v37; // [rsp+88h] [rbp-78h]
const char *v38; // [rsp+98h] [rbp-68h]
const char *v39; // [rsp+A0h] [rbp-60h]
void *Block[2]; // [rsp+A8h] [rbp-58h] BYREF
__int64 v41; // [rsp+B8h] [rbp-48h]
unsigned __int64 v42; // [rsp+C0h] [rbp-40h]
void *Src[2]; // [rsp+C8h] [rbp-38h] BYREF
__int64 v44; // [rsp+D8h] [rbp-28h]
unsigned __int64 v45; // [rsp+E0h] [rbp-20h]
_QWORD v46[4]; // [rsp+E8h] [rbp-18h] BYREF
v38 = a2;
v39 = a3;
*(_OWORD *)Block = 0;
v41 = 0;
v42 = 0;
sub_14003A930(Block, "login_account", 0xDu);
v6 = cocos2d::CCDictionary::objectForKey(a1->m_activeDownloads, Block);
if ( v42 > 0xF )
{
v7 = Block[0];
if ( v42 + 1 >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
if ( v6 )
{
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
return 0;
}
else
{
GJAccountManager::addDLToActive(a1, "login_account");
v9 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v29 = (char *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = qword_1406C2ED8;
}
sub_14003BDB0((__int64)v46, v9 + 584);
v10 = a3;
if ( *((_QWORD *)a3 + 3) > 0xFu )
v10 = *(const char **)a3;
v11 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v11 = *(const char **)a2;
v12 = (const char *)v46;
if ( v46[3] > 0xFu )
v12 = (const char *)v46[0];
v13 = cocos2d::CCString::createWithFormat("udid=%s&userName=%s&gjp2=%s", v12, v11, v10);
CString = cocos2d::CCString::getCString(v13);
*(_OWORD *)Src = 0;
v44 = 0;
v45 = 0;
v15 = -1;
v16 = -1;
do
++v16;
while ( CString[v16] );
sub_14003A930(Src, CString, v16);
sub_140041270(Src, "&sID=", 5u);
sub_140077F10(v17);
if ( *(_QWORD *)SteamInternal_ContextInit(&off_1406BA0B0)
&& *(_QWORD *)SteamInternal_ContextInit(&off_1406BA098)
&& (v18 = (_QWORD *)SteamInternal_ContextInit(&off_1406BA098),
(*(unsigned __int8 (__fastcall **)(_QWORD))(*(_QWORD *)*v18 + 8LL))(*v18)) )
{
v19 = (_QWORD *)SteamInternal_ContextInit(&off_1406BA098);
v20 = *(_QWORD *)(*(__int64 (__fastcall **)(_QWORD, char **))(*(_QWORD *)*v19 + 16LL))(*v19, &v29);
}
else
{
v20 = 0;
}
v21 = cocos2d::CCString::createWithFormat("%lld", v20);
v22 = (char *)cocos2d::CCString::getCString(v21);
v23 = -1;
do
++v23;
while ( v22[v23] );
sub_140041270(Src, v22, v23);
sub_140041270(Src, "&secret=", 8u);
v24 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfv", "3899", 103, 99, "9");
v25 = (char *)cocos2d::CCString::getCString(v24);
v26 = -1;
do
++v26;
while ( v25[v26] );
sub_140041270(Src, v25, v26);
v27 = Src;
if ( v45 > 0xF )
v27 = (void **)Src[0];
v29 = v30;
v37 = &v34;
v32 = 12;
v33 = 15;
strcpy(v30, "LoginAccount");
v30[13] = 0;
v31 = 0;
v34 = 0;
v35 = 0;
v36 = 0;
do
++v15;
while ( *((_BYTE *)v27 + v15) );
sub_14003A930(&v34, v27, v15);
*(_OWORD *)Block = 0;
v41 = 0;
v42 = 15;
Block[0] = sub_14003AA10(0x40u);
v41 = 62;
v42 = 63;
strcpy((char *)Block[0], "https://www.boomlings.com/database/accounts/loginGJAccount.php");
GJAccountManager::ProcessHttpRequest(a1, (const char *)Block, (const char *)&v34, v30, 23);
if ( v45 > 0xF )
{
v28 = Src[0];
if ( v45 + 1 >= 0x1000 )
{
v28 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v28 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v28);
}
sub_14003A830((__int64)v46);
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
return 1;
}
}