//
// GJSongBrowser::loadPage from 0x1403bdd50 to 0x1403bdf5d (525 bytes)
//
// 6 xrefs:
// > GJSongBrowser::init @ 0x1403bd8af
// > GJSongBrowser::onNextPage @ 0x1403bdf68
// > GJSongBrowser::onPrevPage @ 0x1403bdf78
// > ??> @ 0x1408c1c30
// > ??> @ 0x1408c1c40
// > ??> @ 0x140923f18
//
// 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:31:27 +0000
//
__int64 __fastcall GJSongBrowser::loadPage(__int64 a1, __int64 a2)
{
__int64 v3; // rcx
int v4; // ebx
__int64 v5; // rcx
cocos2d::CCArray *v6; // r14
int v7; // esi
signed int v8; // r15d
unsigned int v9; // ebx
struct cocos2d::CCObject *v10; // rax
unsigned int v11; // ebx
unsigned int v12; // eax
__int64 *v13; // rcx
__int64 v14; // rdx
__int64 v15; // rdx
__int64 v16; // rdx
__int64 v17; // rcx
signed int v18; // ebx
void (__fastcall *v19)(__int64, __int64); // r8
cocos2d::CCString *v20; // rax
const char *CString; // rax
__int64 v22; // r8
__int64 v23; // rdx
_QWORD *v24; // rax
__int64 v26; // [rsp+20h] [rbp-38h]
*(_DWORD *)(a1 + 624) = a2;
v3 = *(_QWORD *)(a1 + 648);
v4 = a2;
if ( (int)a2 <= 0 )
a2 = 0;
else
LOBYTE(a2) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v3 + 336LL))(v3, a2);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v7 = 10 * v4;
v8 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 672));
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 672)) )
{
v9 = 10 * v4;
if ( !__OFSUB__(v7, v7 + 10) )
{
do
{
if ( v9 > cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 672)) - 1 )
break;
v10 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 672), v9);
cocos2d::CCArray::addObject(v6, v10);
++v9;
}
while ( (int)v9 < v7 + 10 );
}
}
v11 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 672));
v12 = cocos2d::CCArray::count(v6);
v13 = *(__int64 **)(a1 + 640);
v14 = *v13;
if ( v12 + v7 >= v11 )
v14 = 0;
else
LOBYTE(v14) = 1;
(*(void (__fastcall **)(__int64 *, __int64))(*v13 + 336))(v13, v14);
if ( v7 )
LOBYTE(v15) = 1;
else
v15 = 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 648) + 336LL))(*(_QWORD *)(a1 + 648), v15);
v17 = *(_QWORD *)(a1 + 640);
v18 = v7 + 10;
v19 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 336LL);
if ( v7 + 10 < v8 )
{
LOBYTE(v16) = 1;
v19(v17, v16);
}
else
{
v19(v17, 0);
v18 = v8;
}
v20 = cocos2d::CCString::createWithFormat("%i to %i of %i", v7 + 1, v18, v8);
CString = cocos2d::CCString::getCString(v20);
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 656) + 360LL))(
*(_QWORD *)(a1 + 656) + 360LL,
CString);
LOBYTE(v22) = 1;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 568) + 552LL))(*(_QWORD *)(a1 + 568), 9, v22);
v23 = a1 + 616;
if ( !a1 )
v23 = 0;
v24 = CustomListView::create(v6, v23, 220.0, 356.0, v26, 14);
*(_QWORD *)(a1 + 680) = v24;
(*(void (__fastcall **)(_QWORD *, __int64))(*v24 + 64LL))(v24, 9);
return (*(__int64 (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 568) + 456LL))(
*(_QWORD *)(a1 + 568),
*(_QWORD *)(a1 + 680),
6);
}