//
// GJRewardItem::init from 0x1402f8f30 to 0x1402f918f (607 bytes)
//
// 2 xrefs:
// > GJRewardItem::create @ 0x1402f8edd
// > ??> @ 0x14091e224
//
// This function is hookable on this platform (idp: pc, 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:30:05 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall GJRewardItem::init(__int64 a1, int a2, int a3, __int64 *a4)
{
cocos2d::CCArray *v6; // rbx
cocos2d::CCString *v7; // rax
cocos2d::CCString *v8; // rax
int v9; // r12d
cocos2d::CCString *v10; // rax
int v11; // r14d
cocos2d::CCString *v12; // rax
int v13; // eax
__int64 v14; // rcx
BOOL v15; // r13d
int v16; // r15d
cocos2d::CCArray *v17; // rdi
struct cocos2d::CCObject *v18; // rax
cocos2d::CCObject *v19; // rcx
int v21; // [rsp+20h] [rbp-58h]
cocos2d::CCObject *v22; // [rsp+28h] [rbp-50h]
cocos2d::CCObject *v23; // [rsp+28h] [rbp-50h]
cocos2d::CCObject *v24; // [rsp+28h] [rbp-50h]
*(_DWORD *)(a1 + 56) = a2;
*(_DWORD *)(a1 + 60) = a3;
if ( a4[2] )
{
v6 = sub_1400D2840(a4, byte_14070ECF8);
if ( cocos2d::CCArray::count(v6) >= 4 )
{
v7 = cocos2d::CCArray::stringAtIndex(v6, 0);
v21 = cocos2d::CCString::intValue(v7);
v8 = cocos2d::CCArray::stringAtIndex(v6, 1u);
v9 = cocos2d::CCString::intValue(v8);
v10 = cocos2d::CCArray::stringAtIndex(v6, 2u);
v11 = cocos2d::CCString::intValue(v10);
v12 = cocos2d::CCArray::stringAtIndex(v6, 3u);
v13 = cocos2d::CCString::intValue(v12);
v15 = v11 == v13;
v16 = 0;
if ( v11 != v13 )
v16 = v13;
v17 = (cocos2d::CCArray *)cocos2d::CCArray::create(v14);
if ( v21 > 0 )
{
v22 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v22);
*(_QWORD *)v22 = &GJRewardObject::`vftable';
*((_DWORD *)v22 + 14) = 7;
*((_DWORD *)v22 + 16) = 0;
*((_DWORD *)v22 + 17) = v21;
cocos2d::CCObject::autorelease(v22);
cocos2d::CCArray::addObject(v17, v22);
}
if ( v9 > 0 )
{
v23 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v23);
*(_QWORD *)v23 = &GJRewardObject::`vftable';
*((_DWORD *)v23 + 14) = 8;
*((_DWORD *)v23 + 16) = 0;
*((_DWORD *)v23 + 17) = v9;
cocos2d::CCObject::autorelease(v23);
cocos2d::CCArray::addObject(v17, v23);
}
if ( v11 )
{
v18 = GJRewardObject::create(v11, v15 + 1, 0);
cocos2d::CCArray::addObject(v17, v18);
}
if ( v16 )
{
v24 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v24);
*(_QWORD *)v24 = &GJRewardObject::`vftable';
*((_DWORD *)v24 + 14) = v16;
*((_DWORD *)v24 + 16) = 0;
*((_DWORD *)v24 + 17) = 1;
cocos2d::CCObject::autorelease(v24);
cocos2d::CCArray::addObject(v17, v24);
}
if ( cocos2d::CCArray::count(v17) && *(cocos2d::CCArray **)(a1 + 72) != v17 )
{
if ( v17 )
cocos2d::CCObject::retain(v17);
v19 = *(cocos2d::CCObject **)(a1 + 72);
if ( v19 )
cocos2d::CCObject::release(v19);
*(_QWORD *)(a1 + 72) = v17;
}
}
}
sub_14003D310((__int64)a4);
return 1;
}