//
// AchievementManager::getAllAchievementsSorted from 0x678ddc to 0x678ff4 (536 bytes)
//
// 3 xrefs:
// > AchievementManager::init @ 0x6792ec
// > AchievementManager::init @ 0x679300
// > ??> @ 0x58c48
//
// 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:50:20 +0000
//
cocos2d::CCArray *__fastcall AchievementManager::getAllAchievementsSorted(
cocos2d::CCDictionary **this,
unsigned __int8 a2)
{
int v3; // w25
unsigned int v4; // w21
cocos2d::CCArray *v5; // x22
cocos2d::CCArray *v6; // x26
cocos2d::CCString *v7; // x0
const char *CString; // x0
const char *v9; // x23
size_t v10; // x0
size_t v11; // x20
__int64 v12; // x28
char *v13; // x3
cocos2d::CCObject *v14; // x20
__int64 v16; // x23
unsigned __int64 v17; // x27
char *v18; // x0
unsigned __int64 v19; // [xsp+70h] [xbp+70h] BYREF
size_t v20; // [xsp+78h] [xbp+78h]
void *v21; // [xsp+80h] [xbp+80h]
v3 = a2;
v4 = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(*(this + 41));
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
if ( (unsigned int)cocos2d::CCArray::count(v5) )
{
do
{
v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v5, v4);
CString = (const char *)cocos2d::CCString::getCString(v7);
v19 = 0;
v20 = 0;
v9 = CString;
v21 = nullptr;
v10 = strlen(CString);
v11 = v10;
v12 = (__int64)*(this + 41);
if ( v10 > 0xFFFFFFFFFFFFFFEFLL )
sub_62B060();
if ( v10 > 0x16 )
{
v17 = (v10 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v18 = (char *)operator new(v17);
v20 = v11;
v13 = v18;
v21 = v18;
v19 = v17 | 1;
}
else
{
LOBYTE(v19) = 2 * v10;
v13 = (char *)&v19 + 1;
if ( !v10 )
goto LABEL_5;
}
v13 = (char *)memcpy(v13, v9, v11);
LABEL_5:
v13[v11] = 0;
v14 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v12, &v19);
if ( (v19 & 1) != 0 )
{
operator delete(v21);
if ( !v3 )
goto LABEL_7;
}
else if ( !v3 )
{
goto LABEL_7;
}
v19 = 0;
v20 = 0;
v21 = nullptr;
std::string::__init((__int64 *)&v19, &word_122D628, 2u);
v16 = cocos2d::CCDictionary::objectForKey(v14, &v19);
if ( (v19 & 1) != 0 )
{
operator delete(v21);
if ( v16 )
{
LABEL_15:
++v4;
continue;
}
}
else if ( v16 )
{
goto LABEL_15;
}
LABEL_7:
++v4;
cocos2d::CCArray::addObject(v6, v14);
}
while ( v4 < (unsigned int)cocos2d::CCArray::count(v5) );
}
if ( (unsigned int)cocos2d::CCArray::count(v6) )
qsort(
*(void **)(*((_QWORD *)v6 + 7) + 16LL),
**((unsigned int **)v6 + 7),
8u,
(int (*)(const void *, const void *))achievementCompare);
return v6;
}