//
// GameStatsManager::isSecretChestUnlocked from 0x7a6044 to 0x7a6154 (272 bytes)
//
// 6 xrefs:
// > GameStatsManager::getNextGoldChestID @ 0x7a6178
// > GameStatsManager::isItemUnlocked @ 0x7b9bb0
// > GameStatsManager::unlockSecretChest @ 0x7bc02c
// > GameStatsManager::unlockGoldChest @ 0x7bc1c8
// > SecretRewardsLayer::generateChestItems @ 0xa6a404
// > ??> @ 0xc6768
//
// 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
//
// local variable allocation has failed, the output may be wrong!
bool GameStatsManager::isSecretChestUnlocked(GameStatsManager *a1, int a2)
{
cocos2d::CCDictionary *m_treasureRoomChests; // x21
cocos2d::CCString *v3; // x0
char *CString; // x0
bool v5; // zf
__int64 *v6; // x0
bool v7; // w20
unsigned int *v9; // x2
int v10; // w1
std::string v11; // [xsp+40h] [xbp+40h] BYREF
m_treasureRoomChests = a1->m_treasureRoomChests;
v3 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", *(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_D153B8((int)&v11, CString);
v5 = cocos2d::CCDictionary::objectForKey(m_treasureRoomChests, &v11) == 0;
v6 = (__int64 *)((char *)v11.m_data.m_data - 24);
v7 = !v5;
if ( v6 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)((char *)v11.m_data.m_data - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v11.m_data.m_data - 2);
*((_DWORD *)v11.m_data.m_data - 2) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v6);
}
return v7;
}