//
// MenuGameLayer::init from 0x7daeb4 to 0x7db348 (1172 bytes)
//
// 2 xrefs:
// > ??> @ 0xab6b8
// > ??> @ 0x1439350
//
// 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:54:23 +0000
//
__int64 __fastcall MenuGameLayer::init(PlayerObject **this)
{
unsigned __int8 v2; // w0
unsigned int v3; // w25
cocos2d::CCDirector *v5; // x0
cocos2d::CCDirector *v6; // x0
GameManager *WinSize; // x0
GameManager *v8; // x23
__int64 v9; // x0
cocos2d::CCSprite *BGTexture; // x0
const char *v11; // x1
__int64 v12; // x0
__int64 v13; // x0
__int64 v14; // x23
void (__fastcall *v15)(__int64, _BYTE *); // x26
AppDelegate **v16; // x23
void (__fastcall *v17)(AppDelegate **); // x26
AppDelegate *v18; // x0
unsigned __int64 BGColor; // x0
int v20; // w1
__int64 v21; // x2
float v22; // s8
float v23; // s0
float v24; // s1
__int64 v25; // x0
GameManager *v26; // x0
__int64 v27; // x0
int v28; // w2
__int64 v29; // x0
__int64 v30; // x22
__int64 (__fastcall *v31)(__int64, __int64 *); // x23
GameManager *v32; // x0
GameManager *v33; // x0
int v34; // w22
GameManager *v35; // x0
char v36; // w23
__int64 v37; // x0
__int64 v38; // x26
GameManager *v39; // x0
__int64 v40; // x0
__int64 v41; // x26
void (__fastcall *v42)(__int64, __int64 *); // x27
GameManager **v43; // x26
__int64 (__fastcall *v44)(GameManager **, __int64 *); // x27
GameManager *v45; // x28
int v46; // w0
int v47; // w0
GameManager *v48; // x0
__int64 v49; // x26
GameManager *v50; // x27
int v51; // w0
unsigned __int64 v52; // x0
float *v53; // x0
__int64 v54; // x0
__int64 v55; // x0
__int64 v56; // x21
GameManager *v57; // x0
__int16 v58; // [xsp+80h] [xbp+80h] BYREF
char v59; // [xsp+82h] [xbp+82h]
__int64 v60; // [xsp+88h] [xbp+88h] BYREF
__int64 v61; // [xsp+90h] [xbp+90h] BYREF
_DWORD v62[4]; // [xsp+98h] [xbp+98h] BYREF
_BYTE v63[8]; // [xsp+A8h] [xbp+A8h] BYREF
float v64; // [xsp+B0h] [xbp+B0h]
v2 = cocos2d::CCLayer::init((cocos2d::CCLayer *)this);
v3 = v2;
if ( v2 )
{
v5 = (cocos2d::CCDirector *)(*((__int64 (__fastcall **)(PlayerObject **, __int64))*this + 125))(this, 1);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize(&v60, v6);
v8 = (GameManager *)GameManager::sharedState(WinSize);
v9 = GameManager::sharedState(v8);
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v8, *(_DWORD *)(v9 + 980));
v12 = cocos2d::CCSprite::create(BGTexture, v11);
*(this + 55) = (PlayerObject *)v12;
v62[0] = 9729;
v62[1] = 9729;
v62[2] = 10497;
v62[3] = 10497;
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 1072LL))(v12);
cocos2d::CCTexture2D::setTexParameters(v13, v62);
(*((void (__fastcall **)(PlayerObject **, _QWORD, __int64))*this + 58))(this, *(this + 55), 4294967196LL);
v14 = (__int64)*(this + 55);
v15 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v14 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, 0.0, 0.0);
v15(v14, v63);
v16 = (AppDelegate **)*(this + 55);
v17 = *((void (__fastcall **)(AppDelegate **))*v16 + 20);
v18 = (AppDelegate *)AppDelegate::get(*v16);
AppDelegate::bgScale(v18);
v17(v16);
v58 = 26112;
v59 = -1;
BGColor = MenuGameLayer::getBGColor((MenuGameLayer *)this, 0);
v20 = *((_DWORD *)this + 104);
v21 = (__int64)*(this + 55);
v58 = BGColor;
*((_DWORD *)this + 104) = v20 + 1;
v59 = BYTE2(BGColor);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v21 + 960LL))(v21, &v58);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v63, (PlayerObject *)((char *)*(this + 55) + 424));
v22 = v64;
v23 = (*(float (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 55) + 168LL))(*(this + 55));
v24 = v64 + v64;
v25 = (__int64)*(this + 55);
*((float *)this + 114) = v22 * v23;
v64 = v24;
v26 = (GameManager *)(*(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v25 + 1136LL))(v25, v63);
v27 = GameManager::sharedState(v26);
v29 = GJGroundLayer::create((GJGroundLayer *)*(unsigned int *)(v27 + 984), 1, v28);
*(this + 56) = (PlayerObject *)v29;
(*((void (__fastcall **)(PlayerObject **, __int64, __int64))*this + 58))(this, v29, 100);
v30 = (__int64)*(this + 56);
v31 = *(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v30 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v61, 0.0, 90.0);
v32 = (GameManager *)v31(v30, &v61);
v33 = (GameManager *)GameManager::sharedState(v32);
v34 = *((_DWORD *)v33 + 212) - *((_DWORD *)v33 + 213);
v35 = (GameManager *)GameManager::sharedState(v33);
v36 = *((_BYTE *)v35 + 912);
v37 = GameManager::sharedState(v35);
*(_DWORD *)(v37 + 856) = 1;
v38 = v37;
v39 = (GameManager *)(unsigned int)(int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v38 + 852) = (_DWORD)v39;
*(_DWORD *)(v38 + 848) = (_DWORD)v39 + 1;
*(_BYTE *)(GameManager::sharedState(v39) + 912) = 0;
v40 = PlayerObject::create((PlayerObject *)((char *)&dword_0 + 1), 1, nullptr, (GJBaseGameLayer *)this, nullptr);
*(this + 54) = (PlayerObject *)v40;
(*((void (__fastcall **)(PlayerObject **, __int64, __int64))*this + 58))(this, v40, 60);
PlayerObject::addAllParticles(*(this + 54));
v41 = (__int64)*(this + 54);
v42 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v41 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v61, 0.0, 105.0);
v42(v41, &v61);
v43 = (GameManager **)*(this + 54);
v44 = *((__int64 (__fastcall **)(GameManager **, __int64 *))*v43 + 120);
v45 = (GameManager *)GameManager::sharedState(*v43);
v46 = rand();
v47 = GameManager::colorForIdx(v45, (int)(float)((float)((float)v46 * 4.6566e-10) * 108.0));
LOWORD(v61) = v47;
BYTE2(v61) = BYTE2(v47);
v48 = (GameManager *)v44(v43, &v61);
v49 = (__int64)*(this + 54);
v50 = (GameManager *)GameManager::sharedState(v48);
v51 = rand();
v52 = GameManager::colorForIdx(v50, (int)(float)((float)((float)v51 * 4.6566e-10) * 108.0));
LOWORD(v61) = v52;
BYTE2(v61) = BYTE2(v52);
PlayerObject::setSecondColor(v49, &v61);
PlayerObject::updateGlowColor(*(this + 54));
v53 = (float *)*(this + 54);
v53[659] = 0.5;
v54 = *(unsigned __int8 *)(GameManager::sharedState((GameManager *)v53) + 1092);
if ( !(_DWORD)v54 )
{
*(_BYTE *)(GameManager::sharedState((GameManager *)v54) + 1092) = 1;
PlayerObject::toggleDartMode((__int64)*(this + 54), 1u, 0);
v54 = PlayerObject::toggleDartMode((__int64)*(this + 54), 0, 0);
}
v55 = GameManager::sharedState((GameManager *)v54);
*(_DWORD *)(v55 + 856) = v34;
v56 = v55;
v57 = (GameManager *)(unsigned int)(int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v56 + 852) = (_DWORD)v57;
*(_DWORD *)(v56 + 848) = v34 + (_DWORD)v57;
*(_BYTE *)(GameManager::sharedState(v57) + 912) = v36;
cocos2d::CCNode::scheduleUpdate((cocos2d::CCNode *)this);
cocos2d::CCNode::schedule(this, MenuGameLayer::tryJump, 0, 0.25);
cocos2d::CCNode::schedule(this, MenuGameLayer::updateColor, 0, 5.0);
MenuGameLayer::updateColor((MenuGameLayer *)this, 0.0);
PlayerObject::stopStreak2((cocos2d::CCNode **)*(this + 54));
MenuGameLayer::resetPlayer((cocos2d::CCMotionStreak ***)this);
}
return v3;
}