//
// GJItemIcon::init from 0x1003a478c to 0x1003a4c00 (1140 bytes)
//
// 1 xrefs:
// > GJItemIcon::create @ 0x1003a4730
//
// 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 11:03:48 +0000
//
__int64 __fastcall GJItemIcon::init(__int64 a1, __int64 a2, __int64 a3, int a4, int a5, int a6, __int64 a7, char a8)
{
__int64 v13; // x0
__int64 v14; // x20
__int64 v15; // x0
double v16; // d0
const std::string::value_type *v17; // x8
const std::string::value_type *v18; // x1
char *v19; // x0
char *v20; // x21
__n128 v21; // q0
__int64 v22; // x0
__int64 v23; // x23
__int64 v24; // x0
double *v25; // x0
std::string *v27; // x8
void *v28; // x0
__int64 CString; // x0
__int64 v30; // x0
__int64 v31; // x0
const char *v32; // x0
void *v33; // x22
float v34; // s8
__int64 v35; // x0
float v36[2]; // [xsp+1Ch] [xbp-84h] BYREF
__int16 v37; // [xsp+24h] [xbp-7Ch] BYREF
char v38; // [xsp+26h] [xbp-7Ah]
std::string v39; // [xsp+28h] [xbp-78h] BYREF
double v40; // [xsp+40h] [xbp-60h] BYREF
__int16 v41; // [xsp+48h] [xbp-58h] BYREF
char v42; // [xsp+4Ah] [xbp-56h]
__int16 v43; // [xsp+4Ch] [xbp-54h] BYREF
char v44; // [xsp+4Eh] [xbp-52h]
v43 = a4;
v44 = BYTE2(a4);
v41 = a5;
v42 = BYTE2(a5);
v13 = cocos2d::CCSprite::init(a1);
v14 = v13;
if ( (_DWORD)v13 )
{
*(_DWORD *)(a1 + 624) = a3;
*(_DWORD *)(a1 + 628) = a2;
v15 = GameManager::sharedState(v13);
*(_DWORD *)(a1 + 608) = sub_1003B4E98(v15);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)a1 + 1136LL))(a1, &unk_1009F6E70);
sub_1000262C4((float *)&v40, 30.0, 30.0);
v16 = sub_100026450((_QWORD *)(a1 + 612), &v40);
(*(void (__fastcall **)(__int64, double *, double))(*(_QWORD *)a1 + 320LL))(a1, &v40, v16);
memset(&v39, 0, sizeof(v39));
v17 = "player_special";
v18 = "ship";
switch ( (int)a2 )
{
case 1:
v18 = "player";
goto LABEL_17;
case 4:
goto LABEL_17;
case 5:
v18 = "player_ball";
goto LABEL_17;
case 6:
v18 = "bird";
goto LABEL_17;
case 7:
v18 = "dart";
goto LABEL_17;
case 8:
v18 = "robot";
goto LABEL_17;
case 9:
v18 = "spider";
goto LABEL_17;
case 10:
goto LABEL_24;
case 11:
v17 = "explosionIcon";
goto LABEL_24;
case 12:
v17 = "gjItem";
goto LABEL_24;
case 13:
v18 = "swing";
goto LABEL_17;
case 14:
v18 = "jetpack";
LABEL_17:
std::string::assign(&v39, v18);
goto LABEL_18;
case 15:
v17 = "shipfireIcon";
LABEL_24:
std::string::assign(&v39, v17);
goto LABEL_25;
default:
std::string::assign(&v39, "player");
if ( (unsigned int)a2 > 0xE )
goto LABEL_25;
if ( ((1 << a2) & 0x6002) != 0 )
{
LABEL_18:
*(_BYTE *)(a1 + 620) = 1;
v20 = SimplePlayer::create(1);
v22 = GameManager::sharedState(v20);
v23 = GameManager::unlockTypeToIconType(v22, a2);
v24 = GameManager::sharedState(v23);
sub_1003B45B0(v24, a3, v23);
SimplePlayer::updatePlayerFrame((__int64)v20, a3, v23);
(*(void (__fastcall **)(_QWORD, __int16 *))(**((_QWORD **)v20 + 75) + 960LL))(*((_QWORD *)v20 + 75), &v43);
(*(void (__fastcall **)(_QWORD, __int16 *))(**((_QWORD **)v20 + 76) + 960LL))(*((_QWORD *)v20 + 76), &v41);
SimplePlayer::updateColors((__int64)v20);
v25 = (double *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v20 + 75) + 328LL))(*((_QWORD *)v20 + 75));
v21.n128_f64[0] = sub_100026450((_QWORD *)(a1 + 612), v25);
}
else if ( ((1 << a2) & 0xC) != 0 )
{
v19 = (char *)cocos2d::CCSprite::createWithSpriteFrameName((__int64)"player_special_01_001.png");
v20 = v19;
if ( a6 )
{
LABEL_14:
(*(void (__fastcall **)(char *, _BYTE *))(*(_QWORD *)v19 + 960LL))(v19, algn_10076DC6E);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v20 + 912LL))(v20, 120);
goto LABEL_19;
}
v30 = GameManager::sharedState(v19);
v31 = GameManager::colorForIdx(v30, a3);
v37 = v31;
v38 = BYTE2(v31);
(*(void (__fastcall **)(char *, __int16 *))(*(_QWORD *)v20 + 960LL))(v20, &v37);
if ( (a8 & 1) == 0 )
{
if ( (_DWORD)a2 == 2 )
v32 = "1";
else
v32 = "2";
v33 = cocos2d::CCLabelBMFont::create_1(v32, "bigFont.fnt");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v33 + 160LL))(v33, 0.5);
(*(void (__fastcall **)(void *, __int16 *))(*(_QWORD *)v33 + 1072LL))(v33, &v37);
(*(void (__fastcall **)(char *, void *, __int64))(*(_QWORD *)v20 + 464LL))(v20, v33, 1);
v34 = *(float *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v20 + 328LL))(v20);
v35 = (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v20 + 328LL))(v20);
sub_1000262BC(v36, v34 * 0.5, *(float *)(v35 + 4) * 0.5);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v33 + 184LL))(v33, v36);
}
}
else
{
LABEL_25:
if ( (unsigned int)(a3 - 6) <= 9 && *(_DWORD *)(a1 + 628) == 12 )
{
v20 = (char *)GJPathSprite::create((unsigned int)(a3 - 5));
}
else
{
v27 = &v39;
if ( (v39.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v27 = (std::string *)v39.__r_.__value_.__r.__words[0];
v28 = sub_1003065B0("%s_%02d_001.png", (const char *)v27, a3);
CString = cocos2d::CCString::getCString((__int64)v28);
v19 = (char *)cocos2d::CCSprite::createWithSpriteFrameName(CString);
v20 = v19;
if ( a6 )
goto LABEL_14;
}
}
LABEL_19:
(*(void (__fastcall **)(__int64, char *, __n128))(*(_QWORD *)a1 + 456LL))(a1, v20, v21);
sub_1000262BC(v36, *(float *)&v40 * 0.5, *((float *)&v40 + 1) * 0.5);
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v20 + 184LL))(v20, v36);
*(_QWORD *)(a1 + 600) = v20;
if ( SHIBYTE(v39.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v39.__r_.__value_.__l.__data_);
break;
}
}
return v14;
}