//
// GJRewardItem::init from 0x8cf3f0 to 0x8cf59c (428 bytes)
//
// 2 xrefs:
// > GJRewardItem::create @ 0x8cf634
// > ??> @ 0x7c900
//
// 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:38 +0000
//
__int64 __fastcall GJRewardItem::init(__int64 a1, int a2, int a3, __int64 a4)
{
__int64 v4; // x2
cocos2d::CCArray *v7; // x20
int v8; // w25
cocos2d::CCString *v9; // x0
int v10; // w24
cocos2d::CCString *v11; // x0
int v12; // w23
cocos2d::CCString *v13; // x0
int v14; // w22
cocos2d::CCString *v15; // x0
cocos2d::CCArray *v16; // x0
int v17; // w21
cocos2d::CCArray *v18; // x20
cocos2d::CCObject *v19; // x0
cocos2d::CCObject *v20; // x0
cocos2d::CCObject *v21; // x0
cocos2d::CCObject *v22; // x0
cocos2d::CCObject *v23; // x0
*(_DWORD *)(a1 + 60) = a3;
*(_DWORD *)(a1 + 56) = a2;
v4 = *(_BYTE *)a4 >> 1;
if ( (*(_BYTE *)a4 & 1) != 0 )
v4 = *(_QWORD *)(a4 + 8);
if ( v4 )
{
v7 = sub_8CF0E8((unsigned __int8 *)a4, &byte_1169BE0);
if ( (unsigned int)cocos2d::CCArray::count(v7) > 3 )
{
v8 = 1;
v9 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 0);
v10 = cocos2d::CCString::intValue(v9);
v11 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 1u);
v12 = cocos2d::CCString::intValue(v11);
v13 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 2u);
v14 = cocos2d::CCString::intValue(v13);
v15 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 3u);
v16 = (cocos2d::CCArray *)cocos2d::CCString::intValue(v15);
v17 = (int)v16;
if ( v14 == (_DWORD)v16 )
{
v8 = 2;
v17 = 0;
}
v18 = (cocos2d::CCArray *)cocos2d::CCArray::create(v16);
if ( v10 > 0 )
{
v19 = GJRewardObject::create(7, v10, 0);
cocos2d::CCArray::addObject(v18, v19);
}
if ( v12 > 0 )
{
v20 = GJRewardObject::create(8, v12, 0);
cocos2d::CCArray::addObject(v18, v20);
}
if ( v14 )
{
v22 = GJRewardObject::create(v14, v8, 0);
cocos2d::CCArray::addObject(v18, v22);
}
if ( v17 )
{
v23 = GJRewardObject::create(v17, 1, 0);
cocos2d::CCArray::addObject(v18, v23);
}
if ( (unsigned int)cocos2d::CCArray::count(v18) )
{
v21 = *(cocos2d::CCObject **)(a1 + 72);
if ( v21 != v18 )
{
if ( v18 )
{
cocos2d::CCObject::retain(v18);
v21 = *(cocos2d::CCObject **)(a1 + 72);
}
if ( v21 )
cocos2d::CCObject::release(v21);
*(_QWORD *)(a1 + 72) = v18;
}
}
}
}
return 1;
}