//
// GJRewardItem::init from 0x1401f4260 to 0x1401f44bf (607 bytes)
//
// 2 xrefs:
// > GJRewardItem::create @ 0x1401f420d
// > ??> @ 0x1406cc780
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// 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
SpecialRewardItem v11; // r14d
cocos2d::CCString *v12; // rax
int v13; // eax
__int64 v14; // rcx
BOOL v15; // r13d
int v16; // r15d
cocos2d::CCArray *v17; // rdi
GJRewardObject *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_140140F70(a4, ",");
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);
v22->__vftable = (cocos2d::CCObject_vtbl *)&GJRewardObject::`vftable';
LODWORD(v22[1].__vftable) = 7;
v22[1].m_uID = 0;
v22[1].m_nLuaID = v21;
cocos2d::CCObject::autorelease(v22);
cocos2d::CCArray::addObject(v17, v22);
}
if ( v9 > 0 )
{
v23 = (cocos2d::CCObject *)operator new(0x48u);
cocos2d::CCObject::CCObject(v23);
v23->__vftable = (cocos2d::CCObject_vtbl *)&GJRewardObject::`vftable';
LODWORD(v23[1].__vftable) = 8;
v23[1].m_uID = 0;
v23[1].m_nLuaID = 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);
v24->__vftable = (cocos2d::CCObject_vtbl *)&GJRewardObject::`vftable';
LODWORD(v24[1].__vftable) = v16;
v24[1].m_uID = 0;
v24[1].m_nLuaID = 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_14003A830((__int64)a4);
return 1;
}