//
// ProfilePage::loadPage from 0x1403c61d0 to 0x1403c64b6 (742 bytes)
//
// 6 xrefs:
// > ProfilePage::getUserInfoFinished @ 0x1403c5f79
// > ProfilePage::onNextPage @ 0x1403c68f8
// > ProfilePage::onPrevPage @ 0x1403c6908
// > ProfilePage::commentUploadFinished @ 0x1403c694a
// > ProfilePage::commentDeleteFailed @ 0x1403c6c58
// > ??> @ 0x1406d78c8
//
// 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
//
// Hidden C++ exception states: #wind=6
void ProfilePage::loadPage(ProfilePage *a1, int a2)
{
cocos2d::CCString *v4; // rax
char *CString; // rax
size_t v6; // rbx
size_t v7; // r8
std::string *p_m_profileKey; // rsi
_BOOL8 v9; // rdx
_BOOL8 v10; // rdx
std::string *m_bigStorage; // r14
GameLevelManager *v12; // rcx
_BOOL8 v13; // rdx
GameLevelManager *v14; // rcx
cocos2d::CCArray *StoredOnlineLevels; // r14
std::string *v16; // rsi
GameLevelManager *v17; // rcx
const char *PageInfo; // rax
GameLevelManager *v19; // rcx
__int128 v20; // [rsp+20h] [rbp-38h] BYREF
__int64 v21; // [rsp+30h] [rbp-28h]
__int64 v22; // [rsp+38h] [rbp-20h]
void *v23; // [rsp+60h] [rbp+8h]
void *v24; // [rsp+60h] [rbp+8h]
void *v25; // [rsp+60h] [rbp+8h]
void *v26; // [rsp+60h] [rbp+8h]
void *v27; // [rsp+60h] [rbp+8h]
if ( !qword_1406C2EC0 )
{
v23 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
v4 = cocos2d::CCString::createWithFormat("a_%i_%i", a1->m_accountID, a2);
CString = (char *)cocos2d::CCString::getCString(v4);
v6 = -1;
v7 = -1;
do
++v7;
while ( CString[v7] );
p_m_profileKey = &a1->m_profileKey;
sub_14003CCE0((void **)&a1->m_profileKey, CString, v7);
LOBYTE(v9) = 1;
a1->m_circle->setVisible(a1->m_circle, v9);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
if ( a2 <= 0 )
v10 = 0;
else
LOBYTE(v10) = 1;
a1->m_leftArrow->setVisible(a1->m_leftArrow, v10);
m_bigStorage = &a1->m_profileKey;
if ( a1->m_profileKey.m_data.m_capacity > 0xF )
m_bigStorage = (std::string *)p_m_profileKey->m_data.m_bigStorage;
v12 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v24 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v12 = (GameLevelManager *)qword_1406C2EC0;
}
if ( GameLevelManager::getStoredOnlineLevels(v12, m_bigStorage->m_data.m_smallStorage._Elems) )
LOBYTE(v13) = 1;
else
v13 = 0;
a1->m_rightArrow->setVisible(a1->m_rightArrow, v13);
if ( a1->m_profileKey.m_data.m_capacity > 0xF )
p_m_profileKey = (std::string *)p_m_profileKey->m_data.m_bigStorage;
v14 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v25 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v14 = (GameLevelManager *)qword_1406C2EC0;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v14, p_m_profileKey->m_data.m_smallStorage._Elems);
if ( StoredOnlineLevels )
{
v16 = &a1->m_profileKey;
if ( a1->m_profileKey.m_data.m_capacity > 0xF )
v16 = (std::string *)v16->m_data.m_bigStorage;
v17 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v26 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v17 = (GameLevelManager *)qword_1406C2EC0;
}
PageInfo = GameLevelManager::getPageInfo(v17, v16->m_data.m_smallStorage._Elems);
v20 = 0;
v21 = 0;
v22 = 0;
do
++v6;
while ( PageInfo[v6] );
sub_14003A930(&v20, PageInfo, v6);
((void (__fastcall *)(LevelCommentDelegate *, __int128 *))a1->setupPageInfo)(&a1->LevelCommentDelegate, &v20);
((void (__fastcall *)(LevelCommentDelegate *, cocos2d::CCArray *))a1->loadCommentsFinished)(
&a1->LevelCommentDelegate,
StoredOnlineLevels);
}
else
{
ProfilePage::setupCommentsBrowser(a1, nullptr);
v19 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v27 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v27);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v19 = (GameLevelManager *)qword_1406C2EC0;
}
v19->m_levelCommentDelegate = &a1->LevelCommentDelegate;
GameLevelManager::getAccountComments(v19, a1->m_accountID, a2, a1->m_itemCount);
}
a1->m_page = a2;
}