//
// GameStatsManager::getTotalCollectedCurrency from 0x8ce430 to 0x8ce9a8 (1400 bytes)
//
// 2 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x8ebaf0
// > ??> @ 0x5b810
//
// This function is hookable on this platform (idp: arm, 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:56:37 +0000
//
__int64 __fastcall GameStatsManager::getTotalCollectedCurrency(cocos2d::CCDictionary **this)
{
unsigned int v2; // w19
GameLevelManager *AwardedCurrencyForLevel; // x0
float v4; // s8
GameLevelManager *v5; // x0
unsigned int *MainLevel; // x1
unsigned int i; // w19
GameLevelManager *v8; // x0
unsigned int j; // w19
GameLevelManager *v10; // x0
unsigned int v11; // w19
cocos2d::CCArray *v12; // x22
cocos2d::CCString *v13; // x0
GameLevelManager *v14; // x0
unsigned int v15; // w21
GameLevelManager *v16; // x0
GJGameLevel *SavedLevel; // x1
unsigned int v18; // w19
cocos2d::CCArray *v19; // x22
cocos2d::CCString *v20; // x0
GameLevelManager *v21; // x0
unsigned int v22; // w21
GameLevelManager *v23; // x0
GJGameLevel *SavedGauntletLevel; // x1
unsigned int v25; // w19
cocos2d::CCArray *v26; // x22
cocos2d::CCString *v27; // x0
GameLevelManager *v28; // x0
unsigned int v29; // w21
GameLevelManager *v30; // x0
GJGameLevel *SavedDailyLevel; // x1
cocos2d::CCString *v33; // x0
const char *CString; // x0
size_t v35; // x0
__int64 v36; // x27
char *v37; // x21
size_t v38; // x0
cocos2d::CCString *v39; // x0
const char *v40; // x0
size_t v41; // x0
__int64 v42; // x27
char *v43; // x21
size_t v44; // x0
cocos2d::CCString *v45; // x0
const char *v46; // x0
size_t v47; // x0
__int64 v48; // x28
char *v49; // x21
size_t v50; // x0
__int64 v51; // x21
const char *v52; // x1
size_t v53; // x0
char *v54; // [xsp+78h] [xbp+78h]
char *v55; // [xsp+78h] [xbp+78h]
char *v56; // [xsp+78h] [xbp+78h]
char *v57; // [xsp+78h] [xbp+78h]
__int64 v58[2]; // [xsp+80h] [xbp+80h] BYREF
void *v59; // [xsp+90h] [xbp+90h]
__int64 v60; // [xsp+98h] [xbp+98h] BYREF
__int64 v61; // [xsp+A0h] [xbp+A0h]
void *v62; // [xsp+A8h] [xbp+A8h]
__int64 v63; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v64; // [xsp+B8h] [xbp+B8h]
void *v65; // [xsp+C0h] [xbp+C0h]
v2 = 1;
AwardedCurrencyForLevel = (GameLevelManager *)_stack_chk_guard;
v4 = 0.0;
while ( 1 )
{
v5 = (GameLevelManager *)GameLevelManager::sharedState(AwardedCurrencyForLevel);
MainLevel = (unsigned int *)GameLevelManager::getMainLevel(v5, (const char *)v2, 1u);
if ( !MainLevel )
break;
++v2;
AwardedCurrencyForLevel = (GameLevelManager *)GameStatsManager::getAwardedCurrencyForLevel(
(GameStatsManager *)this,
(GJGameLevel *)MainLevel);
v4 = v4 + (float)(int)AwardedCurrencyForLevel;
if ( v2 == 23 )
goto LABEL_5;
}
LABEL_4:
AwardedCurrencyForLevel = (GameLevelManager *)MainLevel[82];
__break(0x3E8u);
LABEL_5:
for ( i = 5001; i != 5005; ++i )
{
v8 = (GameLevelManager *)GameLevelManager::sharedState(AwardedCurrencyForLevel);
MainLevel = (unsigned int *)GameLevelManager::getMainLevel(v8, (const char *)i, 1u);
if ( !MainLevel )
goto LABEL_4;
AwardedCurrencyForLevel = (GameLevelManager *)GameStatsManager::getAwardedCurrencyForLevel(
(GameStatsManager *)this,
(GJGameLevel *)MainLevel);
v4 = v4 + (float)(int)AwardedCurrencyForLevel;
}
for ( j = 2001; j != 2011; ++j )
{
v10 = (GameLevelManager *)GameLevelManager::sharedState(AwardedCurrencyForLevel);
MainLevel = (unsigned int *)GameLevelManager::getMainLevel(v10, (const char *)j, 1u);
if ( !MainLevel )
goto LABEL_4;
AwardedCurrencyForLevel = (GameLevelManager *)GameStatsManager::getAwardedCurrencyForLevel(
(GameStatsManager *)this,
(GJGameLevel *)MainLevel);
v4 = v4 + (float)(int)AwardedCurrencyForLevel;
}
v11 = 0;
v12 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(*(this + 80));
if ( (unsigned int)cocos2d::CCArray::count(v12) )
{
do
{
v13 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v12, v11);
v14 = (GameLevelManager *)cocos2d::CCString::intValue(v13);
v15 = (unsigned int)v14;
v16 = (GameLevelManager *)GameLevelManager::sharedState(v14);
SavedLevel = (GJGameLevel *)GameLevelManager::getSavedLevel(v16, (const char *)v15);
if ( SavedLevel )
{
v4 = v4 + (float)(int)GameStatsManager::getAwardedCurrencyForLevel((GameStatsManager *)this, SavedLevel);
}
else
{
v33 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v15);
CString = (const char *)cocos2d::CCString::getCString(v33);
v60 = 0;
v54 = (char *)CString;
v61 = 0;
v62 = nullptr;
v35 = strlen(CString);
std::string::__init(&v60, v54, v35);
v36 = (__int64)*(this + 80);
v37 = (char *)&v60 + 1;
if ( (v60 & 1) != 0 )
v37 = (char *)v62;
v63 = 0;
v64 = 0;
v65 = nullptr;
v38 = strlen(v37);
std::string::__init(&v63, v37, v38);
cocos2d::CCDictionary::removeObjectForKey(v36, &v63);
if ( (v63 & 1) != 0 )
operator delete(v65);
if ( (v60 & 1) != 0 )
{
++v11;
operator delete(v62);
continue;
}
}
++v11;
}
while ( v11 < (unsigned int)cocos2d::CCArray::count(v12) );
}
v18 = 0;
v19 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(*(this + 82));
if ( (unsigned int)cocos2d::CCArray::count(v19) )
{
do
{
v20 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v19, v18);
v21 = (GameLevelManager *)cocos2d::CCString::intValue(v20);
v22 = (unsigned int)v21;
v23 = (GameLevelManager *)GameLevelManager::sharedState(v21);
SavedGauntletLevel = (GJGameLevel *)GameLevelManager::getSavedGauntletLevel(v23, (const char *)v22);
if ( SavedGauntletLevel )
{
v4 = v4 + (float)(int)GameStatsManager::getAwardedCurrencyForLevel((GameStatsManager *)this, SavedGauntletLevel);
}
else
{
v39 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v22);
v40 = (const char *)cocos2d::CCString::getCString(v39);
v60 = 0;
v55 = (char *)v40;
v61 = 0;
v62 = nullptr;
v41 = strlen(v40);
std::string::__init(&v60, v55, v41);
v42 = (__int64)*(this + 82);
v43 = (char *)&v60 + 1;
if ( (v60 & 1) != 0 )
v43 = (char *)v62;
v63 = 0;
v64 = 0;
v65 = nullptr;
v44 = strlen(v43);
std::string::__init(&v63, v43, v44);
cocos2d::CCDictionary::removeObjectForKey(v42, &v63);
if ( (v63 & 1) != 0 )
operator delete(v65);
if ( (v60 & 1) != 0 )
{
++v18;
operator delete(v62);
continue;
}
}
++v18;
}
while ( v18 < (unsigned int)cocos2d::CCArray::count(v19) );
}
v25 = 0;
v26 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(*(this + 83));
if ( (unsigned int)cocos2d::CCArray::count(v26) )
{
do
{
v27 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v26, v25);
v28 = (GameLevelManager *)cocos2d::CCString::intValue(v27);
v29 = (unsigned int)v28;
v30 = (GameLevelManager *)GameLevelManager::sharedState(v28);
SavedDailyLevel = (GJGameLevel *)GameLevelManager::getSavedDailyLevel(v30, (const char *)v29);
if ( SavedDailyLevel )
{
v4 = v4 + (float)(int)GameStatsManager::getAwardedCurrencyForLevel((GameStatsManager *)this, SavedDailyLevel);
}
else
{
v45 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v29);
v46 = (const char *)cocos2d::CCString::getCString(v45);
v58[0] = 0;
v56 = (char *)v46;
v58[1] = 0;
v59 = nullptr;
v47 = strlen(v46);
std::string::__init(v58, v56, v47);
v48 = (__int64)*(this + 83);
v49 = (char *)v58 + 1;
if ( (v58[0] & 1) != 0 )
v49 = (char *)v59;
v60 = 0;
v61 = 0;
v62 = nullptr;
v50 = strlen(v49);
std::string::__init(&v60, v49, v50);
cocos2d::CCDictionary::removeObjectForKey(v48, &v60);
if ( (v60 & 1) != 0 )
operator delete(v62);
v51 = (__int64)*(this + 85);
v52 = (char *)v58 + 1;
if ( (v58[0] & 1) != 0 )
v52 = (const char *)v59;
v63 = 0;
v64 = 0;
v65 = nullptr;
v57 = (char *)v52;
v53 = strlen(v52);
std::string::__init(&v63, v57, v53);
cocos2d::CCDictionary::removeObjectForKey(v51, &v63);
if ( (v63 & 1) != 0 )
operator delete(v65);
if ( (v58[0] & 1) != 0 )
{
++v25;
operator delete(v59);
continue;
}
}
++v25;
}
while ( v25 < (unsigned int)cocos2d::CCArray::count(v26) );
}
return (unsigned int)(int)v4;
}