//
// GJAccountManager::onLoginAccountCompleted from 0x1000d00a0 to 0x1000d0432 (914 bytes)
//
// 1 xrefs:
// > GJAccountManager::handleIt @ 0x1000cfa23
//
// 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
//
unsigned int __fastcall GJAccountManager::onLoginAccountCompleted(GJAccountManager *a1, unsigned __int8 *a2, double a3)
{
cocos2d::CCString *v3; // rax
const char *CString; // r12
size_t v5; // rax
size_t v6; // r15
char *v7; // rbx
size_t v8; // r14
char *v9; // r14
void *v10; // rbx
unsigned int v11; // eax
const void *v12; // rdi
size_t v13; // rax
size_t v14; // rdx
char *v15; // rsi
bool v16; // zf
char v17; // r12
unsigned int result; // eax
GJAccountLoginDelegate *m_accountLoginDelegate; // rdi
cocos2d::CCString *v20; // rax
const char *v21; // rbx
size_t v22; // rax
size_t v23; // r13
char *v24; // r12
size_t v25; // r15
void *v26; // rbx
unsigned int v27; // eax
size_t v28; // rax
const void *v29; // rdi
size_t v30; // rdx
bool v31; // zf
char v32; // r14
GJAccountLoginDelegate *v33; // rdi
unsigned __int64 v34; // rcx
const void *v35; // rdi
size_t v36; // rdx
cocos2d::CCArray *v37; // r14
cocos2d::CCString *v38; // rax
int v39; // ebx
cocos2d::CCString *v40; // rax
GJAccountLoginDelegate *v41; // rdi
GJAccountLoginDelegate *v42; // rdi
char v43; // [rsp+0h] [rbp-60h]
char v44; // [rsp+0h] [rbp-60h]
void *__s1; // [rsp+10h] [rbp-50h]
size_t __dst; // [rsp+18h] [rbp-48h] BYREF
size_t v48; // [rsp+20h] [rbp-40h]
void *__p; // [rsp+28h] [rbp-38h]
GJAccountManager *v50; // [rsp+30h] [rbp-30h]
GJAccountManager::removeDLFromActive(a1, "login_account");
v3 = (cocos2d::CCString *)sub_1007AB580("%i", v43);
CString = cocos2d::CCString::getCString(v3);
v5 = strlen(CString);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_58;
v6 = v5;
v50 = a1;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst = v8 + 1;
v48 = v6;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( v5 )
LABEL_8:
memmove(v7, CString, v6);
v9 = (char *)&__dst + 1;
v7[v6] = 0;
v10 = __p;
v11 = *a2;
v12 = a2 + 1;
__s1 = a2 + 1;
if ( (v11 & 1) != 0 )
{
v13 = *((_QWORD *)a2 + 1);
v12 = *((const void **)a2 + 2);
}
else
{
v13 = v11 >> 1;
}
v14 = (unsigned __int8)__dst >> 1;
if ( (__dst & 1) != 0 )
v14 = v48;
v15 = (char *)__p;
if ( (__dst & 1) == 0 )
v15 = (char *)&__dst + 1;
v16 = v14 == v13;
if ( v14 >= v13 )
v14 = v13;
v17 = v16 & (memcmp(v12, v15, v14) == 0);
if ( (__dst & 1) != 0 )
operator delete(v10);
if ( v17 )
{
result = (unsigned int)v50;
m_accountLoginDelegate = v50->m_accountLoginDelegate;
if ( m_accountLoginDelegate )
return ((__int64 (__fastcall *)(GJAccountLoginDelegate *, __int64))m_accountLoginDelegate->loginAccountFailed)(
m_accountLoginDelegate,
4294967284LL);
return result;
}
v20 = (cocos2d::CCString *)sub_1007AB580("%i", v44);
v21 = cocos2d::CCString::getCString(v20);
v22 = strlen(v21);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_58:
sub_100006BF0(a3);
v23 = v22;
if ( v22 >= 0x17 )
{
v25 = 26;
if ( (v22 | 7) != 0x17 )
v25 = (v22 | 7) + 1;
v24 = (char *)operator new(v25);
__p = v24;
__dst = v25 + 1;
v48 = v23;
}
else
{
LOBYTE(__dst) = 2 * v22;
v24 = (char *)&__dst + 1;
if ( !v22 )
goto LABEL_31;
}
memmove(v24, v21, v23);
LABEL_31:
v24[v23] = 0;
v26 = __p;
v27 = *a2;
if ( (v27 & 1) != 0 )
{
v28 = *((_QWORD *)a2 + 1);
v29 = *((const void **)a2 + 2);
}
else
{
v28 = v27 >> 1;
v29 = __s1;
}
v30 = (unsigned __int8)__dst >> 1;
if ( (__dst & 1) != 0 )
{
v30 = v48;
v9 = (char *)__p;
}
v31 = v30 == v28;
if ( v30 >= v28 )
v30 = v28;
v32 = v31 & (memcmp(v29, v9, v30) == 0);
if ( (__dst & 1) != 0 )
operator delete(v26);
if ( v32 )
{
result = (unsigned int)v50;
v33 = v50->m_accountLoginDelegate;
if ( v33 )
return ((__int64 (__fastcall *)(GJAccountLoginDelegate *, __int64))v33->loginAccountFailed)(v33, 4294967283LL);
}
else
{
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
v34 = *a2 >> 1;
v35 = __s1;
if ( (*a2 & 1) != 0 )
{
v35 = *((const void **)a2 + 2);
v34 = *((_QWORD *)a2 + 1);
}
v36 = 2;
if ( v34 < 2 )
v36 = v34;
if ( (v34 != 2) | (memcmp(v35, (char *)&__dst + 1, v36) != 0)
&& (v37 = (cocos2d::CCArray *)sub_1000D2610(a2, ","), (unsigned int)sub_100720070(v37) > 1)
&& (v38 = cocos2d::CCArray::stringAtIndex(v37, 0),
v39 = cocos2d::CCString::intValue(v38),
v40 = cocos2d::CCArray::stringAtIndex(v37, 1u),
result = cocos2d::CCString::intValue(v40),
v39 > 0) )
{
v41 = v50->m_accountLoginDelegate;
if ( v50->m_accountID == 0 || v50->m_accountID == v39 )
{
if ( v41 )
return ((__int64 (__fastcall *)(GJAccountLoginDelegate *, _QWORD, _QWORD))v41->loginAccountFinished)(
v41,
(unsigned int)v39,
result);
}
else if ( v41 )
{
return ((__int64 (__fastcall *)(GJAccountLoginDelegate *, __int64))v41->loginAccountFailed)(v41, 4294967286LL);
}
}
else
{
result = (unsigned int)v50;
v42 = v50->m_accountLoginDelegate;
if ( v42 )
return ((__int64 (__fastcall *)(GJAccountLoginDelegate *, __int64))v42->loginAccountFailed)(v42, 0xFFFFFFFFLL);
}
}
return result;
}