//
// ProfilePage::loadPage from 0x8fec0c to 0x8fee74 (616 bytes)
//
// 6 xrefs:
// > ProfilePage::onNextPage @ 0x8fee7c
// > ProfilePage::onPrevPage @ 0x8fee88
// > ProfilePage::commentUploadFinished @ 0x8feedc
// > ProfilePage::commentDeleteFailed @ 0x8ff018
// > ProfilePage::getUserInfoFinished @ 0x8ff10c
// > ??> @ 0x91b60
//
// 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 ProfilePage::loadPage(ProfilePage *a1, int a2)
{
GameLevelManager *v4; // x0
size_t v5; // x0
long double v6; // q0
CCMenuItemSpriteExtra *m_leftArrow; // x2
GameLevelManager *v8; // x0
cocos2d::CCArray *StoredOnlineLevels; // x0
CCMenuItemSpriteExtra *m_rightArrow; // x2
GameLevelManager *v11; // x0
cocos2d::CCArray *v12; // x23
void (__fastcall *setupPageInfo)(ProfilePage *__hidden, std::string, const unsigned __int8 *); // x24
GameLevelManager *v14; // x0
char *PageInfo; // x0
void *v16; // x0
GameLevelManager *v17; // x0
cocos2d::CCArray *v18; // x0
GameLevelManager *v19; // x0
GameLevelManager *v20; // x0
unsigned int *v21; // x2
int v22; // w1
const char *AccountCommentKey; // [xsp+48h] [xbp+48h]
__int64 v24; // [xsp+60h] [xbp+60h] BYREF
v4 = GameLevelManager::sharedState();
AccountCommentKey = GameLevelManager::getAccountCommentKey(v4, a1->m_accountID, a2);
v5 = strlen(AccountCommentKey);
*(__n128 *)&v6 = sub_D1798C(&a1->m_profileKey, AccountCommentKey, v5);
((void (__fastcall *)(LoadingCircle *, __int64, long double))a1->m_circle->setVisible)(a1->m_circle, 1, v6);
a1->m_refreshBtn->setVisible(a1->m_refreshBtn, 0);
m_leftArrow = a1->m_leftArrow;
if ( a2 > 0 )
{
m_leftArrow->setVisible(a1->m_leftArrow, 1);
v8 = GameLevelManager::sharedState();
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v8, (const char *)a1->m_profileKey.m_data.m_data);
m_rightArrow = a1->m_rightArrow;
if ( StoredOnlineLevels )
goto LABEL_3;
LABEL_8:
m_rightArrow->setVisible(m_rightArrow, 0);
v19 = GameLevelManager::sharedState();
v12 = GameLevelManager::getStoredOnlineLevels(v19, (const char *)a1->m_profileKey.m_data.m_data);
if ( v12 )
goto LABEL_4;
LABEL_9:
ProfilePage::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_levelCommentDelegate = &a1->LevelCommentDelegate;
v20 = GameLevelManager::sharedState();
GameLevelManager::getAccountComments(v20, a1->m_accountID, a2, a1->m_itemCount);
goto LABEL_6;
}
m_leftArrow->setVisible(a1->m_leftArrow, 0);
v17 = GameLevelManager::sharedState();
v18 = GameLevelManager::getStoredOnlineLevels(v17, (const char *)a1->m_profileKey.m_data.m_data);
m_rightArrow = a1->m_rightArrow;
if ( !v18 )
goto LABEL_8;
LABEL_3:
m_rightArrow->setVisible(m_rightArrow, 1);
v11 = GameLevelManager::sharedState();
v12 = GameLevelManager::getStoredOnlineLevels(v11, (const char *)a1->m_profileKey.m_data.m_data);
if ( !v12 )
goto LABEL_9;
LABEL_4:
setupPageInfo = a1->setupPageInfo;
v14 = GameLevelManager::sharedState();
PageInfo = (char *)GameLevelManager::getPageInfo(v14, (const char *)a1->m_profileKey.m_data.m_data);
sub_D153B8((int)&v24, PageInfo);
((void (__fastcall *)(ProfilePage *, __int64 *, stl::StringData::Internal *))setupPageInfo)(
a1,
&v24,
a1->m_profileKey.m_data.m_data);
v16 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v24 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v16);
}
a1->loadCommentsFinished(a1, v12, (const unsigned __int8 *)a1->m_profileKey.m_data.m_data);
LABEL_6:
a1->m_page = a2;
}