//
// GJGarageLayer::descriptionForUnlock from 0x10036f730 to 0x10036f868 (312 bytes)
//
// 1 xrefs:
// > ItemInfoPopup::init @ 0x1003720c6
//
// 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
//
size_t *__fastcall GJGarageLayer::descriptionForUnlock(size_t *a1, unsigned int a2, unsigned int a3)
{
AchievementManager *v4; // rax
AchievementManager *v5; // rax
const char *v6; // rsi
cocos2d::CCDictionary *AchievementsWithID; // rax
cocos2d::CCString *v8; // rax
const char *CString; // r14
size_t v10; // rax
size_t v11; // r15
_BYTE *v12; // r12
size_t v14; // r13
char v15; // [rsp+8h] [rbp-58h] BYREF
char v16; // [rsp+9h] [rbp-57h] BYREF
void *v17; // [rsp+18h] [rbp-48h]
void *v18[8]; // [rsp+20h] [rbp-40h] BYREF
v4 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock(&v15, v4, a2, a3);
v5 = AchievementManager::sharedState();
if ( (v15 & 1) != 0 )
v6 = (const char *)v17;
else
v6 = &v16;
AchievementsWithID = AchievementManager::getAchievementsWithID(v5, v6);
strcpy((char *)v18, "*unachievedDescription");
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)AchievementsWithID, (__int64)v18);
CString = cocos2d::CCString::getCString(v8);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(2.106970165862151e262);
v11 = v10;
if ( v10 >= 0x17 )
{
v14 = 26;
if ( (v10 | 7) != 0x17 )
v14 = (v10 | 7) + 1;
v12 = operator new(v14);
a1[2] = (size_t)v12;
*a1 = v14 | 1;
a1[1] = v11;
}
else
{
*(_BYTE *)a1 = 2 * v10;
v12 = (char *)a1 + 1;
if ( !v10 )
{
*v12 = 0;
if ( ((__int64)v18[0] & 1) == 0 )
goto LABEL_9;
goto LABEL_8;
}
}
memmove(v12, CString, v11);
v12[v11] = 0;
if ( ((__int64)v18[0] & 1) != 0 )
LABEL_8:
operator delete(v18[2]);
LABEL_9:
if ( (v15 & 1) != 0 )
operator delete(v17);
return a1;
}