//
// EditorSoundsLayer::showTab from 0xcd6704 to 0xcd6ba8 (1188 bytes)
//
// 2 xrefs:
// > ??> @ 0x97db0
// > ??> @ 0x1500930
//
// This function is hookable on this platform (idp: arm, 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 13:06:30 +0000
//
__int64 __fastcall EditorSoundsLayer::showTab(EditorSoundsLayer *this, int a2)
{
int v5; // w26
__int64 v6; // x28
int v7; // w27
_BOOL4 v8; // w22
size_t v9; // x2
char *v10; // x1
__int64 v11; // x0
__int64 v12; // x5
__int64 v13; // x0
__int64 v14; // x0
cocos2d::CCDirector *v15; // x0
cocos2d::CCDirector *v16; // x0
float v17; // s2
float v18; // s1
ScrollableContentLayer *v19; // x23
float v20; // s8
float v21; // s9
__int64 v22; // x23
void (__fastcall *v23)(__int64, _BYTE *); // x24
cocos2d::CCMenu *v24; // x0
__int64 v25; // x0
ScrollableContentLayer *v26; // x22
size_t v27; // x2
char *v28; // x1
__int64 v29; // x0
__int64 v30; // x5
int v31; // w21
__int64 v32; // [xsp+70h] [xbp+70h] BYREF
_BYTE v33[8]; // [xsp+78h] [xbp+78h] BYREF
__int64 v34; // [xsp+80h] [xbp+80h] BYREF
__int64 v35; // [xsp+88h] [xbp+88h]
void *v36; // [xsp+90h] [xbp+90h]
__int64 v37; // [xsp+98h] [xbp+98h] BYREF
size_t v38; // [xsp+A0h] [xbp+A0h]
void *v39; // [xsp+A8h] [xbp+A8h]
__int64 v40; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v41; // [xsp+B8h] [xbp+B8h]
void *v42; // [xsp+C0h] [xbp+C0h]
if ( a2 < 0 || a2 >= (int)(954437177 * ((__int64)(*((_QWORD *)this + 128) - *((_QWORD *)this + 127)) >> 3)) )
return _stack_chk_guard;
v5 = *((_DWORD *)this + 286);
v6 = *((_QWORD *)this + 144);
v7 = *((_DWORD *)this + 266);
v8 = a2 == v5;
if ( v6 && (v7 & 0x80000000) == 0 )
{
v34 = 0;
v35 = 0;
v36 = nullptr;
std::string::__init(&v34, "editorsounds.tab.", 0x11u);
std::to_string(&v37, *((_DWORD *)this + 266));
if ( (v37 & 1) != 0 )
{
v10 = (char *)v39;
v9 = v38;
}
else
{
v9 = (unsigned __int8)v37 >> 1;
v10 = (char *)&v37 + 1;
}
v11 = std::string::append((__int64)&v34, v10, v9);
v12 = *(_QWORD *)(v11 + 8);
v40 = *(_QWORD *)v11;
v41 = v12;
v42 = *(void **)(v11 + 16);
*(_QWORD *)v11 = 0;
*(_QWORD *)(v11 + 8) = 0;
*(_QWORD *)(v11 + 16) = 0;
ScrollableContentLayer::persistScrollOffset(v6, (__int64)&v40);
if ( (v40 & 1) != 0 )
operator delete(v42);
if ( (v37 & 1) != 0 )
operator delete(v39);
if ( (v34 & 1) != 0 )
operator delete(v36);
}
v13 = *((_QWORD *)this + 137);
if ( v13 )
{
(*(void (__fastcall **)(__int64, _BOOL4))(*(_QWORD *)v13 + 344LL))(v13, v8);
(*(void (__fastcall **)(_QWORD, _BOOL4))(**((_QWORD **)this + 137) + 1000LL))(*((_QWORD *)this + 137), v8);
if ( (v7 == v5) > (unsigned int)v8 )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 137) + 1160LL))(*((_QWORD *)this + 137), 0);
v14 = *((_QWORD *)this + 138);
if ( !v14 )
goto LABEL_18;
goto LABEL_17;
}
}
v14 = *((_QWORD *)this + 138);
if ( v14 )
LABEL_17:
(*(void (__fastcall **)(__int64, _BOOL4))(*(_QWORD *)v14 + 344LL))(v14, v8);
LABEL_18:
v15 = *((cocos2d::CCDirector **)this + 139);
if ( v15 )
v15 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(cocos2d::CCDirector *, _BOOL4))(*(_QWORD *)v15 + 344LL))(
v15,
v8);
*((_DWORD *)this + 266) = a2;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::getWinSize(&v32, v16);
v17 = *((float *)&v32 + 1) * 0.5;
if ( v8 )
v18 = v17 + 64.0;
else
v18 = v17 + 96.0;
v19 = *((ScrollableContentLayer **)this + 144);
if ( v19 )
{
v20 = v17 - 100.0;
v21 = *((float *)this + 183) - 30.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v33, v21, v18 - (float)(v17 - 100.0));
ScrollableContentLayer::setViewSize(v19, (__int64)v33);
v22 = *((_QWORD *)this + 144);
v23 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v22 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v33,
-(float)((float)(v21 * 0.5) - (float)(*(float *)&v32 * 0.5)),
v20);
v23(v22, v33);
v24 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(*((_QWORD *)this + 144) + 416LL)
+ 584LL))(
*(_QWORD *)(*((_QWORD *)this + 144) + 416LL),
1);
v25 = cocos2d::CCMenu::create(v24);
*((_QWORD *)this + 145) = v25;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v25 + 296LL))(v25, &unk_155F308);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 145) + 320LL))(*((_QWORD *)this + 145), &unk_155F310);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 145) + 184LL))(*((_QWORD *)this + 145), &unk_155F308);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(*((_QWORD *)this + 144) + 416LL) + 464LL))(
*(_QWORD *)(*((_QWORD *)this + 144) + 416LL),
*((_QWORD *)this + 145),
2);
}
EditorSoundsLayer::buildContentForTab(this, a2);
v26 = *((ScrollableContentLayer **)this + 144);
if ( v26 )
{
v34 = 0;
v35 = 0;
v36 = nullptr;
std::string::__init(&v34, "editorsounds.tab.", 0x11u);
std::to_string(&v37, a2);
if ( (v37 & 1) != 0 )
{
v28 = (char *)v39;
v27 = v38;
}
else
{
v27 = (unsigned __int8)v37 >> 1;
v28 = (char *)&v37 + 1;
}
v29 = std::string::append((__int64)&v34, v28, v27);
v30 = *(_QWORD *)(v29 + 8);
v40 = *(_QWORD *)v29;
v41 = v30;
v42 = *(void **)(v29 + 16);
*(_QWORD *)v29 = 0;
*(_QWORD *)(v29 + 8) = 0;
*(_QWORD *)(v29 + 16) = 0;
v31 = (unsigned __int8)ScrollableContentLayer::restoreScrollOffset(v26, (__int64)&v40);
if ( (v40 & 1) != 0 )
operator delete(v42);
if ( (v37 & 1) != 0 )
operator delete(v39);
if ( (v34 & 1) != 0 )
operator delete(v36);
if ( !v31 )
ScrollableContentLayer::scrollTo(*((ScrollableContentLayer **)this + 144), 0.0);
}
TabbedPopupLayer::refreshTabButtons(this, "GJ_button_02.png", "GJ_button_05.png");
TabbedPopupLayer::refreshPageButtons(this);
return _stack_chk_guard;
}