//
// AchievementsLayer::loadPage from 0x7328c0 to 0x732d30 (1136 bytes)
//
// 4 xrefs:
// > AchievementsLayer::customSetup @ 0x732f78
// > AchievementsLayer::onNextPage @ 0x732ff0
// > AchievementsLayer::onPrevPage @ 0x732ffc
// > ??> @ 0xd6e28
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:52:37 +0000
//
__int64 __fastcall AchievementsLayer::loadPage(AchievementsLayer *this, int a2)
{
__int64 v4; // x2
AchievementManager *v5; // x0
AchievementManager *v6; // x0
cocos2d::CCArray *v7; // x21
AchievementManager *v8; // x0
unsigned int v9; // w22
unsigned __int64 isAchievementEarned; // x0
__int64 v11; // x0
__int64 v12; // x26
cocos2d::CCString *v13; // x0
const char *CString; // x0
size_t v15; // x0
_BOOL4 v16; // w26
AchievementManager *v17; // x0
unsigned int v18; // w22
unsigned __int64 v19; // x0
__int64 v20; // x0
__int64 v21; // x26
cocos2d::CCString *v22; // x0
const char *v23; // x0
size_t v24; // x0
_BOOL4 v25; // w26
cocos2d::CCArray *v26; // x20
int v27; // w25
unsigned int v28; // w26
unsigned int v29; // w19
unsigned int v30; // w0
__int64 v31; // x2
unsigned int v33; // w19
unsigned int v34; // w1
cocos2d::CCObject *v35; // x0
unsigned int v36; // w19
unsigned int v37; // w0
char *v38; // [xsp+68h] [xbp+68h]
char *v39; // [xsp+68h] [xbp+68h]
__int64 v40; // [xsp+78h] [xbp+78h] BYREF
__int64 v41; // [xsp+80h] [xbp+80h]
void *v42; // [xsp+88h] [xbp+88h]
__int64 v43; // [xsp+90h] [xbp+90h] BYREF
__int64 v44; // [xsp+98h] [xbp+98h]
void *v45; // [xsp+A0h] [xbp+A0h]
*((_DWORD *)this + 151) = a2;
v4 = *((_QWORD *)this + 77);
if ( a2 <= 0 )
v5 = (AchievementManager *)(*(__int64 (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v4 + 344LL))(
*((_QWORD *)this + 77),
0);
else
v5 = (AchievementManager *)(*(__int64 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)v4 + 344LL))(
*((_QWORD *)this + 77),
1);
v6 = (AchievementManager *)AchievementManager::sharedState(v5);
v7 = *((cocos2d::CCArray **)v6 + 46);
v8 = (AchievementManager *)AchievementManager::sharedState(v6);
v9 = 0;
isAchievementEarned = AchievementManager::isAchievementEarned(v8, "geometry.ach.steam01");
if ( !(_BYTE)isAchievementEarned )
{
isAchievementEarned = cocos2d::CCArray::count(v7);
if ( (_DWORD)isAchievementEarned )
{
do
{
v11 = cocos2d::CCArray::objectAtIndex(v7, v9);
v43 = 0;
v12 = v11;
v44 = 0;
v45 = nullptr;
std::string::__init(&v43, "identifier", 0xAu);
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v12, &v43);
CString = (const char *)cocos2d::CCString::getCString(v13);
v40 = 0;
v41 = 0;
v42 = nullptr;
v38 = (char *)CString;
v15 = strlen(CString);
std::string::__init(&v40, v38, v15);
if ( (v43 & 1) != 0 )
operator delete(v45);
v43 = 0;
v44 = 0;
v45 = nullptr;
std::string::__init(&v43, "geometry.ach.steam01", 0x14u);
v16 = sub_732554((__int64)&v40, (__int64)&v43);
if ( (v43 & 1) != 0 )
{
operator delete(v45);
if ( v16 )
{
LABEL_27:
cocos2d::CCArray::removeObjectAtIndex(v7, v9, 1);
isAchievementEarned = (unsigned __int8)v40;
if ( (v40 & 1) != 0 )
operator delete(v42);
break;
}
}
else if ( v16 )
{
goto LABEL_27;
}
++v9;
if ( (v40 & 1) != 0 )
operator delete(v42);
isAchievementEarned = cocos2d::CCArray::count(v7);
}
while ( v9 < (unsigned int)isAchievementEarned );
}
}
v17 = (AchievementManager *)AchievementManager::sharedState((AchievementManager *)isAchievementEarned);
v18 = 0;
v19 = AchievementManager::isAchievementEarned(v17, "geometry.ach.steam02");
if ( (_BYTE)v19 )
goto LABEL_21;
v19 = cocos2d::CCArray::count(v7);
if ( !(_DWORD)v19 )
goto LABEL_21;
while ( 1 )
{
v20 = cocos2d::CCArray::objectAtIndex(v7, v18);
v43 = 0;
v21 = v20;
v44 = 0;
v45 = nullptr;
std::string::__init(&v43, "identifier", 0xAu);
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v21, &v43);
v23 = (const char *)cocos2d::CCString::getCString(v22);
v40 = 0;
v41 = 0;
v42 = nullptr;
v39 = (char *)v23;
v24 = strlen(v23);
std::string::__init(&v40, v39, v24);
if ( (v43 & 1) != 0 )
operator delete(v45);
v43 = 0;
v44 = 0;
v45 = nullptr;
std::string::__init(&v43, "geometry.ach.steam02", 0x14u);
v25 = sub_732554((__int64)&v40, (__int64)&v43);
if ( (v43 & 1) != 0 )
break;
if ( v25 )
goto LABEL_30;
LABEL_18:
++v18;
if ( (v40 & 1) != 0 )
operator delete(v42);
v19 = cocos2d::CCArray::count(v7);
if ( v18 >= (unsigned int)v19 )
goto LABEL_21;
}
operator delete(v45);
if ( !v25 )
goto LABEL_18;
LABEL_30:
cocos2d::CCArray::removeObjectAtIndex(v7, v18, 1);
v19 = (unsigned __int8)v40;
if ( (v40 & 1) != 0 )
operator delete(v42);
LABEL_21:
v26 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v19);
v27 = 10 * a2;
v28 = cocos2d::CCArray::count(v7);
if ( v7 && (unsigned int)cocos2d::CCArray::count(v7) )
{
v33 = v27;
while ( v33 <= (unsigned int)cocos2d::CCArray::count(v7) - 1 )
{
v34 = v33++;
v35 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v7, v34);
cocos2d::CCArray::addObject(v26, v35);
if ( v33 == v27 + 10 )
{
v36 = cocos2d::CCArray::count(v26) + v27;
v37 = cocos2d::CCArray::count(v7);
v31 = *((_QWORD *)this + 76);
if ( v36 >= v37 )
goto LABEL_24;
goto LABEL_36;
}
}
}
v29 = cocos2d::CCArray::count(v26) + v27;
v30 = cocos2d::CCArray::count(v7);
v31 = *((_QWORD *)this + 76);
if ( v29 < v30 )
LABEL_36:
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v31 + 344LL))(v31, 1);
else
LABEL_24:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v31 + 344LL))(v31, 0);
AchievementsLayer::setupPageInfo(this, v28, v27, 10);
AchievementsLayer::setupLevelBrowser(this, v26);
return _stack_chk_guard;
}