//
// InfoLayer::loadPage from 0x100351f28 to 0x1003521d8 (688 bytes)
//
// 7 xrefs:
// > InfoLayer::init @ 0x100351068
// > InfoLayer::onPrevPage @ 0x100351c78
// > InfoLayer::onNextPage @ 0x100351c88
// > InfoLayer::toggleCommentMode @ 0x100351dc8
// > InfoLayer::onGetComments @ 0x100351f24
// > InfoLayer::onRefreshComments @ 0x1003528e8
// > InfoLayer::commentUploadFinished @ 0x1003530fc
//
// 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 InfoLayer::loadPage(InfoLayer *a1, int a2, bool a3)
{
GameManager *v6; // x0
_BOOL4 GameVariable; // w22
GJUserScore *m_score; // x8
int m_userID; // w1
GJLevelList *m_levelList; // x8
GJGameLevel *m_level; // x8
void **p_m_commentKey; // x23
GameLevelManager *v13; // x0
std::string *v14; // x1
_BOOL8 v15; // x1
GameLevelManager *v16; // x0
std::string *v17; // x1
cocos2d::CCArray *StoredOnlineLevels; // x0
cocos2d::CCArray *v19; // x24
GameLevelManager *v20; // x0
std::string *v21; // x1
char *PageInfo; // x0
std::string *v23; // x2
GameManager *v24; // x0
GameLevelManager *v25; // x0
GameLevelManager *v26; // x0
GJUserScore *v27; // x8
int v28; // w1
GJLevelList *v29; // x8
GJGameLevel *v30; // x8
void *__p[2]; // [xsp+0h] [xbp-60h] BYREF
char v32; // [xsp+17h] [xbp-49h]
__int128 v33; // [xsp+18h] [xbp-48h] BYREF
char *v34; // [xsp+28h] [xbp-38h]
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_commentsBtn->setVisible)(a1->m_commentsBtn, 0);
v6 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v6, "0069");
GameLevelManager::sharedState();
m_score = a1->m_score;
if ( m_score )
{
m_userID = m_score->m_userID;
}
else
{
m_levelList = a1->m_levelList;
if ( m_levelList )
{
m_userID = -m_levelList->m_listID;
}
else
{
m_level = a1->m_level;
if ( m_level )
m_userID = m_level->m_levelID.random - m_level->m_levelID.seed;
else
m_userID = 0;
}
}
GameLevelManager::getCommentKey(m_userID, a2, GameVariable, a1->m_mode, &v33);
p_m_commentKey = (void **)&a1->m_commentKey;
if ( a1->m_commentKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete(*p_m_commentKey);
*(_OWORD *)p_m_commentKey = v33;
a1->m_commentKey.m_data.m_long.longStorage = v34;
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 1);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_noComments->setVisible)(a1->m_noComments, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_leftArrow->setVisible)(a1->m_leftArrow, a2 > 0);
v13 = GameLevelManager::sharedState();
v14 = &a1->m_commentKey;
if ( a1->m_commentKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v14 = (std::string *)*p_m_commentKey;
v15 = GameLevelManager::getStoredLevelComments(v13, (const char *)v14) != nullptr;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BOOL8))a1->m_rightArrow->setVisible)(a1->m_rightArrow, v15);
v16 = GameLevelManager::sharedState();
v17 = &a1->m_commentKey;
if ( a1->m_commentKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v17 = (std::string *)*p_m_commentKey;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v16, (const char *)v17);
if ( !StoredOnlineLevels )
{
if ( !a3 )
InfoLayer::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_levelCommentDelegate = &a1->LevelCommentDelegate;
v24 = GameManager::sharedState();
if ( v24->m_playerUserID.random == v24->m_playerUserID.seed )
{
a1->m_canUpdateUserScore = 1;
v25 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v25);
if ( a3 )
goto LABEL_38;
}
else
{
v26 = GameLevelManager::sharedState();
v27 = a1->m_score;
if ( v27 )
{
v28 = v27->m_userID;
}
else
{
v29 = a1->m_levelList;
if ( v29 )
{
v28 = -v29->m_listID;
}
else
{
v30 = a1->m_level;
if ( v30 )
v28 = v30->m_levelID.random - v30->m_levelID.seed;
else
v28 = 0;
}
}
GameLevelManager::getLevelComments(v26, v28, a2, a1->m_itemCount, GameVariable, a1->m_mode);
if ( a3 )
goto LABEL_38;
}
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_pageLabel->setString)(a1->m_pageLabel, " ");
goto LABEL_38;
}
v19 = StoredOnlineLevels;
v20 = GameLevelManager::sharedState();
v21 = &a1->m_commentKey;
if ( a1->m_commentKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v21 = (std::string *)*p_m_commentKey;
PageInfo = (char *)GameLevelManager::getPageInfo(v20, (const char *)v21);
sub_100009900(__p, PageInfo);
v23 = &a1->m_commentKey;
if ( a1->m_commentKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
v23 = (std::string *)*p_m_commentKey;
((void (__fastcall *)(InfoLayer *, void **, std::string *))a1->setupPageInfo)(a1, __p, v23);
if ( v32 < 0 )
operator delete(__p[0]);
if ( a1->m_commentKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
p_m_commentKey = (void **)*p_m_commentKey;
((void (__fastcall *)(InfoLayer *, cocos2d::CCArray *, void **))a1->loadCommentsFinished)(a1, v19, p_m_commentKey);
LABEL_38:
a1->m_page = a2;
}