//
// GJGarageLayer::achievementForUnlock from 0x100358d80 to 0x100358e34 (180 bytes)
//
// 0 xrefs:
//
// 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 12:28:53 +0000
//
__int64 __fastcall GJGarageLayer::achievementForUnlock(__int64 a1, __int64 a2, unsigned int a3)
{
unsigned int v4; // r15d
__int64 v5; // rsi
__int64 v6; // r14
char isAchievementAvailable; // r14
__int128 v9; // [rsp+0h] [rbp-50h] BYREF
void *__p; // [rsp+10h] [rbp-40h]
__int128 v11; // [rsp+20h] [rbp-30h] BYREF
void *v12; // [rsp+30h] [rbp-20h]
v4 = a2;
v5 = AchievementManager::sharedState(a1, a2);
AchievementManager::achievementForUnlock(&v11, v5, v4, a3);
v6 = AchievementManager::sharedState(&v11, v5);
if ( (v11 & 1) != 0 )
{
sub_10001AD30(&v9, v12, *((unsigned __int64 *)&v11 + 1));
}
else
{
__p = v12;
v9 = v11;
}
isAchievementAvailable = AchievementManager::isAchievementAvailable(v6, &v9);
if ( (v9 & 1) != 0 )
operator delete(__p);
if ( isAchievementAvailable )
{
*(_QWORD *)(a1 + 16) = v12;
*(_OWORD *)a1 = v11;
}
else
{
*(_WORD *)a1 = 0;
if ( (v11 & 1) != 0 )
operator delete(v12);
}
return a1;
}