//
// GJItemIcon::init from 0x50d3e8 to 0x50d6da (754 bytes)
//
// 1 xrefs:
// > GJItemIcon::create @ 0x50d7c2
//
// 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:51:29 +0000
//
GameManager *__fastcall GJItemIcon::init(int *a1, int a2, int a3, int a4, char a5, unsigned __int8 a6, int a7, char a8)
{
GameManager *v11; // r0
GameManager *v12; // r10
GameManager *v13; // r0
int IconRequestID; // r0
int v15; // r3
unsigned int v16; // r4
char *v17; // r1
const char *v18; // r1
cocos2d::CCSprite *v19; // r4
GameManager *v20; // r0
GameManager *v21; // r9
GameManager *v22; // r0
int v23; // r0
GameManager *v24; // r0
void (*v25)(void); // r3
GameManager *v26; // r0
int v27; // r0
const char *v28; // r2
__int16 *v29; // r0
int v30; // r9
void (__fastcall *v31)(int, _BYTE *); // r7
float v32; // s17
int v33; // r0
char *v34; // r1
cocos2d::CCString *v35; // r0
cocos2d::CCSprite *CString; // r0
const char *v37; // r1
cocos2d::CCSprite *v38; // r0
void (__fastcall *v39)(cocos2d::CCSprite *, _BYTE *); // r7
int v41; // [sp+4h] [bp-38h]
int v42; // [sp+Ch] [bp-30h] BYREF
__int16 v43; // [sp+14h] [bp-28h] BYREF
char v44; // [sp+16h] [bp-26h]
float v45[2]; // [sp+18h] [bp-24h] BYREF
_BYTE v46[8]; // [sp+20h] [bp-1Ch] BYREF
int v47[2]; // [sp+28h] [bp-14h] BYREF
char *v48; // [sp+30h] [bp-Ch]
v42 = a4;
v41 = a6;
v11 = (GameManager *)cocos2d::CCSprite::init((cocos2d::CCSprite *)a1);
v12 = v11;
if ( v11 )
{
a1[132] = a3;
a1[133] = a2;
v13 = (GameManager *)GameManager::sharedState(v11);
IconRequestID = GameManager::getIconRequestID(v13);
v15 = *a1;
a1[128] = IconRequestID;
(*(void (__fastcall **)(int *, void *))(v15 + 568))(a1, &unk_D2BCC8);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v45, 30.0, 30.0);
cocos2d::CCSize::operator=(a1 + 129, v45);
v16 = a2 - 1;
(*(void (__fastcall **)(int *, float *))(*a1 + 160))(a1, v45);
v47[0] = 0;
v47[1] = 0;
v48 = nullptr;
switch ( a2 )
{
case 1:
v17 = "player";
break;
case 4:
v17 = "ship";
break;
case 5:
v17 = "player_ball";
break;
case 6:
v17 = "bird";
break;
case 7:
v17 = "dart";
break;
case 8:
v17 = "robot";
break;
case 9:
v17 = "spider";
break;
case 10:
v17 = "player_special";
break;
case 11:
v17 = "explosionIcon";
break;
case 12:
v17 = "gjItem";
break;
case 13:
v17 = "swing";
break;
case 14:
v17 = "jetpack";
break;
case 15:
v17 = "shipfireIcon";
break;
default:
v17 = "player";
break;
}
std::string::assign(v47, v17);
if ( v16 <= 0xD )
{
if ( ((((_DWORD)&dword_0 + 1) << v16) & 0x31F9) != 0 )
{
*((_BYTE *)a1 + 524) = (unsigned __int8)&dword_0 + 1;
v19 = SimplePlayer::create((SimplePlayer *)((char *)&dword_0 + 1), (int)v18);
v20 = (GameManager *)GameManager::sharedState(v19);
v21 = (GameManager *)GameManager::unlockTypeToIconType(v20, a2);
v22 = (GameManager *)GameManager::sharedState(v21);
GameManager::isIconLoaded(v22, a3, (int)v21);
SimplePlayer::updatePlayerFrame((int)v19, a3, (int)v21);
SimplePlayer::setColors(v19, (int)&v42, (int)&a5);
v23 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)v19 + 127) + 164))(*((_DWORD *)v19 + 127));
cocos2d::CCSize::operator=(a1 + 129, v23);
goto LABEL_39;
}
if ( ((((_DWORD)&dword_0 + 1) << v16) & 6) != 0 )
{
v24 = (GameManager *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"player_special_01_001.png",
v18);
v19 = v24;
if ( !v41 )
{
v26 = (GameManager *)GameManager::sharedState(v24);
v27 = GameManager::colorForIdx(v26, a3);
v43 = v27;
v44 = BYTE2(v27);
(*(void (__fastcall **)(cocos2d::CCSprite *, __int16 *))(*(_DWORD *)v19 + 480))(v19, &v43);
if ( !a8 )
{
if ( a2 == 2 )
v29 = a1i2r3e45s789g;
else
v29 = &a1i2r3e45s789g[2];
v30 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v29, "bigFont.fnt", v28);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v30 + 80))(v30, 1056964608);
(*(void (__fastcall **)(int, __int16 *))(*(_DWORD *)v30 + 536))(v30, &v43);
(*(void (__fastcall **)(cocos2d::CCSprite *, int, int))(*(_DWORD *)v19 + 232))(v19, v30, 1);
v31 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v30 + 92);
v32 = *(float *)(*(int (__fastcall **)(cocos2d::CCSprite *))(*(_DWORD *)v19 + 164))(v19);
v33 = (*(int (__fastcall **)(cocos2d::CCSprite *))(*(_DWORD *)v19 + 164))(v19);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v32 * 0.5, *(float *)(v33 + 4) * 0.5);
v31(v30, v46);
}
goto LABEL_39;
}
v25 = *(void (**)(void))(*(_DWORD *)v24 + 480);
LABEL_38:
v25();
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v19 + 456))(v19, 120);
goto LABEL_39;
}
}
if ( a1[133] != 12 || (unsigned int)(a3 - 6) > 9 )
{
if ( (v47[0] & 1) != 0 )
v34 = v48;
else
v34 = (char *)v47 + 1;
v35 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%02d_001.png",
v34,
a3,
LOBYTE(v47[0]) << 31);
CString = (cocos2d::CCSprite *)cocos2d::CCString::getCString(v35);
v38 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(CString, v37);
v19 = v38;
if ( !v41 )
goto LABEL_39;
v25 = *(void (**)(void))(*(_DWORD *)v38 + 480);
goto LABEL_38;
}
v19 = (cocos2d::CCSprite *)GJPathSprite::create((GJPathSprite *)(a3 - 5), (int)v18);
LABEL_39:
(*(void (__fastcall **)(int *, cocos2d::CCSprite *))(*a1 + 228))(a1, v19);
v39 = *(void (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v19 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v45[0] * 0.5, v45[1] * 0.5);
v39(v19, v46);
a1[127] = (int)v19;
std::string::~string((int)v47);
}
return v12;
}