//
// SimplePlayer::init from 0x8bd304 to 0x8bd934 (1584 bytes)
//
// 2 xrefs:
// > SimplePlayer::create @ 0x8bd9ac
// > ??> @ 0x46a08
//
// 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 SimplePlayer::init(SimplePlayer *this, int a2)
{
GameManager *v3; // x0
int v4; // w25
size_t v5; // x22
size_t v6; // x0
unsigned __int8 v7; // w0
unsigned int v8; // w27
size_t v10; // x22
size_t v11; // x20
GameManager *v12; // x0
__int64 **v13; // x0
cocos2d::CCSprite *v14; // x0
__int64 v15; // x0
__int64 v16; // x3
cocos2d::CCSprite *v17; // x0
__int64 v18; // x0
__int64 v19; // x3
cocos2d::CCSprite *v20; // x0
__int64 v21; // x0
__int64 v22; // x3
cocos2d::CCSprite *v23; // x0
__int64 v24; // x0
__int64 v25; // x3
cocos2d::CCSprite *v26; // x0
__int64 v27; // x0
__int64 v28; // x3
void (__fastcall *v29)(__int64, __int64 *); // [xsp+60h] [xbp+60h]
void (__fastcall *v30)(__int64, __int64 *); // [xsp+60h] [xbp+60h]
void (__fastcall *v31)(__int64, __int64 *); // [xsp+60h] [xbp+60h]
void (__fastcall *v32)(__int64, __int64 *); // [xsp+60h] [xbp+60h]
void *v34; // [xsp+68h] [xbp+68h]
__int64 v35; // [xsp+68h] [xbp+68h]
__int64 v36; // [xsp+68h] [xbp+68h]
__int64 v37; // [xsp+68h] [xbp+68h]
__int64 v38; // [xsp+68h] [xbp+68h]
__int64 v39; // [xsp+70h] [xbp+70h] BYREF
__int64 v40; // [xsp+78h] [xbp+78h] BYREF
size_t v41; // [xsp+80h] [xbp+80h]
void *v42; // [xsp+88h] [xbp+88h]
__int64 v43; // [xsp+90h] [xbp+90h] BYREF
size_t v44; // [xsp+98h] [xbp+98h]
cocos2d::CCSprite *v45; // [xsp+A0h] [xbp+A0h]
__int64 v46; // [xsp+A8h] [xbp+A8h] BYREF
size_t v47; // [xsp+B0h] [xbp+B0h]
cocos2d::CCSprite *v48; // [xsp+B8h] [xbp+B8h]
__int64 v49; // [xsp+C0h] [xbp+C0h] BYREF
size_t v50; // [xsp+C8h] [xbp+C8h]
cocos2d::CCSprite *v51; // [xsp+D0h] [xbp+D0h]
size_t v52; // [xsp+D8h] [xbp+D8h] BYREF
unsigned __int64 v53; // [xsp+E0h] [xbp+E0h]
_BYTE *v54; // [xsp+E8h] [xbp+E8h]
_BYTE v55[504]; // [xsp+F0h] [xbp+F0h] BYREF
v3 = (GameManager *)GameManager::sharedState(_stack_chk_guard);
*((_DWORD *)this + 166) = GameManager::getIconRequestID(v3);
if ( a2 <= 0 )
{
v53 = 500;
v4 = 1;
v54 = v55;
qmemcpy(v55, "player_", 7);
v52 = 7;
LABEL_28:
v10 = v52;
v11 = v52 + 1;
if ( v52 + 1 > v53 )
{
fmt::internal::Array::grow(&v52, v52 + 1);
v52 = v11;
}
else
{
++v52;
}
v54[v10] = aAssertionFaile_0[72];
goto LABEL_6;
}
if ( a2 > 485 )
v4 = 485;
else
v4 = a2;
v53 = 500;
qmemcpy(v55, "player_", 7);
v54 = v55;
v52 = 7;
if ( v4 <= 9 )
goto LABEL_28;
LABEL_6:
LODWORD(v39) = v4;
fmt::BasicWriter::FormatInt,char>>(&v52, v4);
v5 = v52;
if ( v53 < v52 + 1 )
fmt::internal::Array::grow(&v52, v52 + 1);
v54[v5] = 0;
v40 = 0;
v41 = 0;
v42 = nullptr;
v34 = v54;
v6 = strlen(v54);
std::string::__init(&v40, v34, v6);
v43 = 0;
v44 = 0;
v45 = nullptr;
if ( (v40 & 1) != 0 )
{
std::string::__init(&v43, v42, v41);
}
else
{
v45 = (cocos2d::CCSprite *)v42;
v43 = v40;
v44 = v41;
}
std::string::append((__int64)&v43, "_001.png", 8u);
v46 = 0;
v47 = 0;
v48 = nullptr;
if ( (v40 & 1) != 0 )
{
std::string::__init(&v46, v42, v41);
}
else
{
v48 = (cocos2d::CCSprite *)v42;
v46 = v40;
v47 = v41;
}
std::string::append((__int64)&v46, "_2_001.png", 0xAu);
v49 = 0;
v50 = 0;
v51 = nullptr;
if ( (v40 & 1) != 0 )
{
std::string::__init(&v49, v42, v41);
}
else
{
v51 = (cocos2d::CCSprite *)v42;
v49 = v40;
v50 = v41;
}
std::string::append((__int64)&v49, "_glow_001.png", 0xDu);
v7 = cocos2d::CCSprite::init(this);
v8 = v7;
if ( v7 )
{
v12 = (GameManager *)(*(__int64 (__fastcall **)(SimplePlayer *, void *))(*(_QWORD *)this + 1136LL))(
this,
&unk_155CB28);
v13 = (__int64 **)GameManager::sharedState(v12);
GameManager::loadIcon(v13, v4, 0, *((_DWORD *)this + 166));
v14 = (cocos2d::CCSprite *)((char *)&v43 + 1);
if ( (v43 & 1) != 0 )
v14 = v45;
v15 = cocos2d::CCSprite::createWithSpriteFrameName(v14, (const char *)(unsigned __int8)v43);
v16 = *(_QWORD *)this;
*((_QWORD *)this + 75) = v15;
(*(void (__fastcall **)(SimplePlayer *, __int64, __int64))(v16 + 464))(this, v15, 1);
v17 = (cocos2d::CCSprite *)((char *)&v46 + 1);
if ( (v46 & 1) != 0 )
v17 = v48;
v18 = cocos2d::CCSprite::createWithSpriteFrameName(v17, (const char *)(unsigned __int8)v46);
v19 = *((_QWORD *)this + 75);
*((_QWORD *)this + 76) = v18;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v19 + 464LL))(v19, v18, 0xFFFFFFFFLL);
v35 = *((_QWORD *)this + 76);
v29 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v35 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v39, *((cocos2d::CCNode **)this + 75), (const cocos2d::CCPoint *)&unk_155CB38);
v29(v35, &v39);
v20 = (cocos2d::CCSprite *)((char *)&v46 + 1);
if ( (v46 & 1) != 0 )
v20 = v48;
v21 = cocos2d::CCSprite::createWithSpriteFrameName(v20, (const char *)(unsigned __int8)v46);
v22 = *((_QWORD *)this + 75);
*((_QWORD *)this + 77) = v21;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v22 + 464LL))(v22, v21, 4294967294LL);
v36 = *((_QWORD *)this + 77);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v36 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v39, *((cocos2d::CCNode **)this + 75), (const cocos2d::CCPoint *)&unk_155CB38);
v30(v36, &v39);
v23 = (cocos2d::CCSprite *)((char *)&v49 + 1);
if ( (v49 & 1) != 0 )
v23 = v51;
v24 = cocos2d::CCSprite::createWithSpriteFrameName(v23, (const char *)(unsigned __int8)v49);
v25 = *((_QWORD *)this + 75);
*((_QWORD *)this + 78) = v24;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v25 + 464LL))(v25, v24, 4294967293LL);
v37 = *((_QWORD *)this + 78);
v31 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v39, *((cocos2d::CCNode **)this + 75), (const cocos2d::CCPoint *)&unk_155CB38);
v31(v37, &v39);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 78) + 344LL))(*((_QWORD *)this + 78), 0);
v26 = (cocos2d::CCSprite *)((char *)&v46 + 1);
if ( (v46 & 1) != 0 )
v26 = v48;
v27 = cocos2d::CCSprite::createWithSpriteFrameName(v26, (const char *)(unsigned __int8)v46);
v28 = *((_QWORD *)this + 75);
*((_QWORD *)this + 79) = v27;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v28 + 464LL))(v28, v27, 1);
v38 = *((_QWORD *)this + 79);
v32 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v38 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v39, *((cocos2d::CCNode **)this + 75), (const cocos2d::CCPoint *)&unk_155CB38);
v32(v38, &v39);
SimplePlayer::updatePlayerFrame((__int64)this, v4, 0);
}
if ( (v49 & 1) != 0 )
operator delete(v51);
if ( (v46 & 1) != 0 )
operator delete(v48);
if ( (v43 & 1) != 0 )
operator delete(v45);
if ( (v40 & 1) != 0 )
operator delete(v42);
if ( v54 != v55 && v54 )
operator delete[](v54);
return v8;
}