//
// GameStatsManager::completedStarLevel from 0x1401de770 to 0x1401de90a (410 bytes)
//
// 5 xrefs:
// > GameLevelManager::updateLevelRewards @ 0x14014650b
// > GameManager::dataLoaded @ 0x140187cdf
// > GameStatsManager::completedLevel @ 0x1401de4c6
// > LevelInfoLayer::init @ 0x1402f8ed8
// > ??> @ 0x1406cc420
//
// 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
//
// Hidden C++ exception states: #wind=1
void GameStatsManager::completedStarLevel(GameStatsManager *a1, GJGameLevel *a2)
{
cocos2d::CCString *v4; // rax
const char *v5; // rcx
const char *CString; // rax
size_t v7; // r8
void *v8; // rcx
int v9; // r8d
const char *v10; // rdx
void *Block[2]; // [rsp+20h] [rbp-38h] BYREF
__int128 v12; // [rsp+30h] [rbp-28h]
if ( !GameStatsManager::hasCompletedStarLevel(a1, a2) && a2->m_stars.random - a2->m_stars.seed > 0 )
{
if ( a2->m_dailyID.random - a2->m_dailyID.seed <= 0 )
{
v5 = "gstar_%i";
if ( !a2->m_gauntletLevel )
v5 = "star_%i";
v4 = cocos2d::CCString::createWithFormat(v5);
}
else
{
v4 = cocos2d::CCString::createWithFormat("dstar_%i");
}
CString = cocos2d::CCString::getCString(v4);
*(_OWORD *)Block = 0;
v12 = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003A930(Block, CString, v7);
cocos2d::CCDictionary::setObject(a1->m_completedLevels, a1->m_trueString, Block);
if ( *((_QWORD *)&v12 + 1) > 0xFu )
{
v8 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v12 + 1) + 1LL) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
v9 = a2->m_stars.random - a2->m_stars.seed;
if ( v9 > 10 && a2->m_levelType != Main )
v9 = 0;
v10 = "6";
if ( a2->m_levelLength == 5 )
v10 = "28";
GameStatsManager::incrementStat(a1, v10, v9);
if ( (unsigned int)(a2->m_stars.random - a2->m_stars.seed - 8) <= 1 )
GameStatsManager::incrementStat(a1, "42", 1);
}
}