//
// FRequestProfilePage::loadPage from 0x1001b6d70 to 0x1001b6f4c (476 bytes)
//
// 5 xrefs:
// > FRequestProfilePage::init @ 0x1001b6960
// > FRequestProfilePage::onPrevPage @ 0x1001b6cfc
// > FRequestProfilePage::onNextPage @ 0x1001b6d08
// > FRequestProfilePage::forceReloadRequests @ 0x1001b7718
// > sub_1001B7720 @ 0x1001b7734
//
// 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 FRequestProfilePage::loadPage(FRequestProfilePage *a1, int a2)
{
GameLevelManager *v4; // x0
char *FriendRequestKey; // x0
std::size_t size; // x8
std::string *p_m_key; // x21
GameLevelManager *v8; // x0
std::string *capacitym1; // x1
_BOOL8 v10; // x1
GameLevelManager *v11; // x0
std::string *v12; // x1
cocos2d::CCArray *StoredOnlineLevels; // x22
GameLevelManager *v14; // x0
std::string *v15; // x1
char *PageInfo; // x0
std::string *v17; // x2
GameLevelManager *v18; // x0
void *__p[2]; // [xsp+0h] [xbp-50h] BYREF
char v20; // [xsp+17h] [xbp-39h]
std::string __str; // [xsp+18h] [xbp-38h] BYREF
v4 = GameLevelManager::sharedState();
FriendRequestKey = (char *)GameLevelManager::getFriendRequestKey(v4, a1->m_sent, a2);
sub_100009900(&__str, FriendRequestKey);
size = a1->m_key.m_data.m_short.shortStorage.__elems_[22];
if ( (size & 0x8000000000000000LL) != 0 )
size = a1->m_key.m_data.m_long.size;
p_m_key = &a1->m_key;
if ( size && !sub_1000045BC(&__str, &a1->m_key.m_data.m_long.capacitym1) )
FRequestProfilePage::untoggleAll(a1);
std::string::operator=((std::string *)&a1->m_key, &__str);
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_circle->setVisible)(a1->m_circle, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_refreshButton->setVisible)(a1->m_refreshButton, 0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_errorLabel->setVisible)(a1->m_errorLabel, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_prevButton->setVisible)(a1->m_prevButton, a2 > 0);
v8 = GameLevelManager::sharedState();
capacitym1 = &a1->m_key;
if ( a1->m_key.m_data.m_short.shortStorage.__elems_[22] < 0 )
capacitym1 = (std::string *)p_m_key->m_data.m_long.capacitym1;
v10 = GameLevelManager::getStoredOnlineLevels(v8, (const char *)capacitym1) != nullptr;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BOOL8))a1->m_nextButton->setVisible)(a1->m_nextButton, v10);
v11 = GameLevelManager::sharedState();
v12 = &a1->m_key;
if ( a1->m_key.m_data.m_short.shortStorage.__elems_[22] < 0 )
v12 = (std::string *)p_m_key->m_data.m_long.capacitym1;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v11, (const char *)v12);
if ( StoredOnlineLevels )
{
v14 = GameLevelManager::sharedState();
v15 = &a1->m_key;
if ( a1->m_key.m_data.m_short.shortStorage.__elems_[22] < 0 )
v15 = (std::string *)p_m_key->m_data.m_long.capacitym1;
PageInfo = (char *)GameLevelManager::getPageInfo(v14, (const char *)v15);
sub_100009900(__p, PageInfo);
v17 = &a1->m_key;
if ( a1->m_key.m_data.m_short.shortStorage.__elems_[22] < 0 )
v17 = (std::string *)p_m_key->m_data.m_long.capacitym1;
((void (__fastcall *)(FRequestProfilePage *, void **, std::string *))a1->setupPageInfo)(a1, __p, v17);
if ( v20 < 0 )
operator delete(__p[0]);
if ( a1->m_key.m_data.m_short.shortStorage.__elems_[22] < 0 )
p_m_key = (std::string *)p_m_key->m_data.m_long.capacitym1;
((void (__fastcall *)(FRequestProfilePage *, cocos2d::CCArray *, std::string *))a1->loadFRequestsFinished)(
a1,
StoredOnlineLevels,
p_m_key);
}
else
{
FRequestProfilePage::setupCommentsBrowser(a1, nullptr);
v18 = GameLevelManager::sharedState();
GameLevelManager::getFriendRequests(v18, a1->m_sent, a2, a1->m_itemCount);
}
a1->m_page = a2;
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}