//
// ProfilePage::loadPage from 0x10019c424 to 0x10019c5b4 (400 bytes)
//
// 5 xrefs:
// > ProfilePage::onPrevPage @ 0x10019bd58
// > ProfilePage::onNextPage @ 0x10019bd64
// > ProfilePage::getUserInfoFinished @ 0x10019c3d0
// > ProfilePage::commentUploadFinished @ 0x10019cb60
// > ProfilePage::commentDeleteFailed @ 0x10019cd1c
//
// 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)
{
GameLevelManager *v4; // x0
const char *AccountCommentKey; // x0
std::string *p_m_profileKey; // x21
GameLevelManager *v7; // x0
std::string *capacitym1; // x1
_BOOL8 v9; // x1
GameLevelManager *v10; // x0
std::string *v11; // x1
cocos2d::CCArray *StoredOnlineLevels; // x0
cocos2d::CCArray *v13; // x22
GameLevelManager *v14; // x0
std::string *v15; // x1
char *PageInfo; // x0
std::string *v17; // x2
GameLevelManager *v18; // x0
void *__p[2]; // [xsp+8h] [xbp-38h] BYREF
char v20; // [xsp+1Fh] [xbp-21h]
v4 = GameLevelManager::sharedState();
AccountCommentKey = GameLevelManager::getAccountCommentKey(v4, a1->m_accountID, a2);
p_m_profileKey = &a1->m_profileKey;
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();
capacitym1 = &a1->m_profileKey;
if ( a1->m_profileKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
capacitym1 = (std::string *)p_m_profileKey->m_data.m_long.capacitym1;
v9 = GameLevelManager::getStoredOnlineLevels(v7, (const char *)capacitym1) != nullptr;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BOOL8))a1->m_rightArrow->setVisible)(a1->m_rightArrow, v9);
v10 = GameLevelManager::sharedState();
v11 = &a1->m_profileKey;
if ( a1->m_profileKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v11 = (std::string *)p_m_profileKey->m_data.m_long.capacitym1;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v10, (const char *)v11);
if ( StoredOnlineLevels )
{
v13 = StoredOnlineLevels;
v14 = GameLevelManager::sharedState();
v15 = &a1->m_profileKey;
if ( a1->m_profileKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v15 = (std::string *)p_m_profileKey->m_data.m_long.capacitym1;
PageInfo = (char *)GameLevelManager::getPageInfo(v14, (const char *)v15);
sub_100009900(__p, PageInfo);
v17 = &a1->m_profileKey;
if ( a1->m_profileKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v17 = (std::string *)p_m_profileKey->m_data.m_long.capacitym1;
((void (__fastcall *)(ProfilePage *, void **, std::string *))a1->setupPageInfo)(a1, __p, v17);
if ( v20 < 0 )
operator delete(__p[0]);
if ( a1->m_profileKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
p_m_profileKey = (std::string *)p_m_profileKey->m_data.m_long.capacitym1;
((void (__fastcall *)(ProfilePage *, cocos2d::CCArray *, std::string *))a1->loadCommentsFinished)(
a1,
v13,
p_m_profileKey);
}
else
{
ProfilePage::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_levelCommentDelegate = &a1->LevelCommentDelegate;
v18 = GameLevelManager::sharedState();
GameLevelManager::getAccountComments(v18, a1->m_accountID, a2, a1->m_itemCount);
}
a1->m_page = a2;
}