//
// TopArtistsLayer::loadPage from 0x14066eb70 to 0x14066eff8 (1160 bytes)
//
// 3 xrefs:
// > TopArtistsLayer::onNextPage @ 0x14066f008
// > TopArtistsLayer::onPrevPage @ 0x14066f018
// > ??> @ 0x140932234
//
// 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:35:53 +0000
//
// Hidden C++ exception states: #wind=10
void __fastcall TopArtistsLayer::loadPage(__int64 a1, int a2)
{
cocos2d::CCString *v3; // rax
const char *CString; // rax
size_t v5; // rbx
size_t v6; // r8
cocos2d::CCString *v7; // rax
const char *v8; // rax
size_t v9; // r8
__int64 v10; // rdx
__int64 v11; // rdx
void **v12; // rsi
__int64 v13; // rcx
__int64 v14; // rdx
__int64 v15; // rcx
void **v16; // rdx
__int64 StoredOnlineLevels; // rsi
__int64 v18; // rcx
void **v19; // rdx
char *PageInfo; // rax
void **v21; // r8
void **v22; // r8
__int64 v23; // rdx
__int64 v24; // rcx
void *v25; // rcx
void *v26; // rcx
void *v27; // [rsp+30h] [rbp-29h]
void *v28; // [rsp+30h] [rbp-29h]
void *v29; // [rsp+30h] [rbp-29h]
void *v30; // [rsp+30h] [rbp-29h]
void *v31; // [rsp+30h] [rbp-29h]
void *v32; // [rsp+30h] [rbp-29h]
void *v33; // [rsp+30h] [rbp-29h]
__int128 v34; // [rsp+38h] [rbp-21h] BYREF
__int64 v35; // [rsp+48h] [rbp-11h]
__int64 v36; // [rsp+50h] [rbp-9h]
void *v37[2]; // [rsp+58h] [rbp-1h] BYREF
__int64 v38; // [rsp+68h] [rbp+Fh]
unsigned __int64 v39; // [rsp+70h] [rbp+17h]
void *Block[2]; // [rsp+78h] [rbp+1Fh] BYREF
__int64 v41; // [rsp+88h] [rbp+2Fh]
unsigned __int64 v42; // [rsp+90h] [rbp+37h]
*(_DWORD *)(a1 + 744) = a2;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v27 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v27);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
v3 = cocos2d::CCString::createWithFormat("topArtists_%i", *(_DWORD *)(a1 + 744));
CString = cocos2d::CCString::getCString(v3);
*(_OWORD *)v37 = 0;
v38 = 0;
v39 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003D230(v37, CString, v6);
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v28 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v28);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
v7 = cocos2d::CCString::createWithFormat("topArtists_%i", *(_DWORD *)(a1 + 744) + 1);
v8 = cocos2d::CCString::getCString(v7);
*(_OWORD *)Block = 0;
v41 = 0;
v42 = 0;
v9 = -1;
do
++v9;
while ( v8[v9] );
sub_14003D230(Block, v8, v9);
LOBYTE(v10) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 688) + 336LL))(*(_QWORD *)(a1 + 688), v10);
if ( *(int *)(a1 + 744) <= 0 )
v11 = 0;
else
LOBYTE(v11) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 704) + 336LL))(*(_QWORD *)(a1 + 704), v11);
v12 = Block;
if ( v42 > 0xF )
v12 = (void **)Block[0];
v13 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v29 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v29);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v13 = *(_QWORD *)&qword_14090BFB0;
}
if ( GameLevelManager::getStoredOnlineLevels(v13, v12) )
LOBYTE(v14) = 1;
else
v14 = 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 696) + 336LL))(*(_QWORD *)(a1 + 696), v14);
v15 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v30 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v30);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v15 = *(_QWORD *)&qword_14090BFB0;
}
v16 = v37;
if ( v39 > 0xF )
v16 = (void **)v37[0];
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v15, v16);
v18 = *(_QWORD *)&qword_14090BFB0;
if ( StoredOnlineLevels )
{
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v31 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v31);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v18 = *(_QWORD *)&qword_14090BFB0;
}
v19 = v37;
if ( v39 > 0xF )
v19 = (void **)v37[0];
PageInfo = GameLevelManager::getPageInfo(v18, v19);
v34 = 0;
v35 = 0;
v36 = 0;
do
++v5;
while ( PageInfo[v5] );
sub_14003D230(&v34, PageInfo, v5);
v21 = v37;
if ( v39 > 0xF )
v21 = (void **)v37[0];
(*(void (__fastcall **)(__int64, __int128 *, void **))(*(_QWORD *)(a1 + 664) + 16LL))(a1 + 664, &v34, v21);
v22 = v37;
if ( v39 > 0xF )
v22 = (void **)v37[0];
(**(void (__fastcall ***)(__int64, __int64, void **))(a1 + 664))(a1 + 664, StoredOnlineLevels, v22);
}
else
{
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v32 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v32);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v18 = *(_QWORD *)&qword_14090BFB0;
}
GameLevelManager::makeTimeStamp(v18, "upd_artists");
LOBYTE(v23) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 688) + 336LL))(*(_QWORD *)(a1 + 688), v23);
TopArtistsLayer::setupLeaderboard(a1, nullptr);
v24 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v33 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v33);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v24 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v24 + 1584) = a1 + 664;
GameLevelManager::getTopArtists((cocos2d::CCActionManager **)v24, *(_DWORD *)(a1 + 744), *(_DWORD *)(a1 + 728));
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 720) + 360LL))(
*(_QWORD *)(a1 + 720) + 360LL,
" ");
}
if ( v42 > 0xF )
{
v25 = Block[0];
if ( v42 + 1 >= 0x1000 )
{
v25 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v25 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v25);
}
if ( v39 > 0xF )
{
v26 = v37[0];
if ( v39 + 1 >= 0x1000 )
{
v26 = *((void **)v37[0] - 1);
if ( (unsigned __int64)((char *)v37[0] - (char *)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
}