//
// AccountLoginLayer::loginAccountFinished from 0x852200 to 0x85250c (780 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'AccountLoginLayer::loginAccountFinished @ 0x852514
// > ??> @ 0x6b8c8
// > ??> @ 0x118f4f0
//
// 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::loginAccountFinished(AccountLoginLayer *a1, int a2, int a3)
{
GJAccountManager *v6; // x25
char *v7; // x0
void *v8; // x0
cocos2d::CCString *v9; // x0
char *CString; // x24
char *v11; // x0
FLAlertLayer *v12; // x20
char *v13; // x0
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
__int64 v22; // [xsp+58h] [xbp+58h] BYREF
char *v23; // [xsp+60h] [xbp+60h] BYREF
v6 = GJAccountManager::sharedState();
sub_D18D28(&v22);
sub_D18D28(&v23);
GJAccountManager::linkToAccount((__int64)v6, (__int64)&v22, (__int64)&v23, a2, a3);
v7 = v23 - 24;
if ( v23 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v23 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v23 - 2);
*((_DWORD *)v23 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v7);
}
v8 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v22 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v8);
}
CCTextInputNode::getString(a1->m_usernameInput, (__int64)&v23);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Thank you for logging in.\n"
"You have now linked your account:\n"
"%s",
v23);
CString = (char *)cocos2d::CCString::getCString(v9);
v11 = v23 - 24;
if ( v23 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v23 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v23 - 2);
*((_DWORD *)v23 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v11);
}
AccountLoginLayer::hideLoadingUI(a1);
sub_D153B8((int)&v23, CString);
v12 = FLAlertLayer::create((int)a1 + 648, (__int64)"Login Success", (__int64)&v23);
v13 = v23 - 24;
if ( v23 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v23 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v23 - 2);
*((_DWORD *)v23 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v13);
}
v12->setTag(v12, 2);
v12->show(v12);
}