//
// EditorUI::updateCreateMenu from 0x10000cf80 to 0x10000d462 (1250 bytes)
//
// 8 xrefs:
// > EditorUI::resetUI @ 0x100008d17
// > EditorUI::onShowUIBtn @ 0x10000b5fa
// > EditorUI::clickOnPosition @ 0x10000c7a8
// > EditorUI::onCreateButton @ 0x1000108b7
// > EditorUI::handleEditorAction @ 0x10060c0c8
// > EditorUI::setupCreateMenu @ 0x100637e8f
// > EditorUI::orderUpCustomItem @ 0x10063caca
// > EditorUI::orderDownCustomItem @ 0x10063cb87
//
// 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 12:18:50 +0000
//
__int64 __fastcall EditorUI::updateCreateMenu(__int64 a1, char a2)
{
__int64 v3; // r14
unsigned int i; // r15d
int *v5; // r13
__int64 v6; // rax
__int64 v7; // r12
__int64 v8; // rdi
__int64 v9; // r13
int v10; // eax
__int64 result; // rax
__int64 v12; // r14
unsigned int j; // r15d
int *v14; // r13
__int64 v15; // rax
__int64 v16; // r12
__int64 v17; // rdi
__int64 v18; // r13
int v19; // eax
__int64 v20; // r14
unsigned int v21; // r15d
_DWORD *v22; // rax
__int64 v23; // r14
unsigned int v24; // r15d
_DWORD *v25; // r15
__int64 v26; // rax
__int64 v27; // r14
__int64 v28; // rdi
__int64 v29; // r14
__int64 v30; // r14
__int16 v31; // [rsp+10h] [rbp-30h] BYREF
char v32; // [rsp+12h] [rbp-2Eh]
__int16 v33; // [rsp+14h] [rbp-2Ch] BYREF
char v34; // [rsp+16h] [rbp-2Ah]
if ( *(_BYTE *)(a1 + 1589) || *(_DWORD *)(a1 + 1436) != 2 )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 824) + 344LL))(*(_QWORD *)(a1 + 824), 0);
return (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1200) + 344LL))(*(_QWORD *)(a1 + 1200), 0);
}
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 824) + 344LL))(*(_QWORD *)(a1 + 824), 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1200) + 344LL))(*(_QWORD *)(a1 + 1200), 1);
v3 = *(_QWORD *)(a1 + 1352);
if ( (unsigned int)sub_1007FEF90(v3) )
{
for ( i = 0; i < (unsigned int)sub_1007FEF90(v3); ++i )
{
v5 = (int *)sub_1007FEFE0(v3, i);
v6 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)v5 + 1072LL))(v5);
v7 = v6;
v8 = *(_QWORD *)(v6 + 640);
if ( v8 || (v8 = *(_QWORD *)(v6 + 648)) != 0 )
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v8 + 960LL))(v8, &unk_100A038D0);
if ( v5[132] < 0 )
continue;
v9 = *(_QWORD *)(v7 + 632);
v34 = -1;
v33 = -1;
if ( *(_DWORD *)(v9 + 1248) == 1 && (unsigned __int8)GameObject::isColorObject(v9) && *(_BYTE *)(v9 + 1768) == 1 )
{
v34 = -1;
v33 = -14136;
goto LABEL_6;
}
v10 = *(_DWORD *)(v9 + 1028);
if ( v10 > 1583 )
{
if ( v10 != 2012 && v10 != 1584 )
{
LABEL_22:
if ( (unsigned int)GameObject::getMainColorMode(v9) != 1010 )
goto LABEL_6;
}
}
else if ( (unsigned int)(v10 - 918) >= 2 && (unsigned int)(v10 - 1327) >= 2 )
{
goto LABEL_22;
}
v34 = 0;
v33 = 0;
LABEL_6:
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v9 + 1496LL))(v9, &v33);
v32 = -1;
v31 = -14136;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v9 + 1096LL))(v9, &v31);
}
}
v12 = *(_QWORD *)(a1 + 1360);
if ( (unsigned int)sub_1007FEF90(v12) )
{
for ( j = 0; j < (unsigned int)sub_1007FEF90(v12); ++j )
{
v14 = (int *)sub_1007FEFE0(v12, j);
v15 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)v14 + 1072LL))(v14);
v16 = v15;
v17 = *(_QWORD *)(v15 + 640);
if ( v17 || (v17 = *(_QWORD *)(v15 + 648)) != 0 )
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v17 + 960LL))(v17, &unk_100A038D0);
if ( v14[132] < 0 )
continue;
v18 = *(_QWORD *)(v16 + 632);
v34 = -1;
v33 = -1;
if ( *(_DWORD *)(v18 + 1248) == 1 && (unsigned __int8)GameObject::isColorObject(v18) && *(_BYTE *)(v18 + 1768) )
{
v34 = -1;
v33 = -14136;
goto LABEL_28;
}
v19 = *(_DWORD *)(v18 + 1028);
if ( v19 > 1583 )
{
if ( v19 != 2012 && v19 != 1584 )
{
LABEL_44:
if ( (unsigned int)GameObject::getMainColorMode(v18) != 1010 )
goto LABEL_28;
}
}
else if ( (unsigned int)(v19 - 918) >= 2 && (unsigned int)(v19 - 1327) >= 2 )
{
goto LABEL_44;
}
v34 = 0;
v33 = 0;
LABEL_28:
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v18 + 1496LL))(v18, &v33);
v32 = -1;
v31 = -14136;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v18 + 1096LL))(v18, &v31);
}
}
v20 = *(_QWORD *)(a1 + 1352);
if ( (unsigned int)sub_1007FEF90(v20) )
{
v21 = 0;
while ( 1 )
{
v22 = (_DWORD *)sub_1007FEFE0(v20, v21);
if ( v22[132] == *(_DWORD *)(a1 + 1344) )
break;
if ( ++v21 >= (unsigned int)sub_1007FEF90(v20) )
goto LABEL_50;
}
}
else
{
LABEL_50:
v23 = *(_QWORD *)(a1 + 1360);
result = sub_1007FEF90(v23);
if ( !(_DWORD)result )
return result;
v24 = 0;
while ( 1 )
{
v22 = (_DWORD *)sub_1007FEFE0(v23, v24);
if ( v22[132] == *(_DWORD *)(a1 + 1344) )
break;
++v24;
result = sub_1007FEF90(v23);
if ( v24 >= (unsigned int)result )
return result;
}
}
v25 = v22;
v26 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v22 + 1072LL))(v22);
v27 = v26;
v28 = *(_QWORD *)(v26 + 640);
if ( v28 || (v28 = *(_QWORD *)(v26 + 648)) != 0 )
{
v34 = 127;
v33 = 32639;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v28 + 960LL))(v28, &v33);
}
result = (__int64)v25;
if ( (int)v25[132] >= 0 )
{
v29 = *(_QWORD *)(v27 + 632);
v34 = 127;
v33 = 32639;
v32 = 127;
v31 = 25700;
if ( *(_DWORD *)(v29 + 1248) == 1 && (unsigned __int8)GameObject::isColorObject(v29) && *(_BYTE *)(v29 + 1768) == 1 )
{
v34 = v32;
v33 = v31;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v29 + 1496LL))(v29, &v33);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v29 + 1096LL))(v29, &v31);
result = (__int64)v25;
}
if ( a2 )
{
v30 = result;
EditorUI::selectBuildTab(a1, *(unsigned int *)(result + 536));
return EditButtonBar::goToPage(*(_QWORD *)(a1 + 824), *(unsigned int *)(v30 + 532));
}
return result;
}