//
// GameLevelManager::parseEventReward from 0x4ca22c to 0x4ca440 (532 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetGJDailyLevelStateCompleted @ 0x4ca5d0
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x4da368
//
// 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:50:37 +0000
//
int __fastcall GameLevelManager::parseEventReward(int a1, unsigned __int8 *a2, unsigned __int8 *a3)
{
int v4; // r6
unsigned int v6; // r3
int v7; // r0
int v8; // r1
int v9; // r2
cocos2d::CCString *v10; // r0
char *CString; // r0
char *v12; // r6
const void *v13; // r0
unsigned __int8 *v14; // r3
char *v15; // r2
size_t v16; // r0
int Reward; // r6
cocos2d::CCArray *v18; // r4
cocos2d::CCString *v19; // r0
GameManager *v20; // r6
int v21; // r0
cocos2d::CCString *v22; // r0
int v23; // r6
cocos2d::CCString *v24; // r0
int v25; // r10
cocos2d::CCString *v26; // r0
const char *v27; // r11
size_t v28; // r0
GameStatsManager *v29; // r0
int v30; // r11
int v32[3]; // [sp+14h] [bp-90h] BYREF
int v33[3]; // [sp+20h] [bp-84h] BYREF
_DWORD v34[3]; // [sp+2Ch] [bp-78h] BYREF
int v35[3]; // [sp+38h] [bp-6Ch] BYREF
int v36[3]; // [sp+44h] [bp-60h] BYREF
int v37; // [sp+50h] [bp-54h] BYREF
int v38; // [sp+54h] [bp-50h]
int v39; // [sp+58h] [bp-4Ch]
unsigned __int8 v40[20]; // [sp+5Ch] [bp-48h] BYREF
unsigned __int8 v41[44]; // [sp+70h] [bp-34h] BYREF
v4 = *a2;
if ( (v4 & 1) != 0 )
v6 = *((_DWORD *)a2 + 1);
else
v6 = v4 >> 1;
if ( v6 <= 5 )
return 0;
std::string::basic_string(&v37, a2, 5u, 0xFFFFFFFF);
if ( (*a2 & 1) != 0 )
{
**((_BYTE **)a2 + 2) = 0;
*((_DWORD *)a2 + 1) = 0;
}
else
{
a2[1] = 0;
*a2 = 0;
}
std::string::reserve((int *)a2, 0);
v7 = v37;
v8 = v38;
v9 = v39;
v37 = 0;
v38 = 0;
v39 = 0;
*(_DWORD *)a2 = v7;
*((_DWORD *)a2 + 1) = v8;
*((_DWORD *)a2 + 2) = v9;
std::string::~string((int)&v37);
std::string::basic_string(v32, (int)a2);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_70,
"C26",
"fpYa",
81,
67,
"tg");
CString = (char *)cocos2d::CCString::getCString(v10);
std::string::append(v32, CString);
if ( (v32[0] & 1) != 0 )
v12 = (char *)v32[2];
else
v12 = (char *)v32 + 1;
v13 = (const void *)strlen(v12);
rtsha1::calc((rtsha1 *)v12, v13, (int)v40, v14);
rtsha1::toHexString((rtsha1 *)v40, v41, v15);
memset(v33, 0, sizeof(v33));
v16 = strlen((const char *)v41);
std::string::__init(v33, v41, v16);
Reward = sub_4A9CC4((unsigned __int8 *)v33, a3);
std::string::~string((int)v33);
if ( Reward )
{
memset(v35, 0, sizeof(v35));
std::string::__init(v35, "59182", 5u);
cocos2d::ZipUtils::base64DecodeEnc(v34, a2, v35);
std::string::~string((int)v35);
v18 = sub_4C1A88(v34, ":");
if ( cocos2d::CCArray::count(v18) > 4u
&& (v19 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v18, 1u),
v20 = (GameManager *)cocos2d::CCString::intValue(v19),
v21 = GameManager::sharedState(v20),
v20 == (GameManager *)(*(_DWORD *)(v21 + 696) - *(_DWORD *)(v21 + 700))) )
{
v22 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v18, 2u);
v23 = cocos2d::CCString::intValue(v22);
v24 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v18, 3u);
v25 = cocos2d::CCString::intValue(v24);
v26 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v18, 4u);
v27 = (const char *)cocos2d::CCString::getCString(v26);
memset(v36, 0, sizeof(v36));
v28 = strlen(v27);
v29 = (GameStatsManager *)std::string::__init(v36, v27, v28);
v30 = GameStatsManager::sharedState(v29);
std::string::basic_string(&v37, (int)v36);
Reward = GameStatsManager::createReward(v30, v25, v23, (int)&v37);
std::string::~string((int)&v37);
std::string::~string((int)v36);
}
else
{
Reward = 0;
}
std::string::~string((int)v34);
}
std::string::~string((int)v32);
return Reward;
}