//
// GJSongBrowser::loadPage from 0x30827c to 0x308376 (250 bytes)
//
// 3 xrefs:
// > GJSongBrowser::init @ 0x30838c
// > GJSongBrowser::onNextPage @ 0x30839e
// > GJSongBrowser::onPrevPage @ 0x3083a8
//
// 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 GJSongBrowser::loadPage(GJSongBrowser *a1, int a2)
{
CCMenuItemSpriteExtra *m_leftArrow; // r0
unsigned int v5; // r6
cocos2d::CCArray *v6; // r0
unsigned int v7; // r1
cocos2d::CCArray *v8; // r7
cocos2d::CCArray *v9; // r0
cocos2d::CCObject *v10; // r8
MusicDownloadManager *v11; // r0
int v12; // r5
cocos2d::CCArray *v13; // r7
int v14; // r8
unsigned int i; // r6
cocos2d::CCObject *v16; // r0
m_leftArrow = a1->m_leftArrow;
a1->m_page = a2;
v5 = 0;
m_leftArrow->setVisible(m_leftArrow, a2 > 0);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::count(a1->m_downloadedSongs);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::createWithCapacity(v6, v7);
cocos2d::CCArray::addObjectsFromArray(v8, a1->m_downloadedSongs);
while ( 1 )
{
v9 = (cocos2d::CCArray *)cocos2d::CCArray::count(v8);
if ( v5 >= (unsigned int)v9 )
break;
v10 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v8, v5);
v11 = MusicDownloadManager::sharedState();
if ( !MusicDownloadManager::isSongDownloaded(v11, v10[5].m_uID) )
cocos2d::CCArray::removeObject(a1->m_downloadedSongs, v10, 1);
++v5;
}
v12 = 10 * a2;
v13 = (cocos2d::CCArray *)cocos2d::CCArray::create(v9);
v14 = cocos2d::CCArray::count(a1->m_downloadedSongs);
if ( cocos2d::CCArray::count(a1->m_downloadedSongs) )
{
for ( i = v12; i != v12 + 10 && i <= cocos2d::CCArray::count(a1->m_downloadedSongs) - 1; ++i )
{
v16 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a1->m_downloadedSongs, i);
cocos2d::CCArray::addObject(v13, v16);
}
}
cocos2d::CCArray::count(v13);
cocos2d::CCArray::count(a1->m_downloadedSongs);
((void (*)(void))a1->m_rightArrow->setVisible)();
GJSongBrowser::setupPageInfo(a1, v14, v12, 10);
GJSongBrowser::setupSongBrowser(a1, v13);
}