//
// AccountLayer::customSetup from 0x14007d710 to 0x14007de5b (1867 bytes)
//
// 2 xrefs:
// > ??> @ 0x14053b6e0
// > ??> @ 0x1406c68ac
//
// 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
//
// Hidden C++ exception states: #wind=2
void AccountLayer::customSetup(AccountLayer *a1)
{
char v2; // si
cocos2d::CCDirector *v3; // rax
cocos2d::CCLabelBMFont *v4; // rax
cocos2d::CCLabelBMFont_vtbl *v5; // rbx
const cocos2d::CCPoint *v6; // rax
const struct cocos2d::CCPoint *v7; // rax
char *v8; // rax
const cocos2d::CCPoint *v9; // rax
ButtonSprite *v10; // rax
CCMenuItemSpriteExtra *v11; // rax
ButtonSprite *v12; // rax
CCMenuItemSpriteExtra *v13; // rax
ButtonSprite *v14; // rax
cocos2d::CCNode *v15; // rbx
CCMenuItemSpriteExtra *v16; // rax
ButtonSprite *v17; // rax
CCMenuItemSpriteExtra *v18; // rax
ButtonSprite *v19; // rax
CCMenuItemSpriteExtra *v20; // rax
ButtonSprite *v21; // rax
CCMenuItemSpriteExtra *v22; // rax
GJAccountManager *v23; // rax
GJAccountManager *v24; // rax
bool v25; // al
LoadingCircle *v26; // rax
cocos2d::CCSprite *m_sprite; // rbx
cocos2d::CCSprite_vtbl *v28; // rdi
const cocos2d::CCPoint *v29; // rax
__int128 *v30; // [rsp+58h] [rbp-39h] BYREF
ButtonSprite *v31; // [rsp+60h] [rbp-31h] BYREF
struct cocos2d::CCPoint v32; // [rsp+68h] [rbp-29h] BYREF
float v33; // [rsp+70h] [rbp-21h]
float v34; // [rsp+74h] [rbp-1Dh]
__int128 v35; // [rsp+78h] [rbp-19h] BYREF
__int64 v36; // [rsp+88h] [rbp-9h]
__int64 v37; // [rsp+90h] [rbp-1h]
v2 = 0;
v32.x = 0.0;
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v3);
v4 = cocos2d::CCLabelBMFont::create(byte_140518980, "goldFont.fnt");
a1->m_linkedAccountTitle = v4;
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v4->setScale_0)(v4);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, a1->m_linkedAccountTitle);
v5 = a1->m_linkedAccountTitle->__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v30, v33 * 0.5, (float)(v34 * 0.5) + 87.0);
v5->setPosition_0(a1->m_linkedAccountTitle, v6);
v30 = &v35;
v35 = 0;
v36 = 1;
v37 = 15;
LOWORD(v35) = (unsigned __int8)asc_140518984[0];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.5, 1.0);
v8 = TextArea::create((__int64)&v35, &qword_14052A4D8, 1.0, 1000.0, v7, 1108082688, 0);
a1->m_textArea = (TextArea *)v8;
(*(void (__fastcall **)(char *))(*(_QWORD *)v8 + 160LL))(v8);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, a1->m_textArea);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, -17.0);
v9 = a1->m_linkedAccountTitle->getPosition_0(a1->m_linkedAccountTitle);
cocos2d::CCPoint::operator+(v9, &v30);
a1->m_textArea->setPosition_0(a1->m_textArea, (const cocos2d::CCPoint *)&v30);
v10 = ButtonSprite::create_1("Log in", 160, 0, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, a1, (cocos2d::SEL_MenuHandler *)AccountLayer::onLogin);
a1->m_loginButton = v11;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v11);
v12 = ButtonSprite::create_1("Register", 160, 0, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
v13 = CCMenuItemSpriteExtra::create(v12, nullptr, a1, (cocos2d::SEL_MenuHandler *)AccountLayer::onRegister);
a1->m_registerButton = v13;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v13);
v31 = (ButtonSprite *)operator new(0x2C0u);
v14 = ButtonSprite::ButtonSprite(v31);
v15 = v14;
if ( v14 )
{
if ( ButtonSprite::init_1(v14, "Save", 160, 0, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0) )
{
cocos2d::CCObject::autorelease(v15);
}
else
{
((void (__fastcall *)(cocos2d::CCNode *, __int64))v15->~CCNode)(v15, 1);
v15 = nullptr;
}
}
v16 = CCMenuItemSpriteExtra::create(v15, nullptr, a1, (cocos2d::SEL_MenuHandler *)AccountLayer::onBackup);
a1->m_backupButton = v16;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v16);
v17 = ButtonSprite::create_1("Load", 160, 0, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
v18 = CCMenuItemSpriteExtra::create(v17, nullptr, a1, (cocos2d::SEL_MenuHandler *)AccountLayer::onSync);
a1->m_syncButton = v18;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v18);
v19 = ButtonSprite::create_1("Help", 160, 0, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
v20 = CCMenuItemSpriteExtra::create(v19, nullptr, a1, (cocos2d::SEL_MenuHandler *)AccountLayer::onHelp);
a1->m_helpButton = v20;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v20);
v21 = ButtonSprite::create_1("More", 160, 0, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
v22 = CCMenuItemSpriteExtra::create(v21, nullptr, a1, (cocos2d::SEL_MenuHandler *)AccountLayer::onMore);
a1->m_moreButton = v22;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v22);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, v33 * 0.5, (float)(v34 * 0.5) + 30.0);
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, (const struct cocos2d::CCPoint *)&v30);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v32, &v30);
a1->m_loginButton->setPosition_0(a1->m_loginButton, (const cocos2d::CCPoint *)&v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, -90.0);
cocos2d::CCPoint::operator+(&v32, &v30);
a1->m_registerButton->setPosition_0(a1->m_registerButton, (const cocos2d::CCPoint *)&v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v32, &v30);
a1->m_backupButton->setPosition_0(a1->m_backupButton, (const cocos2d::CCPoint *)&v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, -45.0);
cocos2d::CCPoint::operator+(&v32, &v30);
a1->m_syncButton->setPosition_0(a1->m_syncButton, (const cocos2d::CCPoint *)&v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, -45.0);
cocos2d::CCPoint::operator+(&v32, &v30);
a1->m_helpButton->setPosition_0(a1->m_helpButton, (const cocos2d::CCPoint *)&v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, -90.0);
cocos2d::CCPoint::operator+(&v32, &v30);
a1->m_moreButton->setPosition_0(a1->m_moreButton, (const cocos2d::CCPoint *)&v30);
v23 = GJAccountManager::sharedState();
v25 = false;
if ( v23->m_accountID != v23->m_unkInt1 )
{
v24 = GJAccountManager::sharedState();
sub_14003BDB0((__int64)&v35, (__int64)&v24->m_GJP2);
v2 = 3;
if ( v36 )
v25 = true;
}
a1->m_isLoggedIn = v25;
if ( (v2 & 1) != 0 )
sub_14003A830((__int64)&v35);
AccountLayer::updatePage(a1, 0);
GJAccountManager::sharedState()->m_accountDelegate = &a1->GJAccountDelegate;
GJAccountManager::sharedState()->m_backupDelegate = &a1->GJAccountBackupDelegate;
GJAccountManager::sharedState()->m_syncDelegate = &a1->GJAccountSyncDelegate;
v26 = LoadingCircle::create();
a1->m_loadingCircle = v26;
v26->m_parentLayer = a1->m_mainLayer;
a1->m_loadingCircle->m_fade = 1;
cocos2d::CCObject::retain(a1->m_loadingCircle);
LoadingCircle::show(a1->m_loadingCircle);
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 0);
m_sprite = a1->m_loadingCircle->m_sprite;
v28 = m_sprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, v33 * 0.5, v34 * 0.5);
v28->setPosition_0(m_sprite, v29);
}