//
// GameManager::syncPlatformAchievements from 0x7183c0 to 0x718508 (328 bytes)
//
// 5 xrefs:
// > MenuLayer::syncPlatformAchievements @ 0x6ea50c
// > MenuLayer::onGooglePlayGames @ 0x6eaa84
// > MenuLayer::onGameCenter @ 0x6eabc8
// > LoadingLayer::loadAssets @ 0x6ee138
// > ??> @ 0x4d500
//
// This function is hookable on this platform (idp: arm, 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:52:17 +0000
//
__int64 __fastcall GameManager::syncPlatformAchievements(GameManager *this)
{
PlatformToolbox *v2; // x0
PlatformToolbox *isLocalPlayerAuthenticated; // x0
unsigned int v5; // w20
AchievementManager *v6; // x0
cocos2d::CCArray *AllAchievements; // x22
AchievementManager *v8; // x0
AchievementManager *v9; // x0
AchievementManager *v10; // x0
__int64 v11; // x0
__int64 v12; // x21
cocos2d::CCString *v13; // x0
AchievementManager *CString; // x0
char *v15; // x21
unsigned int v16; // [xsp+48h] [xbp+48h]
__int64 v17[2]; // [xsp+50h] [xbp+50h] BYREF
void *v18; // [xsp+60h] [xbp+60h]
v2 = (PlatformToolbox *)*((unsigned __int8 *)this + 505);
if ( !(_DWORD)v2 )
{
isLocalPlayerAuthenticated = (PlatformToolbox *)(unsigned __int8)PlatformToolbox::isLocalPlayerAuthenticated(v2);
if ( (_BYTE)isLocalPlayerAuthenticated || PlatformToolbox::isSignedInGooglePlay(isLocalPlayerAuthenticated) )
{
*((_BYTE *)this + 505) = (unsigned __int8)&dword_0 + 1;
v5 = 0;
v6 = (AchievementManager *)AchievementManager::sharedState((AchievementManager *)((char *)&dword_0 + 1));
AllAchievements = (cocos2d::CCArray *)AchievementManager::getAllAchievements(v6);
while ( v5 < (unsigned int)cocos2d::CCArray::count(AllAchievements) )
{
v11 = cocos2d::CCArray::objectAtIndex(AllAchievements, v5);
v17[0] = 0;
v12 = v11;
v17[1] = 0;
v18 = nullptr;
std::string::__init(v17, "identifier", 0xAu);
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v12, v17);
CString = (AchievementManager *)cocos2d::CCString::getCString(v13);
v15 = (char *)CString;
if ( (v17[0] & 1) != 0 )
operator delete(v18);
v8 = (AchievementManager *)AchievementManager::sharedState(CString);
++v5;
v9 = (AchievementManager *)AchievementManager::percentForAchievement(v8, v15);
v16 = (unsigned int)v9;
v10 = (AchievementManager *)AchievementManager::sharedState(v9);
AchievementManager::reportPlatformAchievementWithID(v10, v15, v16);
}
}
}
return _stack_chk_guard;
}