//
// AchievementManager::notifyAchievementWithID from 0x553384 to 0x553664 (736 bytes)
//
// 2 xrefs:
// > AchievementManager::reportAchievementWithID @ 0x553bd4
// > ??> @ 0x46878
//
// 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
//
void AchievementManager::notifyAchievementWithID(AchievementManager *a1, const char *a2)
{
cocos2d::CCDictionary *m_platformAchievements; // x21
cocos2d::CCDictionary *v3; // x22
char *v4; // x0
cocos2d::CCString *v5; // x0
const char *CString; // x25
char *v7; // x0
cocos2d::CCString *v8; // x0
const char *v9; // x24
char *v10; // x0
cocos2d::CCString *v11; // x0
char *v12; // x3
char *v13; // x0
AchievementNotifier *v14; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x20
int v22; // w1
char *v23[2]; // [xsp+0h] [xbp+0h] BYREF
char *v24; // [xsp+58h] [xbp+58h]
std::string v25; // [xsp+70h] [xbp+70h] BYREF
if ( !a1->m_dontNotify )
{
m_platformAchievements = a1->m_platformAchievements;
sub_D153B8((int)&v25, (char *)a2);
v3 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_platformAchievements, &v25);
v4 = (char *)v25.m_data.m_data - 24;
if ( (__int64 *)v25.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)((char *)v25.m_data.m_data - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v25.m_data.m_data - 2);
*((_DWORD *)v25.m_data.m_data - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v4);
}
if ( v3 )
{
sub_D153B8((unsigned int)v23 + 112, "title");
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v3, &v25);
CString = cocos2d::CCString::getCString(v5);
v7 = (char *)v25.m_data.m_data - 24;
if ( (__int64 *)v25.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)((char *)v25.m_data.m_data - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v25.m_data.m_data - 2);
*((_DWORD *)v25.m_data.m_data - 2) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v7);
}
sub_D153B8((unsigned int)v23 + 112, "achievedDescription");
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v3, &v25);
v9 = cocos2d::CCString::getCString(v8);
v10 = (char *)v25.m_data.m_data - 24;
if ( (__int64 *)v25.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)((char *)v25.m_data.m_data - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v25.m_data.m_data - 2);
*((_DWORD *)v25.m_data.m_data - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v10);
}
sub_D153B8((unsigned int)v23 + 112, "icon");
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v3, &v25);
v12 = (char *)cocos2d::CCString::getCString(v11);
v13 = (char *)v25.m_data.m_data - 24;
if ( (__int64 *)v25.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)((char *)v25.m_data.m_data - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v25.m_data.m_data - 2);
*((_DWORD *)v25.m_data.m_data - 2) = v22 - 1;
}
if ( v22 <= 0 )
{
v24 = v12;
operator delete(v13);
v12 = v24;
}
}
v24 = v12;
v14 = AchievementNotifier::sharedState();
AchievementNotifier::notifyAchievement(v14, CString, v9, v24, 0);
}
}
}