//
// GameStatsManager::trySelectActivePath from 0x1402da5f0 to 0x1402da77d (397 bytes)
//
// 4 xrefs:
// > GameStatsManager::incrementStat @ 0x1402da556
// > GJPathsLayer::init @ 0x1403929dc
// > GJPathPage::init @ 0x140394cf7
// > ??> @ 0x14091ddc8
//
// This function is hookable on this platform (idp: pc, 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 11:29:46 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall GameStatsManager::trySelectActivePath(__int64 a1)
{
int v2; // eax
unsigned int v3; // ebx
_QWORD *v4; // rax
int Stat; // ebx
unsigned int v6; // edi
_QWORD *v7; // rax
int v8; // ebx
void *v9; // [rsp+20h] [rbp-38h]
void *v10; // [rsp+20h] [rbp-38h]
_QWORD v11[4]; // [rsp+28h] [rbp-30h] BYREF
v2 = *(_DWORD *)(a1 + 996);
if ( v2 < 30 || v2 > 39 )
goto LABEL_9;
*(_DWORD *)(a1 + 996) = v2;
v3 = v2 - 24;
if ( !qword_14090BFE0 )
{
v9 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( !(unsigned __int8)GameStatsManager::isItemUnlocked(a1, 12, v3) )
goto LABEL_9;
v4 = GameToolbox::intToString(v11, *(_DWORD *)(a1 + 996));
if ( v4[3] > 0xFu )
v4 = (_QWORD *)*v4;
Stat = GameStatsManager::getStat(a1, v4);
sub_14003D310((__int64)v11);
if ( Stat >= 1000 )
LABEL_9:
*(_DWORD *)(a1 + 996) = 0;
if ( !*(_DWORD *)(a1 + 996) )
{
v6 = 30;
while ( 1 )
{
if ( !qword_14090BFE0 )
{
v10 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( (unsigned __int8)GameStatsManager::isItemUnlocked(a1, 12, v6 - 24) )
{
v7 = GameToolbox::intToString(v11, v6);
if ( v7[3] > 0xFu )
v7 = (_QWORD *)*v7;
v8 = GameStatsManager::getStat(a1, v7);
sub_14003D310((__int64)v11);
if ( v8 < 1000 )
break;
}
if ( (int)++v6 > 39 )
return;
}
*(_DWORD *)(a1 + 996) = v6;
}
}