//
// GJGarageLayer::descriptionForUnlock from 0x140278310 to 0x140278496 (390 bytes)
//
// 2 xrefs:
// > ItemInfoPopup::init @ 0x14027cb29
// > ??> @ 0x1406d0fec
//
// 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
//
// Hidden C++ exception states: #wind=2
_QWORD *__fastcall GJGarageLayer::descriptionForUnlock(_QWORD *a1, int a2, int a3)
{
AchievementManager *v6; // rax
_QWORD *v7; // rbx
AchievementManager *v8; // rax
__int64 AchievementsWithID; // rbx
cocos2d::CCString *v10; // rax
const char *CString; // rax
size_t v12; // r8
void *v13; // rcx
void *Block[2]; // [rsp+30h] [rbp-68h] BYREF
__int64 v16; // [rsp+40h] [rbp-58h]
unsigned __int64 v17; // [rsp+48h] [rbp-50h]
_QWORD v18[4]; // [rsp+50h] [rbp-48h] BYREF
v6 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock((__int64)v6, v18, a2, a3);
v7 = v18;
if ( v18[3] > 0xFu )
v7 = (_QWORD *)v18[0];
v8 = AchievementManager::sharedState();
AchievementsWithID = AchievementManager::getAchievementsWithID((__int64)v8, (__int64)v7);
*(_OWORD *)Block = 0;
Block[0] = sub_14003AA10(0x20u);
v16 = 21;
v17 = 31;
strcpy((char *)Block[0], "unachievedDescription");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(AchievementsWithID, Block);
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 0;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003A930(a1, CString, v12);
if ( v17 > 0xF )
{
v13 = Block[0];
if ( v17 + 1 >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
v16 = 0;
v17 = 15;
LOBYTE(Block[0]) = 0;
sub_14003A830((__int64)v18);
return a1;
}