//
// EditLevelLayer::FLAlert_Clicked from 0x6e2f3c to 0x6e3258 (796 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'EditLevelLayer::FLAlert_Clicked @ 0x6e325c
// > ??> @ 0x7f080
// > ??> @ 0x115be08
//
// 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
//
void EditLevelLayer::FLAlert_Clicked(EditLevelLayer *a1, FLAlertLayer *a2, bool a3)
{
_BOOL4 v5; // w21
GameLevelManager *v6; // x23
GJGameLevel *m_level; // x3
int v8; // w21
int updated; // w23
UploadPopupDelegate_vtbl *v10; // x0
UploadActionPopup *m_descriptionPopup; // x0
UploadActionPopup *v12; // x0
UploadPopupDelegate_vtbl *v13; // x1
GameManager *v14; // x0
unsigned int *v15; // x1
int onClosePopup; // w2
unsigned int *v17; // x19
int v18; // w0
UploadPopupDelegate v19; // [xsp+50h] [xbp+50h] BYREF
std::string v20; // 0:x2.8
v5 = a3;
if ( a2->getTag(a2) == 4 && v5 )
{
EditLevelLayer::onDelete(a1);
return;
}
if ( a2->getTag(a2) == 7 && v5 )
{
EditLevelLayer::onClone(a1);
return;
}
if ( a2->getTag(a2) == 8 && v5 )
{
EditLevelLayer::onMoveToTop(a1);
return;
}
if ( a2->getTag(a2) == 10 )
{
EditLevelLayer::onShare(a1, nullptr);
return;
}
if ( a2->getTag(a2) == 5 )
{
if ( !v5 )
{
EditLevelLayer::onEdit(a1, nullptr);
return;
}
goto LABEL_22;
}
if ( a2->getTag(a2) != 9 || !v5 )
{
if ( a2->getTag(a2) != 6 || !v5 )
return;
LABEL_22:
v14 = GameManager::sharedState();
GameManager::openEditorGuide(v14);
return;
}
EditLevelLayer::closeTextInputs(a1);
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v6 = GameLevelManager::sharedState();
m_level = a1->m_level;
v8 = m_level->m_levelID.random - m_level->m_levelID.seed;
sub_D18D28(&v19, &m_level->m_levelDesc);
updated = (unsigned __int8)GameLevelManager::updateDescription(v6, v8, (std::string)&v19);
v10 = v19.__vftable - 3;
if ( (__int64 *)&v19.__vftable[-3] != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)&v19.__vftable[-1];
do
onClosePopup = __ldaxr(v15);
while ( __stlxr(onClosePopup - 1, v15) );
}
else
{
onClosePopup = (int)v19.__vftable[-1].onClosePopup;
LODWORD(v19.__vftable[-1].onClosePopup) = onClosePopup - 1;
}
if ( onClosePopup <= 0 )
operator delete(v10);
}
if ( updated )
{
m_descriptionPopup = a1->m_descriptionPopup;
if ( m_descriptionPopup )
{
m_descriptionPopup->m_delegate = nullptr;
a1->m_descriptionPopup = nullptr;
}
sub_D153B8((int)&v19, "Updating description...");
v12 = (UploadActionPopup *)UploadActionPopup::create((UploadActionPopup *)&a1->UploadPopupDelegate, &v19, v20);
a1->m_descriptionPopup = v12;
v13 = v19.__vftable - 3;
if ( (__int64 *)&v19.__vftable[-3] != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)&v19.__vftable[-1];
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = (int)v19.__vftable[-1].onClosePopup;
LODWORD(v19.__vftable[-1].onClosePopup) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v13);
v12 = a1->m_descriptionPopup;
}
v12->show(v12);
}
}