//
// EditorUI::editButton2Usable from 0x100018720 to 0x100018ac6 (934 bytes)
//
// 2 xrefs:
// > EditorUI::updateButtons @ 0x10000add1
// > EditorUI::toggleEditObjectButton @ 0x10000beff
//
// 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:55 +0000
//
__int64 __fastcall EditorUI::editButton2Usable(__int64 a1)
{
__int64 v1; // r14
_DWORD *v2; // rax
int v3; // ebx
int v4; // r13d
int v5; // r12d
__int64 v6; // r15
unsigned int v7; // r12d
int v8; // ecx
unsigned int v10; // r15d
_DWORD *v11; // rax
__int64 v12; // rdi
_DWORD *v13; // rdi
int v14; // eax
__int64 v15; // rsi
unsigned int v16; // r15d
__int64 v17; // rax
unsigned int v18; // r15d
__int64 v19; // rax
v2 = *(_DWORD **)(a1 + 1496);
if ( v2 )
{
v3 = v2[231];
v4 = v2[257];
v5 = v2[312];
}
else
{
v1 = *(_QWORD *)(a1 + 896);
v5 = -1;
if ( v1 )
{
v3 = -1;
v4 = -1;
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
{
v10 = 0;
v4 = -1;
do
{
v11 = (_DWORD *)sub_1007FEFE0(v1, v10);
if ( v4 )
{
if ( v4 == -1 )
{
v4 = v11[257];
}
else if ( v11[257] != v4 )
{
v4 = 0;
}
}
if ( v5 )
{
if ( v5 == -1 )
{
v5 = v11[312];
}
else if ( v11[312] != v5 )
{
v5 = 0;
}
}
if ( v3 )
{
if ( v3 == -1 )
{
v3 = v11[231];
}
else if ( v11[231] != v3 )
{
v3 = 0;
}
}
++v10;
}
while ( v10 < (unsigned int)sub_1007FEF90(v1) );
}
}
else
{
v3 = -1;
v4 = -1;
}
}
if ( v4 == -1 && v5 == -1 )
goto LABEL_5;
LOBYTE(v1) = 1;
if ( v5 == 5 )
return (unsigned int)v1;
v6 = *(_QWORD *)(a1 + 896);
if ( v6 && (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
{
v7 = 0;
while ( *(_DWORD *)(sub_1007FEFE0(v6, v7) + 1248) != 5 )
{
if ( ++v7 >= (unsigned int)sub_1007FEF90(v6) )
goto LABEL_12;
}
}
else
{
LABEL_12:
if ( v3 == 30 )
return (unsigned int)v1;
if ( v4 <= 2064 )
{
if ( v4 <= 1703 )
{
if ( v4 == 1594 || v4 == 1615 )
return (unsigned int)v1;
}
else if ( v4 == 1704 || v4 == 1751 || v4 == 2063 )
{
return (unsigned int)v1;
}
}
else
{
if ( (unsigned int)(v4 - 2903) <= 0x15 )
{
v8 = 4161495;
if ( _bittest(&v8, v4 - 2903) )
return (unsigned int)v1;
}
if ( v4 == 2065 )
return (unsigned int)v1;
if ( v4 == 3643 )
{
LABEL_5:
LODWORD(v1) = 0;
return (unsigned int)v1;
}
}
v12 = *(_QWORD *)(a1 + 1496);
if ( v12 )
{
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v12 + 1800LL))(v12) == 30 )
return (unsigned int)v1;
v13 = *(_DWORD **)(a1 + 1496);
v14 = v13[257];
if ( v14 == 1615 )
return (unsigned int)v1;
if ( v14 == 2065 )
return (unsigned int)v1;
if ( (*(unsigned __int8 (__fastcall **)(_DWORD *))(*(_QWORD *)v13 + 1736LL))(v13) )
return (unsigned int)v1;
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1496) + 1728LL))(*(_QWORD *)(a1 + 1496)) )
return (unsigned int)v1;
v12 = *(_QWORD *)(a1 + 1496);
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v12 + 1632LL))(v12) )
return (unsigned int)v1;
v15 = *(_QWORD *)(a1 + 1496);
}
else
{
v15 = 0;
}
if ( (unsigned __int8)EditorUI::canAllowMultiActivate(v12, v15, *(_QWORD *)(a1 + 896)) )
return (unsigned int)v1;
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
{
if ( !(unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
return (unsigned int)v1;
v16 = 0;
while ( 1 )
{
v17 = sub_1007FEFE0(*(_QWORD *)(a1 + 896), v16);
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v17 + 1728LL))(v17) )
break;
if ( ++v16 >= (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
return (unsigned int)v1;
}
}
if ( !(unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
goto LABEL_5;
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) )
{
v18 = 0;
do
{
v19 = sub_1007FEFE0(*(_QWORD *)(a1 + 896), v18);
LODWORD(v1) = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v19 + 1736LL))(v19);
if ( (_BYTE)v1 )
break;
++v18;
}
while ( v18 < (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 896)) );
LOBYTE(v1) = v1 ^ 1;
}
}
return (unsigned int)v1;
}