//
// GameStatsManager::trySelectActivePath from 0x52915c to 0x529224 (200 bytes)
//
// 3 xrefs:
// > GameStatsManager::incrementActivePath @ 0x52923a
// > GJPathsLayer::init @ 0x6d2b4a
// > GJPathPage::init @ 0x6d3c62
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:57 +0000
//
int __fastcall GameStatsManager::trySelectActivePath(GameStatsManager *this, int a2, char *a3, int a4)
{
int result; // r0
int v6; // r1
char *v7; // r1
int Stat; // r7
int v9; // r5
const char *v10; // r1
int v11; // r8
_DWORD v12[2]; // [sp+0h] [bp-10h] BYREF
char *v13; // [sp+8h] [bp-8h]
int v14; // [sp+Ch] [bp-4h]
v12[0] = this;
v12[1] = a2;
v13 = a3;
v14 = a4;
result = GameStatsManager::updateActivePath((int)this, *((_DWORD *)this + 143));
v6 = *((_DWORD *)this + 143);
if ( v6 )
{
result = GameStatsManager::isPathUnlocked(this, v6);
if ( !result
|| ((GameToolbox::intToString((GameToolbox *)v12, *((_DWORD *)this + 143)), (v12[0] & 1) != 0)
? (v7 = v13)
: (v7 = (char *)v12 + 1),
Stat = GameStatsManager::getStat(this, v7),
result = std::string::~string((int)v12),
Stat >= 1000) )
{
*((_DWORD *)this + 143) = 0;
}
}
if ( !*((_DWORD *)this + 143) )
{
v9 = 30;
while ( 1 )
{
result = GameStatsManager::isPathUnlocked(this, v9);
if ( result )
{
GameToolbox::intToString((GameToolbox *)v12, v9);
v10 = (v12[0] & 1) != 0 ? v13 : (char *)v12 + 1;
v11 = GameStatsManager::getStat(this, v10);
result = std::string::~string((int)v12);
if ( v11 < 1000 )
break;
}
if ( ++v9 == 40 )
return result;
}
*((_DWORD *)this + 143) = v9;
}
return result;
}