//
// InfoLayer::loadPage from 0x1007b1290 to 0x1007b162e (926 bytes)
//
// 7 xrefs:
// > InfoLayer::init @ 0x1007affba
// > InfoLayer::onPrevPage @ 0x1007b0f1f
// > InfoLayer::onNextPage @ 0x1007b0f3f
// > InfoLayer::toggleCommentMode @ 0x1007b1108
// > InfoLayer::onGetComments @ 0x1007b1289
// > InfoLayer::onRefreshComments @ 0x1007b1e80
// > InfoLayer::commentUploadFinished @ 0x1007b2f14
//
// 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)
{
double v3; // xmm0_8
int v5; // r13d
GameManager *v6; // rax
bool GameVariable; // r12
std::string *p_m_commentKey; // rbx
double v9; // xmm0_8
GameLevelManager *v10; // rax
std::array *longStorage; // rsi
cocos2d::CCArray *StoredLevelComments; // rax
GameLevelManager *v13; // rax
cocos2d::CCArray *StoredOnlineLevels; // rax
GameLevelManager *v15; // rax
std::array *p_shortStorage; // rsi
GameManager *v17; // rax
GameLevelManager *v18; // rax
const char *PageInfo; // r12
size_t v20; // rax
size_t v21; // r15
char *v22; // rbx
std::string *v23; // rbx
std::array *v24; // rdx
size_t v25; // r13
std::array *v26; // rdx
GameLevelManager *v27; // rax
GJUserScore *m_score; // rcx
int m_userID; // esi
GJLevelList *m_levelList; // rcx
GJGameLevel *m_level; // rcx
__int128 v32; // [rsp+0h] [rbp-70h] BYREF
char *v33; // [rsp+10h] [rbp-60h]
std::string *v34; // [rsp+18h] [rbp-58h]
cocos2d::CCArray *v35; // [rsp+20h] [rbp-50h]
_QWORD __dst[2]; // [rsp+28h] [rbp-48h] BYREF
void *__p; // [rsp+38h] [rbp-38h]
int v38; // [rsp+44h] [rbp-2Ch]
v5 = a2;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_commentsBtn->setVisible)(a1->m_commentsBtn, 0);
v6 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v6, "0069");
GameLevelManager::sharedState();
GameLevelManager::getCommentKey(&v32, v3);
p_m_commentKey = &a1->m_commentKey;
if ( (a1->m_commentKey.m_data.m_short.sizex2 & 1) != 0 )
operator delete(a1->m_commentKey.m_data.m_long.longStorage);
a1->m_commentKey.m_data.m_long.longStorage = v33;
v9 = *(double *)&v32;
*(_OWORD *)&p_m_commentKey->m_data.m_short.sizex2 = v32;
((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);
v10 = GameLevelManager::sharedState();
if ( (a1->m_commentKey.m_data.m_short.sizex2 & 1) != 0 )
longStorage = (std::array *)a1->m_commentKey.m_data.m_long.longStorage;
else
longStorage = &a1->m_commentKey.m_data.m_short.shortStorage;
StoredLevelComments = GameLevelManager::getStoredLevelComments(v10, longStorage->__elems_);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_rightArrow->setVisible)(
a1->m_rightArrow,
StoredLevelComments != nullptr);
v13 = GameLevelManager::sharedState();
if ( (a1->m_commentKey.m_data.m_short.sizex2 & 1) == 0 )
{
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(
v13,
a1->m_commentKey.m_data.m_short.shortStorage.__elems_);
if ( StoredOnlineLevels )
goto LABEL_8;
LABEL_11:
if ( !a3 )
InfoLayer::setupCommentsBrowser(a1, nullptr);
GameLevelManager::sharedState()->m_levelCommentDelegate = &a1->LevelCommentDelegate;
v17 = GameManager::sharedState();
if ( v17->m_playerUserID.random == v17->m_playerUserID.seed )
{
a1->m_canUpdateUserScore = 1;
v18 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v18);
if ( a3 )
goto LABEL_42;
}
else
{
v27 = 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::getLevelComments(v27, m_userID, v5, a1->m_itemCount, GameVariable, a1->m_mode);
if ( a3 )
goto LABEL_42;
}
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const std::string::value_type *))a1->m_pageLabel->setString)(
a1->m_pageLabel,
" ");
goto LABEL_42;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v13, a1->m_commentKey.m_data.m_long.longStorage);
if ( !StoredOnlineLevels )
goto LABEL_11;
LABEL_8:
v35 = StoredOnlineLevels;
v15 = GameLevelManager::sharedState();
if ( (p_m_commentKey->m_data.m_short.sizex2 & 1) != 0 )
p_shortStorage = (std::array *)a1->m_commentKey.m_data.m_long.longStorage;
else
p_shortStorage = &a1->m_commentKey.m_data.m_short.shortStorage;
PageInfo = GameLevelManager::getPageInfo(v15, p_shortStorage->__elems_);
v20 = strlen(PageInfo);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v9);
v21 = v20;
v34 = &a1->m_commentKey;
if ( v20 >= 0x17 )
{
v38 = v5;
v25 = 26;
if ( (v20 | 7) != 0x17 )
v25 = (v20 | 7) + 1;
v22 = (char *)operator new(v25);
__p = v22;
__dst[0] = v25 + 1;
v5 = v38;
__dst[1] = v21;
LABEL_25:
memmove(v22, PageInfo, v21);
v22[v21] = 0;
v23 = v34;
if ( (v34->m_data.m_short.sizex2 & 1) == 0 )
goto LABEL_21;
LABEL_26:
v24 = (std::array *)a1->m_commentKey.m_data.m_long.longStorage;
goto LABEL_27;
}
LOBYTE(__dst[0]) = 2 * v20;
v22 = (char *)__dst + 1;
if ( v20 )
goto LABEL_25;
BYTE1(__dst[0]) = 0;
v23 = v34;
if ( (v34->m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_26;
LABEL_21:
v24 = &a1->m_commentKey.m_data.m_short.shortStorage;
LABEL_27:
((void (__fastcall *)(InfoLayer *, _QWORD *, std::array *))a1->setupPageInfo)(a1, __dst, v24);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( (v23->m_data.m_short.sizex2 & 1) != 0 )
v26 = (std::array *)a1->m_commentKey.m_data.m_long.longStorage;
else
v26 = &a1->m_commentKey.m_data.m_short.shortStorage;
((void (__fastcall *)(InfoLayer *, cocos2d::CCArray *, std::array *))a1->loadCommentsFinished)(a1, v35, v26);
LABEL_42:
a1->m_page = v5;
}