//
// GameStatsManager::trySelectActivePath from 0x10032fd54 to 0x10032fe78 (292 bytes)
//
// 3 xrefs:
// > GameStatsManager::incrementActivePath @ 0x10032fbbc
// > GJPathsLayer::init @ 0x1003b800c
// > GJPathPage::init @ 0x1003b9b74
//
// 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 __fastcall GameStatsManager::trySelectActivePath(GameStatsManager *a1)
{
int m_activePath; // w8
int v3; // w20
GameStatsManager *v4; // x0
void **v5; // x1
int Stat; // w20
__int64 v7; // x20
GameStatsManager *v8; // x0
const char *v9; // x1
int v10; // w21
void *__p[2]; // [xsp+8h] [xbp-38h] BYREF
char v12; // [xsp+1Fh] [xbp-21h]
m_activePath = a1->m_activePath;
if ( (unsigned int)(m_activePath - 40) < 0xFFFFFFF6 )
m_activePath = 0;
a1->m_activePath = m_activePath;
if ( m_activePath )
{
v3 = m_activePath - 24;
v4 = GameStatsManager::sharedState();
if ( !GameStatsManager::isItemUnlocked(v4, GJItem, v3) )
goto LABEL_11;
GameToolbox::intToString((unsigned int)a1->m_activePath, __p);
if ( v12 >= 0 )
v5 = __p;
else
v5 = (void **)__p[0];
Stat = GameStatsManager::getStat(a1, (const char *)v5);
if ( v12 < 0 )
operator delete(__p[0]);
if ( Stat <= 999 )
{
if ( a1->m_activePath )
return;
}
else
{
LABEL_11:
a1->m_activePath = 0;
}
}
v7 = 30;
while ( 1 )
{
v8 = GameStatsManager::sharedState();
if ( GameStatsManager::isItemUnlocked(v8, GJItem, v7 - 24) )
{
GameToolbox::intToString(v7, __p);
v9 = v12 >= 0 ? (const char *)__p : (const char *)__p[0];
v10 = GameStatsManager::getStat(a1, v9);
if ( v12 < 0 )
operator delete(__p[0]);
if ( v10 <= 999 )
break;
}
v7 = (unsigned int)(v7 + 1);
if ( (_DWORD)v7 == 40 )
return;
}
a1->m_activePath = v7;
}