//
// GameStatsManager::incrementChallenge from 0x518fb8 to 0x519118 (352 bytes)
//
// 1 xrefs:
// > GameStatsManager::incrementStat @ 0x5292fe
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:45 +0000
//
int __fastcall GameStatsManager::incrementChallenge(GameStatsManager *this, int a2, int a3)
{
const char *v6; // r7
int result; // r0
int v8; // r4
int v9; // r3
int *v10; // r0
char *v11; // r1
int *v12; // r0
FMODAudioEngine *v13; // r11
char *v14; // r2
char *v15; // r1
cocos2d::CCString *v16; // r0
const char *CString; // r2
char *v18; // r3
int v19[2]; // [sp+24h] [bp-20h] BYREF
char *v20; // [sp+2Ch] [bp-18h]
int v21[2]; // [sp+30h] [bp-14h] BYREF
char *v22; // [sp+38h] [bp-Ch]
v6 = (_BYTE *)(&dword_0 + 1);
do
{
result = GameStatsManager::getChallenge(this, v6);
v8 = result;
if ( result && !*(_BYTE *)(result + 96) )
{
if ( *(_DWORD *)(result + 52) == a2 )
result = GJChallengeItem::incrementCount(result, a3);
if ( *(_BYTE *)(v8 + 96) )
{
v19[0] = 0;
v19[1] = 0;
v20 = nullptr;
std::string::__init(v19, &unk_B6B226, 0);
v21[0] = 0;
v21[1] = 0;
v22 = nullptr;
std::string::__init(v21, "currencyOrbIcon_001.png", 0x17u);
v9 = *(_DWORD *)(v8 + 52);
switch ( v9 )
{
case 1:
std::string::assign(v19, "Mana Orbs");
v10 = v21;
v11 = "currencyOrbIcon_001.png";
break;
case 3:
std::string::assign(v19, "Stars/Moons");
v10 = v21;
v11 = "GJ_starsIcon_001.png";
break;
case 2:
if ( *(_DWORD *)(v8 + 80) - *(_DWORD *)(v8 + 84) == 1 )
v15 = "Silver Coin";
else
v15 = "Silver Coins";
std::string::assign(v19, v15);
v10 = v21;
v11 = "GJ_coinsIcon2_001.png";
break;
default:
v10 = v19;
v11 = "?";
break;
}
v12 = std::string::assign(v10, v11);
v13 = (FMODAudioEngine *)AchievementManager::sharedState((AchievementManager *)v12);
if ( (v19[0] & 1) != 0 )
v14 = v20;
else
v14 = (char *)v19 + 1;
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i %s.",
(const char *)(*(_DWORD *)(v8 + 80) - *(_DWORD *)(v8 + 84)),
v14);
CString = (const char *)cocos2d::CCString::getCString(v16);
if ( (v21[0] & 1) != 0 )
v18 = v22;
else
v18 = (char *)v21 + 1;
AchievementManager::notifyAchievement(v13, (AchievementBar *)"Quest Complete!", CString, v18);
std::string::~string((int)v21);
result = std::string::~string((int)v19);
}
}
++v6;
}
while ( v6 != &byte_4 );
return result;
}