//
// AchievementManager::getAllAchievementsSorted from 0x1000e7d14 to 0x1000e7e54 (320 bytes)
//
// 2 xrefs:
// > AchievementManager::init @ 0x1000b6e14
// > AchievementManager::init @ 0x1000b6e28
//
// 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
//
cocos2d::CCArray *__fastcall AchievementManager::getAllAchievementsSorted(AchievementManager *a1, bool a2)
{
_BOOL4 v2; // w20
cocos2d::CCArray *v4; // x22
cocos2d::CCArray *v5; // x19
__int64 v6; // x23
cocos2d::CCString *v7; // x0
char *CString; // x0
cocos2d::CCDictionary *m_platformAchievements; // x25
__int64 v10; // x25
__int64 v11; // x0
__int64 v12; // x26
void *__p[2]; // [xsp+8h] [xbp-58h] BYREF
char v15; // [xsp+1Fh] [xbp-41h]
v2 = a2;
v4 = cocos2d::CCDictionary::allKeys(a1->m_platformAchievements);
v5 = (cocos2d::CCArray *)sub_10024A15C(v4);
if ( (unsigned int)sub_10024A36C(v4) )
{
v6 = 0;
while ( 1 )
{
v7 = (cocos2d::CCString *)sub_10024A388(v4, v6);
CString = (char *)cocos2d::CCString::getCString(v7);
m_platformAchievements = a1->m_platformAchievements;
sub_100009900(__p, CString);
v10 = cocos2d::CCDictionary::objectForKey_1(m_platformAchievements, __p);
if ( v15 < 0 )
{
operator delete(__p[0]);
if ( !v2 )
goto LABEL_9;
}
else if ( !v2 )
{
goto LABEL_9;
}
sub_100009900(__p, "un");
v11 = cocos2d::CCDictionary::objectForKey_1(v10, __p);
v12 = v11;
if ( v15 < 0 )
break;
if ( !v11 )
goto LABEL_9;
LABEL_10:
v6 = (unsigned int)(v6 + 1);
if ( (unsigned int)v6 >= (unsigned int)sub_10024A36C(v4) )
goto LABEL_14;
}
operator delete(__p[0]);
if ( v12 )
goto LABEL_10;
LABEL_9:
sub_10024A2D0(v5, v10);
goto LABEL_10;
}
LABEL_14:
if ( (unsigned int)sub_10024A36C(v5) )
qsort(v5->data->arr, v5->data->num, 8u, (int (__cdecl *)(const void *, const void *))sub_1000B6C78);
return v5;
}