//
// SimplePlayer::init from 0x1003a3d20 to 0x1003a4140 (1056 bytes)
//
// 1 xrefs:
// > SimplePlayer::create @ 0x10039ff2c
//
// 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:47 +0000
//
__int64 __fastcall SimplePlayer::init(__int64 *a1, int a2)
{
__int64 v4; // x0
int v5; // w8
__int64 v6; // x20
__int64 v7; // x21
__int64 v8; // x21
__int64 v9; // x0
__int64 v10; // x0
std::string *p_dst; // x0
std::string *v12; // x0
__int64 v13; // x22
std::string *v14; // x0
__int64 v15; // x22
std::string *v16; // x0
__int64 v17; // x22
std::string *v18; // x0
__int64 v19; // x22
__int64 v21; // [xsp+8h] [xbp-2C8h] BYREF
std::string v22; // [xsp+10h] [xbp-2C0h] BYREF
std::string v23; // [xsp+30h] [xbp-2A0h] BYREF
std::string __dst; // [xsp+50h] [xbp-280h] BYREF
std::string __p; // [xsp+68h] [xbp-268h] BYREF
__int128 v26; // [xsp+80h] [xbp-250h] BYREF
char *__s; // [xsp+90h] [xbp-240h]
_BYTE v28[512]; // [xsp+98h] [xbp-238h] BYREF
v4 = GameManager::sharedState(a1);
*((_DWORD *)a1 + 166) = sub_1003B4E98(v4);
if ( a2 >= 485 )
v5 = 485;
else
v5 = a2;
if ( v5 <= 1 )
v6 = 1;
else
v6 = (unsigned int)v5;
v26 = xmmword_10075BA80;
__s = v28;
sub_10000CB50((__int64 *)&v26, "player_", 0);
if ( a2 <= 9 )
sub_10000CB50((__int64 *)&v26, "0", 0);
LODWORD(__p.__r_.__value_.__l.__data_) = v6;
sub_100009A40((int)&v26, v6, (int)&__p);
v7 = v26;
if ( *((_QWORD *)&v26 + 1) < (unsigned __int64)(v26 + 1) )
sub_100009ED4((__int64)&v26, v26 + 1);
__s[v7] = 0;
sub_100009900(&__p, __s);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, __p.__r_.__value_.__l.__data_, __p.__r_.__value_.__l.__size_);
else
__dst = __p;
std::string::append(&__dst, "_001.png");
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v23, __p.__r_.__value_.__l.__data_, __p.__r_.__value_.__l.__size_);
else
v23 = __p;
std::string::append(&v23, "_2_001.png");
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v22, __p.__r_.__value_.__l.__data_, __p.__r_.__value_.__l.__size_);
else
v22 = __p;
std::string::append(&v22, "_glow_001.png");
v8 = cocos2d::CCSprite::init((__int64)a1);
if ( (v8 & 1) != 0 )
{
v9 = (*(__int64 (__fastcall **)(__int64 *, void *))(*a1 + 1136))(a1, &unk_1009F6E70);
v10 = GameManager::sharedState(v9);
GameManager::loadIcon(v10, v6, 0, *((unsigned int *)a1 + 166));
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
a1[75] = (__int64)cocos2d::CCSprite::createWithSpriteFrameName((__int64)p_dst);
(*(void (__fastcall **)(__int64 *))(*a1 + 464))(a1);
if ( (v23.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v12 = &v23;
else
v12 = (std::string *)v23.__r_.__value_.__r.__words[0];
a1[76] = (__int64)cocos2d::CCSprite::createWithSpriteFrameName((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[75] + 464LL))(a1[75]);
v13 = a1[76];
cocos2d::CCNode::convertToNodeSpace(a1[75], (__int64)&unk_1009F6E60, &v21);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v13 + 184LL))(v13, &v21);
if ( (v23.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v14 = &v23;
else
v14 = (std::string *)v23.__r_.__value_.__r.__words[0];
a1[77] = (__int64)cocos2d::CCSprite::createWithSpriteFrameName((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[75] + 464LL))(a1[75]);
v15 = a1[77];
cocos2d::CCNode::convertToNodeSpace(a1[75], (__int64)&unk_1009F6E60, &v21);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v15 + 184LL))(v15, &v21);
if ( (v22.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v16 = &v22;
else
v16 = (std::string *)v22.__r_.__value_.__r.__words[0];
a1[78] = (__int64)cocos2d::CCSprite::createWithSpriteFrameName((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[75] + 464LL))(a1[75]);
v17 = a1[78];
cocos2d::CCNode::convertToNodeSpace(a1[75], (__int64)&unk_1009F6E60, &v21);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 184LL))(v17, &v21);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1[78] + 344LL))(a1[78], 0);
if ( (v23.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = &v23;
else
v18 = (std::string *)v23.__r_.__value_.__r.__words[0];
a1[79] = (__int64)cocos2d::CCSprite::createWithSpriteFrameName((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[75] + 464LL))(a1[75]);
v19 = a1[79];
cocos2d::CCNode::convertToNodeSpace(a1[75], (__int64)&unk_1009F6E60, &v21);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v19 + 184LL))(v19, &v21);
SimplePlayer::updatePlayerFrame((__int64)a1, v6, 0);
}
if ( SHIBYTE(v22.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v22.__r_.__value_.__l.__data_);
if ( SHIBYTE(v23.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v23.__r_.__value_.__l.__data_);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( __s != v28 && __s )
operator delete[](__s);
return v8;
}