//
// UploadPopup::init from 0x6e50dc to 0x6e56a4 (1480 bytes)
//
// 2 xrefs:
// > UploadPopup::create @ 0x6e5784
// > ??> @ 0x7ace8
//
// 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 UploadPopup::init(UploadPopup *a1, GJGameLevel *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 *); // x27
cocos2d::CCMenu *v14; // x0
cocos2d::CCLayer *m_mainLayer; // x3
void *v16; // x0
TextArea *m_textArea; // x25
void (__fastcall *v18)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
LoadingCircle *v19; // x0
LoadingCircle *m_loadingCircle; // x0
cocos2d::CCSprite *m_sprite; // x25
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
TextArea *v23; // x25
void *v24; // x0
unsigned int *v25; // x1
int v26; // w2
GameLevelManager *v27; // x0
cocos2d::CCSprite *v28; // x0
CCMenuItemSpriteExtra *v29; // x0
cocos2d::CCMenu *m_buttonMenu; // x2
CCMenuItemSpriteExtra *m_backButton; // x24
cocos2d::CCMenu *v32; // x25
void (__fastcall *v33)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
cocos2d::CCDirector *v34; // x0
float v35; // s0
float v36; // s8
cocos2d::CCDirector *v37; // x0
float v38; // s0
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x2
int v42; // w1
float v43; // [xsp+68h] [xbp+68h]
float v44; // [xsp+6Ch] [xbp+6Ch]
cocos2d::CCPoint v45; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCRect v46; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v47; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v48; // 0:x2.16
cocos2d::CCRect v49; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v46.origin.x = -1.034e-25;
v4 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v46);
if ( v4 )
{
FLAlertLayer::incrementForcePrio(a1);
a1->m_level = 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(&v46, 0.0, 0.0, 80.0, 80.0);
v8 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square04_001.png",
(const char *)&v46,
v49);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v8->__vftable[1].~CCNode_0)(v8, 0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCNode *, void *))v8->__vftable[1].getTag)(v8, &unk_EC9AF0);
setContentSize = v8->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v46, 420.0, 300.0);
setContentSize(v8, (const cocos2d::CCSize *)&v46);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, -1);
setPosition = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v46.origin, v43 * 0.5, v44 * 0.5);
setPosition(v8, &v46.origin);
sub_D18D28(&v46, &a1->m_level->m_levelName);
v11 = cocos2d::CCLabelBMFont::create();
v12 = (void *)(*(_QWORD *)&v46.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v46.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(*(_QWORD *)&v46.origin - 8LL);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(*(_QWORD *)&v46.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v46.origin - 8LL) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v12);
}
a1->m_mainLayer->addChild(a1->m_mainLayer, v11);
v13 = v11->setPosition;
cocos2d::CCPoint::CCPoint(&v46.origin, v43 * 0.5, (float)((float)(v44 * 0.5) + 150.0) - 25.0);
v13(v11, &v46.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)&v46, "Please wait, uploading level...");
cocos2d::CCPoint::CCPoint(&v45, 0.5, 1.0);
a1->m_textArea = (TextArea *)TextArea::create((__int64)&v46, "chatFont.fnt", &v45, 0, 1.0, 400.0, 20.0);
v16 = (void *)(*(_QWORD *)&v46.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v46.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(*(_QWORD *)&v46.origin - 8LL);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(_DWORD *)(*(_QWORD *)&v46.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v46.origin - 8LL) = v42 - 1;
}
if ( v42 <= 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(&v46.origin, v43 * 0.5, (float)(v44 * 0.5) + -30.0);
v18(m_textArea, &v46.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(&v46.origin, v43 * 0.5, (float)(v44 * 0.5) + 20.0);
v22(m_sprite, &v46.origin);
if ( a1->m_level->m_isUploaded )
{
((void (__fastcall *)(UploadPopup *))a1->levelUploadFinished)(a1);
v23 = a1->m_textArea;
sub_D153B8((int)&v46, "Level already uploaded");
TextArea::setString((__int64)v23, (const void **)&v46);
v24 = (void *)(*(_QWORD *)&v46.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v46.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(*(_QWORD *)&v46.origin - 8LL);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(*(_QWORD *)&v46.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v46.origin - 8LL) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v24);
}
}
else
{
GameLevelManager::sharedState()->m_levelUploadDelegate = &a1->LevelUploadDelegate;
v27 = GameLevelManager::sharedState();
GameLevelManager::uploadLevel(v27, a1->m_level);
}
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v48.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v48.adj = (size_t)UploadPopup::onBack;
v29 = CCMenuItemSpriteExtra::create(v28, nullptr, v48);
m_buttonMenu = a1->m_buttonMenu;
a1->m_backButton = v29;
m_buttonMenu->addChild(m_buttonMenu, v29);
m_backButton = a1->m_backButton;
v32 = a1->m_buttonMenu;
v33 = m_backButton->setPosition;
v34 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v34);
v36 = v35;
v37 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v37);
cocos2d::CCPoint::CCPoint(&v45, v36 + 40.0, v38 - 40.0);
v47 = cocos2d::CCNode::convertToNodeSpace(v32, &v45);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v33)(
m_backButton,
&v46,
v47.x,
v47.y);
}
return v4;
}