//
// AccountLoginLayer::loginAccountFinished from 0x10049a1a0 to 0x10049a419 (633 bytes)
//
// 2 xrefs:
// > sub_10049A500 @ 0x10049a50c
// > ??> @ 0x100944bb8
//
// 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 AccountLoginLayer::loginAccountFinished(AccountLoginLayer *a1, int a2, int a3)
{
__int128 v3; // xmm0
GJAccountManager *v5; // r12
cocos2d::CCString *v6; // rax
const char *CString; // r14
size_t v8; // rax
size_t v9; // r15
char *v10; // r12
size_t v11; // r13
__int64 v12; // rbx
char v13; // [rsp+0h] [rbp-A0h]
void *v14[3]; // [rsp+8h] [rbp-98h] BYREF
std::string v15; // [rsp+20h] [rbp-80h] BYREF
std::string v16; // [rsp+40h] [rbp-60h] BYREF
_QWORD __dst[2]; // [rsp+60h] [rbp-40h] BYREF
void *v18; // [rsp+70h] [rbp-30h]
v5 = GJAccountManager::sharedState();
if ( (a1->m_username.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v15, a1->m_username.m_data.m_long.longStorage, a1->m_username.m_data.m_long.size, *(double *)&v3);
if ( (a1->m_password.m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_3;
}
else
{
v15.__r_.__value_.__r.__words[2] = (std::string::size_type)a1->m_username.m_data.m_long.longStorage;
v3 = *(_OWORD *)&a1->m_username.m_data.m_short.sizex2;
*(_OWORD *)&v15.__r_.__value_.__l.0 = v3;
if ( (a1->m_password.m_data.m_short.sizex2 & 1) != 0 )
{
LABEL_3:
sub_100006B70(&v16, a1->m_password.m_data.m_long.longStorage, a1->m_password.m_data.m_long.size, *(double *)&v3);
goto LABEL_6;
}
}
v16.__r_.__value_.__r.__words[2] = (std::string::size_type)a1->m_password.m_data.m_long.longStorage;
v3 = *(_OWORD *)&a1->m_password.m_data.m_short.sizex2;
*(_OWORD *)&v16.__r_.__value_.__l.0 = v3;
LABEL_6:
GJAccountManager::linkToAccount((__int64)v5, &v15, &v16, a2, a3, *(double *)&v3);
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v16.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v15.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v15.__r_.__value_.__l.__data_);
CCTextInputNode::getString(v14, (__int64)a1->m_usernameInput, *(double *)&v3);
v6 = (cocos2d::CCString *)sub_1007AB580(
"Thank you for logging in.\nYou have now linked your account:\n%s",
v13);
CString = cocos2d::CCString::getCString(v6);
if ( ((__int64)v14[0] & 1) != 0 )
operator delete(v14[2]);
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->m_buttonMenu->setEnabled)(a1->m_buttonMenu, 1);
((void (__fastcall *)(CCTextInputNode *, __int64))a1->m_usernameInput->setTouchEnabled)(a1->m_usernameInput, 1);
((void (__fastcall *)(CCTextInputNode *, __int64))a1->m_passwordInput->setTouchEnabled)(a1->m_passwordInput, 1);
((void (__fastcall *)(AccountLoginLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(AccountLoginLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 0);
v8 = strlen(CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&v3);
v9 = v8;
if ( v8 >= 0x17 )
{
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
v10 = (char *)operator new(v11);
v18 = v10;
__dst[0] = v11 + 1;
__dst[1] = v9;
goto LABEL_19;
}
LOBYTE(__dst[0]) = 2 * v8;
v10 = (char *)__dst + 1;
if ( v8 )
LABEL_19:
memmove(v10, CString, v9);
v10[v9] = 0;
v12 = FLAlertLayer::create_1(&a1->FLAlertLayerProtocol, "Login Success", __dst, "OK", 0, 320.0);
if ( (__dst[0] & 1) != 0 )
operator delete(v18);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 72LL))(v12, 2);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 1288LL))(v12);
}