//
// GameManager::getUnlockForAchievement from 0x32106c to 0x32145a (1006 bytes)
//
// 5 xrefs:
// > GameManager::completedAchievement @ 0x325bf8
// > GameManager::resetAchievement @ 0x326326
// > ShardsPage::init @ 0x4fbe0e
// > GJPathPage::onIconInfo @ 0x58bad0
// > GJPathPage::init @ 0x58da2e
//
// 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::CCDictionary *__fastcall GameManager::getUnlockForAchievement(int a1, const char **a2, int *a3, int *a4)
{
AchievementManager *v6; // r0
cocos2d::CCDictionary *result; // r0
cocos2d::CCDictionary *v8; // r7
int v9; // r8
cocos2d::CCString *v10; // r0
char *CString; // r0
cocos2d::CCArray *v12; // r0
cocos2d::CCArray *v13; // r8
int v14; // r9
int v15; // r7
const std::string *v16; // r1
cocos2d::CCObject *v17; // r0
cocos2d::CCString *v18; // r0
char *v19; // r0
cocos2d::CCString *v20; // r0
_BOOL4 v21; // r8
int v22; // r3
_BOOL4 v23; // r8
_BOOL4 v24; // r8
_BOOL4 v25; // r8
_BOOL4 v26; // r8
_BOOL4 v27; // r8
_BOOL4 v28; // r8
_BOOL4 v29; // r9
_BOOL4 v30; // r9
_BOOL4 v31; // r9
_BOOL4 v32; // r9
_BOOL4 v33; // r9
_BOOL4 v34; // r9
_BOOL4 v35; // r9
_BOOL4 v36; // r6
int v38; // [sp+Ch] [bp-60h]
int v39; // [sp+1Ch] [bp-50h] BYREF
_BYTE v40[4]; // [sp+20h] [bp-4Ch] BYREF
_BYTE v41[4]; // [sp+24h] [bp-48h] BYREF
_BYTE v42[4]; // [sp+28h] [bp-44h] BYREF
_BYTE v43[4]; // [sp+2Ch] [bp-40h] BYREF
_BYTE v44[4]; // [sp+30h] [bp-3Ch] BYREF
_BYTE v45[4]; // [sp+34h] [bp-38h] BYREF
_BYTE v46[4]; // [sp+38h] [bp-34h] BYREF
_BYTE v47[4]; // [sp+3Ch] [bp-30h] BYREF
_BYTE v48[4]; // [sp+40h] [bp-2Ch] BYREF
_BYTE v49[4]; // [sp+44h] [bp-28h] BYREF
_BYTE v50[4]; // [sp+48h] [bp-24h] BYREF
_BYTE v51[4]; // [sp+4Ch] [bp-20h] BYREF
_BYTE v52[4]; // [sp+50h] [bp-1Ch] BYREF
_BYTE v53[4]; // [sp+54h] [bp-18h] BYREF
_BYTE v54[4]; // [sp+58h] [bp-14h] BYREF
char *v55; // [sp+5Ch] [bp-10h] BYREF
std::string v56; // [sp+60h] [bp-Ch] BYREF
*a3 = 0;
*a4 = 0;
v6 = AchievementManager::sharedState();
result = AchievementManager::getAchievementsWithID(v6, *a2);
v8 = result;
if ( result )
{
sub_776584((int)&v56, "icon");
v9 = cocos2d::CCDictionary::objectForKey(v8, &v56);
result = (cocos2d::CCDictionary *)sub_774008(&v56);
if ( v9 )
{
sub_776584((int)&v56, "icon");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v8, &v56);
CString = (char *)cocos2d::CCString::getCString(v10);
sub_776584((int)&v39, CString);
v12 = (cocos2d::CCArray *)sub_774008(&v56);
v13 = (cocos2d::CCArray *)cocos2d::CCArray::create(v12);
v14 = sub_774A78((int)&v39, "_");
v15 = 0;
v38 = *(_DWORD *)(v39 - 12);
while ( 1 )
{
sub_776158(&v55, &v39, v15, v14 - v15);
if ( *((_DWORD *)v55 - 3) || v15 != v38 )
{
sub_776584((int)&v56, v55);
v17 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v56, v16);
cocos2d::CCArray::addObject(v13, v17);
sub_774008(&v56);
}
if ( v14 == -1 )
break;
v15 = v14 + 1;
v14 = sub_774A78((int)&v39, "_");
sub_774008(&v55);
}
sub_774008(&v55);
if ( cocos2d::CCArray::count(v13) <= 1u )
return (cocos2d::CCDictionary *)sub_774008(&v39);
v18 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v13, 0);
v19 = (char *)cocos2d::CCString::getCString(v18);
sub_776584((int)&v56, v19);
v20 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v13, 1u);
*a3 = cocos2d::CCString::intValue(v20);
sub_776584((int)v40, "icon");
v21 = sub_32018C((int)&v56, (int)v40);
sub_774008(v40);
if ( v21 )
{
v22 = 1;
}
else
{
sub_776584((int)v41, "ship");
v23 = sub_32018C((int)&v56, (int)v41);
sub_774008(v41);
if ( v23 )
{
v22 = 4;
}
else
{
sub_776584((int)v42, "ball");
v24 = sub_32018C((int)&v56, (int)v42);
sub_774008(v42);
if ( v24 )
{
v22 = 5;
}
else
{
sub_776584((int)v43, "bird");
v25 = sub_32018C((int)&v56, (int)v43);
sub_774008(v43);
if ( v25 )
{
v22 = 6;
}
else
{
sub_776584((int)v44, "dart");
v26 = sub_32018C((int)&v56, (int)v44);
sub_774008(v44);
if ( v26 )
{
v22 = 7;
}
else
{
sub_776584((int)v45, "special");
v27 = sub_32018C((int)&v56, (int)v45);
sub_774008(v45);
if ( v27 )
{
v22 = 10;
}
else
{
sub_776584((int)v46, "robot");
v28 = sub_32018C((int)&v56, (int)v46);
sub_774008(v46);
if ( v28 )
{
v22 = 8;
}
else
{
sub_776584((int)v47, "spider");
v29 = sub_32018C((int)&v56, (int)v47);
sub_774008(v47);
if ( v29 )
{
v22 = 9;
}
else
{
sub_776584((int)v48, "death");
v30 = sub_32018C((int)&v56, (int)v48);
sub_774008(v48);
if ( v30 )
{
v22 = 11;
}
else
{
sub_776584((int)v49, "item");
v31 = sub_32018C((int)&v56, (int)v49);
sub_774008(v49);
if ( v31 )
{
v22 = 12;
}
else
{
sub_776584((int)v50, "swing");
v32 = sub_32018C((int)&v56, (int)v50);
sub_774008(v50);
if ( v32 )
{
v22 = 13;
}
else
{
sub_776584((int)v51, "jetpack");
v33 = sub_32018C((int)&v56, (int)v51);
sub_774008(v51);
if ( v33 )
{
v22 = 14;
}
else
{
sub_776584((int)v52, "shipstreak");
v34 = sub_32018C((int)&v56, (int)v52);
sub_774008(v52);
if ( v34 )
{
v22 = 15;
}
else
{
sub_776584((int)v53, "color");
v35 = sub_32018C((int)&v56, (int)v53);
sub_774008(v53);
if ( v35 )
{
v22 = 2;
}
else
{
sub_776584((int)v54, "color2");
v36 = sub_32018C((int)&v56, (int)v54);
sub_774008(v54);
if ( !v36 )
{
LABEL_41:
sub_774008(&v56);
return (cocos2d::CCDictionary *)sub_774008(&v39);
}
v22 = 3;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
*a4 = v22;
goto LABEL_41;
}
}
return result;
}