//
// UpdateAccountSettingsPopup::init from 0x8ca100 to 0x8ca9e8 (2280 bytes)
//
// 2 xrefs:
// > UpdateAccountSettingsPopup::create @ 0x8cabc4
// > ??> @ 0x5a4b0
//
// 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
//
__int64 __fastcall UpdateAccountSettingsPopup::init(
__int64 a1,
__int64 a2,
unsigned int a3,
unsigned int a4,
unsigned int a5)
{
unsigned __int8 v8; // w0
unsigned int v9; // w21
cocos2d::CCDirector *v11; // x0
cocos2d::CCLayer *v12; // x0
__int64 v13; // x28
cocos2d::CCMenu *v14; // x0
__int64 v15; // x3
void *v16; // x0
LoadingCircle *v17; // x0
LoadingCircle *v18; // x0
int updated; // w26
void *v20; // x0
void *v21; // x0
void *v22; // x0
void *v23; // x0
void *v24; // x0
char *v25; // x0
void *v26; // x24
cocos2d::CCSprite *v27; // x22
CCMenuItemSpriteExtra *v28; // x0
__int64 v29; // x22
cocos2d::CCNode *v30; // x25
void (__fastcall *v31)(__int64, cocos2d::CCRect *, float, float); // x24
unsigned int *v32; // x22
int v33; // w0
unsigned int *v34; // x2
int v35; // w1
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
__int64 v48; // [xsp+90h] [xbp+70h]
__int64 v49; // [xsp+90h] [xbp+70h]
void (__fastcall *v50)(__int64, cocos2d::CCRect *); // [xsp+98h] [xbp+78h]
void (__fastcall *v51)(__int64, cocos2d::CCRect *); // [xsp+98h] [xbp+78h]
GJAccountManager *v52; // [xsp+98h] [xbp+78h]
void (__fastcall *v53)(__int64, cocos2d::CCRect *); // [xsp+A8h] [xbp+88h]
void (__fastcall *v54)(__int64, cocos2d::CCRect *); // [xsp+A8h] [xbp+88h]
float v57; // [xsp+F0h] [xbp+D0h]
float v58; // [xsp+F4h] [xbp+D4h]
__int64 v59; // [xsp+F8h] [xbp+D8h] BYREF
char *v60; // [xsp+100h] [xbp+E0h] BYREF
__int64 v61; // [xsp+108h] [xbp+E8h] BYREF
__int64 v62; // [xsp+110h] [xbp+F0h] BYREF
__int64 v63; // [xsp+118h] [xbp+F8h] BYREF
cocos2d::CCPoint v64; // [xsp+120h] [xbp+100h] BYREF
cocos2d::CCRect v65; // [xsp+128h] [xbp+108h] BYREF
cocos2d::CCPoint v66; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v67; // 0:x2.16
cocos2d::CCRect v68; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v65.origin.x = -1.034e-25;
v8 = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const cocos2d::_ccColor4B *)&v65);
v9 = v8;
if ( v8 )
{
FLAlertLayer::incrementForcePrio((FLAlertLayer *)a1);
*(_QWORD *)(a1 + 648) = a2;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 984LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1056LL))(a1, 1);
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v11);
v12 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 576) = v12;
(*(void (__fastcall **)(__int64, cocos2d::CCLayer *))(*(_QWORD *)a1 + 440LL))(a1, v12);
cocos2d::CCRect::CCRect(&v65, 0.0, 0.0, 80.0, 80.0);
v13 = cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square02.png",
(const char *)&v65,
v68);
v53 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v13 + 304LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v65, 200.0, 100.0);
v53(v13, &v65);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
v13,
0xFFFFFFFFLL);
v54 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v13 + 184LL);
cocos2d::CCPoint::CCPoint(&v65.origin, v57 * 0.5, v58 * 0.5);
v54(v13, &v65);
v14 = cocos2d::CCMenu::create();
v15 = *(_QWORD *)(a1 + 576);
*(_QWORD *)(a1 + 544) = v14;
(*(void (__fastcall **)(__int64, cocos2d::CCMenu *, __int64))(*(_QWORD *)v15 + 448LL))(v15, v14, 10);
sub_D153B8((int)&v65, "Updating...");
cocos2d::CCPoint::CCPoint(&v64, 0.5, 1.0);
*(_QWORD *)(a1 + 656) = TextArea::create((__int64)&v65, "chatFont.fnt", &v64, 0, 1.0, 400.0, 20.0);
v16 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v16);
}
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 576) + 440LL))(*(_QWORD *)(a1 + 576));
v48 = *(_QWORD *)(a1 + 656);
v50 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v48 + 184LL);
cocos2d::CCPoint::CCPoint(&v65.origin, v57 * 0.5, (float)(v58 * 0.5) + -20.0);
v50(v48, &v65);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 656) + 160LL))(*(_QWORD *)(a1 + 656), 0.8);
*(_DWORD *)(a1 + 624) = -1;
v17 = LoadingCircle::create();
*(_QWORD *)(a1 + 664) = v17;
v17->m_parentLayer = *(cocos2d::CCLayer **)(a1 + 576);
v18 = *(LoadingCircle **)(a1 + 664);
v18->m_fade = 0;
LoadingCircle::show(v18);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 664) + 160LL))(*(_QWORD *)(a1 + 664), 0.7);
v49 = *(_QWORD *)(*(_QWORD *)(a1 + 664) + 544LL);
v51 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v49 + 184LL);
cocos2d::CCPoint::CCPoint(&v65.origin, v57 * 0.5, (float)(v58 * 0.5) + 10.0);
v51(v49, &v65);
GJAccountManager::sharedState()->m_accountSettingsDelegate = (GJAccountSettingsDelegate *)(a1 + 632);
v52 = GJAccountManager::sharedState();
sub_D18D28(&v59);
sub_D18D28(&v60);
sub_D18D28(&v61);
sub_D18D28(&v62);
sub_D18D28(&v63);
sub_D18D28(&v64);
sub_D18D28(&v65);
updated = (unsigned __int8)GJAccountManager::updateAccountSettings(
v52,
a3,
a4,
a5,
&v59,
(__int64 *)&v60,
&v61,
&v62,
&v63,
(__int64 *)&v64,
(__int64 *)&v65);
v20 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v20);
}
v21 = (void *)(*(_QWORD *)&v64 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v64 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(*(_QWORD *)&v64 - 8LL);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(*(_QWORD *)&v64 - 8LL);
*(_DWORD *)(*(_QWORD *)&v64 - 8LL) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v21);
}
v22 = (void *)(v63 - 24);
if ( (__int64 *)(v63 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(v63 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(v63 - 8);
*(_DWORD *)(v63 - 8) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v22);
}
v23 = (void *)(v62 - 24);
if ( (__int64 *)(v62 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v62 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(_DWORD *)(v62 - 8);
*(_DWORD *)(v62 - 8) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v23);
}
v24 = (void *)(v61 - 24);
if ( (__int64 *)(v61 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v61 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(v61 - 8);
*(_DWORD *)(v61 - 8) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v24);
}
v25 = v60 - 24;
if ( v60 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v60 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *((_DWORD *)v60 - 2);
*((_DWORD *)v60 - 2) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v25);
}
v26 = (void *)(v59 - 24);
if ( (__int64 *)(v59 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v59 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v59 - 8);
*(_DWORD *)(v59 - 8) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v26);
}
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v27->setScale(v27, 0.6);
v67.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v67.adj = (size_t)UpdateAccountSettingsPopup::onClose;
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, v67);
*(_QWORD *)(a1 + 672) = v28;
CCMenuItemSpriteExtra::setSizeMult(v28, 1.6);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 544) + 440LL))(
*(_QWORD *)(a1 + 544),
*(_QWORD *)(a1 + 672));
v29 = *(_QWORD *)(a1 + 672);
v30 = *(cocos2d::CCNode **)(a1 + 544);
v31 = *(void (__fastcall **)(__int64, cocos2d::CCRect *, float, float))(*(_QWORD *)v29 + 184LL);
cocos2d::CCPoint::CCPoint(
&v64,
(float)((float)(v57 * 0.5) + -100.0) + 5.0,
(float)((float)(v58 * 0.5) + 50.0) - 5.0);
v66 = cocos2d::CCNode::convertToNodeSpace(v30, &v64);
v31(v29, &v65, v66.x, v66.y);
if ( !updated )
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1304LL))(a1);
}
return v9;
}