//
// AchievementManager::reportPlatformAchievementWithID from 0x553794 to 0x553ac8 (820 bytes)
//
// 3 xrefs:
// > AchievementManager::reportAchievementWithID @ 0x553bb8
// > GameManager::syncPlatformAchievements @ 0x5eb73c
// > ??> @ 0x6fee8
//
// 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::reportPlatformAchievementWithID(AchievementManager *a1, const char *a2, int a3)
{
cocos2d::CCDictionary *m_platformAchievements; // x21
cocos2d::CCDictionary *v5; // x22
char *v6; // x0
cocos2d::CCString *v7; // x0
char *CString; // x24
char *v9; // x0
_DWORD *v10; // x26
_DWORD *v11; // x27
unsigned __int64 v12; // x22
unsigned __int64 v13; // x28
size_t v14; // x2
int v15; // w0
_BOOL4 v16; // w3
unsigned __int64 v17; // x22
char *v18; // x0
char *v19; // x0
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x26
int v25; // w1
unsigned int *v26; // x27
int v27; // w1
_BOOL4 v28; // [xsp+68h] [xbp+68h]
_BOOL4 v29; // [xsp+68h] [xbp+68h]
void *v30; // [xsp+88h] [xbp+88h] BYREF
void *v31; // [xsp+90h] [xbp+90h] BYREF
m_platformAchievements = a1->m_platformAchievements;
sub_D153B8((int)&v31, (char *)a2);
v5 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_platformAchievements, (const std::string *)&v31);
v6 = (char *)v31 - 24;
if ( (char *)v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)((char *)v31 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v6);
}
if ( v5 )
{
sub_D153B8((int)&v31, "googleID");
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v5, (const std::string *)&v31);
CString = (char *)cocos2d::CCString::getCString(v7);
v9 = (char *)v31 - 24;
if ( (char *)v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)((char *)v31 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v9);
}
if ( CString )
{
sub_D153B8((int)&v30, CString);
sub_D153B8((int)&v31, &byte_F288A0);
v10 = v30;
v11 = v31;
v12 = *((_QWORD *)v30 - 3);
v13 = *((_QWORD *)v31 - 3);
if ( v13 > v12 )
v14 = *((_QWORD *)v30 - 3);
else
v14 = *((_QWORD *)v31 - 3);
v15 = memcmp(v30, v31, v14);
v16 = 1;
if ( !v15 )
{
v17 = v12 - v13;
if ( v17 + 0x80000000 <= 0xFFFFFFFF )
v16 = v17 != 0;
}
v18 = (char *)(v11 - 6);
if ( v11 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = v11 - 2;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(v11 - 2);
*(v11 - 2) = v27 - 1;
}
if ( v27 <= 0 )
{
v29 = v16;
operator delete(v18);
v10 = v30;
v16 = v29;
}
else
{
v10 = v30;
}
}
v19 = (char *)(v10 - 6);
if ( v10 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = v10 - 2;
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(v10 - 2);
*(v10 - 2) = v25 - 1;
}
if ( v25 <= 0 )
{
v28 = v16;
operator delete(v19);
v16 = v28;
}
}
if ( v16 )
PlatformToolbox::reportAchievementWithID(CString, a3);
}
}
}