//
// SimplePlayer::init from 0x793b90 to 0x794234 (1700 bytes)
//
// 2 xrefs:
// > SimplePlayer::create @ 0x7942ac
// > ??> @ 0x2f268
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool SimplePlayer::init(SimplePlayer *a1, int a2)
{
GameManager *v3; // x0
int v4; // w21
size_t v5; // x24
bool v6; // w27
const char *v7; // x1
char *v8; // x0
char *v9; // x0
char *v10; // x0
void *v11; // x24
size_t v13; // x23
size_t v14; // x22
GameManager *v15; // x0
cocos2d::CCSprite *v16; // x0
SimplePlayer_vtbl *v17; // x3
cocos2d::CCSprite *v18; // x0
cocos2d::CCSprite *m_firstLayer; // x3
cocos2d::CCSprite *v20; // x0
cocos2d::CCSprite *v21; // x3
cocos2d::CCSprite *v22; // x0
cocos2d::CCSprite *v23; // x3
cocos2d::CCSprite *v24; // x0
cocos2d::CCSprite *v25; // x3
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x23
int v33; // w0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+60h] [xbp+60h]
void (__fastcall *v35)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+60h] [xbp+60h]
void (__fastcall *v36)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+60h] [xbp+60h]
void (__fastcall *v37)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+60h] [xbp+60h]
cocos2d::CCSprite *m_secondLayer; // [xsp+68h] [xbp+68h]
cocos2d::CCSprite *m_birdDome; // [xsp+68h] [xbp+68h]
cocos2d::CCSprite *m_outlineSprite; // [xsp+68h] [xbp+68h]
cocos2d::CCSprite *m_detailSprite; // [xsp+68h] [xbp+68h]
__int64 v43; // [xsp+70h] [xbp+70h] BYREF
const char *v44; // [xsp+78h] [xbp+78h] BYREF
const char *v45; // [xsp+80h] [xbp+80h] BYREF
const char *v46; // [xsp+88h] [xbp+88h] BYREF
int v47; // [xsp+90h] [xbp+90h] BYREF
size_t v48; // [xsp+98h] [xbp+98h] BYREF
unsigned __int64 v49; // [xsp+A0h] [xbp+A0h]
char *v50; // [xsp+A8h] [xbp+A8h]
_BYTE v51[504]; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v52; // 0:kr00_8.8
cocos2d::CCPoint v53; // 0:kr08_8.8
cocos2d::CCPoint v54; // 0:kr10_8.8
cocos2d::CCPoint v55; // 0:kr18_8.8
v3 = GameManager::sharedState();
a1->m_iconRequestID = GameManager::getIconRequestID(v3);
if ( a2 <= 0 )
{
v49 = 500;
qmemcpy(v51, "player_", 7);
v4 = 1;
v50 = v51;
v48 = 7;
LABEL_18:
v13 = v48;
v14 = v48 + 1;
if ( v48 + 1 > v49 )
{
fmt::internal::Array::grow(&v48, v48 + 1);
v48 = v14;
}
else
{
++v48;
}
v50[v13] = aAssertionFaile_0[72];
goto LABEL_6;
}
if ( a2 > 485 )
v4 = 485;
else
v4 = a2;
qmemcpy(v51, "player_", 7);
v49 = 500;
v50 = v51;
v48 = 7;
if ( v4 <= 9 )
goto LABEL_18;
LABEL_6:
v47 = v4;
fmt::BasicWriter::FormatInt,char>>(&v48, v4);
v5 = v48;
if ( v49 < v48 + 1 )
fmt::internal::Array::grow(&v48, v48 + 1);
v50[v5] = 0;
sub_D153B8((int)&v43, v50);
sub_D18D28(&v44);
sub_D15FD4(&v44, "_001.png", 8);
sub_D18D28(&v45);
sub_D15FD4(&v45, "_2_001.png", 10);
sub_D18D28(&v46);
sub_D15FD4(&v46, "_glow_001.png", 13);
v6 = cocos2d::CCSprite::init(a1);
if ( v6 )
{
a1->setTextureRect(a1, &stru_1242538);
v15 = GameManager::sharedState();
GameManager::loadIcon(v15, v4, 0, a1->m_iconRequestID);
v16 = cocos2d::CCSprite::createWithSpriteFrameName(v44);
v17 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_firstLayer = v16;
v17->addChild_0(a1, v16, 1);
v18 = cocos2d::CCSprite::createWithSpriteFrameName(v45);
m_firstLayer = a1->m_firstLayer;
a1->m_secondLayer = v18;
m_firstLayer->addChild_0(m_firstLayer, v18, -1);
m_secondLayer = a1->m_secondLayer;
setPosition = m_secondLayer->setPosition;
v52 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_1242548);
((void (__fastcall *)(cocos2d::CCSprite *, int *, float, float))setPosition)(m_secondLayer, &v47, v52.x, v52.y);
v20 = cocos2d::CCSprite::createWithSpriteFrameName(v45);
v21 = a1->m_firstLayer;
a1->m_birdDome = v20;
v21->addChild_0(v21, v20, -2);
m_birdDome = a1->m_birdDome;
v35 = m_birdDome->setPosition;
v53 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_1242548);
((void (__fastcall *)(cocos2d::CCSprite *, int *, float, float))v35)(m_birdDome, &v47, v53.x, v53.y);
v22 = cocos2d::CCSprite::createWithSpriteFrameName(v46);
v23 = a1->m_firstLayer;
a1->m_outlineSprite = v22;
v23->addChild_0(v23, v22, -3);
m_outlineSprite = a1->m_outlineSprite;
v36 = m_outlineSprite->setPosition;
v54 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_1242548);
((void (__fastcall *)(cocos2d::CCSprite *, int *, float, float))v36)(m_outlineSprite, &v47, v54.x, v54.y);
a1->m_outlineSprite->setVisible(a1->m_outlineSprite, 0);
v24 = cocos2d::CCSprite::createWithSpriteFrameName(v45);
v25 = a1->m_firstLayer;
a1->m_detailSprite = v24;
v25->addChild_0(v25, v24, 1);
m_detailSprite = a1->m_detailSprite;
v37 = m_detailSprite->setPosition;
v55 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_1242548);
((void (__fastcall *)(cocos2d::CCSprite *, int *, float, float))v37)(m_detailSprite, &v47, v55.x, v55.y);
SimplePlayer::updatePlayerFrame(a1, v4, Cube);
v7 = v46;
v8 = (char *)(v46 - 24);
if ( v46 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_10;
}
else
{
v7 = v46;
v8 = (char *)(v46 - 24);
if ( v46 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_10;
}
if ( &pthread_create )
{
v26 = (unsigned int *)(v7 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v7 - 2);
*((_DWORD *)v7 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v8);
LABEL_10:
v9 = (char *)(v45 - 24);
if ( v45 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v45 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v45 - 2);
*((_DWORD *)v45 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v9);
}
v10 = (char *)(v44 - 24);
if ( v44 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v44 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *((_DWORD *)v44 - 2);
*((_DWORD *)v44 - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v10);
}
v11 = (void *)(v43 - 24);
if ( (__int64 *)(v43 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v43 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v43 - 8);
*(_DWORD *)(v43 - 8) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v11);
}
if ( v50 != v51 && v50 )
operator delete[](v50);
return v6;
}