//
// GJItemIcon::init from 0x8bda08 to 0x8bdeec (1252 bytes)
//
// 2 xrefs:
// > GJItemIcon::create @ 0x8bdfa0
// > ??> @ 0x90dc0
//
// 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 12:56:29 +0000
//
__int64 __fastcall GJItemIcon::init(
__int64 a1,
int a2,
unsigned int a3,
__int64 a4,
__int64 a5,
unsigned __int8 a6,
__int64 a7,
unsigned __int8 a8)
{
int v11; // w25
int v12; // w26
GameManager *v13; // x0
unsigned int v14; // w21
GameManager *v16; // x0
const char *v17; // x1
char *v18; // x1
cocos2d::CCString *v19; // x0
cocos2d::CCSprite *CString; // x0
const char *v21; // x1
GameManager *v22; // x0
GameManager *v23; // x22
void (__fastcall *v24)(GameManager *, char *); // x24
char v25; // w0
GameManager *v26; // x0
unsigned __int64 v27; // x0
const char *v28; // x2
char *v29; // x0
__int64 v30; // x24
void (__fastcall *v31)(__int64, char *); // x25
float v32; // s8
__int64 v33; // x0
GameManager *v34; // x0
GameManager *v35; // x0
int v36; // w23
__int64 **v37; // x0
__int64 v38; // x0
__int64 v39; // [xsp+70h] [xbp+70h] BYREF
__int64 v40; // [xsp+78h] [xbp+78h] BYREF
__int16 v41; // [xsp+88h] [xbp+88h] BYREF
char v42; // [xsp+8Ah] [xbp+8Ah]
float v43[2]; // [xsp+90h] [xbp+90h] BYREF
char v44[8]; // [xsp+98h] [xbp+98h] BYREF
__int64 v45[2]; // [xsp+A0h] [xbp+A0h] BYREF
char *v46; // [xsp+B0h] [xbp+B0h]
v40 = a4;
v11 = a6;
v12 = a8;
v39 = a5;
v13 = (GameManager *)(unsigned __int8)cocos2d::CCSprite::init((cocos2d::CCSprite *)a1);
v14 = (unsigned __int8)v13;
if ( (_BYTE)v13 )
{
*(_DWORD *)(a1 + 624) = a3;
*(_DWORD *)(a1 + 628) = a2;
v16 = (GameManager *)GameManager::sharedState(v13);
*(_DWORD *)(a1 + 608) = GameManager::getIconRequestID(v16);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)a1 + 1136LL))(a1, &unk_155CB28);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v43, 30.0, 30.0);
cocos2d::CCSize::operator=(a1 + 612, v43);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)a1 + 320LL))(a1, v43);
v45[0] = 0;
v45[1] = 0;
v46 = nullptr;
switch ( a2 )
{
case 4:
std::string::assign(v45, "ship");
break;
case 5:
std::string::assign(v45, "player_ball");
break;
case 6:
std::string::assign(v45, "bird");
break;
case 7:
std::string::assign(v45, "dart");
break;
case 8:
std::string::assign(v45, "robot");
break;
case 9:
std::string::assign(v45, "spider");
break;
case 10:
std::string::assign(v45, "player_special");
break;
case 11:
std::string::assign(v45, "explosionIcon");
break;
case 12:
std::string::assign(v45, "gjItem");
break;
case 13:
std::string::assign(v45, "swing");
break;
case 14:
std::string::assign(v45, "jetpack");
break;
case 15:
std::string::assign(v45, "shipfireIcon");
break;
default:
std::string::assign(v45, "player");
break;
}
switch ( a2 )
{
case 1:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 13:
case 14:
*(_BYTE *)(a1 + 620) = 1;
v23 = (GameManager *)SimplePlayer::create((SimplePlayer *)((char *)&dword_0 + 1));
v34 = (GameManager *)GameManager::sharedState(v23);
v35 = (GameManager *)GameManager::unlockTypeToIconType(v34, a2);
v36 = (int)v35;
v37 = (__int64 **)GameManager::sharedState(v35);
GameManager::isIconLoaded(v37, a3, v36);
SimplePlayer::updatePlayerFrame((__int64)v23, a3, v36);
SimplePlayer::setColors(v23, (__int64)&v40, (__int64)&v39);
v38 = (*(__int64 (__fastcall **)(_QWORD *))(**((_QWORD **)v23 + 75) + 328LL))(*((_QWORD **)v23 + 75));
cocos2d::CCSize::operator=(a1 + 612, v38);
break;
case 2:
case 3:
v22 = (GameManager *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"player_special_01_001.png",
v17);
v23 = v22;
if ( v11 )
goto LABEL_19;
v26 = (GameManager *)GameManager::sharedState(v22);
v27 = GameManager::colorForIdx(v26, a3);
v41 = v27;
v42 = BYTE2(v27);
(*(void (__fastcall **)(GameManager *, __int16 *))(*(_QWORD *)v23 + 960LL))(v23, &v41);
if ( !v12 )
{
if ( a2 == 2 )
v29 = "1";
else
v29 = &byte_120A098;
v30 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v29, "bigFont.fnt", v28);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 160LL))(v30, 0.5);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v30 + 1072LL))(v30, &v41);
(*(void (__fastcall **)(GameManager *, __int64, __int64))(*(_QWORD *)v23 + 464LL))(v23, v30, 1);
v31 = *(void (__fastcall **)(__int64, char *))(*(_QWORD *)v30 + 184LL);
v32 = *(float *)(*(__int64 (__fastcall **)(GameManager *))(*(_QWORD *)v23 + 328LL))(v23) * 0.5;
v33 = (*(__int64 (__fastcall **)(GameManager *))(*(_QWORD *)v23 + 328LL))(v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, v32, *(float *)(v33 + 4) * 0.5);
v31(v30, v44);
}
break;
default:
if ( *(_DWORD *)(a1 + 628) == 12 && a3 - 6 <= 9 )
{
v23 = (GameManager *)GJPathSprite::create((GJPathSprite *)(a3 - 5), (int)v17);
}
else
{
v18 = (char *)v45 + 1;
if ( (v45[0] & 1) != 0 )
v18 = v46;
v19 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%02d_001.png",
v18,
a3);
CString = (cocos2d::CCSprite *)cocos2d::CCString::getCString(v19);
v22 = (GameManager *)cocos2d::CCSprite::createWithSpriteFrameName(CString, v21);
v23 = v22;
if ( v11 )
{
LABEL_19:
(*(void (__fastcall **)(GameManager *, void *))(*(_QWORD *)v23 + 960LL))(v22, &unk_114C9B0);
(*(void (__fastcall **)(GameManager *, __int64))(*(_QWORD *)v23 + 912LL))(v23, 120);
}
}
break;
}
(*(void (__fastcall **)(__int64, GameManager *))(*(_QWORD *)a1 + 456LL))(a1, v23);
v24 = *(void (__fastcall **)(GameManager *, char *))(*(_QWORD *)v23 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, v43[0] * 0.5, v43[1] * 0.5);
v24(v23, v44);
v25 = v45[0];
*(_QWORD *)(a1 + 600) = v23;
if ( (v25 & 1) != 0 )
operator delete(v46);
}
return v14;
}