//
// GameStatsManager::completedMapPack from 0x7ba80c to 0x7ba9a8 (412 bytes)
//
// 3 xrefs:
// > MapPackCell::onClaimReward @ 0x613898
// > GJAccountManager::onSyncAccountCompleted @ 0x848bd8
// > ??> @ 0x735d8
//
// 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 GameStatsManager::completedMapPack(GameStatsManager *a1, GJMapPack *a2)
{
char *MapPackKey; // x0
cocos2d::CCDictionary *m_completedLevels; // x24
cocos2d::CCString *m_trueString; // x23
void *v7; // x0
int m_stars; // w22
int m_coins; // w23
unsigned int *v10; // x2
int v11; // w1
__int64 v12; // [xsp+50h] [xbp+50h] BYREF
if ( !GameStatsManager::hasCompletedMapPack(a1, a2->m_packID) )
{
MapPackKey = (char *)GameStatsManager::getMapPackKey(a1, a2->m_packID);
m_completedLevels = a1->m_completedLevels;
m_trueString = a1->m_trueString;
sub_D153B8((int)&v12, MapPackKey);
cocos2d::CCDictionary::setObject((int)m_completedLevels, m_trueString);
v7 = (void *)(v12 - 24);
if ( (__int64 *)(v12 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v12 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v7);
}
if ( GJMapPack::totalMaps(a2) > 2 )
{
m_stars = a2->m_stars;
m_coins = a2->m_coins;
if ( m_stars >= 11 )
m_stars = 0;
if ( m_coins >= 3 )
m_coins = 0;
GameStatsManager::incrementStat(a1, "6", m_stars);
GameStatsManager::incrementStat(a1, "8", m_coins);
GameStatsManager::incrementStat(a1, "7");
GameStatsManager::setStarsForMapPack(a1, a2->m_packID, m_stars);
}
}
}