//
// GameStatsManager::isItemUnlocked from 0x100030ff0 to 0x1000311cb (475 bytes)
//
// 32 xrefs:
// > GameStatsManager::isPathUnlocked @ 0x100030feb
// > GameStatsManager::trySelectActivePath @ 0x100031260
// > GameStatsManager::trySelectActivePath @ 0x1000312cc
// > GameStatsManager::trySelectActivePath @ 0x10003132b
// > GameStatsManager::trySelectActivePath @ 0x10003138a
// > GameStatsManager::trySelectActivePath @ 0x1000313e9
// > GameStatsManager::trySelectActivePath @ 0x100031448
// > GameStatsManager::trySelectActivePath @ 0x1000314a7
// > GameStatsManager::trySelectActivePath @ 0x100031506
// > GameStatsManager::trySelectActivePath @ 0x100031565
// > GameStatsManager::trySelectActivePath @ 0x1000315c4
// > GameStatsManager::trySelectActivePath @ 0x10003161f
// > GameStatsManager::recountSpecialStats @ 0x10003cb87
// > GameStatsManager::isItemEnabled @ 0x10003d8f8
// > GameOptionsLayer::setupOptions @ 0x10029e6bc
// > GameOptionsLayer::onPracticeMusicSync @ 0x10029ea7c
// > GJPathSprite::updateState @ 0x1002e9540
// > GJPathPage::init @ 0x1002e9e66
// > GameManager::isIconUnlocked @ 0x10036134b
// > GameManager::isColorUnlocked @ 0x1003619bc
// > GameManager::dataLoaded @ 0x100373594
// > LevelSelectLayer::init @ 0x10041f3a9
// > LevelPage::onSecretDoor @ 0x100424815
// > SecretLayer3::onClick @ 0x10049dde0
// > SecretLayer3::onClick @ 0x10049de0d
// > SecretLayer3::onClick @ 0x10049de3a
// > GauntletSelectLayer::onPlay @ 0x10059fd55
// > GameSettingsLayer::buildTabContent @ 0x1005ffde9
// > GameSettingsLayer::valueDidChange @ 0x100602966
// > SongInfoLayer::init @ 0x1006d8f23
// > SongInfoLayer::onMenuMusic @ 0x1006d951f
// > SongInfoLayer::onPracticeMusic @ 0x1006d95af
//
// 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 12:19:30 +0000
//
__int64 __fastcall GameStatsManager::isItemUnlocked(__int64 a1, __int64 a2, unsigned int a3)
{
unsigned int v4; // ebx
__int64 v5; // r15
__int64 v6; // rsi
__int64 v7; // r15
__int64 v8; // rax
__int64 v9; // r15
__int64 v10; // rsi
__int64 v11; // rax
int v12; // r15d
__int64 v13; // rax
__int64 v14; // r12
__int64 v15; // r14
__int64 v16; // rbx
const char *CString; // r15
size_t v18; // rax
size_t v19; // r14
char *v20; // r12
size_t v21; // r13
_QWORD __dst[2]; // [rsp+8h] [rbp-58h] BYREF
void *v24; // [rsp+18h] [rbp-48h]
size_t v25[2]; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
v4 = a2;
v5 = *(_QWORD *)(GameStatsManager::sharedState() + 328);
GameStatsManager::getItemKey(v25, a2, a3, a2);
v6 = (__int64)v25;
v7 = cocos2d::CCDictionary::objectForKey(v5, v25);
if ( (v25[0] & 1) != 0 )
operator delete(__p);
if ( !v7
|| (v8 = GameStatsManager::sharedState(),
v6 = (unsigned int)(*(_DWORD *)(v7 + 316) - *(_DWORD *)(v7 + 320)),
LOBYTE(v7) = 1,
!GameStatsManager::isStoreItemUnlocked(v8)) )
{
v9 = *(_QWORD *)(GameStatsManager::sharedState() + 352);
GameStatsManager::getItemKey(v25, v6, a3, v4);
v10 = (__int64)v25;
v11 = cocos2d::CCDictionary::valueForKey(v9, v25);
v12 = cocos2d::CCString::intValue(v11);
if ( (v25[0] & 1) != 0 )
operator delete(__p);
if ( v12 <= 0 )
{
LODWORD(v7) = 0;
}
else
{
v13 = GameStatsManager::sharedState();
v10 = (unsigned int)v12;
LODWORD(v7) = GameStatsManager::isSecretChestUnlocked(v13, (unsigned int)v12);
if ( (_BYTE)v7 )
return (unsigned int)v7;
}
v14 = *(_QWORD *)(GameStatsManager::sharedState() + 368);
GameStatsManager::getItemKey(v25, v10, a3, v4);
v15 = cocos2d::CCDictionary::objectForKey(v14, v25);
if ( (v25[0] & 1) != 0 )
operator delete(__p);
if ( v15 )
{
v16 = GameStatsManager::sharedState();
CString = (const char *)cocos2d::CCString::getCString(v15);
v18 = strlen(CString);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
v24 = v20;
__dst[0] = v21 + 1;
__dst[1] = v19;
}
else
{
LOBYTE(__dst[0]) = 2 * v18;
v20 = (char *)__dst + 1;
if ( !v18 )
{
LABEL_22:
v20[v19] = 0;
LODWORD(v7) = GameStatsManager::isSpecialChestUnlocked(v16, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(v24);
return (unsigned int)v7;
}
}
memmove(v20, CString, v19);
goto LABEL_22;
}
}
return (unsigned int)v7;
}