//
// GJGarageLayer::selectTab from 0x100356020 to 0x100356152 (306 bytes)
//
// 2 xrefs:
// > GJGarageLayer::setupIconSelect @ 0x100355315
// > GJGarageLayer::onSelectTab @ 0x100355ebd
//
// 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:28:52 +0000
//
__int64 __fastcall GJGarageLayer::selectTab(__int64 a1, signed int a2)
{
unsigned int v2; // r15d
__int64 v3; // r12
int v4; // eax
_BOOL4 v5; // r13d
_QWORD *v6; // rax
_QWORD *v7; // r12
_QWORD *v8; // r15
_QWORD *v9; // r13
__int64 v10; // rax
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 480)) )
{
v2 = 0;
do
{
v3 = sub_1007FEFE0(*(_QWORD *)(a1 + 480), v2);
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 64LL))(v3);
v5 = v4 != a2;
CCMenuItemToggler::toggle(v3, v4 == a2);
(*(void (__fastcall **)(__int64, _BOOL4))(*(_QWORD *)v3 + 1056LL))(v3, v5);
++v2;
}
while ( v2 < (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 480)) );
}
v6 = *(_QWORD **)(a1 + 528);
if ( v6 )
{
while ( 1 )
{
while ( 1 )
{
v8 = v6;
if ( *((_DWORD *)v6 + 7) <= a2 )
break;
v6 = (_QWORD *)*v6;
v7 = v8;
if ( !*v8 )
goto LABEL_11;
}
if ( *((_DWORD *)v6 + 7) >= a2 )
break;
v6 = (_QWORD *)v6[1];
if ( !v6 )
{
v7 = v8 + 1;
goto LABEL_11;
}
}
}
else
{
v7 = (_QWORD *)(a1 + 528);
v8 = (_QWORD *)(a1 + 528);
LABEL_11:
v9 = v8;
v8 = operator new(0x28u);
*((_DWORD *)v8 + 7) = a2;
*((_DWORD *)v8 + 8) = 0;
*(_OWORD *)v8 = 0;
v8[2] = v9;
*v7 = v8;
v10 = **(_QWORD **)(a1 + 520);
if ( v10 )
*(_QWORD *)(a1 + 520) = v10;
sub_10001B680(*(__int64 **)(a1 + 528), v8);
++*(_QWORD *)(a1 + 536);
}
return GJGarageLayer::setupPage(a1, *((unsigned int *)v8 + 8), (unsigned int)a2);
}