//
// GameStatsManager::dataLoaded from 0x10033f07c to 0x10033fac8 (2636 bytes)
//
// 1 xrefs:
// > GameManager::dataLoaded @ 0x10031bab8
//
// 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
//
void __fastcall GameStatsManager::dataLoaded(GameStatsManager *a1, DS_Dictionary *a2)
{
bool m_pathBugFixed; // w0
cocos2d::CCDictionary *DictForKey; // x0
cocos2d::CCArray *v6; // x23
unsigned int i; // w24
cocos2d::CCString *v8; // x0
char *CString; // x28
unsigned int v10; // w0
cocos2d::CCString *v11; // x0
int v12; // w26
cocos2d::CCDictionary *m_playerStats; // x25
cocos2d::CCString *v14; // x0
int v15; // w27
int v16; // w0
int v17; // w25
cocos2d::CCDictionary *v18; // x25
int v19; // w8
cocos2d::CCObject *v20; // x26
int v21; // w0
cocos2d::CCDictionary *v22; // x25
_BOOL4 v23; // w25
cocos2d::CCDictionary *v24; // x25
cocos2d::CCString *m_trueString; // x26
int v26; // w22
StatKey j; // w21
int StatFromKey; // w0
cocos2d::CCDictionary *v29; // x0
cocos2d::CCArray *v30; // x21
unsigned int v31; // w22
cocos2d::CCString *v32; // x0
const char *v33; // x24
cocos2d::CCDictionary *v34; // x1
cocos2d::CCDictionary *m_pendingUserCoins; // x0
cocos2d::CCDictionary *v36; // x0
cocos2d::CCDictionary *v37; // x1
cocos2d::CCDictionary *m_completedMappacks; // x0
cocos2d::CCDictionary *v39; // x1
cocos2d::CCDictionary *m_purchasedItems; // x0
cocos2d::CCDictionary *v41; // x1
cocos2d::CCDictionary *m_onlineCurrencyScores; // x0
cocos2d::CCDictionary *v43; // x1
cocos2d::CCDictionary *m_gauntletCurrencyScores; // x0
cocos2d::CCDictionary *v45; // x1
cocos2d::CCDictionary *m_mainCurrencyScores; // x0
cocos2d::CCDictionary *v47; // x1
cocos2d::CCDictionary *m_timelyCurrencyScores; // x0
cocos2d::CCDictionary *v49; // x1
cocos2d::CCDictionary *m_onlineStars; // x0
cocos2d::CCDictionary *v51; // x1
cocos2d::CCDictionary *m_timelyStars; // x0
cocos2d::CCDictionary *v53; // x1
cocos2d::CCDictionary *m_gauntletDiamondScores; // x0
cocos2d::CCDictionary *v55; // x1
cocos2d::CCDictionary *m_timelyDiamondScores; // x0
cocos2d::CCDictionary *v57; // x1
cocos2d::CCDictionary *m_unusedCurrencyAwardDict; // x0
cocos2d::CCDictionary *v59; // x1
cocos2d::CCDictionary *m_dailyChests; // x0
cocos2d::CCDictionary *v61; // x1
cocos2d::CCDictionary *m_weeklyChest; // x0
cocos2d::CCDictionary *v63; // x1
cocos2d::CCDictionary *m_eventChest; // x0
cocos2d::CCDictionary *v65; // x1
cocos2d::CCDictionary *m_worldAdvertChests; // x0
cocos2d::CCDictionary *v67; // x0
cocos2d::CCDictionary *v68; // x21
cocos2d::CCArray *v69; // x0
cocos2d::ccArray *data; // x9
__int64 num; // x8
cocos2d::CCString **arr; // x24
unsigned __int64 v73; // x25
char *v74; // x0
__int64 v75; // x22
_DWORD *v76; // x0
_DWORD *v77; // x23
int v78; // w22
int v79; // w8
cocos2d::CCDictionary *v80; // x0
cocos2d::CCDictionary *v81; // x1
cocos2d::CCDictionary *m_challengeDiamonds; // x0
cocos2d::CCDictionary *v83; // x1
cocos2d::CCDictionary *m_completedLists; // x0
cocos2d::CCDictionary *v85; // x1
cocos2d::CCDictionary *m_treasureRoomChests; // x0
cocos2d::CCDictionary *v87; // x1
cocos2d::CCDictionary *m_wraithChests; // x0
cocos2d::CCDictionary *v89; // x1
cocos2d::CCDictionary *m_miscChests; // x0
cocos2d::CCDictionary *v91; // x1
cocos2d::CCDictionary *m_enabledItems; // x0
cocos2d::CCDictionary *v93; // x1
cocos2d::CCDictionary *m_unlockedGauntlets; // x0
int v95; // w22
int v96; // w0
int v97; // w21
float v98; // s0
int v99; // w0
int v100; // w8
cocos2d::CCDictionary *v101; // [xsp+8h] [xbp-A8h]
int IntegerForKey; // [xsp+14h] [xbp-9Ch]
void *v103[2]; // [xsp+18h] [xbp-98h] BYREF
char v104; // [xsp+2Fh] [xbp-81h]
std::string v105; // [xsp+30h] [xbp-80h] BYREF
void *__p[2]; // [xsp+48h] [xbp-68h] BYREF
char v107; // [xsp+5Fh] [xbp-51h]
IntegerForKey = DS_Dictionary::getIntegerForKey(a2, "binaryVersion");
m_pathBugFixed = a1->m_pathBugFixed;
if ( !m_pathBugFixed )
{
m_pathBugFixed = DS_Dictionary::getBoolForKey(a2, "GS_29");
a1->m_pathBugFixed = m_pathBugFixed;
}
if ( IntegerForKey == 38 && !m_pathBugFixed )
a1->m_tryFixPathBug = 1;
DictForKey = DS_Dictionary::getDictForKey(a2, "GS_value", 0);
if ( a1->m_playerStats )
{
v101 = DictForKey;
v6 = cocos2d::CCDictionary::allKeys(DictForKey);
if ( (unsigned int)sub_10024A36C((__int64)v6) )
{
for ( i = 0; i < (unsigned int)sub_10024A36C((__int64)v6); ++i )
{
v8 = cocos2d::CCArray::stringAtIndex(v6, i);
CString = (char *)cocos2d::CCString::getCString(v8);
v10 = atoi(CString);
if ( v10 > 0x2B
|| ((1LL << v10) & 0xF003FBFF1F8LL) == 0
&& (((1LL << v10) & 0xFFC0000000LL) == 0 || IntegerForKey != 38 || a1->m_tryFixPathBug) )
{
sub_100009900(__p, CString);
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v101, __p);
v12 = cocos2d::CCString::intValue(v11);
if ( v107 < 0 )
operator delete(__p[0]);
m_playerStats = a1->m_playerStats;
sub_100009900(__p, CString);
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(m_playerStats, __p);
v15 = cocos2d::CCString::intValue(v14);
if ( v107 < 0 )
operator delete(__p[0]);
sub_100009900(&v105, CString);
v16 = std::string::compare(&v105, 0, 7u, "unique_");
v17 = v16;
if ( SHIBYTE(v105.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v105.__r_.__value_.__l.__data_);
if ( v17 )
{
LABEL_22:
v18 = a1->m_playerStats;
if ( v12 <= v15 )
v19 = v15;
else
v19 = v12;
v20 = sub_100268F4C("%i", v19);
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject_1(v18, v20, __p);
if ( v107 < 0 )
operator delete(__p[0]);
continue;
}
}
else if ( v16 )
{
goto LABEL_22;
}
v21 = (unsigned int)sub_100009900(v103, CString);
if ( (unsigned int)GameStatsManager::isSecretCoinValid(v21, (int)v103) )
{
v22 = a1->m_playerStats;
sub_100009900(__p, CString);
v23 = cocos2d::CCDictionary::objectForKey_1(v22, __p) == 0;
if ( v107 < 0 )
operator delete(__p[0]);
}
else
{
v23 = 0;
}
if ( v104 < 0 )
{
operator delete(v103[0]);
if ( v23 )
{
LABEL_36:
v24 = a1->m_playerStats;
m_trueString = a1->m_trueString;
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject_1(v24, m_trueString, __p);
if ( v107 < 0 )
operator delete(__p[0]);
GameStatsManager::incrementStat(a1, "8", 1);
}
}
else if ( v23 )
{
goto LABEL_36;
}
}
}
}
}
else
{
sub_10033E5A8((__int64)a1, DictForKey);
}
if ( !a1->m_pathBugFixed && !a1->m_tryFixPathBug )
{
v26 = 0;
for ( j = FirePath; j != Gauntlets; ++j )
{
if ( GameStatsManager::getStatFromKey(a1, j) > 999 )
StatFromKey = 1000;
else
StatFromKey = GameStatsManager::getStatFromKey(a1, j);
v26 += StatFromKey;
}
if ( v26 > 1000 )
a1->m_pathBugFixed = 1;
}
v29 = DS_Dictionary::getDictForKey(a2, "GS_3", 0);
if ( a1->m_verifiedUserCoins )
{
v30 = cocos2d::CCDictionary::allKeys(v29);
if ( (unsigned int)sub_10024A36C((__int64)v30) )
{
v31 = 0;
do
{
v32 = cocos2d::CCArray::stringAtIndex(v30, v31);
v33 = cocos2d::CCString::getCString(v32);
if ( !GameStatsManager::hasUserCoin(a1, v33) )
{
GameStatsManager::storeUserCoin(a1, v33);
GameStatsManager::incrementStat(a1, "12", 1);
}
++v31;
}
while ( v31 < (unsigned int)sub_10024A36C((__int64)v30) );
}
}
else
{
sub_10033E638((__int64)a1, v29);
}
v34 = DS_Dictionary::getDictForKey(a2, "GS_4", 0);
m_pendingUserCoins = a1->m_pendingUserCoins;
if ( m_pendingUserCoins )
GameToolbox::mergeDictsSaveLargestInt(m_pendingUserCoins, v34);
else
sub_10033E680((__int64)a1, v34);
v36 = DS_Dictionary::getDictForKey(a2, "GS_completed", 0);
if ( !a1->m_completedLevels )
sub_10033E5F0((__int64)a1, v36);
v37 = DS_Dictionary::getDictForKey(a2, "GS_5", 0);
m_completedMappacks = a1->m_completedMappacks;
if ( m_completedMappacks )
GameToolbox::mergeDictsSaveLargestInt(m_completedMappacks, v37);
else
sub_10033E6C8((__int64)a1, v37);
v39 = DS_Dictionary::getDictForKey(a2, "GS_6", 0);
m_purchasedItems = a1->m_purchasedItems;
if ( m_purchasedItems )
GameToolbox::mergeDictsSaveLargestInt(m_purchasedItems, v39);
else
sub_10033E710((__int64)a1, v39);
v41 = DS_Dictionary::getDictForKey(a2, "GS_7", 0);
m_onlineCurrencyScores = a1->m_onlineCurrencyScores;
if ( m_onlineCurrencyScores )
GameToolbox::mergeDictsSaveLargestInt(m_onlineCurrencyScores, v41);
else
sub_10033E758((__int64)a1, v41);
v43 = DS_Dictionary::getDictForKey(a2, "GS_23", 0);
m_gauntletCurrencyScores = a1->m_gauntletCurrencyScores;
if ( m_gauntletCurrencyScores )
GameToolbox::mergeDictsSaveLargestInt(m_gauntletCurrencyScores, v43);
else
sub_10033E7A0((__int64)a1, v43);
v45 = DS_Dictionary::getDictForKey(a2, "GS_10", 0);
m_mainCurrencyScores = a1->m_mainCurrencyScores;
if ( m_mainCurrencyScores )
GameToolbox::mergeDictsSaveLargestInt(m_mainCurrencyScores, v45);
else
sub_10033E878((__int64)a1, v45);
v47 = DS_Dictionary::getDictForKey(a2, "GS_16", 0);
m_timelyCurrencyScores = a1->m_timelyCurrencyScores;
if ( m_timelyCurrencyScores )
GameToolbox::mergeDictsSaveLargestInt(m_timelyCurrencyScores, v47);
else
sub_10033E8C0((__int64)a1, v47);
v49 = DS_Dictionary::getDictForKey(a2, "GS_9", 0);
m_onlineStars = a1->m_onlineStars;
if ( m_onlineStars )
GameToolbox::mergeDictsSaveLargestInt(m_onlineStars, v49);
else
sub_10033E830((__int64)a1, v49);
v51 = DS_Dictionary::getDictForKey(a2, "GS_17", 0);
m_timelyStars = a1->m_timelyStars;
if ( m_timelyStars )
GameToolbox::mergeDictsSaveLargestInt(m_timelyStars, v51);
else
sub_10033E908((__int64)a1, v51);
v53 = DS_Dictionary::getDictForKey(a2, "GS_18", 0);
m_gauntletDiamondScores = a1->m_gauntletDiamondScores;
if ( m_gauntletDiamondScores )
GameToolbox::mergeDictsSaveLargestInt(m_gauntletDiamondScores, v53);
else
sub_10033E950((__int64)a1, v53);
v55 = DS_Dictionary::getDictForKey(a2, "GS_24", 0);
m_timelyDiamondScores = a1->m_timelyDiamondScores;
if ( m_timelyDiamondScores )
GameToolbox::mergeDictsSaveLargestInt(m_timelyDiamondScores, v55);
else
sub_10033E998((__int64)a1, v55);
v57 = DS_Dictionary::getDictForKey(a2, "GS_8", 0);
m_unusedCurrencyAwardDict = a1->m_unusedCurrencyAwardDict;
if ( m_unusedCurrencyAwardDict )
GameToolbox::mergeDictsSaveLargestInt(m_unusedCurrencyAwardDict, v57);
else
sub_10033E7E8((__int64)a1, v57);
v59 = DS_Dictionary::getDictForKey(a2, "GS_11", 0);
m_dailyChests = a1->m_dailyChests;
if ( m_dailyChests )
GameToolbox::mergeDictsSkipConflict(m_dailyChests, v59);
else
sub_1001AF9CC((__int64)a1, v59);
v61 = DS_Dictionary::getDictForKey(a2, "GS_25", 0);
m_weeklyChest = a1->m_weeklyChest;
if ( m_weeklyChest )
GameToolbox::mergeDictsSkipConflict(m_weeklyChest, v61);
else
sub_10033EBD8((__int64)a1, v61);
v63 = DS_Dictionary::getDictForKey(a2, "GS_31", 0);
m_eventChest = a1->m_eventChest;
if ( m_eventChest )
GameToolbox::mergeDictsSkipConflict(m_eventChest, v63);
else
sub_10033EC20((__int64)a1, v63);
v65 = DS_Dictionary::getDictForKey(a2, "GS_22", 0);
m_worldAdvertChests = a1->m_worldAdvertChests;
if ( m_worldAdvertChests )
GameToolbox::mergeDictsSkipConflict(m_worldAdvertChests, v65);
else
sub_1001AFA14((__int64)a1, v65);
v67 = DS_Dictionary::getDictForKey(a2, "GS_12", 0);
v68 = v67;
if ( a1->m_activeChallenges )
{
v69 = cocos2d::CCDictionary::allKeys(v67);
if ( v69 )
{
data = v69->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (cocos2d::CCString **)data->arr;
v73 = (unsigned __int64)&arr[num - 1];
do
{
if ( !*arr )
break;
v74 = (char *)cocos2d::CCString::getCString(*arr);
sub_100009900(__p, v74);
v75 = cocos2d::CCDictionary::objectForKey_1(v68, __p);
v76 = (_DWORD *)cocos2d::CCDictionary::objectForKey_1(a1->m_activeChallenges, __p);
v77 = v76;
if ( v76 )
{
if ( v76[24] == *(_DWORD *)(v75 + 96) && v76[14] == *(_DWORD *)(v75 + 56) )
{
v78 = *(_DWORD *)(v75 + 60) - *(_DWORD *)(v75 + 64);
if ( v76[15] - v76[16] < v78 )
{
v76[17] = v78;
v79 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v77[15] = v78 + v79;
v77[16] = v79;
}
}
}
else if ( !GameStatsManager::hasCompletedChallenge(a1, (GJChallengeItem *)v75) )
{
cocos2d::CCDictionary::setObject_1(a1->m_activeChallenges, v75, __p);
}
if ( v107 < 0 )
operator delete(__p[0]);
++arr;
}
while ( (unsigned __int64)arr <= v73 );
}
}
}
else
{
sub_10009ACB0((__int64)a1, v67);
}
v80 = DS_Dictionary::getDictForKey(a2, "GS_15", 0);
if ( !a1->m_upcomingChallenges )
sub_10033E9E0((__int64)a1, v80);
v81 = DS_Dictionary::getDictForKey(a2, "GS_14", 0);
m_challengeDiamonds = a1->m_challengeDiamonds;
if ( m_challengeDiamonds )
GameToolbox::mergeDictsSaveLargestInt(m_challengeDiamonds, v81);
else
sub_10033EA28((__int64)a1, v81);
v83 = DS_Dictionary::getDictForKey(a2, "GS_27", 0);
m_completedLists = a1->m_completedLists;
if ( m_completedLists )
GameToolbox::mergeDictsSaveLargestInt(m_completedLists, v83);
else
sub_10033EA70((__int64)a1, v83);
v85 = DS_Dictionary::getDictForKey(a2, "GS_19", 0);
m_treasureRoomChests = a1->m_treasureRoomChests;
if ( m_treasureRoomChests )
GameToolbox::mergeDictsSkipConflict(m_treasureRoomChests, v85);
else
sub_10033EAB8((__int64)a1, v85);
v87 = DS_Dictionary::getDictForKey(a2, "GS_30", 0);
m_wraithChests = a1->m_wraithChests;
if ( m_wraithChests )
GameToolbox::mergeDictsSkipConflict(m_wraithChests, v87);
else
sub_10033EB90((__int64)a1, v87);
v89 = DS_Dictionary::getDictForKey(a2, "GS_21", 0);
m_miscChests = a1->m_miscChests;
if ( m_miscChests )
GameToolbox::mergeDictsSkipConflict(m_miscChests, v89);
else
sub_10033EB00((__int64)a1, v89);
v91 = DS_Dictionary::getDictForKey(a2, "GS_28", 0);
m_enabledItems = a1->m_enabledItems;
if ( m_enabledItems )
GameToolbox::mergeDictsSkipConflict(m_enabledItems, v91);
else
sub_10033EB48((__int64)a1, v91);
v93 = DS_Dictionary::getDictForKey(a2, "GS_32", 0);
m_unlockedGauntlets = a1->m_unlockedGauntlets;
if ( m_unlockedGauntlets )
GameToolbox::mergeDictsSkipConflict(m_unlockedGauntlets, v93);
else
sub_10033EC68((__int64)a1, v93);
GameStatsManager::removeErrorFromSpecialChests(a1);
v95 = a1->m_bonusKey.random - a1->m_bonusKey.seed;
v96 = DS_Dictionary::getIntegerForKey(a2, "GS_20");
if ( v96 > v95 )
{
v97 = v96;
a1->m_bonusKey.value = v96;
v98 = vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0;
a1->m_bonusKey.seed = (int)v98;
a1->m_bonusKey.random = v97 + (int)v98;
}
v99 = DS_Dictionary::getIntegerForKey(a2, "GS_26");
if ( (unsigned int)(v99 - 40) >= 0xFFFFFFF6 )
v100 = v99;
else
v100 = 0;
a1->m_activePath = v100;
GameStatsManager::postLoadGameStats(a1);
}