//
// GameStatsManager::isItemUnlocked from 0x1402e9470 to 0x1402e9724 (692 bytes)
//
// 28 xrefs:
// > GameManager::isIconUnlocked @ 0x140277480
// > GameManager::isColorUnlocked @ 0x140277841
// > GameManager::dataLoaded @ 0x1402834ab
// > GameSettingsLayer::buildTabContent @ 0x1402c481e
// > GameSettingsLayer::getValue @ 0x1402c6f75
// > GameSettingsLayer::valueDidChange @ 0x1402c72bb
// > GameSettingsLayer::valueDidChange @ 0x1402c7348
// > GameStatsManager::trySelectActivePath @ 0x1402da66f
// > GameStatsManager::trySelectActivePath @ 0x1402da70e
// > GameStatsManager::recountSpecialStats @ 0x1402e8bac
// > GauntletSelectLayer::onPlay @ 0x1402ff71e
// > GJGarageLayer::setupSpecialPage @ 0x14037f93e
// > GJGarageLayer::onToggleItem @ 0x14038032f
// > GJPathPage::init @ 0x140393421
// > GJPathSprite::updateState @ 0x140397086
// > LevelSelectLayer::init @ 0x14044172f
// > LevelPage::onSecretDoor @ 0x140446637
// > PlayerObject::init @ 0x1404e4d63
// > PlayerObject::init @ 0x1404e4dfe
// > PlayerObject::init @ 0x1404e4e96
// > PlayLayer::toggleMusicInPractice @ 0x140511415
// > SecretLayer3::onClick @ 0x140581fd1
// > SecretLayer3::onClick @ 0x14058237c
// > SecretLayer3::onClick @ 0x1405826f0
// > SongInfoLayer::init @ 0x1406358f3
// > SongInfoLayer::onMenuMusic @ 0x140636279
// > SongInfoLayer::onPracticeMusic @ 0x140636349
// > ??> @ 0x14091e080
//
// 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:51 +0000
//
// Hidden C++ exception states: #wind=9
__int64 __fastcall GameStatsManager::isItemUnlocked(__int64 a1, unsigned int a2, unsigned int a3)
{
unsigned __int8 v5; // bl
__int64 v6; // rdi
_QWORD *ItemKey; // rax
__int64 v8; // rdi
__int64 v9; // rcx
__int64 result; // rax
__int64 v11; // rcx
__int64 v12; // rcx
int SecretChestForItem; // edi
__int64 v14; // rcx
__int64 v15; // rdi
_QWORD *v16; // rax
cocos2d::CCString *v17; // rdi
const char *CString; // rax
size_t v19; // r8
__int64 v20; // rcx
void *v21; // [rsp+20h] [rbp-78h]
void *v22; // [rsp+20h] [rbp-78h]
void *v23; // [rsp+20h] [rbp-78h]
void *v24; // [rsp+20h] [rbp-78h]
void *v25; // [rsp+20h] [rbp-78h]
void *v26; // [rsp+28h] [rbp-70h]
__int128 v27; // [rsp+30h] [rbp-68h] BYREF
__int64 v28; // [rsp+40h] [rbp-58h]
__int64 v29; // [rsp+48h] [rbp-50h]
_QWORD v30[4]; // [rsp+50h] [rbp-48h] BYREF
v5 = 0;
v6 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v21 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v6 = qword_14090BFE0;
}
ItemKey = GameStatsManager::getItemKey(a1, &v27, a3, a2);
v8 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v6 + 336), ItemKey);
sub_14003D310((__int64)&v27);
if ( !v8 )
goto LABEL_7;
v9 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v22 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v9 = qword_14090BFE0;
}
result = GameStatsManager::isStoreItemUnlocked(v9);
v5 = result;
if ( !(_BYTE)result )
{
LABEL_7:
v11 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v23 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v11 = qword_14090BFE0;
}
SecretChestForItem = GameStatsManager::getSecretChestForItem(v11, a3, a2);
if ( SecretChestForItem <= 0 )
goto LABEL_13;
v14 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v24 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v14 = qword_14090BFE0;
}
result = GameStatsManager::isSecretChestUnlocked(v14, (unsigned int)SecretChestForItem);
v5 = result;
if ( !(_BYTE)result )
{
LABEL_13:
v15 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v25 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v15 = qword_14090BFE0;
}
v16 = GameStatsManager::getItemKey(v12, v30, a3, a2);
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v15 + 376), v16);
sub_14003D310((__int64)v30);
if ( v17 )
{
CString = cocos2d::CCString::getCString(v17);
v27 = 0;
v28 = 0;
v29 = 0;
v19 = -1;
do
++v19;
while ( CString[v19] );
sub_14003D230(&v27, CString, v19);
v20 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v26 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v20 = qword_14090BFE0;
}
return GameStatsManager::isSpecialChestUnlocked(v20, &v27);
}
else
{
return v5;
}
}
}
return result;
}