//
// UploadListPopup::init from 0x1003638d0 to 0x100363d62 (1170 bytes)
//
// 1 xrefs:
// > UploadListPopup::create @ 0x1003634b0
//
// 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
//
bool __fastcall UploadListPopup::init(UploadListPopup *a1, GJLevelList *a2)
{
bool result; // al
bool v4; // r13
cocos2d::CCLayer *v5; // rax
cocos2d::extension::CCScale9Sprite *v6; // r14
double v7; // xmm0_8
GJLevelList *m_levelList; // rax
std::string *p_m_listName; // rax
const char *v10; // rdi
cocos2d::CCLabelBMFont *v11; // r14
cocos2d::CCMenu *v12; // rax
TextArea *m_textArea; // rax
TextArea *v14; // r14
LoadingCircle *v15; // rax
cocos2d::CCSprite *m_sprite; // r14
GameLevelManager *v17; // rax
cocos2d::CCSprite *v18; // rax
CCMenuItemSpriteExtra *v19; // rax
CCMenuItemSpriteExtra *m_backButton; // r14
cocos2d::CCMenu *m_buttonMenu; // rbx
cocos2d::CCDirector *v22; // rax
cocos2d::CCDirector *v23; // rax
double v24; // xmm0_8
float v25; // [rsp+8h] [rbp-78h] BYREF
__int128 v26; // [rsp+10h] [rbp-70h] BYREF
void *v27; // [rsp+20h] [rbp-60h]
float v28; // [rsp+2Ch] [rbp-54h]
__int128 v29; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
float v31; // [rsp+50h] [rbp-30h] BYREF
float v32; // [rsp+54h] [rbp-2Ch]
double v33; // 0:xmm0_8.8
double v34; // 0:xmm0_8.8
cocos2d::CCRect v35; // 0:xmm0_8.8,8:xmm1_8.8
LODWORD(v29) = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)&v29);
if ( !result )
return result;
v4 = result;
FLAlertLayer::incrementForcePrio(a1);
a1->m_levelList = a2;
cocos2d::CCObject::retain(a2);
((void (__fastcall *)(UploadListPopup *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(UploadListPopup *, __int64))a1->setKeypadEnabled)(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v33 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v31);
v5 = cocos2d::CCLayer::create();
a1->m_mainLayer = v5;
((void (__fastcall *)(UploadListPopup *, cocos2d::CCLayer *, double))a1->addChild)(a1, v5, v33);
v35.origin = 0;
v35.size = 0;
sub_10028CC00((__int64)&v29, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v6 = cocos2d::extension::CCScale9Sprite::create_2("square04_001.png", v35);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v6->setOpacity)(v6, 255);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void *))v6->setColor)(v6, &unk_100819D34);
sub_10028CBF0((float *)&v29, 420.0, 300.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int128 *))v6->setContentSize)(v6, &v29);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v6,
0xFFFFFFFFLL);
*(_QWORD *)&v7 = LODWORD(v31);
*(float *)&v7 = v31 * 0.5;
sub_10028CBE0((float *)&v29, v31 * 0.5, v32 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int128 *))v6->setPosition)(v6, &v29);
m_levelList = a1->m_levelList;
if ( (m_levelList->m_listName.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v29,
m_levelList->m_listName.m_data.m_long.longStorage,
m_levelList->m_listName.m_data.m_long.size,
v7);
if ( (v29 & 1) == 0 )
goto LABEL_4;
LABEL_6:
v10 = (const char *)__p;
goto LABEL_7;
}
p_m_listName = &m_levelList->m_listName;
__p = p_m_listName->m_data.m_long.longStorage;
v29 = *(_OWORD *)&p_m_listName->m_data.m_short.sizex2;
if ( (v29 & 1) != 0 )
goto LABEL_6;
LABEL_4:
v10 = (char *)&v29 + 1;
LABEL_7:
v11 = cocos2d::CCLabelBMFont::create_3(v10, "goldFont.fnt");
if ( (v29 & 1) != 0 )
operator delete(__p);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v11);
sub_10028CBE0((float *)&v29, v31 * 0.5, (float)((float)(v32 * 0.5) + 150.0) + -25.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v11->setPosition)(v11, &v29);
v12 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v12;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v12,
10);
v27 = operator new(0x20u);
*(_QWORD *)&v26 = 33;
*((_QWORD *)&v26 + 1) = 30;
strcpy((char *)v27, "Please wait, uploading list...");
sub_10028CBE0((float *)&v29, 0.5, 1.0);
m_textArea = (TextArea *)TextArea::create(&v26, (__int64)"chatFont.fnt", (double *)&v29, 0, 1.0, 400.0, 20.0);
a1->m_textArea = m_textArea;
if ( (v26 & 1) != 0 )
{
operator delete(v27);
m_textArea = a1->m_textArea;
}
((void (__fastcall *)(cocos2d::CCLayer *, TextArea *))a1->m_mainLayer->addChild)(a1->m_mainLayer, m_textArea);
v14 = a1->m_textArea;
sub_10028CBE0((float *)&v29, v31 * 0.5, (float)(v32 * 0.5) + -30.0);
((void (__fastcall *)(TextArea *, __int128 *))v14->setPosition)(v14, &v29);
a1->m_joystickConnected = -1;
v15 = LoadingCircle::create();
a1->m_loadingCircle = v15;
v15->m_parentLayer = a1->m_mainLayer;
v15->m_fade = 0;
LoadingCircle::show(v15);
m_sprite = a1->m_loadingCircle->m_sprite;
sub_10028CBE0((float *)&v29, v31 * 0.5, (float)(0.5 * v32) + 20.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int128 *))m_sprite->setPosition)(m_sprite, &v29);
GameLevelManager::sharedState()->m_listUploadDelegate = &a1->ListUploadDelegate;
v17 = GameLevelManager::sharedState();
GameLevelManager::uploadLevelList(v17, a1->m_levelList);
v18 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v19 = CCMenuItemSpriteExtra::create(
v18,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)UploadListPopup::onBack);
a1->m_backButton = v19;
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v19);
m_backButton = a1->m_backButton;
m_buttonMenu = a1->m_buttonMenu;
v22 = cocos2d::CCDirector::sharedDirector();
v28 = sub_100484D90(v22) + 40.0;
v23 = cocos2d::CCDirector::sharedDirector();
v24 = sub_100484D70(v23);
sub_10028CBE0(&v25, v28, *(float *)&v24 + -40.0);
*(cocos2d::CCPoint *)&v34 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v29,
(const cocos2d::CCPoint *)m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int128 *, double))m_backButton->setPosition)(m_backButton, &v29, v34);
return v4;
}