//
// AchievementManager::achievementForUnlock from 0x2e06f8 to 0x2e0852 (346 bytes)
//
// 6 xrefs:
// > GJGarageLayer::titleForUnlock @ 0x4029fc
// > GJGarageLayer::descriptionForUnlock @ 0x402a90
// > GJGarageLayer::achievementForUnlock @ 0x402b22
// > ItemInfoPopup::init @ 0x404e0a
// > GameStatsManager::getItemUnlockStateLite @ 0x41cbbc
// > GameStatsManager::generateItemUnlockableData @ 0x41ccd4
//
// 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
//
int __fastcall AchievementManager::achievementForUnlock(int a1, int a2, int a3, int a4)
{
char *v7; // r3
unsigned int v8; // r7
cocos2d::CCDictionary *v9; // r10
cocos2d::CCString *v10; // r0
char *CString; // r0
std::string v13; // [sp+8h] [bp-210h] BYREF
const char *v14; // [sp+Ch] [bp-20Ch] BYREF
int v15; // [sp+10h] [bp-208h]
unsigned int v16; // [sp+14h] [bp-204h] BYREF
unsigned int v17; // [sp+18h] [bp-200h]
char *v18; // [sp+1Ch] [bp-1FCh]
_BYTE v19[500]; // [sp+20h] [bp-1F8h] BYREF
v17 = 500;
v18 = v19;
v16 = 0;
switch ( a4 )
{
case 1:
v7 = "icon_";
break;
case 2:
v7 = "color_";
break;
case 3:
v7 = "color2_";
break;
case 4:
v7 = "ship_";
break;
case 5:
v7 = "ball_";
break;
case 6:
v7 = "bird_";
break;
case 7:
v7 = "dart_";
break;
case 8:
v7 = "robot_";
break;
case 9:
v7 = "spider_";
break;
case 10:
v7 = "special_";
break;
case 11:
v7 = "death_";
break;
case 12:
v7 = "item_";
break;
case 13:
v7 = "swing_";
break;
case 14:
v7 = "jetpack_";
break;
case 15:
v7 = "shipstreak_";
break;
default:
v7 = " _";
break;
}
v14 = v7;
v15 = 0;
fmt::BasicWriter::operator<<(&v16, v7, 0);
if ( a3 <= 9 )
{
v14 = "0";
v15 = 0;
fmt::BasicWriter::operator<<(&v16, "0", 0);
}
v14 = (const char *)a3;
fmt::BasicWriter::FormatInt,char>>(&v16, a3, (int)&v14);
v8 = v16;
v9 = *(cocos2d::CCDictionary **)(a2 + 272);
if ( v16 + 1 > v17 )
fmt::internal::Array::grow((int)&v16, v16 + 1);
v18[v8] = 0;
sub_776584((int)&v13, v18);
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v9, &v13);
CString = (char *)cocos2d::CCString::getCString(v10);
sub_776584(a1, CString);
sub_774008(&v13);
if ( v18 != v19 && v18 )
operator delete[](v18);
return a1;
}