//
// GameStatsManager::incrementChallenge from 0x1003cd890 to 0x1003cda74 (484 bytes)
//
// 3 xrefs:
// > GameStatsManager::incrementStat @ 0x1003ca274
// > GameStatsManager::incrementStat @ 0x1003ca28c
// > GameStatsManager::incrementStat @ 0x1003ca2f0
//
// 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 11:04:09 +0000
//
void __fastcall GameStatsManager::incrementChallenge(__int64 a1, int a2, __int64 a3)
{
__int64 v6; // x22
__int64 Challenge; // x0
__int64 v8; // x25
int v9; // w8
std::string *v10; // x0
const std::string::value_type *v11; // x1
const std::string::value_type *v12; // x1
__int64 v13; // x28
std::string *v14; // x9
void *v15; // x0
__int64 CString; // x2
void **v17; // x3
void *__p[2]; // [xsp+10h] [xbp-80h] BYREF
char v19; // [xsp+27h] [xbp-69h]
std::string v20; // [xsp+28h] [xbp-68h] BYREF
v6 = 1;
do
{
Challenge = GameStatsManager::getChallenge(a1, v6);
if ( Challenge )
{
v8 = Challenge;
if ( (*(_BYTE *)(Challenge + 100) & 1) == 0 && *(_DWORD *)(Challenge + 56) == a2 )
{
GJChallengeItem::incrementCount(Challenge, a3);
if ( (*(_BYTE *)(v8 + 100) & 1) != 0 )
{
sub_100009900(&v20, "");
sub_100009900(__p, "currencyOrbIcon_001.png");
v9 = *(_DWORD *)(v8 + 56);
switch ( v9 )
{
case 3:
std::string::assign(&v20, "Stars/Moons");
v10 = (std::string *)__p;
v11 = "GJ_starsIcon_001.png";
break;
case 2:
if ( *(_DWORD *)(v8 + 84) - *(_DWORD *)(v8 + 88) == 1 )
v12 = "Silver Coin";
else
v12 = "Silver Coins";
std::string::assign(&v20, v12);
v10 = (std::string *)__p;
v11 = "GJ_coinsIcon2_001.png";
break;
case 1:
std::string::assign(&v20, "Mana Orbs");
v10 = (std::string *)__p;
v11 = "currencyOrbIcon_001.png";
break;
default:
v10 = &v20;
v11 = "?";
break;
}
std::string::assign(v10, v11);
v13 = AchievementManager::sharedState();
v14 = &v20;
if ( (v20.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v14 = (std::string *)v20.__r_.__value_.__r.__words[0];
v15 = sub_1003065B0("Collect %i %s.", *(_DWORD *)(v8 + 84) - *(_DWORD *)(v8 + 88), (const char *)v14);
CString = cocos2d::CCString::getCString((__int64)v15);
if ( v19 >= 0 )
v17 = __p;
else
v17 = (void **)__p[0];
AchievementManager::notifyAchievement(v13, (__int64)"Quest Complete!", CString, (__int64)v17);
if ( v19 < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v20.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v20.__r_.__value_.__l.__data_);
}
}
}
v6 = (unsigned int)(v6 + 1);
}
while ( (_DWORD)v6 != 4 );
}