//
// GameStatsManager::completedStarLevel from 0x8e9a28 to 0x8e9bb8 (400 bytes)
//
// 5 xrefs:
// > GameManager::verifyStarUnlocks @ 0x714b70
// > LevelInfoLayer::init @ 0x7ecb88
// > GameLevelManager::updateLevelRewards @ 0x805658
// > GameStatsManager::completedLevel @ 0x8e9c30
// > ??> @ 0x9a108
//
// 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:56:54 +0000
//
__int64 __fastcall GameStatsManager::completedStarLevel(cocos2d::CCObject **this, GJGameLevel *a2)
{
size_t v4; // x0
__int64 v5; // x24
cocos2d::CCObject *v6; // x23
int v7; // w2
char *StarLevelKey; // [xsp+48h] [xbp+48h]
__int64 v10[2]; // [xsp+50h] [xbp+50h] BYREF
void *v11; // [xsp+60h] [xbp+60h]
if ( !GameStatsManager::hasCompletedStarLevel((GameStatsManager *)this, a2)
&& *((_DWORD *)a2 + 237) - *((_DWORD *)a2 + 238) > 0 )
{
v10[0] = 0;
StarLevelKey = (char *)GameStatsManager::getStarLevelKey((GameStatsManager *)this, a2);
v10[1] = 0;
v11 = nullptr;
v4 = strlen(StarLevelKey);
v5 = (__int64)*(this + 76);
v6 = *(this + 40);
std::string::__init(v10, StarLevelKey, v4);
cocos2d::CCDictionary::setObject(v5, v6);
if ( (v10[0] & 1) != 0 )
operator delete(v11);
v7 = *((_DWORD *)a2 + 237) - *((_DWORD *)a2 + 238);
if ( v7 > 10 )
{
if ( *((_DWORD *)a2 + 285) != 1 )
v7 = 0;
if ( *((_DWORD *)a2 + 225) != 5 )
{
LABEL_7:
GameStatsManager::incrementStat((GameStatsManager *)this, "6", v7);
if ( (unsigned int)(*((_DWORD *)a2 + 237) - *((_DWORD *)a2 + 238) - 8) > 1 )
return _stack_chk_guard;
LABEL_13:
GameStatsManager::incrementStat((GameStatsManager *)this, "42");
return _stack_chk_guard;
}
}
else if ( *((_DWORD *)a2 + 225) != 5 )
{
goto LABEL_7;
}
GameStatsManager::incrementStat((GameStatsManager *)this, "28", v7);
if ( (unsigned int)(*((_DWORD *)a2 + 237) - *((_DWORD *)a2 + 238) - 8) > 1 )
return _stack_chk_guard;
goto LABEL_13;
}
return _stack_chk_guard;
}