//
// PlatformerControlsPopup::onUpload from 0x140451920 to 0x140451cd5 (949 bytes)
//
// 2 xrefs:
// > PlatformerControlsPopup::init @ 0x14044f7e6
// > ??> @ 0x14092780c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:32:27 +0000
//
// Hidden C++ exception states: #wind=5
void __fastcall PlatformerControlsPopup::onUpload(__int64 *a1)
{
__int64 v2; // rcx
__int64 v3; // rax
cocos2d::CCObject *v4; // rbx
__int64 v5; // rbx
__int64 v6; // rdx
__int64 v7; // r8
cocos2d::CCNode *v8; // rax
__int64 v9; // rax
const char *v10; // rsi
int v11; // ebx
__int64 v12; // rcx
__int64 v13; // rcx
cocos2d::CCObject *v14; // rax
__int128 v15; // [rsp+50h] [rbp-29h] BYREF
__int64 v16; // [rsp+60h] [rbp-19h]
__int64 v17; // [rsp+68h] [rbp-11h]
__int128 *v18; // [rsp+70h] [rbp-9h]
__int128 *v19; // [rsp+78h] [rbp-1h]
__int128 v20; // [rsp+80h] [rbp+7h] BYREF
__int64 v21; // [rsp+90h] [rbp+17h]
__int64 v22; // [rsp+98h] [rbp+1Fh]
_BYTE v23[16]; // [rsp+A0h] [rbp+27h] BYREF
__int64 v24; // [rsp+B0h] [rbp+37h]
v2 = a1[129];
if ( v2 && *(_DWORD *)(v2 + 328) - *(_DWORD *)(v2 + 332) > 0 )
{
PlatformerControlsPopup::commitCustomDraft((__int64)a1);
PlatformerControlsPopup::refreshClassUI((__int64)a1);
GJGameLevel::shippedControls(a1[129], (__int64)v23);
if ( v24 )
{
v9 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v18 = (__int128 *)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v18);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v9 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v9 + 1488) = a1 + 125;
v18 = &v20;
v10 = (const char *)sub_14003F4F0((__int64)&v20, (__int64)v23);
v11 = *(_DWORD *)(a1[129] + 328) - *(_DWORD *)(a1[129] + 332);
v12 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v19 = (__int128 *)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v19);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v12 = *(_QWORD *)&qword_14090BFB0;
}
if ( GameLevelManager::uploadLevelControls(v12, v11, v10) )
{
v13 = a1[148];
if ( v13 )
{
*(_QWORD *)(v13 + 664) = 0;
a1[148] = 0;
}
v15 = 0;
*(_QWORD *)&v15 = sub_14003D460(0x20u);
v16 = 21;
v17 = 31;
strcpy((char *)v15, "Uploading controls...");
v14 = UploadActionPopup::create((__int64)(a1 + 126), (__int64)&v15);
a1[148] = (__int64)v14;
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v14 + 1064LL))(v14);
}
}
else if ( *(_QWORD *)(a1[129] + 2040) )
{
v15 = 0;
*(_QWORD *)&v15 = sub_14003D460(0x40u);
v16 = 63;
v17 = 63;
strcpy((char *)v15, "Nothing selected. Remove the uploaded controls from this level?");
v19 = &v15;
v3 = sub_14003F4F0((__int64)&v20, (__int64)&v15);
v4 = FLAlertLayer::create(
(int)a1 + 1024,
(int)"Remove Controls",
v3,
(__int64)"Cancel",
(__int64)"Remove",
1132068864,
0,
0,
1065353216);
sub_14003D310((__int64)&v15);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v4 + 1064LL))(v4);
}
else
{
v18 = &v20;
v20 = 0;
v21 = 0;
v22 = 15;
LOBYTE(v20) = 0;
v15 = 0;
*(_QWORD *)&v15 = sub_14003D460(0x20u);
v16 = 16;
v17 = 31;
strcpy((char *)v15, "Nothing selected");
v5 = *a1;
v8 = TextAlertPopup::create((__int64)&v15, v6, v7, 150, (__int64)&v20);
(*(void (__fastcall **)(__int64 *, cocos2d::CCNode *, __int64))(v5 + 456))(a1, v8, 100);
}
sub_14003D310((__int64)v23);
}
}