//
// GameStatsManager::incrementChallenge from 0x8d856c to 0x8d87d8 (620 bytes)
//
// 2 xrefs:
// > GameStatsManager::incrementStat @ 0x8e84b0
// > ??> @ 0x8cba8
//
// 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:45 +0000
//
__int64 __fastcall GameStatsManager::incrementChallenge(GameStatsManager *this, int a2, int a3)
{
unsigned int i; // w19
__int64 Challenge; // x0
__int64 v8; // x20
int v10; // w0
__int64 *v11; // x0
char *v12; // x2
cocos2d::CCString *v13; // x0
const char *CString; // x2
const char *v15; // x3
char *v16; // x1
AchievementManager *v17; // [xsp+68h] [xbp+68h]
__int64 v18[2]; // [xsp+78h] [xbp+78h] BYREF
void *v19; // [xsp+88h] [xbp+88h]
__int64 v20[2]; // [xsp+90h] [xbp+90h] BYREF
void *v21; // [xsp+A0h] [xbp+A0h]
for ( i = 1; i != 4; ++i )
{
Challenge = GameStatsManager::getChallenge(this, (const char *)i);
v8 = Challenge;
if ( Challenge )
{
if ( !*(_BYTE *)(Challenge + 100) && *(_DWORD *)(Challenge + 56) == a2 )
{
GJChallengeItem::incrementCount(Challenge, a3);
if ( *(_BYTE *)(v8 + 100) )
{
v18[0] = 0;
v18[1] = 0;
v19 = nullptr;
std::string::__init(v18, &byte_11B8890, 0);
v20[0] = 0;
v20[1] = 0;
v21 = nullptr;
std::string::__init(v20, "currencyOrbIcon_001.png", 0x17u);
v10 = *(_DWORD *)(v8 + 56);
switch ( v10 )
{
case 1:
std::string::assign(v18, "Mana Orbs");
v11 = std::string::assign(v20, "currencyOrbIcon_001.png");
break;
case 3:
std::string::assign(v18, "Stars/Moons");
v11 = std::string::assign(v20, "GJ_starsIcon_001.png");
break;
case 2:
if ( *(_DWORD *)(v8 + 84) - *(_DWORD *)(v8 + 88) == 1 )
v16 = "Silver Coin";
else
v16 = "Silver Coins";
std::string::assign(v18, v16);
v11 = std::string::assign(v20, "GJ_coinsIcon2_001.png");
break;
default:
v11 = std::string::assign(v18, "?");
break;
}
v17 = (AchievementManager *)AchievementManager::sharedState((AchievementManager *)v11);
v12 = (char *)v18 + 1;
if ( (v18[0] & 1) != 0 )
v12 = (char *)v19;
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i %s.",
(const char *)(unsigned int)(*(_DWORD *)(v8 + 84) - *(_DWORD *)(v8 + 88)),
v12);
CString = (const char *)cocos2d::CCString::getCString(v13);
v15 = (char *)v20 + 1;
if ( (v20[0] & 1) != 0 )
v15 = (const char *)v21;
AchievementManager::notifyAchievement(v17, (AchievementBar *)"Quest Complete!", CString, v15);
if ( (v20[0] & 1) != 0 )
operator delete(v21);
if ( (v18[0] & 1) != 0 )
operator delete(v19);
}
}
}
}
return _stack_chk_guard;
}