//
// AccountLoginLayer::onSubmit from 0x851d7c to 0x852198 (1052 bytes)
//
// 3 xrefs:
// > ??> @ 0xba708
// > AccountLoginLayer::init @ 0x85101c
// > ??> @ 0x122e750
//
// 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 AccountLoginLayer::onSubmit(AccountLoginLayer *a1, cocos2d::CCObject *a2)
{
std::string *p_m_username; // x24
void *v4; // x0
void *v5; // x0
void *v6; // x0
void *v7; // x0
GJAccountManager *v8; // x26
int v9; // w23
void *v10; // x0
void *v11; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
__int64 v24; // [xsp+58h] [xbp+58h] BYREF
__int64 v25; // [xsp+60h] [xbp+60h] BYREF
p_m_username = &a1->m_username;
AccountLoginLayer::resetLabels(a1);
AccountLoginLayer::disableNodes(a1);
CCTextInputNode::getString(a1->m_usernameInput, (__int64)&v25);
sub_D163D4(p_m_username, &v25);
v4 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v25 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v4);
}
CCTextInputNode::getString(a1->m_passwordInput, (__int64)&v25);
sub_D163D4(&a1->m_password, &v25);
v5 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v25 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v5);
}
if ( *((_QWORD *)a1->m_username.m_data.m_data - 3) <= 2u )
{
AccountLoginLayer::updateLabel(a1, TooShortLessThan3);
}
else if ( *((_QWORD *)a1->m_password.m_data.m_data - 3) <= 5u )
{
AccountLoginLayer::updateLabel(a1, TooShortLessThan6);
}
else
{
GJAccountManager::sharedState()->m_accountLoginDelegate = &a1->GJAccountLoginDelegate;
sub_D18D28(&v24);
GJAccountManager::getShaPassword((__int64)&v25);
sub_D163D4(&a1->m_password, &v25);
v6 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v25 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v6);
}
v7 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v24 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v7);
}
v8 = GJAccountManager::sharedState();
sub_D18D28(&v24);
sub_D18D28(&v25);
v9 = (unsigned __int8)GJAccountManager::loginAccount(v8, &v24, &v25);
v10 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v25 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v10);
}
v11 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v24 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v11);
}
if ( v9 )
AccountLoginLayer::showLoadingUI(a1);
else
a1->loginAccountFailed(a1, AlreadyUsedUsername|0x1);
}
}