//
// GameSettingsLayer::setupTabs from 0x1402c2920 to 0x1402c2dee (1230 bytes)
//
// 2 xrefs:
// > GameSettingsLayer::create @ 0x1402c285d
// > ??> @ 0x14091db94
//
// 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:29:20 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall GameSettingsLayer::setupTabs(__int64 a1)
{
__int64 v2; // rax
unsigned __int64 v3; // rbx
void *v4; // rcx
void *v5; // rcx
void *v6; // rcx
void *v7; // rcx
void *v8; // rcx
cocos2d::CCObject *v9; // rsi
struct cocos2d::CCObject *v10; // r15
__int64 v11; // rcx
cocos2d::CCArray *v12; // r14
__int64 v13; // r8
__int64 v14; // rsi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rax
float v18[2]; // [rsp+50h] [rbp-9h] BYREF
void *v19; // [rsp+58h] [rbp-1h] BYREF
_BYTE v20[8]; // [rsp+60h] [rbp+7h] BYREF
void *Block[2]; // [rsp+68h] [rbp+Fh] BYREF
__int64 v22; // [rsp+78h] [rbp+1Fh]
unsigned __int64 v23; // [rsp+80h] [rbp+27h]
v2 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2, v18);
v3 = 0;
Block[1] = nullptr;
v22 = 8;
v23 = 15;
Block[0] = (void *)0x79616C70656D6147LL;
TabbedPopupLayer::addTab(a1, Block, 0);
if ( v23 > 0xF )
{
v4 = Block[0];
if ( v23 + 1 >= 0x1000 )
{
v4 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v4 - 8) > 0x1F )
goto LABEL_20;
}
j_j_free(v4);
}
*(_OWORD *)Block = 0;
v22 = 6;
v23 = 15;
strcpy((char *)Block, "Visual");
TabbedPopupLayer::addTab(a1, Block, 0);
sub_14003D310((__int64)Block);
Block[1] = nullptr;
v22 = 8;
v23 = 15;
Block[0] = (void *)0x6563697463617250LL;
TabbedPopupLayer::addTab(a1, Block, 0);
if ( v23 > 0xF )
{
v5 = Block[0];
if ( v23 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
goto LABEL_20;
}
j_j_free(v5);
}
*(_OWORD *)Block = 0;
v22 = 6;
v23 = 15;
strcpy((char *)Block, "Editor");
TabbedPopupLayer::addTab(a1, Block, 0);
if ( v23 > 0xF )
{
v6 = Block[0];
if ( v23 + 1 >= 0x1000 )
{
v6 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v6 - 8) > 0x1F )
goto LABEL_20;
}
j_j_free(v6);
}
*(_OWORD *)Block = 0;
v22 = 5;
v23 = 15;
strcpy((char *)Block, "Audio");
TabbedPopupLayer::addTab(a1, Block, 0);
if ( v23 <= 0xF )
goto LABEL_17;
v7 = Block[0];
if ( v23 + 1 >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
LABEL_20:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
LABEL_17:
*(_OWORD *)Block = 0;
v22 = 5;
v23 = 15;
strcpy((char *)Block, "Other");
TabbedPopupLayer::addTab(a1, Block, 0);
if ( v23 > 0xF )
{
v8 = Block[0];
if ( v23 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
goto LABEL_20;
}
j_j_free(v8);
}
TabbedPopupLayer::createTabButtons_1(a1);
v19 = operator new(0x2C8u);
v9 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v19);
if ( v9 )
{
if ( ButtonSprite::init_1(
(__int64)v9,
(__int64)"Keys",
58,
0,
1056125747,
0,
"goldFont.fnt",
(__int64)"GJ_button_05.png",
1103626240) )
{
cocos2d::CCObject::autorelease(v9);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v9 + 8LL))(v9, 1);
LODWORD(v9) = 0;
}
}
v10 = CCMenuItemSpriteExtra::create((int)v9, 0, a1, (__int64)sub_1402C8C54);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v10 + 64LL))(v10, 4294966293LL);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v10);
v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(v11);
v13 = *(_QWORD *)(a1 + 1000);
if ( (*(_QWORD *)(a1 + 1008) - v13) / 88 )
{
v14 = 0;
do
{
cocos2d::CCArray::addObject(v12, *(struct cocos2d::CCObject **)(v13 + v14 + 80));
++v3;
v14 += 88;
v13 = *(_QWORD *)(a1 + 1000);
}
while ( v3 < (*(_QWORD *)(a1 + 1008) - v13) / 88 );
}
cocos2d::CCArray::addObject(v12, v10);
v15 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v19,
v18[0] * 0.5,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v18[1] * 0.5)) - 20.0);
cocos2d::CCNode::convertToNodeSpace(v15, v20, v16);
GameToolbox::alignItemsHorisontally((__int64)v12, 4.0, v17, 0);
}