//
// GameManager::getUnlockForAchievement from 0x100378750 to 0x100379036 (2278 bytes)
//
// 5 xrefs:
// > GJPathPage::init @ 0x1002fff4c
// > GJPathPage::onIconInfo @ 0x100300cd0
// > GameManager::completedAchievement @ 0x100379157
// > GameManager::resetAchievement @ 0x1003792f7
// > ShardsPage::init @ 0x1004c6a32
//
// 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
//
void __fastcall GameManager::getUnlockForAchievement(double a1, __int64 a2, __int64 a3, int *a4, int *a5)
{
AchievementManager *v7; // rax
const char *v8; // rbx
cocos2d::CCDictionary *AchievementsWithID; // rax
__int64 v10; // rbx
__int64 v11; // r14
char *v12; // rsi
cocos2d::CCString *v13; // rax
const char *CString; // rbx
void *v15; // rdi
size_t v16; // rax
size_t v17; // r15
char *v18; // r14
char *v19; // rax
_BYTE *v20; // r12
__int64 v21; // r15
size_t v22; // r12
_BYTE *v23; // rsi
_BYTE *v24; // rdx
char *v25; // r14
bool v26; // zf
unsigned __int64 v27; // r13
char *v28; // rbx
size_t v29; // r13
char *v30; // r14
char v31; // al
const char *v32; // rbx
size_t v33; // r12
size_t v34; // rax
size_t v35; // r13
char *v36; // r14
size_t v37; // r12
__int64 v38; // rax
__int64 v39; // rbx
void *v40; // rax
unsigned __int64 v41; // rsi
char *v42; // rdx
unsigned __int64 v43; // rdi
cocos2d::CCString *v44; // rax
const char *v45; // rbx
size_t v46; // rax
size_t v47; // r12
char *v48; // r14
size_t v49; // r13
cocos2d::CCString *v50; // rax
char *v51; // r15
char v52; // r13
size_t v53; // rbx
size_t v54; // r12
bool v55; // cl
int v56; // eax
bool v57; // cl
bool v58; // cl
bool v59; // cl
char v60; // bl
char v61; // bl
char v62; // bl
char v63; // bl
char v64; // bl
char v65; // bl
char v66; // bl
char v67; // bl
char v68; // bl
char v69; // bl
char v70; // bl
int *v71; // [rsp+8h] [rbp-98h]
int *v72; // [rsp+10h] [rbp-90h]
_BYTE *v73; // [rsp+18h] [rbp-88h]
__int64 v74; // [rsp+20h] [rbp-80h]
__int64 __dst; // [rsp+28h] [rbp-78h] BYREF
unsigned __int64 v76; // [rsp+30h] [rbp-70h]
void *v77; // [rsp+38h] [rbp-68h]
void *v78; // [rsp+40h] [rbp-60h]
char __s[8]; // [rsp+48h] [rbp-58h] BYREF
size_t __n; // [rsp+50h] [rbp-50h]
void *__p; // [rsp+58h] [rbp-48h]
_QWORD __s2[2]; // [rsp+60h] [rbp-40h] BYREF
void *v83; // [rsp+70h] [rbp-30h]
*a4 = 0;
*a5 = 0;
v7 = AchievementManager::sharedState();
if ( (*(_BYTE *)a3 & 1) != 0 )
v8 = *(const char **)(a3 + 16);
else
v8 = (const char *)(a3 + 1);
AchievementsWithID = AchievementManager::getAchievementsWithID(v7, v8);
if ( AchievementsWithID )
{
v10 = (__int64)AchievementsWithID;
__s[0] = 8;
strcpy(&__s[1], "icon");
v11 = cocos2d::CCDictionary::objectForKey_1((__int64)AchievementsWithID, __s);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
if ( v11 )
{
v71 = a4;
v72 = a5;
__s[0] = 8;
strcpy(&__s[1], "icon");
v12 = __s;
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v10, __s);
CString = cocos2d::CCString::getCString(v13);
v15 = (void *)CString;
v16 = strlen(CString);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a1);
v17 = v16;
if ( v16 >= 0x17 )
{
v22 = 26;
if ( (v16 | 7) != 0x17 )
v22 = (v16 | 7) + 1;
v18 = (char *)operator new(v22);
v77 = v18;
__dst = v22 | 1;
v76 = v17;
}
else
{
LOBYTE(__dst) = 2 * v16;
v18 = (char *)&__dst + 1;
if ( !v16 )
{
BYTE1(__dst) = 0;
if ( (__s[0] & 1) == 0 )
goto LABEL_13;
goto LABEL_12;
}
}
v15 = v18;
v12 = (char *)CString;
memmove(v18, CString, v17);
v18[v17] = 0;
if ( (__s[0] & 1) == 0 )
{
LABEL_13:
v74 = sub_10071F9E0(v15, v12);
v19 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
{
v19 = (char *)v77;
v20 = (_BYTE *)v76;
v21 = -1;
if ( !v76 )
goto LABEL_28;
}
else
{
v20 = (_BYTE *)((unsigned __int8)__dst >> 1);
v21 = -1;
if ( !((unsigned __int8)__dst >> 1) )
{
LABEL_28:
v25 = nullptr;
v73 = v20;
while ( 1 )
{
if ( (__dst & 1) != 0 )
{
v27 = v76;
if ( v76 < (unsigned __int64)v25 )
LABEL_130:
sub_1000547C0();
v28 = (char *)v77;
}
else
{
v27 = (unsigned __int8)__dst >> 1;
v28 = (char *)&__dst + 1;
if ( (unsigned __int64)v25 > v27 )
goto LABEL_130;
}
v29 = v27 - (_QWORD)v25;
if ( v29 >= v21 - (__int64)v25 )
v29 = v21 - (_QWORD)v25;
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a1);
v78 = v25;
if ( v29 >= 0x17 )
{
v33 = (v29 | 7) + 1;
if ( (v29 | 7) == 0x17 )
v33 = 26;
v30 = (char *)operator new(v33);
__p = v30;
*(_QWORD *)__s = v33 | 1;
__n = v29;
v20 = v73;
}
else
{
__s[0] = 2 * v29;
v30 = &__s[1];
if ( !v29 )
{
__s[1] = 0;
v31 = __s[0];
if ( (__s[0] & 1) == 0 )
goto LABEL_41;
goto LABEL_48;
}
}
memmove(v30, &v28[(_QWORD)v78], v29);
v30[v29] = 0;
v31 = __s[0];
if ( (__s[0] & 1) == 0 )
{
LABEL_41:
v25 = (char *)v78;
if ( !v31 && v78 == v20 )
goto LABEL_61;
v32 = &__s[1];
goto LABEL_51;
}
LABEL_48:
v25 = (char *)v78;
if ( !__n && v78 == v20 )
goto LABEL_61;
v32 = (const char *)__p;
LABEL_51:
v34 = strlen(v32);
if ( v34 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a1);
v35 = v34;
if ( v34 >= 0x17 )
{
v37 = (v34 | 7) + 1;
if ( (v34 | 7) == 0x17 )
v37 = 26;
v36 = (char *)operator new(v37);
v83 = v36;
__s2[0] = v37 | 1;
__s2[1] = v35;
v20 = v73;
LABEL_58:
memmove(v36, v32, v35);
goto LABEL_59;
}
LOBYTE(__s2[0]) = 2 * v34;
v36 = (char *)__s2 + 1;
if ( v34 )
goto LABEL_58;
LABEL_59:
v36[v35] = 0;
v38 = sub_1007AB360(__s2);
sub_10071FCD0(v74, v38);
v25 = (char *)v78;
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
LABEL_61:
v39 = -1;
if ( v21 != -1 )
{
if ( (__dst & 1) != 0 )
{
v40 = v77;
v41 = v76;
v25 = (char *)(v21 + 1);
if ( v76 > v21 + 1 )
goto LABEL_68;
}
else
{
v41 = (unsigned __int8)__dst >> 1;
v40 = (char *)&__dst + 1;
v25 = (char *)(v21 + 1);
if ( v41 > v21 + 1 )
{
LABEL_68:
v42 = &v25[(_QWORD)v40];
v43 = v41 + ~v21;
while ( *v42 != 95 )
{
++v42;
if ( !--v43 )
{
v42 = (char *)v40 + v41;
break;
}
}
v39 = v42 - (_BYTE *)v40;
if ( v42 == (char *)v40 + v41 )
v39 = -1;
}
}
}
if ( (__s[0] & 1) != 0 )
operator delete(__p);
v26 = v21 == -1;
v21 = v39;
if ( v26 )
{
if ( (unsigned int)sub_100720070(v74) < 2 )
goto LABEL_127;
v44 = (cocos2d::CCString *)sub_1007200C0(v74, 0);
v45 = cocos2d::CCString::getCString(v44);
v46 = strlen(v45);
if ( v46 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a1);
v47 = v46;
if ( v46 >= 0x17 )
{
v49 = 26;
if ( (v46 | 7) != 0x17 )
v49 = (v46 | 7) + 1;
v48 = (char *)operator new(v49);
__p = v48;
*(_QWORD *)__s = v49 | 1;
__n = v47;
}
else
{
__s[0] = 2 * v46;
v48 = &__s[1];
if ( !v46 )
{
LABEL_84:
v48[v47] = 0;
v50 = (cocos2d::CCString *)sub_1007200C0(v74, 1);
*v71 = cocos2d::CCString::intValue(v50);
LOBYTE(__s2[0]) = 8;
*(_DWORD *)((char *)__s2 + 1) = 1852793705;
BYTE5(__s2[0]) = 0;
v51 = (char *)__p;
v52 = __s[0] & 1;
v78 = __p;
if ( (__s[0] & 1) != 0 )
{
v53 = __n;
}
else
{
v53 = (unsigned __int8)__s[0] >> 1;
v51 = &__s[1];
}
v54 = 4;
if ( v53 < 4 )
v54 = v53;
v55 = memcmp(v51, (char *)__s2 + 1, v54) == 0;
v56 = 1;
if ( v53 == 4 && v55 )
goto LABEL_134;
LOBYTE(__s2[0]) = 8;
*(_DWORD *)((char *)__s2 + 1) = 1885956211;
BYTE5(__s2[0]) = 0;
v57 = memcmp(v51, (char *)__s2 + 1, v54) == 0;
v56 = 4;
if ( v53 == 4 && v57 )
goto LABEL_134;
*(_DWORD *)((char *)__s2 + 1) = 1819042146;
BYTE5(__s2[0]) = 0;
v58 = memcmp(v51, (char *)__s2 + 1, v54) == 0;
v56 = 5;
if ( v53 == 4 && v58 )
goto LABEL_134;
*(_DWORD *)((char *)__s2 + 1) = 1685219682;
BYTE5(__s2[0]) = 0;
v59 = memcmp(v51, (char *)__s2 + 1, v54) == 0;
v56 = 6;
if ( v53 == 4 && v59 )
goto LABEL_134;
sub_100030790(__s2, "dart", a1);
v60 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 7;
if ( v60 )
goto LABEL_134;
sub_100030790(__s2, "special", a1);
v61 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 10;
if ( v61 )
goto LABEL_134;
sub_100030790(__s2, "robot", a1);
v62 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 8;
if ( v62 )
goto LABEL_134;
sub_100030790(__s2, "spider", a1);
v63 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 9;
if ( v63 )
goto LABEL_134;
sub_100030790(__s2, "death", a1);
v64 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 11;
if ( v64 )
goto LABEL_134;
sub_100030790(__s2, "item", a1);
v65 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 12;
if ( v65 )
goto LABEL_134;
sub_100030790(__s2, "swing", a1);
v66 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 13;
if ( v66 )
goto LABEL_134;
sub_100030790(__s2, "jetpack", a1);
v67 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 14;
if ( v67 )
goto LABEL_134;
sub_100030790(__s2, "shipstreak", a1);
v68 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 15;
if ( v68 )
goto LABEL_134;
sub_100030790(__s2, "color", a1);
v69 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v83);
v56 = 2;
if ( v69 )
goto LABEL_134;
sub_100030790(__s2, "color2", a1);
v70 = sub_1001B0EE0((unsigned __int8 *)__s, (unsigned __int8 *)__s2);
if ( (__s2[0] & 1) != 0 )
{
operator delete(v83);
v56 = 3;
if ( v70 )
goto LABEL_134;
LABEL_125:
if ( !v52 )
goto LABEL_127;
}
else
{
v56 = 3;
if ( !v70 )
goto LABEL_125;
LABEL_134:
*v72 = v56;
if ( !v52 )
{
LABEL_127:
if ( (__dst & 1) != 0 )
operator delete(v77);
return;
}
}
operator delete(v78);
goto LABEL_127;
}
}
memmove(v48, v45, v47);
goto LABEL_84;
}
}
}
}
v23 = v20;
v24 = v19;
do
{
if ( *v24 == 95 )
goto LABEL_26;
++v24;
--v23;
}
while ( v23 );
v24 = &v20[(_QWORD)v19];
LABEL_26:
v21 = -1;
if ( v24 != &v20[(_QWORD)v19] )
v21 = v24 - v19;
goto LABEL_28;
}
LABEL_12:
v15 = __p;
operator delete(__p);
goto LABEL_13;
}
}
}