//
// UploadPopup::init from 0x3b94ac to 0x3b9810 (868 bytes)
//
// 1 xrefs:
// > UploadPopup::create @ 0x3b98c0
//
// 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)
{
int v4; // r8
cocos2d::CCDirector *v5; // r0
cocos2d::CCLayer *v6; // r0
UploadPopup_vtbl *v7; // r3
cocos2d::CCNode *v8; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r9
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v11; // r6
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCMenu *v13; // r0
TextArea *m_textArea; // r10
void (__fastcall *v15)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r11
LoadingCircle *v16; // r0
cocos2d::CCLayer *m_mainLayer; // r3
LoadingCircle *m_loadingCircle; // r0
cocos2d::CCSprite *m_sprite; // r10
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r11
TextArea *v21; // r10
GameLevelManager *v22; // r0
cocos2d::CCSprite *v23; // r0
CCMenuItemSpriteExtra *v24; // r0
CCMenuItemSpriteExtra *m_backButton; // r5
cocos2d::CCMenu *m_buttonMenu; // r4
void (__fastcall *v27)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCDirector *v28; // r0
float v29; // s16
cocos2d::CCDirector *v30; // r0
float v31; // r0
float v33; // r2
float v34; // r3
cocos2d::CCSize v35; // [sp+14h] [bp-30h] BYREF
cocos2d::CCPoint v36; // [sp+1Ch] [bp-28h] BYREF
cocos2d::CCPoint v37; // [sp+24h] [bp-20h] BYREF
cocos2d::CCRect v38; // [sp+2Ch] [bp-18h] BYREF
cocos2d::CCSize v39; // 0:^0.8
cocos2d::CCRect v40; // 0:kr00_16.16
v38.origin.x = -1.034e-25;
v4 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v38);
if ( v4 )
{
FLAlertLayer::incrementForcePrio(a1);
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v35, v5);
v6 = cocos2d::CCLayer::create();
v7 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v6;
v7->addChild(a1, v6);
cocos2d::CCRect::CCRect(&v38, 0.0, 0.0, 80.0, 80.0);
v40.origin.x = v33;
v40.origin.y = v34;
v40.size = v39;
v8 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square04_001.png",
(const char *)&v38,
v40);
((void (__fastcall *)(cocos2d::CCNode *, int))v8->__vftable[1].~CCNode_0)(v8, 255);
((void (__fastcall *)(cocos2d::CCNode *, void *))v8->__vftable[1].getTag)(v8, &unk_9AAA8C);
setContentSize = v8->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v38, 420.0, 300.0);
setContentSize(v8, (const cocos2d::CCSize *)&v38);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, -1);
setPosition = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v38.origin, v35.width * 0.5, v35.height * 0.5);
setPosition(v8, &v38.origin);
sub_775C20(&v38, &a1->m_level->m_levelName);
v11 = cocos2d::CCLabelBMFont::create();
sub_774008(&v38);
a1->m_mainLayer->addChild(a1->m_mainLayer, v11);
v12 = v11->setPosition;
cocos2d::CCPoint::CCPoint(&v38.origin, v35.width * 0.5, (float)((float)(v35.height * 0.5) + 150.0) - 25.0);
v12(v11, &v38.origin);
v13 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v13;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v13, 10);
sub_776584((int)&v37, "Please wait, uploading level...");
cocos2d::CCPoint::CCPoint(&v38.origin, 0.5, 1.0);
a1->m_textArea = (TextArea *)TextArea::create(
(TextArea *)&v37,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
1137180672,
&v38.origin,
(cocos2d::CCPoint)COERCE_UNSIGNED_INT(20.0));
sub_774008(&v37);
a1->m_mainLayer->addChild(a1->m_mainLayer, a1->m_textArea);
m_textArea = a1->m_textArea;
v15 = m_textArea->setPosition;
cocos2d::CCPoint::CCPoint(&v38.origin, v35.width * 0.5, (float)(v35.height * 0.5) - 30.0);
v15(m_textArea, &v38.origin);
a1->m_joystickConnected = -1;
v16 = LoadingCircle::create();
m_mainLayer = a1->m_mainLayer;
a1->m_loadingCircle = v16;
v16->m_parentLayer = m_mainLayer;
m_loadingCircle = a1->m_loadingCircle;
m_loadingCircle->m_fade = 0;
LoadingCircle::show(m_loadingCircle);
m_sprite = a1->m_loadingCircle->m_sprite;
v20 = m_sprite->setPosition;
cocos2d::CCPoint::CCPoint(&v38.origin, v35.width * 0.5, (float)(v35.height * 0.5) + 20.0);
v20(m_sprite, &v38.origin);
if ( a1->m_level->m_isUploaded )
{
((void (__fastcall *)(UploadPopup *))a1->levelUploadFinished)(a1);
v21 = a1->m_textArea;
sub_776584((int)&v38, "Level already uploaded");
TextArea::setString((int)v21, &v38);
sub_774008(&v38);
}
else
{
GameLevelManager::sharedState()->m_levelUploadDelegate = &a1->LevelUploadDelegate;
v22 = GameLevelManager::sharedState();
GameLevelManager::uploadLevel(v22, a1->m_level);
}
v23 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
LODWORD(v38.origin.x) = UploadPopup::onBack;
v38.origin.y = 0.0;
v24 = CCMenuItemSpriteExtra::create(
v23,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(UploadPopup::onBack, (unsigned int)a1));
a1->m_backButton = v24;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v24);
m_backButton = a1->m_backButton;
m_buttonMenu = a1->m_buttonMenu;
v27 = m_backButton->setPosition;
v28 = cocos2d::CCDirector::sharedDirector();
v29 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v28));
v30 = cocos2d::CCDirector::sharedDirector();
v31 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v30));
cocos2d::CCPoint::CCPoint(&v36, v29 + 40.0, v31 - 40.0);
cocos2d::CCNode::convertToNodeSpace(&v37, m_buttonMenu, &v36);
v27(m_backButton, &v37);
}
return v4;
}