//
// GJGarageLayer::titleForUnlock from 0x10036f5c0 to 0x10036f6e8 (296 bytes)
//
// 1 xrefs:
// > ItemInfoPopup::init @ 0x10037208c
//
// 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::titleForUnlock(size_t *a1, unsigned int a2, unsigned int a3, double a4)
{
AchievementManager *v5; // rax
AchievementManager *v6; // rax
const char *v7; // rsi
cocos2d::CCDictionary *AchievementsWithID; // rax
cocos2d::CCString *v9; // rax
const char *CString; // r14
size_t v11; // rax
size_t v12; // r15
_BYTE *v13; // r12
size_t v15; // r13
char v16; // [rsp+8h] [rbp-58h] BYREF
char v17; // [rsp+9h] [rbp-57h] BYREF
void *v18; // [rsp+18h] [rbp-48h]
char v19[16]; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
v5 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock(&v16, v5, a2, a3);
v6 = AchievementManager::sharedState();
if ( (v16 & 1) != 0 )
v7 = (const char *)v18;
else
v7 = &v17;
AchievementsWithID = AchievementManager::getAchievementsWithID(v6, v7);
strcpy(v19, "\ntitle");
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)AchievementsWithID, (__int64)v19);
CString = cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v12 = v11;
if ( v11 >= 0x17 )
{
v15 = 26;
if ( (v11 | 7) != 0x17 )
v15 = (v11 | 7) + 1;
v13 = operator new(v15);
a1[2] = (size_t)v13;
*a1 = v15 | 1;
a1[1] = v12;
}
else
{
*(_BYTE *)a1 = 2 * v11;
v13 = (char *)a1 + 1;
if ( !v11 )
{
*v13 = 0;
if ( (v19[0] & 1) == 0 )
goto LABEL_9;
goto LABEL_8;
}
}
memmove(v13, CString, v12);
v13[v12] = 0;
if ( (v19[0] & 1) != 0 )
LABEL_8:
operator delete(__p);
LABEL_9:
if ( (v16 & 1) != 0 )
operator delete(v18);
return a1;
}