//
// GameStatsManager::completedDemonLevel from 0x7ba0dc to 0x7ba23c (352 bytes)
//
// 5 xrefs:
// > GameManager::dataLoaded @ 0x5fba80
// > LevelInfoLayer::init @ 0x6dd3e4
// > GameLevelManager::updateLevelRewards @ 0x704f48
// > GameStatsManager::completedLevel @ 0x7ba760
// > ??> @ 0x63828
//
// 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::completedDemonLevel(GameStatsManager *a1, GJGameLevel *a2)
{
char *DemonLevelKey; // x0
cocos2d::CCDictionary *m_completedLevels; // x24
cocos2d::CCString *m_trueString; // x23
void *v7; // x0
unsigned int *v8; // x2
int v9; // w1
__int64 v10; // [xsp+50h] [xbp+50h] BYREF
if ( !GameStatsManager::hasCompletedDemonLevel(a1, a2) && a2->m_demon.random - a2->m_demon.seed == 1 )
{
DemonLevelKey = (char *)GameStatsManager::getDemonLevelKey(a1, a2);
m_completedLevels = a1->m_completedLevels;
m_trueString = a1->m_trueString;
sub_D153B8((int)&v10, DemonLevelKey);
cocos2d::CCDictionary::setObject((int)m_completedLevels, m_trueString);
v7 = (void *)(v10 - 24);
if ( (__int64 *)(v10 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v10 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v10 - 8);
*(_DWORD *)(v10 - 8) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v7);
}
if ( a2->m_stars.random - a2->m_stars.seed > 9 )
GameStatsManager::incrementStat(a1, "5");
}
}