//
// GJSongBrowser::loadPage from 0x1005fed80 to 0x1005fefea (618 bytes)
//
// 3 xrefs:
// > GJSongBrowser::init @ 0x1005fed70
// > GJSongBrowser::onPrevPage @ 0x1005ff37d
// > GJSongBrowser::onNextPage @ 0x1005ff39d
//
// 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 __fastcall GJSongBrowser::loadPage(GJSongBrowser *a1, int a2)
{
unsigned int v4; // eax
__int64 v5; // r15
cocos2d::CCArray *m_downloadedSongs; // rsi
__int64 v7; // rdi
unsigned int v8; // r12d
__int64 v9; // r14
MusicDownloadManager *v10; // rax
cocos2d::CCArray *v11; // r15
int v12; // r14d
unsigned int v13; // r12d
__int64 v14; // rax
unsigned int v16; // r12d
unsigned int v17; // eax
cocos2d::CCString *v18; // rax
const char *CString; // rax
CustomListView *v20; // rax
char v21; // [rsp+0h] [rbp-40h]
int v22; // [rsp+14h] [rbp-2Ch]
a1->m_page = a2;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_leftArrow->setVisible)(a1->m_leftArrow, a2 > 0);
v4 = sub_100720070(a1->m_downloadedSongs);
v5 = sub_10071FD00(v4);
m_downloadedSongs = a1->m_downloadedSongs;
sub_100720050(v5, m_downloadedSongs);
v7 = v5;
if ( (unsigned int)sub_100720070(v5) )
{
v8 = 0;
do
{
v9 = sub_1007200C0(v5, v8);
v10 = MusicDownloadManager::sharedState();
m_downloadedSongs = (cocos2d::CCArray *)*(unsigned int *)(v9 + 316);
if ( !MusicDownloadManager::isSongDownloaded(v10, (int)m_downloadedSongs) )
{
m_downloadedSongs = (cocos2d::CCArray *)v9;
sub_100720220(a1->m_downloadedSongs, v9, 1);
}
++v8;
v7 = v5;
}
while ( v8 < (unsigned int)sub_100720070(v5) );
}
v11 = (cocos2d::CCArray *)sub_10071F9E0(v7, m_downloadedSongs);
v12 = 10 * a2;
v22 = sub_100720070(a1->m_downloadedSongs);
if ( (unsigned int)sub_100720070(a1->m_downloadedSongs) )
{
v13 = 10 * a2;
do
{
if ( v13 > (unsigned int)sub_100720070(a1->m_downloadedSongs) - 1 )
break;
v14 = sub_1007200C0(a1->m_downloadedSongs, v13);
sub_10071FCD0(v11, v14);
}
while ( (int)v13++ < v12 + 9 );
}
v16 = v12 + sub_100720070(v11);
v17 = sub_100720070(a1->m_downloadedSongs);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_rightArrow->setVisible)(a1->m_rightArrow, v16 < v17);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_leftArrow->setVisible)(a1->m_leftArrow, a2 != 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_rightArrow->setVisible)(a1->m_rightArrow, v12 + 10 < v22);
v18 = (cocos2d::CCString *)sub_1007AB580("%i to %i of %i", v21);
CString = cocos2d::CCString::getCString(v18);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_countText->setString)(a1->m_countText, CString);
((void (__fastcall *)(GJListLayer *, __int64, __int64))a1->m_listLayer->removeChildByTag_0)(a1->m_listLayer, 9, 1);
v20 = CustomListView::create(v11, &a1->TableViewCellDelegate, 220.0, 356.0, 0, CustomSong, 0.0);
a1->m_listView = v20;
((void (__fastcall *)(CustomListView *, __int64))v20->setTag)(v20, 9);
((void (__fastcall *)(GJListLayer *, CustomListView *, __int64))a1->m_listLayer->addChild_0)(
a1->m_listLayer,
a1->m_listView,
6);
}