//
// GameManager::getUnlockForAchievement from 0x416e84 to 0x41736a (1254 bytes)
//
// 5 xrefs:
// > GameManager::completedAchievement @ 0x41924c
// > GameManager::resetAchievement @ 0x4199b6
// > ShardsPage::init @ 0x62c0fc
// > GJPathPage::onIconInfo @ 0x6d2354
// > GJPathPage::init @ 0x6d382a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:47:41 +0000
//
int __fastcall GameManager::getUnlockForAchievement(AchievementManager *a1, int a2, _DWORD *a3, int *a4)
{
AchievementManager *v6; // r0
const char *v7; // r1
int result; // r0
int v9; // r7
int v10; // r6
cocos2d::CCString *v11; // r0
const char *CString; // r7
size_t v13; // r0
cocos2d::CCArray *v14; // r0
cocos2d::CCArray *v15; // r0
int v16; // r3
cocos2d::CCArray *v17; // r8
int v18; // r7
unsigned __int8 *v19; // r6
unsigned __int8 *v20; // r7
unsigned __int8 *first_of; // r0
int v22; // r6
int v23; // r3
unsigned int v24; // r7
const char *v25; // r7
size_t v26; // r0
cocos2d::CCObject *v27; // r0
unsigned __int8 *v28; // r6
unsigned int v29; // r3
unsigned __int8 *v30; // r11
unsigned __int8 *v31; // r0
cocos2d::CCString *v32; // r0
const char *v33; // r6
size_t v34; // r0
cocos2d::CCString *v35; // r0
_BOOL4 v36; // r6
int v37; // r3
_BOOL4 v38; // r6
_BOOL4 v39; // r6
_BOOL4 v40; // r6
_BOOL4 v41; // r6
_BOOL4 v42; // r6
_BOOL4 v43; // r7
_BOOL4 v44; // r7
_BOOL4 v45; // r7
_BOOL4 v46; // r7
_BOOL4 v47; // r7
_BOOL4 v48; // r7
_BOOL4 v49; // r7
_BOOL4 v50; // r7
_BOOL4 v51; // r6
int v52; // [sp+Ch] [bp-F8h]
int v54; // [sp+24h] [bp-E0h] BYREF
unsigned int v55; // [sp+28h] [bp-DCh]
unsigned __int8 *v56; // [sp+2Ch] [bp-D8h]
int v57[3]; // [sp+30h] [bp-D4h] BYREF
int v58[3]; // [sp+3Ch] [bp-C8h] BYREF
int v59[3]; // [sp+48h] [bp-BCh] BYREF
int v60[3]; // [sp+54h] [bp-B0h] BYREF
int v61[3]; // [sp+60h] [bp-A4h] BYREF
int v62[3]; // [sp+6Ch] [bp-98h] BYREF
int v63[3]; // [sp+78h] [bp-8Ch] BYREF
int v64[3]; // [sp+84h] [bp-80h] BYREF
int v65[3]; // [sp+90h] [bp-74h] BYREF
int v66[3]; // [sp+9Ch] [bp-68h] BYREF
int v67[3]; // [sp+A8h] [bp-5Ch] BYREF
int v68[3]; // [sp+B4h] [bp-50h] BYREF
int v69[3]; // [sp+C0h] [bp-44h] BYREF
int v70[3]; // [sp+CCh] [bp-38h] BYREF
int v71[3]; // [sp+D8h] [bp-2Ch] BYREF
int v72[3]; // [sp+E4h] [bp-20h] BYREF
int v73; // [sp+F0h] [bp-14h] BYREF
int v74; // [sp+F4h] [bp-10h]
int v75; // [sp+F8h] [bp-Ch]
*a3 = 0;
*a4 = 0;
v6 = (AchievementManager *)AchievementManager::sharedState(a1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v7 = *(const char **)(a2 + 8);
else
v7 = (const char *)(a2 + 1);
result = AchievementManager::getAchievementsWithID(v6, v7);
v9 = result;
if ( !result )
return result;
v73 = 0;
v74 = 0;
v75 = 0;
std::string::__init(&v73, "icon", 4u);
v10 = cocos2d::CCDictionary::objectForKey(v9, &v73);
result = std::string::~string((int)&v73);
if ( !v10 )
return result;
v73 = 0;
v74 = 0;
v75 = 0;
std::string::__init(&v73, "icon", 4u);
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v73);
CString = (const char *)cocos2d::CCString::getCString(v11);
v54 = 0;
v55 = 0;
v56 = nullptr;
v13 = strlen(CString);
std::string::__init(&v54, CString, v13);
v14 = (cocos2d::CCArray *)std::string::~string((int)&v73);
v15 = (cocos2d::CCArray *)cocos2d::CCArray::create(v14);
v16 = (unsigned __int8)v54;
v17 = v15;
if ( (v54 & 1) == 0 )
{
v18 = (int)(unsigned __int8)v54 >> 1;
if ( !v18 )
{
v22 = -1;
goto LABEL_17;
}
v19 = (unsigned __int8 *)&v54 + 1;
LABEL_8:
v20 = &v19[v18];
first_of = std::__find_first_of_ce(
v19,
v20,
(int)"_",
(int)"",
(int (__fastcall *)(_DWORD, int))std::char_traits::eq);
v16 = (unsigned __int8)v54;
if ( first_of == v20 )
v22 = -1;
else
v22 = first_of - v19;
if ( (v54 & 1) != 0 )
goto LABEL_14;
LABEL_17:
v23 = v16 >> 1;
goto LABEL_18;
}
v18 = v55;
v19 = v56;
if ( v55 )
goto LABEL_8;
v22 = -1;
LABEL_14:
v23 = v55;
LABEL_18:
v52 = v23;
v24 = 0;
while ( 1 )
{
std::string::basic_string(v72, (unsigned __int8 *)&v54, v24, v22 - v24);
if ( (v72[0] & 1) != 0 )
{
if ( v72[1] || v24 != v52 )
{
v25 = (const char *)v72[2];
LABEL_28:
v73 = 0;
v74 = 0;
v75 = 0;
v26 = strlen(v25);
std::string::__init(&v73, v25, v26);
v27 = (cocos2d::CCObject *)cocos2d::CCString::create(&v73);
cocos2d::CCArray::addObject(v17, v27);
std::string::~string((int)&v73);
}
}
else if ( LOBYTE(v72[0]) >> 1 || v24 != v52 )
{
v25 = (char *)v72 + 1;
goto LABEL_28;
}
if ( v22 == -1 )
break;
v24 = v22 + 1;
if ( (v54 & 1) != 0 )
{
v28 = v56;
v29 = v55;
}
else
{
v29 = (int)(unsigned __int8)v54 >> 1;
v28 = (unsigned __int8 *)&v54 + 1;
}
if ( v24 >= v29
|| (v30 = &v28[v29],
v31 = std::__find_first_of_ce(
&v28[v24],
&v28[v29],
(int)"_",
(int)"",
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
v31 == v30) )
{
v22 = -1;
}
else
{
v22 = v31 - v28;
}
std::string::~string((int)v72);
}
std::string::~string((int)v72);
if ( cocos2d::CCArray::count(v17) > 1u )
{
v32 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v17, 0);
v33 = (const char *)cocos2d::CCString::getCString(v32);
v73 = 0;
v74 = 0;
v75 = 0;
v34 = strlen(v33);
std::string::__init(&v73, v33, v34);
v35 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v17, 1u);
*a3 = cocos2d::CCString::intValue(v35);
memset(v57, 0, sizeof(v57));
std::string::__init(v57, "icon", 4u);
v36 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v57);
std::string::~string((int)v57);
if ( v36 )
{
v37 = 1;
goto LABEL_68;
}
memset(v58, 0, sizeof(v58));
std::string::__init(v58, "ship", 4u);
v38 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v58);
std::string::~string((int)v58);
if ( v38 )
{
v37 = 4;
goto LABEL_68;
}
memset(v59, 0, sizeof(v59));
std::string::__init(v59, "ball", 4u);
v39 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v59);
std::string::~string((int)v59);
if ( v39 )
{
v37 = 5;
goto LABEL_68;
}
memset(v60, 0, sizeof(v60));
std::string::__init(v60, "bird", 4u);
v40 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v60);
std::string::~string((int)v60);
if ( v40 )
{
v37 = 6;
goto LABEL_68;
}
memset(v61, 0, sizeof(v61));
std::string::__init(v61, "dart", 4u);
v41 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v61);
std::string::~string((int)v61);
if ( v41 )
{
v37 = 7;
goto LABEL_68;
}
memset(v62, 0, sizeof(v62));
std::string::__init(v62, "special", 7u);
v42 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v62);
std::string::~string((int)v62);
if ( v42 )
{
v37 = 10;
goto LABEL_68;
}
memset(v63, 0, sizeof(v63));
std::string::__init(v63, "robot", 5u);
v43 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v63);
std::string::~string((int)v63);
if ( v43 )
{
v37 = 8;
goto LABEL_68;
}
memset(v64, 0, sizeof(v64));
std::string::__init(v64, "spider", 6u);
v44 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v64);
std::string::~string((int)v64);
if ( v44 )
{
v37 = 9;
goto LABEL_68;
}
memset(v65, 0, sizeof(v65));
std::string::__init(v65, "death", 5u);
v45 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v65);
std::string::~string((int)v65);
if ( v45 )
{
v37 = 11;
goto LABEL_68;
}
memset(v66, 0, sizeof(v66));
std::string::__init(v66, "item", 4u);
v46 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v66);
std::string::~string((int)v66);
if ( v46 )
{
v37 = 12;
goto LABEL_68;
}
memset(v67, 0, sizeof(v67));
std::string::__init(v67, "swing", 5u);
v47 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v67);
std::string::~string((int)v67);
if ( v47 )
{
v37 = 13;
goto LABEL_68;
}
memset(v68, 0, sizeof(v68));
std::string::__init(v68, "jetpack", 7u);
v48 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v68);
std::string::~string((int)v68);
if ( v48 )
{
v37 = 14;
goto LABEL_68;
}
memset(v69, 0, sizeof(v69));
std::string::__init(v69, "shipstreak", 0xAu);
v49 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v69);
std::string::~string((int)v69);
if ( v49 )
{
v37 = 15;
goto LABEL_68;
}
memset(v70, 0, sizeof(v70));
std::string::__init(v70, "color", 5u);
v50 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v70);
std::string::~string((int)v70);
if ( v50 )
{
v37 = 2;
goto LABEL_68;
}
memset(v71, 0, sizeof(v71));
std::string::__init(v71, "color2", 6u);
v51 = sub_41306C((unsigned __int8 *)&v73, (unsigned __int8 *)v71);
std::string::~string((int)v71);
if ( v51 )
{
v37 = 3;
LABEL_68:
*a4 = v37;
}
std::string::~string((int)&v73);
}
return std::string::~string((int)&v54);
}