//
// GJGarageLayer::descriptionForUnlock from 0x140380c20 to 0x140380db8 (408 bytes)
//
// 2 xrefs:
// > ItemInfoPopup::init @ 0x1403855f7
// > ??> @ 0x140922904
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:31:05 +0000
//
// Hidden C++ exception states: #wind=2
_QWORD *__fastcall GJGarageLayer::descriptionForUnlock(_QWORD *a1, __int64 a2, __int64 a3)
{
int v3; // edi
int v4; // ebx
__int64 v6; // rax
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // r8
_QWORD *v10; // rbx
__int64 v11; // rax
__int64 AchievementsWithID; // rbx
cocos2d::CCString *v13; // rax
const char *CString; // rax
size_t v15; // r8
void *v16; // rcx
void *Block[2]; // [rsp+40h] [rbp-68h] BYREF
__m128i si128; // [rsp+50h] [rbp-58h]
_QWORD v20[4]; // [rsp+60h] [rbp-48h] BYREF
v3 = a3;
v4 = a2;
v6 = AchievementManager::sharedState(a1, a2, a3);
AchievementManager::achievementForUnlock(v6, v20, v4, v3);
v10 = v20;
if ( v20[3] > 0xFu )
v10 = (_QWORD *)v20[0];
v11 = AchievementManager::sharedState(v8, v7, v9);
AchievementsWithID = AchievementManager::getAchievementsWithID(v11, (__int64)v10);
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836660);
strcpy((char *)Block[0], "unachievedDescription");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(AchievementsWithID, Block);
CString = cocos2d::CCString::getCString(v13);
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 0;
v15 = -1;
do
++v15;
while ( CString[v15] );
sub_14003D230(a1, CString, v15);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v16 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
sub_14003D310((__int64)v20);
return a1;
}