//
// AccountRegisterLayer::onSubmit from 0x100081ab4 to 0x100081e0c (856 bytes)
//
// 1 xrefs:
// > AccountRegisterLayer::init @ 0x1000811e4
//
// 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 __fastcall AccountRegisterLayer::onSubmit(AccountRegisterLayer *a1, cocos2d::CCObject *a2)
{
__int128 v3; // kr00_16
cocos2d::CCLabelBMFont **p_m_usernameLabel; // x8
__int128 v5; // kr10_16
GJAccountManager *v6; // x20
void *v7; // x20
unsigned __int8 v8; // w21
int v9; // w20
void *v10[2]; // [xsp+0h] [xbp-150h] BYREF
char v11; // [xsp+17h] [xbp-139h]
void *v12[2]; // [xsp+18h] [xbp-138h] BYREF
char v13; // [xsp+2Fh] [xbp-121h]
void *v14[2]; // [xsp+30h] [xbp-120h] BYREF
__int64 v15; // [xsp+40h] [xbp-110h]
char __s[16]; // [xsp+50h] [xbp-100h] BYREF
__int64 v17; // [xsp+60h] [xbp-F0h]
__int128 v18; // [xsp+70h] [xbp-E0h] BYREF
__int64 v19; // [xsp+80h] [xbp-D0h]
__int128 __dst; // [xsp+90h] [xbp-C0h] BYREF
__int64 v21; // [xsp+A0h] [xbp-B0h]
void *__p[2]; // [xsp+A8h] [xbp-A8h] BYREF
char v23; // [xsp+BFh] [xbp-91h]
__int128 v24; // [xsp+C0h] [xbp-90h] BYREF
__int64 v25; // [xsp+D0h] [xbp-80h]
void *v26[2]; // [xsp+D8h] [xbp-78h] BYREF
char v27; // [xsp+EFh] [xbp-61h]
__int128 v28; // [xsp+F0h] [xbp-60h] BYREF
__int64 v29; // [xsp+100h] [xbp-50h]
__int128 v30; // [xsp+108h] [xbp-48h] BYREF
__int64 v31; // [xsp+118h] [xbp-38h]
AccountRegisterLayer::resetLabels(a1);
AccountRegisterLayer::disableNodes(a1);
CCTextInputNode::getString(&v30, a1->m_usernameField);
CCTextInputNode::getString(&v28, a1->m_passwordField);
CCTextInputNode::getString(v26, a1->m_confirmPasswordField);
CCTextInputNode::getString(&v24, a1->m_emailField);
CCTextInputNode::getString(__p, a1->m_verifyEmailField);
if ( SHIBYTE(v31) < 0 )
{
sub_1000097D0(&__dst, (void *)v30, *((unsigned __int64 *)&v30 + 1));
}
else
{
__dst = v30;
v21 = v31;
}
if ( (SHIBYTE(v21) & 0x80000000) == 0 )
{
if ( HIBYTE(v21) > 2u )
goto LABEL_6;
LABEL_9:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_usernameLabel->setString)(
a1->m_usernameLabel,
"Too short. Minimum 3 characters");
p_m_usernameLabel = &a1->m_usernameLabel;
LABEL_28:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))(*p_m_usernameLabel)->setColor)(
*p_m_usernameLabel,
&unk_1006365E5);
goto LABEL_29;
}
v3 = __dst;
operator delete((void *)__dst);
if ( *((_QWORD *)&v3 + 1) <= 2u )
goto LABEL_9;
LABEL_6:
if ( SHIBYTE(v29) < 0 )
{
sub_1000097D0(&v18, (void *)v28, *((unsigned __int64 *)&v28 + 1));
}
else
{
v18 = v28;
v19 = v29;
}
if ( (SHIBYTE(v19) & 0x80000000) == 0 )
{
if ( HIBYTE(v19) > 5u )
goto LABEL_13;
goto LABEL_17;
}
v5 = v18;
operator delete((void *)v18);
if ( *((_QWORD *)&v5 + 1) <= 5u )
{
LABEL_17:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_passwordLabel->setString)(
a1->m_passwordLabel,
"Too short. Minimum 6 characters");
p_m_usernameLabel = &a1->m_passwordLabel;
goto LABEL_28;
}
LABEL_13:
if ( !sub_1000045BC(&v28, v26) )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_confirmPasswordLabel->setString)(
a1->m_confirmPasswordLabel,
"Passwords do not match");
p_m_usernameLabel = &a1->m_confirmPasswordLabel;
goto LABEL_28;
}
if ( SHIBYTE(v25) < 0 )
{
sub_1000097D0(__s, (void *)v24, *((unsigned __int64 *)&v24 + 1));
}
else
{
*(_OWORD *)__s = v24;
v17 = v25;
}
if ( (SHIBYTE(v17) & 0x80000000) == 0 )
{
if ( ((unsigned __int8)sub_100080E08(__s) & 1) != 0 )
goto LABEL_22;
goto LABEL_26;
}
v7 = *(void **)__s;
v8 = (unsigned __int8)sub_100080E08(*(const char **)__s);
operator delete(v7);
if ( (v8 & 1) == 0 )
{
LABEL_26:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_emailLabel->setString)(
a1->m_emailLabel,
"Email is invalid");
p_m_usernameLabel = &a1->m_emailLabel;
goto LABEL_28;
}
LABEL_22:
if ( !sub_1000045BC(&v24, __p) )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_verifyEmailLabel->setString)(
a1->m_verifyEmailLabel,
"Emails do not match");
p_m_usernameLabel = &a1->m_verifyEmailLabel;
goto LABEL_28;
}
GJAccountManager::sharedState()->m_accountRegisterDelegate = &a1->GJAccountRegisterDelegate;
v6 = GJAccountManager::sharedState();
if ( SHIBYTE(v31) < 0 )
{
sub_1000097D0(v14, (void *)v30, *((unsigned __int64 *)&v30 + 1));
}
else
{
*(_OWORD *)v14 = v30;
v15 = v31;
}
CCTextInputNode::getString(v12, a1->m_passwordField);
CCTextInputNode::getString(v10, a1->m_emailField);
v9 = GJAccountManager::registerAccount(v6, v14, v12, v10);
if ( v11 < 0 )
operator delete(v10[0]);
if ( v13 < 0 )
operator delete(v12[0]);
if ( SHIBYTE(v15) < 0 )
operator delete(v14[0]);
if ( v9 )
AccountRegisterLayer::showLoadingUI(a1);
else
((void (__fastcall *)(AccountRegisterLayer *, __int64))a1->registerAccountFailed)(a1, 0xFFFFFFFFLL);
LABEL_29:
if ( v23 < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v25) < 0 )
operator delete((void *)v24);
if ( v27 < 0 )
operator delete(v26[0]);
if ( SHIBYTE(v29) < 0 )
operator delete((void *)v28);
if ( SHIBYTE(v31) < 0 )
operator delete((void *)v30);
}