//
// LeaderboardsLayer::toggleTabButtons from 0x81e610 to 0x81e8cc (700 bytes)
//
// 2 xrefs:
// > LeaderboardsLayer::selectLeaderboard @ 0x81e928
// > ??> @ 0x89040
//
// 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 LeaderboardsLayer::toggleTabButtons(LeaderboardsLayer *a1)
{
__int64 v2; // x0
__int64 v3; // x2
__int64 v4; // x0
__int64 v5; // x2
__int64 v6; // x0
__int64 v7; // x2
__int64 v8; // x0
__int64 v9; // x2
cocos2d::CCArray *m_modeButtons; // x0
cocos2d::ccArray *data; // x1
char *arr; // x21
__int64 v13; // x0
char *v14; // x22
__int64 i; // x19
ButtonSprite *v16; // x25
const char *v17; // x1
cocos2d::CCNode *v18; // [xsp+58h] [xbp+58h]
cocos2d::CCNode *v19; // [xsp+58h] [xbp+58h]
cocos2d::CCNode *v20; // [xsp+58h] [xbp+58h]
cocos2d::CCNode *v21; // [xsp+58h] [xbp+58h]
CCMenuItemToggler::toggle(a1->m_topBtn, a1->m_type == Top100);
CCMenuItemToggler::toggle(a1->m_friendsBtn, a1->m_type == Friends);
CCMenuItemToggler::toggle(a1->m_globalBtn, a1->m_type == Global);
CCMenuItemToggler::toggle(a1->m_creatorsBtn, a1->m_type == Creator);
a1->m_topBtn->setEnabled(a1->m_topBtn, a1->m_type != Top100);
a1->m_friendsBtn->setEnabled(a1->m_friendsBtn, a1->m_type != Friends);
a1->m_globalBtn->setEnabled(a1->m_globalBtn, a1->m_type != Global);
a1->m_creatorsBtn->setEnabled(a1->m_creatorsBtn, a1->m_type != Creator);
v18 = a1->m_topBtn->getParent(a1->m_topBtn);
v2 = ((__int64 (*)(void))v18->getParent)();
if ( a1->m_type == Top100 )
v3 = 2;
else
v3 = 0xFFFFFFFFLL;
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, __int64))(*(_QWORD *)v2 + 576LL))(v2, v18, v3);
v19 = a1->m_friendsBtn->getParent(a1->m_friendsBtn);
v4 = ((__int64 (*)(void))v19->getParent)();
if ( a1->m_type == Friends )
v5 = 2;
else
v5 = 0xFFFFFFFFLL;
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, __int64))(*(_QWORD *)v4 + 576LL))(v4, v19, v5);
v20 = a1->m_globalBtn->getParent(a1->m_globalBtn);
v6 = ((__int64 (*)(void))v20->getParent)();
if ( a1->m_type == Global )
v7 = 2;
else
v7 = 0xFFFFFFFFLL;
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, __int64))(*(_QWORD *)v6 + 576LL))(v6, v20, v7);
v21 = a1->m_creatorsBtn->getParent(a1->m_creatorsBtn);
v8 = ((__int64 (*)(void))v21->getParent)();
if ( a1->m_type == Creator )
v9 = 2;
else
v9 = 0xFFFFFFFFLL;
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, __int64))(*(_QWORD *)v8 + 576LL))(v8, v21, v9);
LeaderboardsLayer::refreshTabs(a1);
m_modeButtons = a1->m_modeButtons;
if ( m_modeButtons )
{
data = m_modeButtons->data;
if ( data->num )
{
arr = (char *)data->arr;
v13 = 8LL * data->num - 8;
v14 = &arr[v13];
if ( arr <= &arr[v13] )
{
for ( i = *(_QWORD *)arr; *(_QWORD *)arr; i = *(_QWORD *)arr )
{
arr += 8;
v16 = (ButtonSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)i + 1056LL))(i);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)i + 64LL))(i) == a1->m_stat )
v17 = "GJ_button_02.png";
else
v17 = "GJ_button_01.png";
ButtonSprite::updateBGImage(v16, v17);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)i + 328LL))(i, a1->m_type != Creator);
if ( v14 < arr )
break;
}
}
}
}
}