//
// GJBaseGameLayer::createPlayer from 0x9c3110 to 0x9c3528 (1048 bytes)
//
// 3 xrefs:
// > PlayLayer::init @ 0x71246c
// > LevelEditorLayer::init @ 0x7af014
// > ??> @ 0xbe990
//
// 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:58:31 +0000
//
__int64 __fastcall GJBaseGameLayer::createPlayer(PlayerObject **this)
{
char *v1; // x21
GameManager *v3; // x0
unsigned int v4; // w23
__int64 v5; // x0
PlayerObject *v6; // x0
PlayerObject *v7; // x23
GameManager *v8; // x0
__int64 (__fastcall *v9)(PlayerObject *, __int64 *); // x24
GameManager *v10; // x25
__int64 v11; // x0
int v12; // w0
GameManager *v13; // x0
__int64 v14; // x23
GameManager *v15; // x24
__int64 v16; // x0
unsigned __int64 v17; // x0
GameManager *v18; // x0
__int64 v19; // x0
GameManager *v20; // x0
__int64 v21; // x23
GameManager *v22; // x24
__int64 v23; // x0
unsigned __int64 v24; // x0
unsigned __int64 v25; // x0
__int64 v26; // x23
GameManager *v27; // x0
char GameVariable; // w0
char v29; // w0
GameManager *v30; // x0
GameManager *v31; // x0
unsigned int v32; // w24
__int64 v33; // x0
PlayerObject *v34; // x0
PlayerObject *v35; // x24
GameManager *v36; // x0
__int64 (__fastcall *v37)(PlayerObject *, __int64 *); // x25
GameManager *v38; // x26
__int64 v39; // x0
int v40; // w0
GameManager *v41; // x0
__int64 v42; // x24
GameManager *v43; // x25
__int64 v44; // x0
unsigned __int64 v45; // x0
GameManager *v46; // x0
__int64 v47; // x0
GameManager *v48; // x0
__int64 v49; // x24
GameManager *v50; // x25
__int64 v51; // x0
unsigned __int64 v52; // x0
char v53; // w0
__int64 v55; // [xsp+50h] [xbp+50h] BYREF
v1 = (char *)(this + 1024);
v3 = (GameManager *)GameManager::sharedState(_stack_chk_guard);
v4 = *((_DWORD *)v3 + 179) - *((_DWORD *)v3 + 180);
v5 = GameManager::sharedState(v3);
v6 = (PlayerObject *)PlayerObject::create(
(PlayerObject *)v4,
*(_DWORD *)(v5 + 728) - *(_DWORD *)(v5 + 732),
(GJBaseGameLayer *)this,
*(this + 490),
(cocos2d::CCLayer *)((unsigned __int8)v1[4044] ^ 1u));
*(this + 407) = v6;
v7 = v6;
v8 = *(GameManager **)v6;
v9 = *((__int64 (__fastcall **)(PlayerObject *, __int64 *))v8 + 120);
v10 = (GameManager *)GameManager::sharedState(v8);
v11 = GameManager::sharedState(v10);
v12 = GameManager::colorForIdx(v10, *(_DWORD *)(v11 + 812) - *(_DWORD *)(v11 + 816));
LOWORD(v55) = v12;
BYTE2(v55) = BYTE2(v12);
v13 = (GameManager *)v9(v7, &v55);
v14 = (__int64)*(this + 407);
v15 = (GameManager *)GameManager::sharedState(v13);
v16 = GameManager::sharedState(v15);
v17 = GameManager::colorForIdx(v15, *(_DWORD *)(v16 + 824) - *(_DWORD *)(v16 + 828));
LOWORD(v55) = v17;
BYTE2(v55) = BYTE2(v17);
v18 = (GameManager *)PlayerObject::setSecondColor(v14, &v55);
v19 = GameManager::sharedState(v18);
v20 = (GameManager *)(unsigned int)(*(_DWORD *)(v19 + 836) - *(_DWORD *)(v19 + 840));
if ( ((unsigned int)v20 & 0x80000000) == 0 )
{
v21 = (__int64)*(this + 407);
v22 = (GameManager *)GameManager::sharedState(v20);
v23 = GameManager::sharedState(v22);
v24 = GameManager::colorForIdx(v22, *(_DWORD *)(v23 + 836) - *(_DWORD *)(v23 + 840));
LOWORD(v55) = v24;
BYTE2(v55) = BYTE2(v24);
PlayerObject::enableCustomGlowColor(v21, (__int64)&v55);
}
PlayerObject::updateGlowColor(*(this + 407));
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(*(_QWORD *)*(this + 490) + 464LL))(*(this + 490), *(this + 407), 59);
*((_DWORD *)*(this + 407) + 229) = 1;
v25 = (unsigned __int8)v1[4044];
if ( !v1[4044] )
v25 = PlayerObject::addAllParticles(*(this + 407));
v26 = (__int64)*(this + 407);
v27 = (GameManager *)GameManager::sharedState((GameManager *)v25);
GameVariable = GameManager::getGameVariable(v27, "0068");
PlayerObject::updateCheckpointMode(v26, GameVariable);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*(this + 407) + 344LL))(
*(this + 407),
(unsigned __int8)v1[4044] ^ 1u);
v29 = v1[4044];
if ( v29 )
v29 = *((_BYTE *)this + 1978);
*((_BYTE *)*(this + 407) + 3052) = v29;
LODWORD(v55) = *((_DWORD *)*(this + 407) + 229);
v30 = (GameManager *)std::unordered_map::operator[]((__int64)(this + 1744), (int *)&v55);
*(_QWORD *)v30 = *(this + 407);
v31 = (GameManager *)GameManager::sharedState(v30);
v32 = *((_DWORD *)v31 + 179) - *((_DWORD *)v31 + 180);
v33 = GameManager::sharedState(v31);
v34 = (PlayerObject *)PlayerObject::create(
(PlayerObject *)v32,
*(_DWORD *)(v33 + 728) - *(_DWORD *)(v33 + 732),
(GJBaseGameLayer *)this,
*(this + 490),
(cocos2d::CCLayer *)((unsigned __int8)v1[4044] ^ 1u));
*(this + 408) = v34;
v35 = v34;
v36 = *(GameManager **)v34;
v37 = *((__int64 (__fastcall **)(PlayerObject *, __int64 *))v36 + 120);
v38 = (GameManager *)GameManager::sharedState(v36);
v39 = GameManager::sharedState(v38);
v40 = GameManager::colorForIdx(v38, *(_DWORD *)(v39 + 824) - *(_DWORD *)(v39 + 828));
LOWORD(v55) = v40;
BYTE2(v55) = BYTE2(v40);
v41 = (GameManager *)v37(v35, &v55);
v42 = (__int64)*(this + 408);
v43 = (GameManager *)GameManager::sharedState(v41);
v44 = GameManager::sharedState(v43);
v45 = GameManager::colorForIdx(v43, *(_DWORD *)(v44 + 812) - *(_DWORD *)(v44 + 816));
LOWORD(v55) = v45;
BYTE2(v55) = BYTE2(v45);
v46 = (GameManager *)PlayerObject::setSecondColor(v42, &v55);
v47 = GameManager::sharedState(v46);
v48 = (GameManager *)(unsigned int)(*(_DWORD *)(v47 + 836) - *(_DWORD *)(v47 + 840));
if ( ((unsigned int)v48 & 0x80000000) == 0 )
{
v49 = (__int64)*(this + 408);
v50 = (GameManager *)GameManager::sharedState(v48);
v51 = GameManager::sharedState(v50);
v52 = GameManager::colorForIdx(v50, *(_DWORD *)(v51 + 836) - *(_DWORD *)(v51 + 840));
LOWORD(v55) = v52;
BYTE2(v55) = BYTE2(v52);
PlayerObject::enableCustomGlowColor(v49, (__int64)&v55);
}
PlayerObject::updateGlowColor(*(this + 408));
cocos2d::CCObject::retain(*(this + 408));
*((_BYTE *)*(this + 408) + 2616) = 1;
*((_DWORD *)*(this + 408) + 229) = 2;
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*(this + 408) + 344LL))(
*(this + 408),
(unsigned __int8)v1[4044] ^ 1u);
v53 = v1[4044];
if ( v53 )
v53 = *((_BYTE *)this + 1978);
*((_BYTE *)*(this + 408) + 3052) = v53;
LODWORD(v55) = *((_DWORD *)*(this + 408) + 229);
*(_QWORD *)std::unordered_map::operator[]((__int64)(this + 1744), (int *)&v55) = *(this + 408);
return _stack_chk_guard;
}