//
// GJBaseGameLayer::createPlayer from 0x100277d64 to 0x100278110 (940 bytes)
//
// 2 xrefs:
// > PlayLayer::init @ 0x10013e748
// > LevelEditorLayer::init @ 0x1003f6f0c
//
// 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:01:51 +0000
//
_QWORD *__fastcall GJBaseGameLayer::createPlayer(__int64 a1)
{
__int64 v2; // x0
__int64 v3; // x20
__int64 v4; // x0
__int64 v5; // x20
__int64 v6; // x21
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x20
__int64 v11; // x21
__int64 v12; // x0
int v13; // w0
__int64 v14; // x0
__int64 v15; // x0
__int64 v16; // x20
__int64 v17; // x21
__int64 v18; // x0
int v19; // w0
__int64 v20; // x0
__int64 v21; // x20
__int64 v22; // x0
__n128 GameVariable; // q0
__int64 v24; // x0
char v25; // w8
__int64 v26; // x20
_QWORD *v27; // x0
__int64 v28; // x0
__int64 v29; // x20
__int64 v30; // x0
__int64 v31; // x20
__int64 v32; // x21
__int64 v33; // x0
__int64 v34; // x0
__int64 v35; // x0
__int64 v36; // x20
__int64 v37; // x21
__int64 v38; // x0
int v39; // w0
__int64 v40; // x0
__int64 v41; // x0
__int64 v42; // x20
__int64 v43; // x21
__int64 v44; // x0
int v45; // w0
__int64 v46; // x0
char v47; // w8
__int64 v48; // x20
_QWORD *result; // x0
int v50; // [xsp+0h] [xbp-40h] BYREF
int *v51; // [xsp+8h] [xbp-38h] BYREF
v2 = GameManager::sharedState(a1);
v3 = (unsigned int)(*(_DWORD *)(v2 + 716) - *(_DWORD *)(v2 + 720));
v4 = GameManager::sharedState(v2);
v5 = PlayerObject::create(
v3,
(unsigned int)(*(_DWORD *)(v4 + 728) - *(_DWORD *)(v4 + 732)),
a1,
*(_QWORD *)(a1 + 3920),
(*(_BYTE *)(a1 + 12236) & 1) == 0);
*(_QWORD *)(a1 + 3256) = v5;
v6 = GameManager::sharedState(v5);
v7 = GameManager::sharedState(v6);
v8 = GameManager::colorForIdx(v6, (unsigned int)(*(_DWORD *)(v7 + 812) - *(_DWORD *)(v7 + 816)));
LOWORD(v51) = v8;
BYTE2(v51) = BYTE2(v8);
v9 = (*(__int64 (__fastcall **)(__int64, int **))(*(_QWORD *)v5 + 960LL))(v5, &v51);
v10 = *(_QWORD *)(a1 + 3256);
v11 = GameManager::sharedState(v9);
v12 = GameManager::sharedState(v11);
v13 = GameManager::colorForIdx(v11, (unsigned int)(*(_DWORD *)(v12 + 824) - *(_DWORD *)(v12 + 828)));
LOWORD(v51) = v13;
BYTE2(v51) = BYTE2(v13);
v14 = PlayerObject::setSecondColor(v10, &v51);
v15 = GameManager::sharedState(v14);
if ( *(_DWORD *)(v15 + 836) >= *(_DWORD *)(v15 + 840) )
{
v16 = *(_QWORD *)(a1 + 3256);
v17 = GameManager::sharedState(v15);
v18 = GameManager::sharedState(v17);
v19 = GameManager::colorForIdx(v17, (unsigned int)(*(_DWORD *)(v18 + 836) - *(_DWORD *)(v18 + 840)));
LOWORD(v51) = v19;
BYTE2(v51) = BYTE2(v19);
PlayerObject::enableCustomGlowColor(v16, &v51);
}
PlayerObject::updateGlowColor(*(_QWORD *)(a1 + 3256));
v20 = (*(__int64 (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 3920) + 464LL))(
*(_QWORD *)(a1 + 3920),
*(_QWORD *)(a1 + 3256),
59);
v21 = *(_QWORD *)(a1 + 3256);
*(_DWORD *)(v21 + 916) = 1;
if ( (*(_BYTE *)(a1 + 12236) & 1) == 0 )
{
v20 = PlayerObject::addAllParticles(v21);
v21 = *(_QWORD *)(a1 + 3256);
}
v22 = GameManager::sharedState(v20);
GameVariable = GameManager::getGameVariable(v22, "0068");
PlayerObject::updateCheckpointMode(v21, v24, GameVariable);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 3256) + 344LL))(
*(_QWORD *)(a1 + 3256),
(*(_BYTE *)(a1 + 12236) & 1) == 0);
if ( *(_BYTE *)(a1 + 12236) == 1 )
v25 = *(_BYTE *)(a1 + 1978);
else
v25 = 0;
v26 = *(_QWORD *)(a1 + 3256);
*(_BYTE *)(v26 + 3052) = v25 & 1;
v50 = *(_DWORD *)(v26 + 916);
v51 = &v50;
v27 = sub_10001A978(a1 + 13952, &v50, (__int64)&unk_100763014, &v51);
v27[3] = v26;
v28 = GameManager::sharedState(v27);
v29 = (unsigned int)(*(_DWORD *)(v28 + 716) - *(_DWORD *)(v28 + 720));
v30 = GameManager::sharedState(v28);
v31 = PlayerObject::create(
v29,
(unsigned int)(*(_DWORD *)(v30 + 728) - *(_DWORD *)(v30 + 732)),
a1,
*(_QWORD *)(a1 + 3920),
(*(_BYTE *)(a1 + 12236) & 1) == 0);
*(_QWORD *)(a1 + 3264) = v31;
v32 = GameManager::sharedState(v31);
v33 = GameManager::sharedState(v32);
v34 = GameManager::colorForIdx(v32, (unsigned int)(*(_DWORD *)(v33 + 824) - *(_DWORD *)(v33 + 828)));
LOWORD(v51) = v34;
BYTE2(v51) = BYTE2(v34);
v35 = (*(__int64 (__fastcall **)(__int64, int **))(*(_QWORD *)v31 + 960LL))(v31, &v51);
v36 = *(_QWORD *)(a1 + 3264);
v37 = GameManager::sharedState(v35);
v38 = GameManager::sharedState(v37);
v39 = GameManager::colorForIdx(v37, (unsigned int)(*(_DWORD *)(v38 + 812) - *(_DWORD *)(v38 + 816)));
LOWORD(v51) = v39;
BYTE2(v51) = BYTE2(v39);
v40 = PlayerObject::setSecondColor(v36, &v51);
v41 = GameManager::sharedState(v40);
if ( *(_DWORD *)(v41 + 836) >= *(_DWORD *)(v41 + 840) )
{
v42 = *(_QWORD *)(a1 + 3264);
v43 = GameManager::sharedState(v41);
v44 = GameManager::sharedState(v43);
v45 = GameManager::colorForIdx(v43, (unsigned int)(*(_DWORD *)(v44 + 836) - *(_DWORD *)(v44 + 840)));
LOWORD(v51) = v45;
BYTE2(v51) = BYTE2(v45);
PlayerObject::enableCustomGlowColor(v42, &v51);
}
PlayerObject::updateGlowColor(*(_QWORD *)(a1 + 3264));
cocos2d::CCObject::retain(*(_QWORD *)(a1 + 3264));
v46 = *(_QWORD *)(a1 + 3264);
*(_BYTE *)(v46 + 2616) = 1;
*(_DWORD *)(v46 + 916) = 2;
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v46 + 344LL))(v46, (*(_BYTE *)(a1 + 12236) & 1) == 0);
if ( *(_BYTE *)(a1 + 12236) == 1 )
v47 = *(_BYTE *)(a1 + 1978);
else
v47 = 0;
v48 = *(_QWORD *)(a1 + 3264);
*(_BYTE *)(v48 + 3052) = v47 & 1;
v50 = *(_DWORD *)(v48 + 916);
v51 = &v50;
result = sub_10001A978(a1 + 13952, &v50, (__int64)&unk_100763014, &v51);
result[3] = v48;
return result;
}