//
// GameManager::syncPlatformAchievements from 0x14008b2a0 to 0x14008b491 (497 bytes)
//
// 3 xrefs:
// > GameManager::update @ 0x140286a6c
// > ??> @ 0x140912818
// > ??> @ 0x140912824
//
// This function is hookable on this platform (idp: pc, 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 11:25:59 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall GameManager::syncPlatformAchievements(__int64 a1)
{
cocos2d::CCArray *v1; // rbp
int v2; // esi
unsigned int v3; // ebx
__m128i si128; // xmm6
__m128i v5; // xmm7
struct cocos2d::CCObject *v6; // rax
cocos2d::CCString *v7; // rax
const char *CString; // rdi
void *v9; // rcx
__int64 v10; // rax
_QWORD *v11; // rax
_QWORD *v12; // rax
_QWORD *v13; // rax
_BYTE v14[8]; // [rsp+30h] [rbp-58h] BYREF
_QWORD v15[2]; // [rsp+38h] [rbp-50h] BYREF
__m128i v16; // [rsp+48h] [rbp-40h]
if ( *(_BYTE *)(a1 + 384) )
{
if ( !*(_BYTE *)(a1 + 386) )
{
*(_BYTE *)(a1 + 386) = 1;
v1 = *(cocos2d::CCArray **)(AchievementManager::sharedState() + 320);
v2 = 0;
v3 = 0;
if ( cocos2d::CCArray::count(v1) )
{
si128 = _mm_load_si128((const __m128i *)&Size);
v5 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
do
{
v6 = cocos2d::CCArray::objectAtIndex(v1, v3);
v15[1] = 29285;
v16 = v5;
v15[0] = 0x696669746E656469LL;
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v6, v15);
CString = cocos2d::CCString::getCString(v7);
if ( v16.m128i_i64[1] > 0xFuLL )
{
v9 = (void *)v15[0];
if ( (unsigned __int64)(v16.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *(void **)(v15[0] - 8LL);
if ( (unsigned __int64)(v15[0] - (_QWORD)v9 - 8LL) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
v16 = si128;
LOBYTE(v15[0]) = 0;
v10 = AchievementManager::sharedState();
if ( (int)AchievementManager::percentForAchievement(v10, (__int64)CString) >= 100 )
{
v14[0] = 0;
v11 = (_QWORD *)SteamInternal_ContextInit(&off_1408FE060);
if ( (*(unsigned __int8 (__fastcall **)(_QWORD, const char *, _BYTE *))(*(_QWORD *)*v11 + 40LL))(
*v11,
CString,
v14) )
{
if ( !v14[0] )
{
v12 = (_QWORD *)SteamInternal_ContextInit(&off_1408FE060);
(*(void (__fastcall **)(_QWORD, const char *))(*(_QWORD *)*v12 + 48LL))(*v12, CString);
++v2;
}
}
}
++v3;
}
while ( v3 < cocos2d::CCArray::count(v1) );
if ( v2 > 0 )
{
v13 = (_QWORD *)SteamInternal_ContextInit(&off_1408FE060);
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)*v13 + 72LL))(*v13);
}
}
}
}
}