//
// EditorUI::selectBuildTab from 0x689ad4 to 0x689c3c (360 bytes)
//
// 4 xrefs:
// > EditorUI::updateCreateMenu @ 0x689dd8
// > EditorUI::onSelectBuildTab @ 0x689e64
// > EditorUI::setupCreateMenu @ 0x6b35d0
// > ??> @ 0x2c8b0
//
// 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 EditorUI::selectBuildTab(EditorUI *a1, int a2)
{
int m_selectedTab; // w0
int v4; // w0
int v5; // w1
int v6; // w1
unsigned int v7; // w20
unsigned int v8; // w0
unsigned int v9; // w1
EditButtonBar *v10; // x21
bool v11; // zf
cocos2d::CCArray *m_createButtonBars; // x0
unsigned int v13; // w0
unsigned int i; // w20
CCMenuItemToggler *v15; // x0
bool v16; // w1
_BOOL4 v17; // w0
int v18; // w0
unsigned int v20; // [xsp+38h] [xbp+38h]
m_selectedTab = a1->m_selectedTab;
if ( m_selectedTab == a2 || a1->m_selectedMode != 2 && m_selectedTab != -1 )
return;
v4 = cocos2d::CCArray::count(a1->m_createButtonBars);
v5 = a2;
if ( v4 - 1 <= (unsigned int)a2 )
{
v17 = cocos2d::CCArray::count(a1->m_createButtonBars) != 1;
v5 = a2;
if ( !v17 )
goto LABEL_7;
}
else if ( !a2 )
{
LABEL_7:
v6 = 0;
goto LABEL_8;
}
v20 = v5;
v18 = cocos2d::CCArray::count(a1->m_createButtonBars);
v6 = v20;
if ( v20 >= v18 - 1 )
v6 = cocos2d::CCArray::count(a1->m_createButtonBars) - 1;
LABEL_8:
a1->m_selectedTab = v6;
v7 = 0;
while ( 1 )
{
v8 = cocos2d::CCArray::count(a1->m_createButtonBars);
v9 = v7;
if ( v7 >= v8 )
break;
while ( 1 )
{
v10 = (EditButtonBar *)cocos2d::CCArray::objectAtIndex(a1->m_createButtonBars, v9);
v10->setVisible(v10, a1->m_selectedTab == v7);
v11 = v7++ == a1->m_selectedTab;
if ( !v11 )
break;
m_createButtonBars = a1->m_createButtonBars;
a1->m_createButtonBar = v10;
v13 = cocos2d::CCArray::count(m_createButtonBars);
v9 = v7;
if ( v7 >= v13 )
goto LABEL_13;
}
}
LABEL_13:
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(a1->m_tabsArray); ++i )
{
v15 = (CCMenuItemToggler *)cocos2d::CCArray::objectAtIndex(a1->m_tabsArray, i);
v11 = a1->m_selectedTab == i;
v16 = v11;
CCMenuItemToggler::toggle(v15, v16);
}
}