//
// GJItemIcon::init from 0x140383530 to 0x140383c6c (1852 bytes)
//
// 10 xrefs:
// > AchievementBar::init @ 0x140096d98
// > CommunityCreditsPage::init @ 0x14012e844
// > AchievementCell::loadFromDict @ 0x140148054
// > GJItemIcon::createStoreItem @ 0x1403833b4
// > GJItemIcon::createBrowserItem @ 0x1403834db
// > GJPathPage::init @ 0x1403942cb
// > RewardUnlockLayer::playRewardEffect @ 0x140565234
// > RewardUnlockLayer::playRewardEffect @ 0x140565a12
// > ShardsPage::init @ 0x14062ce76
// > ??> @ 0x140922a18
//
// 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:31:06 +0000
//
// Hidden C++ exception states: #wind=5
bool __fastcall GJItemIcon::init(
__int64 a1,
int a2,
unsigned int a3,
__int64 a4,
__int64 a5,
char a6,
__int64 a7,
char a8)
{
bool result; // al
__int64 v13; // rdx
int v14; // ecx
__int16 v15; // ax
__int64 v16; // rcx
cocos2d::CCSprite *v17; // rsi
__int64 v18; // rdi
__int64 v19; // r8
__int64 v20; // rax
struct cocos2d::CCSprite *v21; // rax
__int64 v22; // rdx
void (__fastcall *v23)(char *, __int64); // r8
__int64 v24; // rcx
__int16 *v25; // rcx
struct cocos2d::CCLabelBMFont *v26; // rdi
__int64 v27; // rbx
float v28; // xmm6_4
float *v29; // rax
__int64 v30; // rax
cocos2d::CCString *v31; // rax
const char *CString; // rax
struct cocos2d::CCSprite *v33; // rax
__int64 v34; // rdx
__int64 v35; // rbx
__int64 v36; // rax
void *v37; // rcx
void *v38; // [rsp+30h] [rbp-61h] BYREF
float v39[2]; // [rsp+38h] [rbp-59h] BYREF
void *v40; // [rsp+40h] [rbp-51h] BYREF
void *Block[2]; // [rsp+48h] [rbp-49h] BYREF
__int64 v42; // [rsp+58h] [rbp-39h]
unsigned __int64 v43; // [rsp+60h] [rbp-31h]
result = cocos2d::CCSprite::init((cocos2d::CCSprite *)a1);
if ( result )
{
*(_DWORD *)(a1 + 624) = a3;
*(_DWORD *)(a1 + 628) = a2;
v13 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v38 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v13 = qword_14090BFD0;
}
v14 = *(_DWORD *)(v13 + 1272);
*(_DWORD *)(v13 + 1272) = v14 + 1;
*(_DWORD *)(a1 + 608) = v14;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)a1 + 992LL))(a1, &unk_14090AB58);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v39, 30.0, 30.0);
cocos2d::CCSize::operator=(a1 + 612, v39);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)a1 + 312LL))(a1, v39);
*(_OWORD *)Block = 0;
v43 = 15;
LOBYTE(Block[0]) = 0;
switch ( a2 )
{
case 4:
v42 = 4;
strcpy((char *)Block, "ship");
goto LABEL_19;
case 5:
v42 = 11;
strcpy((char *)Block, "player_ball");
goto LABEL_19;
case 6:
v42 = 4;
strcpy((char *)Block, "bird");
goto LABEL_19;
case 7:
v42 = 4;
strcpy((char *)Block, "dart");
goto LABEL_19;
case 8:
v42 = 5;
strcpy((char *)Block, "robot");
goto LABEL_19;
case 9:
LODWORD(Block[0]) = 1684631667;
v15 = 29285;
goto LABEL_18;
case 10:
v42 = 14;
strcpy((char *)Block, "player_special");
goto LABEL_19;
case 11:
v42 = 13;
strcpy((char *)Block, "explosionIcon");
goto LABEL_19;
case 12:
LODWORD(Block[0]) = 1950968423;
v15 = 28005;
goto LABEL_18;
case 13:
v42 = 5;
strcpy((char *)Block, "swing");
goto LABEL_19;
case 14:
v42 = 7;
Block[0] = (void *)0x6B63617074656ALL;
goto LABEL_19;
case 15:
v42 = 12;
strcpy((char *)Block, "shipfireIcon");
goto LABEL_19;
default:
LODWORD(Block[0]) = 2036427888;
v15 = 29285;
LABEL_18:
v42 = 6;
WORD2(Block[0]) = v15;
BYTE6(Block[0]) = 0;
LABEL_19:
switch ( a2 )
{
case 1:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 13:
case 14:
*(_BYTE *)(a1 + 620) = 1;
v17 = SimplePlayer::create(1u);
if ( !qword_14090BFD0 )
{
v38 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
}
v18 = (int)GameManager::unlockTypeToIconType(v16, a2);
if ( !v19 )
{
v38 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v19 = qword_14090BFD0;
}
LODWORD(v38) = a3 + *(_DWORD *)(*(_QWORD *)(v19 + 1232) + 4 * v18) - 1;
sub_14010ECC0((__int64 *)(v19 + 1184), (int *)&v38);
SimplePlayer::updatePlayerFrame((__int64)v17, a3, v18);
(**(void (__fastcall ***)(__int64, __int64))(*((_QWORD *)v17 + 75) + 320LL))(
*((_QWORD *)v17 + 75) + 320LL,
a4);
(**(void (__fastcall ***)(__int64, __int64))(*((_QWORD *)v17 + 76) + 320LL))(
*((_QWORD *)v17 + 76) + 320LL,
a5);
SimplePlayer::updateColors((__int64)v17);
v20 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v17 + 75) + 320LL))(*((_QWORD *)v17 + 75));
cocos2d::CCSize::operator=(a1 + 612, v20);
break;
case 2:
case 3:
v21 = cocos2d::CCSprite::createWithSpriteFrameName("player_special_01_001.png");
v17 = v21;
if ( a6 )
{
(**((void (__fastcall ***)(__int64, void *))v21 + 40))((__int64)v21 + 320, &unk_140703468);
v22 = *((_QWORD *)v17 + 40);
v23 = *(void (__fastcall **)(char *, __int64))(v22 + 40);
LOBYTE(v22) = 120;
v23((char *)v17 + 320, v22);
}
else
{
v24 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v40 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v40);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v24 = qword_14090BFD0;
}
GameManager::colorForIdx(v24, (char *)&v38, a3);
(**((void (__fastcall ***)(__int64, void **))v17 + 40))((__int64)v17 + 320, &v38);
if ( !a8 )
{
v25 = &word_14070D058;
if ( a2 == 2 )
v25 = &word_14070D060;
v26 = cocos2d::CCLabelBMFont::create((const char *)v25, (const char *)&qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v26 + 160LL))(v26);
(**((void (__fastcall ***)(__int64, void **))v26 + 46))((__int64)v26 + 368, &v38);
(*(void (__fastcall **)(cocos2d::CCSprite *, struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v17 + 456LL))(
v17,
v26,
1);
v27 = *(_QWORD *)v26;
v28 = *(float *)((*(__int64 (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v17 + 320LL))(v17) + 4)
* 0.5;
v29 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v17 + 320LL))(v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, *v29 * 0.5, v28);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v27 + 184))(v26, v30);
}
}
break;
default:
if ( *(_DWORD *)(a1 + 628) == 12 && a3 - 6 <= 9 )
{
v17 = (cocos2d::CCSprite *)GJPathSprite::create(a3 - 5);
}
else
{
v31 = cocos2d::CCString::createWithFormat("%s_%02d_001.png", (const char *)Block, a3);
CString = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
v17 = v33;
if ( a6 )
{
(**((void (__fastcall ***)(__int64, void *))v33 + 40))((__int64)v33 + 320, &unk_140703468);
LOBYTE(v34) = 120;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v17 + 40) + 40LL))((__int64)v17 + 320, v34);
}
}
break;
}
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *))(*(_QWORD *)a1 + 464LL))(a1, v17);
v35 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, v39[0] * 0.5, v39[1] * 0.5);
(*(void (__fastcall **)(cocos2d::CCSprite *, __int64))(v35 + 184))(v17, v36);
*(_QWORD *)(a1 + 600) = v17;
if ( v43 > 0xF )
{
v37 = Block[0];
if ( v43 + 1 >= 0x1000 )
{
v37 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v37 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v37);
}
result = 1;
break;
}
}
return result;
}