//
// GJAccountManager::registerAccount from 0x845794 to 0x845a78 (740 bytes)
//
// 2 xrefs:
// > AccountRegisterLayer::onSubmit @ 0x84fb48
// > ??> @ 0x96f78
//
// 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::registerAccount(GJAccountManager *a1, const char **a2, __int64 *a3, __int64 *a4)
{
_BOOL4 isDLActive; // w1
__int64 result; // x0
__int64 v10; // x21
const char *v11; // x24
__int64 v12; // x23
cocos2d::CCString *v13; // x0
const char *CString; // x0
cocos2d::CCString *v15; // x0
char *v16; // x21
char *v17; // x0
char *v18; // x0
char *v19; // x0
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
const char *v26; // [xsp+70h] [xbp+70h] BYREF
const char *v27; // [xsp+78h] [xbp+78h] BYREF
const char *v28; // [xsp+80h] [xbp+80h] BYREF
isDLActive = GJAccountManager::isDLActive(a1, "reg_account");
result = 0;
if ( !isDLActive )
{
GJAccountManager::addDLToActive(a1, "reg_account");
v10 = *a4;
v11 = *a2;
v12 = *a3;
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfv",
"3899",
103,
99,
"9");
CString = cocos2d::CCString::getCString(v13);
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"userName=%s&password=%s&email=%s&secret=%s",
v11,
v12,
v10,
CString);
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_D153B8((int)&v26, "https://www.boomlings.com/database/accounts/registerGJAccount.php");
sub_D153B8((int)&v27, v16);
sub_D153B8((int)&v28, "RegisterAccount");
GJAccountManager::ProcessHttpRequest(a1, &v26, &v27, &v28, 22);
v17 = (char *)(v28 - 24);
if ( v28 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v28 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v17);
}
v18 = (char *)(v27 - 24);
if ( v27 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v27 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v18);
}
v19 = (char *)(v26 - 24);
if ( v26 - 24 == (const char *)&qword_124B6B0 )
return 1;
if ( &pthread_create )
{
v20 = (unsigned int *)(v26 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v21 - 1;
}
if ( v21 > 0 )
{
return 1;
}
else
{
operator delete(v19);
return 1;
}
}
return result;
}