//
// GameStatsManager::preProcessReward from 0x8dd030 to 0x8dd210 (480 bytes)
//
// 5 xrefs:
// > GameStatsManager::unlockSpecialChest @ 0x8eae1c
// > GameStatsManager::unlockSecretChest @ 0x8eb2dc
// > GameStatsManager::unlockGoldChest @ 0x8eb424
// > RewardsPage::rewardsStatusFinished @ 0xa88f44
// > ??> @ 0x4f600
//
// 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:48 +0000
//
__int64 __fastcall GameStatsManager::preProcessReward(GameStatsManager *this, GJRewardItem *a2)
{
int v3; // w23
unsigned int v4; // w19
cocos2d::CCArray *v6; // x21
__int64 v7; // x20
cocos2d::CCObject *RewardObjectForType; // x0
const char *v10; // x1
int Stat; // w28
int v12; // w1
const char *v13; // x1
__int64 v14[2]; // [xsp+68h] [xbp+68h] BYREF
void *v15; // [xsp+78h] [xbp+78h]
__int64 v16[2]; // [xsp+80h] [xbp+80h] BYREF
void *v17; // [xsp+90h] [xbp+90h]
v3 = 0;
v4 = 0;
v6 = *((cocos2d::CCArray **)a2 + 9);
if ( v6 )
{
while ( v4 < (unsigned int)cocos2d::CCArray::count(v6) )
{
while ( 1 )
{
v7 = cocos2d::CCArray::objectAtIndex(v6, v4);
if ( (unsigned __int8)GJRewardItem::isShardType(*(_DWORD *)(v7 + 56)) )
{
GJRewardItem::rewardItemToStat(*(_DWORD *)(v7 + 56), v14);
v10 = (char *)v14 + 1;
if ( (v14[0] & 1) != 0 )
v10 = (const char *)v15;
Stat = 100;
if ( (int)GameStatsManager::getStat(this, v10) <= 99 )
{
GJRewardItem::rewardItemToStat(*(_DWORD *)(v7 + 56), v16);
v13 = (char *)v16 + 1;
if ( (v16[0] & 1) != 0 )
v13 = (const char *)v17;
Stat = GameStatsManager::getStat(this, v13);
if ( (v16[0] & 1) != 0 )
operator delete(v17);
}
if ( (v14[0] & 1) != 0 )
operator delete(v15);
v12 = *(_DWORD *)(v7 + 68);
if ( Stat + v12 > 99 )
{
*(_DWORD *)(v7 + 68) = 100 - Stat;
v3 += Stat + v12 - 100;
if ( 100 - Stat <= 0 )
break;
}
}
if ( ++v4 >= (unsigned int)cocos2d::CCArray::count(v6) )
goto LABEL_5;
}
cocos2d::CCArray::removeObjectAtIndex(v6, v4, 1);
}
LABEL_5:
if ( v3 )
{
RewardObjectForType = GJRewardItem::getRewardObjectForType((cocos2d::CCArray **)a2, 7);
*((_DWORD *)RewardObjectForType + 17) = (int)(float)((float)*((int *)RewardObjectForType + 17)
+ (float)((float)v3 * 100.0));
}
}
return _stack_chk_guard;
}