//
// AchievementManager::notifyAchievementWithID from 0x14003a470 to 0x14003a75a (746 bytes)
//
// 2 xrefs:
// > GameManager::reportAchievementWithID @ 0x14017e197
// > ??> @ 0x1406c3c9c
//
// 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=4
void AchievementManager::notifyAchievementWithID(AchievementManager *a1, const char *a2)
{
__int64 v3; // r8
__int64 v4; // rbx
void *v5; // rcx
cocos2d::CCString *v6; // rax
const char *CString; // rdi
void *v8; // rcx
cocos2d::CCString *v9; // rax
const char *v10; // rsi
void *v11; // rcx
cocos2d::CCString *v12; // rax
const char *v13; // rbx
void *v14; // rcx
AchievementNotifier *v15; // rax
void *v16[2]; // [rsp+30h] [rbp-49h] BYREF
__int64 v17; // [rsp+40h] [rbp-39h]
unsigned __int64 v18; // [rsp+48h] [rbp-31h]
void *v19[2]; // [rsp+50h] [rbp-29h] BYREF
__int64 v20; // [rsp+60h] [rbp-19h]
unsigned __int64 v21; // [rsp+68h] [rbp-11h]
void *v22[2]; // [rsp+70h] [rbp-9h] BYREF
__int64 v23; // [rsp+80h] [rbp+7h]
unsigned __int64 v24; // [rsp+88h] [rbp+Fh]
void *Block[2]; // [rsp+90h] [rbp+17h] BYREF
__m128i si128; // [rsp+A0h] [rbp+27h]
if ( !a1->m_dontNotify )
{
*(_OWORD *)Block = 0;
si128 = 0;
v3 = -1;
do
++v3;
while ( a2[v3] );
sub_14003A930(Block);
v4 = cocos2d::CCDictionary::objectForKey(a1->m_platformAchievements, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v5 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v5);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v4 )
{
*(_OWORD *)v16 = 0;
v17 = 5;
v18 = 15;
strcpy((char *)v16, "title");
v6 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v4, v16);
CString = cocos2d::CCString::getCString(v6);
if ( v18 > 0xF )
{
v8 = v16[0];
if ( v18 + 1 >= 0x1000 )
{
v8 = *((void **)v16[0] - 1);
if ( (unsigned __int64)((char *)v16[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
v17 = 0;
v18 = 15;
LOBYTE(v16[0]) = 0;
*(_OWORD *)v19 = 0;
v20 = 0;
v21 = 15;
v19[0] = (void *)sub_14003AA10(32);
v20 = 19;
v21 = 31;
strcpy((char *)v19[0], "achievedDescription");
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v4, v19);
v10 = cocos2d::CCString::getCString(v9);
if ( v21 > 0xF )
{
v11 = v19[0];
if ( v21 + 1 >= 0x1000 )
{
v11 = *((void **)v19[0] - 1);
if ( (unsigned __int64)((char *)v19[0] - (char *)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v11);
}
v20 = 0;
v21 = 15;
LOBYTE(v19[0]) = 0;
*(_OWORD *)v22 = 0;
v23 = 4;
v24 = 15;
strcpy((char *)v22, "icon");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v4, v22);
v13 = cocos2d::CCString::getCString(v12);
if ( v24 > 0xF )
{
v14 = v22[0];
if ( v24 + 1 >= 0x1000 )
{
v14 = *((void **)v22[0] - 1);
if ( (unsigned __int64)((char *)v22[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
v23 = 0;
v24 = 15;
LOBYTE(v22[0]) = 0;
v15 = AchievementNotifier::sharedState();
AchievementNotifier::notifyAchievement(v15, CString, v10, v13, 0);
}
}
}