//
// PlayLayer::init from 0x40ad98 to 0x40b3b8 (1568 bytes)
//
// 1 xrefs:
// > PlayLayer::create @ 0x40cb28
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:47:31 +0000
//
int __fastcall PlayLayer::init(cocos2d::CCParticleSystem **this, GJGameLevel *a2, int a3)
{
int v6; // r9
cocos2d::CCDictionary *v7; // r0
cocos2d::CCObject *v8; // r0
cocos2d::CCDirector *v9; // r0
int v10; // r0
GameManager *v11; // r0
GameManager *v12; // r0
bool v13; // r1
GameManager *v14; // r0
GameManager *v15; // r0
GameManager *updated; // r0
GameManager *v17; // r0
GameManager *v18; // r5
char v19; // r3
GameManager *v20; // r0
GameManager *v21; // r0
int v22; // r5
GameManager *v23; // r0
char isPlatformer; // r0
int v25; // r3
AppDelegate *active; // r0
AppDelegate *v27; // r0
cocos2d::CCObject *v28; // r0
int v29; // r5
GravityEffectSprite *v30; // r0
cocos2d::CCArray *v31; // r11
int *v32; // r0
cocos2d::CCObject *v33; // r0
GameManager *v34; // r0
GameManager *v35; // r0
GameManager *v36; // r0
cocos2d::CCDictionary *v37; // r0
cocos2d::CCObject *v38; // r0
cocos2d::CCDirector *v39; // r0
cocos2d::CCArray *WinSize; // r0
cocos2d::CCObject *v41; // r0
cocos2d::CCArray *v42; // r0
cocos2d::CCObject *v43; // r0
cocos2d::CCArray *v44; // r0
cocos2d::CCObject *v45; // r0
cocos2d::CCArray *v46; // r0
cocos2d::CCObject *v47; // r0
int v48; // s15
cocos2d::CCParticleSystem *v49; // r0
cocos2d::CCDirector *v50; // r0
int v51; // r8
void (__fastcall *v52)(int, float *); // r11
cocos2d::CCDirector *v53; // r0
float v54; // s17
cocos2d::CCDirector *v55; // r0
float v56; // r0
int v57; // r0
const char *v58; // r8
cocos2d::CCDrawNode *v59; // r0
cocos2d::CCParticleSystem *v60; // r0
cocos2d::CCDrawNode *v61; // r0
cocos2d::CCParticleSystem *v62; // r0
GameManager *Player; // r0
GameManager *v64; // r0
GameManager *GameVariable; // r0
const char *v66; // r2
cocos2d::CCParticleSystem *v67; // r0
int v68; // r11
cocos2d::CCDirector *v69; // r0
int v70; // r11
cocos2d::CCDirector *v71; // r0
float v72; // r0
GameManager *v73; // r0
int v74; // r0
size_t v75; // r0
int v76; // r2
int v77; // r3
int v78; // r3
int v79; // r6
int v80; // r6
void (__fastcall *v81)(int, float *); // r11
int (__fastcall *v83)(int, float *); // [sp+4h] [bp-48h]
void (__fastcall *v84)(int, float *); // [sp+4h] [bp-48h]
float v85[2]; // [sp+8h] [bp-44h] BYREF
_DWORD v86[2]; // [sp+10h] [bp-3Ch] BYREF
float v87[2]; // [sp+18h] [bp-34h] BYREF
unsigned __int8 v88[4]; // [sp+20h] [bp-2Ch] BYREF
int v89; // [sp+24h] [bp-28h]
int v90[3]; // [sp+2Ch] [bp-20h] BYREF
int v91[3]; // [sp+38h] [bp-14h] BYREF
v6 = GJBaseGameLayer::init((GJBaseGameLayer *)this);
if ( v6 )
{
*(this + 352) = a2;
v7 = (cocos2d::CCDictionary *)cocos2d::CCObject::retain(a2);
v8 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v7);
*(this + 2961) = v8;
v9 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(v8);
v10 = cocos2d::CCDirector::sharedDirector(v9);
v11 = (GameManager *)(*(int (__fastcall **)(int))(*(_DWORD *)v10 + 96))(v10);
*((_BYTE *)v11 + 92) = 1;
v12 = (GameManager *)GameManager::sharedState(v11);
if ( GameManager::getGameVariable(v12, "0128") )
{
PlatformToolbox::toggleLockCursor((PlatformToolbox *)((char *)&dword_0 + 1), v13);
}
else
{
v14 = (GameManager *)GameManager::sharedState(nullptr);
if ( !GameManager::getGameVariable(v14, "0024") )
PlatformToolbox::hideCursor(nullptr);
}
v15 = (GameManager *)(*((int (__fastcall **)(cocos2d::CCParticleSystem **))*this + 199))(this);
*(_BYTE *)(GameManager::sharedState(v15) + 852) = 1;
*((_BYTE *)this + 11708) = 0;
*(this + 3068) = (cocos2d::CCParticleSystem *)(&dword_0 + 1);
*((_BYTE *)this + 11796) = 0;
updated = (GameManager *)PlayLayer::updateGameSettings((PlayLayer *)this);
*((_BYTE *)this + 1432) = *((_BYTE *)a2 + 593);
v17 = (GameManager *)GameManager::sharedState(updated);
v18 = v17;
if ( !*((_BYTE *)this + 1432) || (v19 = *((_BYTE *)this + 1433)) == 0 )
{
v17 = (GameManager *)GameManager::sharedState(v17);
v19 = *((_BYTE *)v17 + 725);
}
*((_BYTE *)v18 + 726) = v19;
v20 = (GameManager *)GameManager::sharedState(v17);
*((_BYTE *)v20 + 813) = 1;
v21 = (GameManager *)GameManager::sharedState(v20);
if ( *((_BYTE *)v21 + 433) )
{
v22 = GameManager::sharedState(v21);
v23 = (GameManager *)clock_gettime(0, (struct timespec *)v87);
*(double *)(v22 + 344) = (double)SLODWORD(v87[0]) + (double)SLODWORD(v87[1]) / 1000000000.0 - 180.0 + 180.0;
v21 = (GameManager *)GameManager::sharedState(v23);
*((_BYTE *)v21 + 433) = 0;
}
if ( *(_BYTE *)(GameManager::sharedState(v21) + 723) )
PlayLayer::stopRecording((PlayLayer *)this);
isPlatformer = 0;
*((_BYTE *)this + 10836) = 0;
v25 = *((_DWORD *)a2 + 238);
if ( v25 != 1 )
{
if ( v25 == 2 || *((_DWORD *)a2 + 189) - *((_DWORD *)a2 + 190) == 1 )
isPlatformer = v6;
else
isPlatformer = GJGameLevel::isPlatformer(a2);
}
*((_BYTE *)this + 10936) = isPlatformer;
*(this + 2647) = nullptr;
active = (AppDelegate *)GJBaseGameLayer::resetActiveEnterEffects((GJBaseGameLayer *)this);
*(this + 2974) = nullptr;
*((_QWORD *)this + 98) = 0;
*((_QWORD *)this + 100) = 0;
*((_QWORD *)this + 99) = 0;
*(this + 3021) = nullptr;
*((_BYTE *)this + 11272) = 0;
*((_BYTE *)this + 10829) = 1;
*((_BYTE *)this + 866) = 0;
*(this + 2982) = (cocos2d::CCParticleSystem *)&byte_4;
v27 = (AppDelegate *)AppDelegate::get(active);
if ( *((_BYTE *)v27 + 19) || (v27 = (AppDelegate *)AppDelegate::get(v27), *((_BYTE *)v27 + 20)) )
*(this + 2982) = (cocos2d::CCParticleSystem *)(&dword_0 + 2);
v28 = (cocos2d::CCObject *)cocos2d::CCArray::create(v27);
v29 = 0;
*(this + 2985) = v28;
v30 = (GravityEffectSprite *)cocos2d::CCObject::retain(v28);
while ( v29 < (int)*(this + 2982) )
{
v31 = *(this + 2985);
v32 = GravityEffectSprite::create(v30);
++v29;
v30 = (GravityEffectSprite *)cocos2d::CCArray::addObject(v31, (cocos2d::CCObject *)v32);
}
v33 = (cocos2d::CCObject *)cocos2d::CCArray::create(v30);
*(this + 2971) = v33;
v34 = (GameManager *)cocos2d::CCObject::retain(v33);
v35 = (GameManager *)GameManager::sharedState(v34);
*((_BYTE *)v35 + 506) = 0;
v36 = (GameManager *)GameManager::sharedState(v35);
*((_DWORD *)v36 + 101) = this;
v37 = (cocos2d::CCDictionary *)GameManager::sharedState(v36);
*((_BYTE *)v37 + 505) = 0;
v38 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v37);
*(this + 3058) = v38;
v39 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(v38);
cocos2d::CCDirector::sharedDirector(v39);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v85);
v41 = (cocos2d::CCObject *)cocos2d::CCArray::create(WinSize);
*(this + 2962) = v41;
v42 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v41);
v43 = (cocos2d::CCObject *)cocos2d::CCArray::create(v42);
*(this + 2963) = v43;
v44 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v43);
v45 = (cocos2d::CCObject *)cocos2d::CCArray::create(v44);
*(this + 2970) = v45;
v46 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v45);
v47 = (cocos2d::CCObject *)cocos2d::CCArray::create(v46);
*(this + 2967) = v47;
cocos2d::CCObject::retain(v47);
GJBaseGameLayer::setupLayers((GJBaseGameLayer *)this);
rand();
v48 = (int)(float)(COERCE_FLOAT(roundf()) + 1.0);
*(this + 2973) = (cocos2d::CCParticleSystem *)v48;
v49 = (cocos2d::CCParticleSystem *)cocos2d::CCParticleSystemQuad::create(
(cocos2d::CCParticleSystemQuad *)"glitterEffect.plist",
nullptr,
v48);
*(this + 2715) = v49;
(*(void (__fastcall **)(cocos2d::CCParticleSystem *, int))(*(_DWORD *)v49 + 784))(v49, 1);
v50 = (cocos2d::CCDirector *)(*(int (__fastcall **)(_DWORD, _DWORD, _DWORD))(*(_DWORD *)*(this + 609) + 232))(
*(this + 609),
*(this + 2715),
0);
v51 = (int)*(this + 2715);
v52 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v51 + 480);
v53 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v50);
v54 = COERCE_FLOAT(cocos2d::CCDirector::getScreenScaleFactorW(v53));
v55 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v54));
v56 = COERCE_FLOAT(cocos2d::CCDirector::getScreenScaleFactorH(v55));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v87, (float)(v54 * 480.0) / 1.8, (float)(v56 * 320.0) * 0.5);
v57 = v51;
v58 = (_BYTE *)(&stru_2D2C + 12);
v52(v57, v87);
v59 = (cocos2d::CCDrawNode *)cocos2d::CCParticleSystem::stopSystem(*(this + 2715));
v60 = (cocos2d::CCParticleSystem *)cocos2d::CCDrawNode::create(v59);
*(this + 2894) = v60;
v86[0] = 770;
v86[1] = 771;
cocos2d::CCDrawNode::setBlendFunc(v60, v86);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 2894) + 36))(*(this + 2894), -9999);
v61 = (cocos2d::CCDrawNode *)(*(int (__fastcall **)(_DWORD, _DWORD, int))(*(_DWORD *)*(this + 611) + 232))(
*(this + 611),
*(this + 2894),
1401);
v62 = (cocos2d::CCParticleSystem *)cocos2d::CCDrawNode::create(v61);
*(this + 2895) = v62;
cocos2d::CCDrawNode::setBlendFunc(v62, v86);
(*(void (__fastcall **)(_DWORD, _DWORD))(*(_DWORD *)*(this + 2894) + 228))(*(this + 2894), *(this + 2895));
PlayLayer::updateDebugDrawSettings((PlayLayer *)this);
Player = (GameManager *)GJBaseGameLayer::createPlayer((GJBaseGameLayer *)this);
if ( *((_DWORD *)*(this + 352) + 238) == 2 )
{
v64 = (GameManager *)GameManager::sharedState(Player);
GameVariable = (GameManager *)GameManager::getGameVariable(v64, "0174");
v58 = (const char *)GameVariable;
if ( !GameVariable )
{
v67 = (cocos2d::CCParticleSystem *)cocos2d::CCLabelBMFont::create(
(cocos2d::CCLabelBMFont *)"Ignore Damage",
"bigFont.fnt",
v66);
*(this + 2952) = v67;
(*(void (__fastcall **)(cocos2d::CCParticleSystem *, int))(*(_DWORD *)v67 + 512))(v67, 50);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 2952) + 80))(*(this + 2952), 1053609165);
(*((void (__fastcall **)(cocos2d::CCParticleSystem **, _DWORD, int))*this + 58))(this, *(this + 2952), 1000);
v68 = (int)*(this + 2952);
v83 = *(int (__fastcall **)(int, float *))(*(_DWORD *)v68 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v87, 0.0, 1.0);
v69 = (cocos2d::CCDirector *)v83(v68, v87);
v70 = (int)*(this + 2952);
v84 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v70 + 92);
v71 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v69);
v72 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v71));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v87, 5.0, (float)(v72 - 5.0) + 1.0);
v84(v70, v87);
GameVariable = (GameManager *)(*(int (__fastcall **)(_DWORD, _DWORD))(*(_DWORD *)*(this + 2952) + 172))(
*(this + 2952),
0);
}
v73 = (GameManager *)GameManager::sharedState(GameVariable);
v74 = GameManager::getGameVariable(v73, "0173");
PlayLayer::toggleIgnoreDamage((PlayLayer *)this, v74);
}
*((_BYTE *)this + 11728) = 1;
std::string::basic_string(v90, (int)*(this + 352) + 304);
if ( (v90[0] & 1) == 0 )
v58 = (char *)v90 + 1;
v91[0] = 0;
if ( (v90[0] & 1) != 0 )
v58 = (const char *)v90[2];
v91[1] = 0;
v91[2] = 0;
v75 = strlen(v58);
std::string::__init(v91, v58, v75);
cocos2d::ZipUtils::decompressString(v88, v91, 0, 11);
std::string::~string((int)v91);
std::string::~string((int)v90);
v76 = (int)*(this + 352);
v77 = *(_DWORD *)(v76 + 952);
if ( v77 == 1 )
{
std::string::basic_string(v91, (int)v88);
*((_BYTE *)this + 11728) = LevelTools::verifyLevelIntegrity(
v91,
*((_DWORD *)*(this + 352) + 67) - *((_DWORD *)*(this + 352) + 68));
std::string::~string((int)v91);
}
else if ( v77 != 2 || (v78 = *(_DWORD *)(v76 + 772), v76 = *(_DWORD *)(v76 + 776), v78 - v76 > 0) )
{
if ( (v88[0] & 1) != 0 )
v79 = v89;
else
v79 = (int)v88[0] >> 1;
*((_BYTE *)this + 11728) = v79 != 0;
}
if ( !*((_BYTE *)this + 11728) )
{
v80 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Load Failed!", "bigFont.fnt", (const char *)v76);
(*((void (__fastcall **)(cocos2d::CCParticleSystem **, int, int))*this + 58))(this, v80, 100);
v81 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v80 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v87, v85[0] * 0.5, v85[1] * 0.5);
v81(v80, v87);
}
PlayLayer::prepareCreateObjectsFromSetup(this, v88);
if ( !a3 )
{
while ( *((float *)this + 2697) < 1.0 )
PlayLayer::processCreateObjectsFromSetup((PlayLayer *)this);
}
std::string::~string((int)v88);
}
return v6;
}