//
// AccountRegisterLayer::onSubmit from 0x84f8a4 to 0x85008c (2024 bytes)
//
// 3 xrefs:
// > ??> @ 0x93c90
// > AccountRegisterLayer::init @ 0x84e55c
// > ??> @ 0x122d0d8
//
// 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
//
void AccountRegisterLayer::onSubmit(AccountRegisterLayer *a1, cocos2d::CCObject *a2)
{
_BOOL4 valid; // w23
void *v4; // x0
_DWORD *v5; // x1
char *v6; // x0
char *v7; // x0
char *v8; // x0
char *v9; // x0
void *v10; // x0
_BOOL4 v11; // w23
void *v12; // x0
unsigned __int64 v13; // x23
unsigned __int64 v14; // x24
size_t v15; // x2
unsigned __int64 v16; // x23
_BOOL4 v17; // w23
char *v18; // x0
unsigned __int64 v19; // x23
unsigned __int64 v20; // x25
size_t v21; // x2
unsigned __int64 v22; // x23
GJAccountManager *v23; // x26
int v24; // w23
void *v25; // x0
void *v26; // x0
char *v27; // x0
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
__int64 v50; // [xsp+60h] [xbp+60h] BYREF
void *v51; // [xsp+68h] [xbp+68h] BYREF
void *v52; // [xsp+70h] [xbp+70h] BYREF
void *v53; // [xsp+78h] [xbp+78h] BYREF
void *v54; // [xsp+80h] [xbp+80h] BYREF
__int64 v55; // [xsp+88h] [xbp+88h] BYREF
__int64 v56; // [xsp+90h] [xbp+90h] BYREF
char *v57; // [xsp+98h] [xbp+98h] BYREF
__int64 v58; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v59; // [xsp+A8h] [xbp+A8h] BYREF
const char *v60; // [xsp+B0h] [xbp+B0h] BYREF
AccountRegisterLayer::resetLabels(a1);
AccountRegisterLayer::disableNodes(a1);
CCTextInputNode::getString(a1->m_usernameField, (__int64)&v50);
CCTextInputNode::getString(a1->m_passwordField, (__int64)&v51);
CCTextInputNode::getString(a1->m_confirmPasswordField, (__int64)&v52);
CCTextInputNode::getString(a1->m_emailField, (__int64)&v53);
CCTextInputNode::getString(a1->m_verifyEmailField, (__int64)&v54);
sub_D18D28(&v55);
valid = AccountRegisterLayer::validUser((__int64)a1, &v55);
v4 = (void *)(v55 - 24);
if ( (__int64 *)(v55 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v55 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(_DWORD *)(v55 - 8);
*(_DWORD *)(v55 - 8) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v4);
}
if ( !valid )
{
AccountRegisterLayer::updateLabel(a1, TooShortLessThan3);
goto LABEL_4;
}
sub_D18D28(&v56);
v11 = AccountRegisterLayer::validPassword((__int64)a1, &v56);
v12 = (void *)(v56 - 24);
if ( (__int64 *)(v56 - 24) == &qword_124B6B0 )
goto LABEL_11;
if ( &pthread_create )
{
v32 = (unsigned int *)(v56 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v56 - 8);
*(_DWORD *)(v56 - 8) = v33 - 1;
}
if ( v33 > 0 )
{
LABEL_11:
if ( !v11 )
goto LABEL_31;
LABEL_12:
v13 = *((_QWORD *)v51 - 3);
v14 = *((_QWORD *)v52 - 3);
if ( v14 > v13 )
v15 = *((_QWORD *)v51 - 3);
else
v15 = *((_QWORD *)v52 - 3);
if ( memcmp(v51, v52, v15) || (v16 = v13 - v14, v16 + 0x80000000 > 0xFFFFFFFF) || (_DWORD)v16 )
{
AccountRegisterLayer::updateLabel(a1, PasswordsDoNotMatch);
}
else
{
sub_D18D28(&v57);
v17 = AccountRegisterLayer::validEmail((__int64)a1, &v57);
v18 = v57 - 24;
if ( v57 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v57 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v57 - 2);
*((_DWORD *)v57 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v18);
}
if ( v17 )
{
v19 = *((_QWORD *)v53 - 3);
v20 = *((_QWORD *)v54 - 3);
if ( v20 > v19 )
v21 = *((_QWORD *)v53 - 3);
else
v21 = *((_QWORD *)v54 - 3);
if ( memcmp(v53, v54, v21) || (v22 = v19 - v20, v22 + 0x80000000 > 0xFFFFFFFF) || (_DWORD)v22 )
{
AccountRegisterLayer::updateLabel(a1, EmailsDoNotMatch);
}
else
{
GJAccountManager::sharedState()->m_accountRegisterDelegate = &a1->GJAccountRegisterDelegate;
v23 = GJAccountManager::sharedState();
sub_D18D28(&v60);
CCTextInputNode::getString(a1->m_passwordField, (__int64)&v58);
CCTextInputNode::getString(a1->m_emailField, (__int64)&v59);
v24 = (unsigned __int8)GJAccountManager::registerAccount(v23, &v60, &v58, &v59);
v25 = (void *)(v59 - 24);
if ( (__int64 *)(v59 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v59 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(v59 - 8);
*(_DWORD *)(v59 - 8) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v25);
}
v26 = (void *)(v58 - 24);
if ( (__int64 *)(v58 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v58 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(v58 - 8);
*(_DWORD *)(v58 - 8) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v26);
}
v27 = (char *)(v60 - 24);
if ( v60 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v60 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v60 - 2);
*((_DWORD *)v60 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v27);
}
if ( v24 )
AccountRegisterLayer::showLoadingUI(a1);
else
a1->registerAccountFailed(a1, AlreadyUsedUsername|0x1);
}
}
else
{
AccountRegisterLayer::updateLabel(a1, InvalidEmail);
}
}
LABEL_4:
v5 = v54;
v6 = (char *)v54 - 24;
if ( (char *)v54 - 24 == (char *)&qword_124B6B0 )
goto LABEL_5;
goto LABEL_32;
}
operator delete(v12);
if ( v11 )
goto LABEL_12;
LABEL_31:
AccountRegisterLayer::updateLabel(a1, TooShortLessThan6);
v5 = v54;
v6 = (char *)v54 - 24;
if ( (char *)v54 - 24 == (char *)&qword_124B6B0 )
goto LABEL_5;
LABEL_32:
if ( &pthread_create )
{
v28 = v5 - 2;
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(v5 - 2);
*(v5 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v6);
LABEL_5:
v7 = (char *)v53 - 24;
if ( (char *)v53 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)((char *)v53 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)v53 - 2);
*((_DWORD *)v53 - 2) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v7);
}
v8 = (char *)v52 - 24;
if ( (char *)v52 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)((char *)v52 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *((_DWORD *)v52 - 2);
*((_DWORD *)v52 - 2) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v8);
}
v9 = (char *)v51 - 24;
if ( (char *)v51 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)((char *)v51 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v51 - 2);
*((_DWORD *)v51 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v9);
}
v10 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(v50 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v10);
}
}