//
// GameStatsManager::init from 0x1401d1110 to 0x1401d130e (510 bytes)
//
// 2 xrefs:
// > ??> @ 0x140562bd0
// > ??> @ 0x1406cc2f4
//
// 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
//
// Hidden C++ exception states: #wind=1
bool GameStatsManager::init(GameStatsManager *a1)
{
cocos2d::CCString *v2; // rax
__int64 v3; // rcx
cocos2d::CCDictionary *v4; // rax
__int64 v5; // rcx
cocos2d::CCDictionary *v6; // rax
cocos2d::CCDictionary *v7; // rbx
cocos2d::CCDictionary *m_rewardItems; // rcx
__int64 v9; // rcx
cocos2d::CCDictionary *v10; // rax
__int64 v11; // rcx
cocos2d::CCDictionary *v12; // rax
cocos2d::CCDictionary *m_allTreasureRoomChests; // rbp
cocos2d::CCDictElement *m_pElements; // rbp
cocos2d::CCDictElement *i; // r14
cocos2d::CCObject *m_pObject; // rbp
cocos2d::CCArray *v17; // rdi
unsigned int v18; // ebx
struct cocos2d::CCObject *v19; // rax
__int64 v20; // rcx
struct cocos2d::CCString *v21; // rax
_BYTE v23[32]; // [rsp+20h] [rbp-48h] BYREF
v2 = cocos2d::CCString::createWithFormat("%i", 1);
a1->m_trueString = v2;
cocos2d::CCObject::retain(v2);
v4 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v3);
a1->m_unkDict = v4;
cocos2d::CCObject::retain(v4);
v6 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v5);
v7 = v6;
if ( a1->m_rewardItems != v6 )
{
if ( v6 )
cocos2d::CCObject::retain(v6);
m_rewardItems = a1->m_rewardItems;
if ( m_rewardItems )
cocos2d::CCObject::release(m_rewardItems);
a1->m_rewardItems = v7;
}
GameStatsManager::setupIconCredits(a1);
GameStatsManager::createStoreItems(a1);
if ( !a1->m_allTreasureRoomChestItems )
{
v10 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v9);
a1->m_allTreasureRoomChestItems = v10;
cocos2d::CCObject::retain(v10);
v12 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v11);
a1->m_allTreasureRoomChests = v12;
cocos2d::CCObject::retain(v12);
GameStatsManager::createSecretChestRewards(a1);
m_allTreasureRoomChests = a1->m_allTreasureRoomChests;
if ( m_allTreasureRoomChests )
{
m_pElements = m_allTreasureRoomChests->m_pElements;
if ( m_pElements )
{
for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )
{
m_pObject = m_pElements->m_pObject;
if ( m_pObject )
{
v17 = *(cocos2d::CCArray **)&m_pObject[1].m_nTag;
if ( v17 )
{
v18 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)&m_pObject[1].m_nTag) )
{
do
{
v19 = cocos2d::CCArray::objectAtIndex(v17, v18);
if ( LODWORD(v19[1].__vftable) == 9 )
{
GameStatsManager::getItemKey(v20, v23, v19[1].m_uID, HIDWORD(v19[1].__vftable));
cocos2d::CCDictionary::objectForKey(a1->m_allTreasureRoomChestItems, v23);
v21 = cocos2d::CCString::createWithFormat("%i", LODWORD(m_pObject[1].__vftable));
cocos2d::CCDictionary::setObject(a1->m_allTreasureRoomChestItems, v21, v23);
sub_14003A830((__int64)v23);
}
++v18;
}
while ( v18 < cocos2d::CCArray::count(v17) );
}
}
}
m_pElements = i;
if ( !i )
break;
}
}
}
}
GameStatsManager::createSpecialChestItems(a1);
GameStatsManager::generateItemUnlockableData(a1);
return 1;
}