//
// UploadListPopup::init from 0xa7aa74 to 0xa7af98 (1316 bytes)
//
// 2 xrefs:
// > UploadListPopup::create @ 0xa7b078
// > ??> @ 0xac4b8
//
// 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 UploadListPopup::init(UploadListPopup *a1, GJLevelList *a2)
{
char v4; // w23
cocos2d::CCDirector *v6; // x0
cocos2d::CCLayer *v7; // x0
cocos2d::CCNode *v8; // x22
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x24
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCLabelBMFont *v11; // x25
void *v12; // x0
void (__fastcall *v13)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCMenu *v14; // x0
cocos2d::CCLayer *m_mainLayer; // x3
void *v16; // x0
TextArea *m_textArea; // x24
void (__fastcall *v18)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
LoadingCircle *v19; // x0
LoadingCircle *m_loadingCircle; // x0
cocos2d::CCSprite *m_sprite; // x24
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
GameLevelManager *v23; // x0
cocos2d::CCSprite *v24; // x0
CCMenuItemSpriteExtra *v25; // x0
cocos2d::CCMenu *m_buttonMenu; // x2
CCMenuItemSpriteExtra *m_backButton; // x24
cocos2d::CCMenu *v28; // x25
void (__fastcall *v29)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
cocos2d::CCDirector *v30; // x0
float v31; // s0
float v32; // s8
cocos2d::CCDirector *v33; // x0
float v34; // s0
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x2
int v38; // w1
float v39; // [xsp+68h] [xbp+68h]
float v40; // [xsp+6Ch] [xbp+6Ch]
cocos2d::CCPoint v41; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCRect v42; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v43; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v44; // 0:x2.16
cocos2d::CCRect v45; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v42.origin.x = -1.034e-25;
v4 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v42);
if ( v4 )
{
FLAlertLayer::incrementForcePrio(a1);
a1->m_levelList = a2;
cocos2d::CCObject::retain(a2);
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLayer::create();
a1->m_mainLayer = v7;
a1->addChild(a1, v7);
cocos2d::CCRect::CCRect(&v42, 0.0, 0.0, 80.0, 80.0);
v8 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square04_001.png",
(const char *)&v42,
v45);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v8->__vftable[1].~CCNode_0)(v8, 0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCNode *, void *))v8->__vftable[1].getTag)(v8, &unk_F14B18);
setContentSize = v8->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v42, 420.0, 300.0);
setContentSize(v8, (const cocos2d::CCSize *)&v42);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, -1);
setPosition = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v42.origin, v39 * 0.5, v40 * 0.5);
setPosition(v8, &v42.origin);
sub_D18D28(&v42);
v11 = cocos2d::CCLabelBMFont::create();
v12 = (void *)(*(_QWORD *)&v42.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v42.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(*(_QWORD *)&v42.origin - 8LL);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(*(_QWORD *)&v42.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v42.origin - 8LL) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v12);
}
a1->m_mainLayer->addChild(a1->m_mainLayer, v11);
v13 = v11->setPosition;
cocos2d::CCPoint::CCPoint(&v42.origin, v39 * 0.5, (float)((float)(v40 * 0.5) + 150.0) - 25.0);
v13(v11, &v42.origin);
v14 = cocos2d::CCMenu::create();
m_mainLayer = a1->m_mainLayer;
a1->m_buttonMenu = v14;
m_mainLayer->addChild_0(m_mainLayer, v14, 10);
sub_D153B8((int)&v42, "Please wait, uploading list...");
cocos2d::CCPoint::CCPoint(&v41, 0.5, 1.0);
a1->m_textArea = (TextArea *)TextArea::create((__int64)&v42, "chatFont.fnt", &v41, 0, 1.0, 400.0, 20.0);
v16 = (void *)(*(_QWORD *)&v42.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v42.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(*(_QWORD *)&v42.origin - 8LL);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(*(_QWORD *)&v42.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v42.origin - 8LL) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v16);
}
((void (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild)(a1->m_mainLayer);
m_textArea = a1->m_textArea;
v18 = m_textArea->setPosition;
cocos2d::CCPoint::CCPoint(&v42.origin, v39 * 0.5, (float)(v40 * 0.5) + -30.0);
v18(m_textArea, &v42.origin);
a1->m_joystickConnected = -1;
v19 = LoadingCircle::create();
a1->m_loadingCircle = v19;
v19->m_parentLayer = a1->m_mainLayer;
m_loadingCircle = a1->m_loadingCircle;
m_loadingCircle->m_fade = 0;
LoadingCircle::show(m_loadingCircle);
m_sprite = a1->m_loadingCircle->m_sprite;
v22 = m_sprite->setPosition;
cocos2d::CCPoint::CCPoint(&v42.origin, v39 * 0.5, (float)(v40 * 0.5) + 20.0);
v22(m_sprite, &v42.origin);
GameLevelManager::sharedState()->m_listUploadDelegate = &a1->ListUploadDelegate;
v23 = GameLevelManager::sharedState();
GameLevelManager::uploadLevelList(v23, a1->m_levelList);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v44.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v44.adj = (size_t)UploadListPopup::onBack;
v25 = CCMenuItemSpriteExtra::create(v24, nullptr, v44);
m_buttonMenu = a1->m_buttonMenu;
a1->m_backButton = v25;
m_buttonMenu->addChild(m_buttonMenu, v25);
m_backButton = a1->m_backButton;
v28 = a1->m_buttonMenu;
v29 = m_backButton->setPosition;
v30 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v30);
v32 = v31;
v33 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v33);
cocos2d::CCPoint::CCPoint(&v41, v32 + 40.0, v34 - 40.0);
v43 = cocos2d::CCNode::convertToNodeSpace(v28, &v41);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v29)(
m_backButton,
&v42,
v43.x,
v43.y);
}
return v4;
}