//
// ProfilePage::loadPage from 0x1007bff70 to 0x1007c01d9 (617 bytes)
//
// 7 xrefs:
// > ProfilePage::onPrevPage @ 0x1007bf39d
// > ProfilePage::onNextPage @ 0x1007bf3bd
// > ProfilePage::getUserInfoFinished @ 0x1007bff14
// > sub_1007C0200 @ 0x1007c0259
// > ProfilePage::commentUploadFinished @ 0x1007c0ca6
// > sub_1007C0CB0 @ 0x1007c0ced
// > ProfilePage::commentDeleteFailed @ 0x1007c0f06
//
// 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 ProfilePage::loadPage(ProfilePage *a1, int a2)
{
double v2; // xmm0_8
int v3; // r15d
GameLevelManager *v5; // rax
const char *AccountCommentKey; // rax
GameLevelManager *v7; // rax
std::array *longStorage; // rsi
cocos2d::CCArray *StoredOnlineLevels; // rax
GameLevelManager *v10; // rax
cocos2d::CCArray *v11; // rax
GameLevelManager *v12; // rax
std::array *p_shortStorage; // rsi
GameLevelManager *v14; // rax
const char *PageInfo; // rbx
size_t v16; // rax
size_t v17; // r13
char *v18; // r12
std::string *v19; // rbx
std::array *v20; // rdx
size_t v21; // r15
std::array *v22; // rdx
std::string *p_m_profileKey; // [rsp+8h] [rbp-58h]
cocos2d::CCArray *v24; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
int v27; // [rsp+34h] [rbp-2Ch]
v3 = a2;
v5 = GameLevelManager::sharedState();
AccountCommentKey = GameLevelManager::getAccountCommentKey(v5, a1->m_accountID, a2);
std::string::assign((std::string *)&a1->m_profileKey, AccountCommentKey);
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_circle->setVisible)(a1->m_circle, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_refreshBtn->setVisible)(a1->m_refreshBtn, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_leftArrow->setVisible)(a1->m_leftArrow, a2 > 0);
v7 = GameLevelManager::sharedState();
if ( (a1->m_profileKey.m_data.m_short.sizex2 & 1) != 0 )
longStorage = (std::array *)a1->m_profileKey.m_data.m_long.longStorage;
else
longStorage = &a1->m_profileKey.m_data.m_short.shortStorage;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v7, longStorage->__elems_);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_rightArrow->setVisible)(
a1->m_rightArrow,
StoredOnlineLevels != nullptr);
v10 = GameLevelManager::sharedState();
if ( (a1->m_profileKey.m_data.m_short.sizex2 & 1) == 0 )
{
v11 = GameLevelManager::getStoredOnlineLevels(v10, a1->m_profileKey.m_data.m_short.shortStorage.__elems_);
if ( v11 )
goto LABEL_6;
LABEL_9:
ProfilePage::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_levelCommentDelegate = &a1->LevelCommentDelegate;
v14 = GameLevelManager::sharedState();
GameLevelManager::getAccountComments(v14, a1->m_accountID, v3, a1->m_itemCount);
goto LABEL_27;
}
v11 = GameLevelManager::getStoredOnlineLevels(v10, a1->m_profileKey.m_data.m_long.longStorage);
if ( !v11 )
goto LABEL_9;
LABEL_6:
v24 = v11;
v12 = GameLevelManager::sharedState();
if ( (a1->m_profileKey.m_data.m_short.sizex2 & 1) != 0 )
p_shortStorage = (std::array *)a1->m_profileKey.m_data.m_long.longStorage;
else
p_shortStorage = &a1->m_profileKey.m_data.m_short.shortStorage;
PageInfo = GameLevelManager::getPageInfo(v12, p_shortStorage->__elems_);
v16 = strlen(PageInfo);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v17 = v16;
p_m_profileKey = &a1->m_profileKey;
if ( v16 >= 0x17 )
{
v27 = v3;
v21 = 26;
if ( (v16 | 7) != 0x17 )
v21 = (v16 | 7) + 1;
v18 = (char *)operator new(v21);
__p = v18;
__dst[0] = v21 + 1;
v3 = v27;
__dst[1] = v17;
LABEL_19:
memmove(v18, PageInfo, v17);
v18[v17] = 0;
v19 = &a1->m_profileKey;
if ( (p_m_profileKey->m_data.m_short.sizex2 & 1) == 0 )
goto LABEL_15;
LABEL_20:
v20 = (std::array *)a1->m_profileKey.m_data.m_long.longStorage;
goto LABEL_21;
}
LOBYTE(__dst[0]) = 2 * v16;
v18 = (char *)__dst + 1;
if ( v16 )
goto LABEL_19;
BYTE1(__dst[0]) = 0;
v19 = &a1->m_profileKey;
if ( (p_m_profileKey->m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_20;
LABEL_15:
v20 = &a1->m_profileKey.m_data.m_short.shortStorage;
LABEL_21:
((void (__fastcall *)(ProfilePage *, _QWORD *, std::array *))a1->setupPageInfo)(a1, __dst, v20);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( (v19->m_data.m_short.sizex2 & 1) != 0 )
v22 = (std::array *)a1->m_profileKey.m_data.m_long.longStorage;
else
v22 = &a1->m_profileKey.m_data.m_short.shortStorage;
((void (__fastcall *)(ProfilePage *, cocos2d::CCArray *, std::array *))a1->loadCommentsFinished)(
a1,
v24,
v22);
LABEL_27:
a1->m_page = v3;
}