//
// GJBaseGameLayer::updateShaderLayer from 0x591ec0 to 0x59257a (1722 bytes)
//
// 6 xrefs:
// > PlayLayer::resetLevel @ 0x412904
// > LevelEditorLayer::onPlaytest @ 0x46852c
// > LevelEditorLayer::updateGameObjects @ 0x46ceaa
// > GJBaseGameLayer::resetLevelVariables @ 0x5b977a
// > GJBaseGameLayer::update @ 0x5bd810
// > GJBaseGameLayer::update @ 0x5be352
//
// 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:53:06 +0000
//
int __fastcall GJBaseGameLayer::updateShaderLayer(GJBaseGameLayer *this, float a2)
{
int v4; // r1
int v5; // r1
int active; // r0
int v7; // r1
int v8; // r5
int v9; // r1
int v10; // r0
int v11; // r0
char v12; // r3
int v13; // r5
int v14; // r2
int v15; // r5
int v16; // r2
int v17; // r5
int v18; // r2
int v19; // r6
int v20; // r2
int v21; // r6
int v22; // r2
int v23; // r6
int v24; // r2
int v25; // r6
int v26; // r2
int v27; // r1
int v28; // r0
char v29; // r7
char v30; // r6
char v31; // r5
char shouldBlend; // r0
_BYTE *v33; // r2
int v34; // r2
float v35; // r7
int v36; // r2
float v37; // r6
_BYTE *v38; // r0
int (*v39)(void); // r3
int i; // r7
cocos2d::CCArray *v41; // r0
cocos2d::CCNode *v42; // r8
cocos2d::CCArray *v43; // r5
int j; // r7
cocos2d::CCArray *v45; // r6
_DWORD *v46; // r2
cocos2d::CCNode **v47; // r6
cocos2d::CCNode **v48; // r5
cocos2d::CCNode *v49; // r1
cocos2d::CCNode *v50; // t1
cocos2d::CCArray *v51; // r0
cocos2d::CCArray *v52; // r5
cocos2d::CCArray *v53; // r6
_DWORD *v54; // r2
cocos2d::CCNode **v55; // r6
cocos2d::CCNode **v56; // r5
cocos2d::CCNode *v57; // r1
cocos2d::CCNode *v58; // t1
GJBaseGameLayer *v59; // r2
int v60; // r5
int v61; // r9
cocos2d::CCNode *v62; // r2
cocos2d::CCNode *v63; // r1
cocos2d::CCNode *v64; // r6
cocos2d::CCNode *v65; // r1
cocos2d::CCNode *v66; // r1
cocos2d::CCNode *v67; // r2
int v68; // r8
cocos2d::CCArray *v69; // r0
cocos2d::CCNode *v70; // r2
cocos2d::CCNode *v71; // r3
int v72; // r7
cocos2d::CCArray *v73; // r0
cocos2d::CCArray *v74; // r0
cocos2d::CCArray *v75; // r10
cocos2d::CCArray *v76; // r0
cocos2d::CCArray *v77; // r0
cocos2d::CCArray *v78; // r11
cocos2d::CCArray *v79; // r0
int k; // r6
int v81; // r5
int v82; // r5
void (__fastcall *v83)(int, _BOOL4); // r6
_BOOL4 v84; // r1
int v85; // r5
int (__fastcall *v86)(int, _BOOL4); // r6
_BOOL4 v87; // r1
cocos2d::CCNode *v89; // r2
bool v90; // cc
bool v91; // cc
cocos2d::CCArray *v92; // r3
_DWORD *v93; // r3
cocos2d::CCNode **v94; // r9
cocos2d::CCNode *v95; // r1
cocos2d::CCNode *v96; // t1
int v97; // r0
cocos2d::CCNode *v98; // r2
cocos2d::CCArray *v99; // [sp+0h] [bp-34h]
cocos2d::CCNode *v100; // [sp+4h] [bp-30h]
cocos2d::CCNode *v101; // [sp+8h] [bp-2Ch]
cocos2d::CCNode **v102; // [sp+Ch] [bp-28h]
cocos2d::CCNode *v103; // [sp+14h] [bp-20h]
__int16 v104; // [sp+1Ch] [bp-18h]
char v105; // [sp+1Eh] [bp-16h]
float v106; // [sp+24h] [bp-10h] BYREF
float v107; // [sp+28h] [bp-Ch]
v4 = *((_DWORD *)this + 2678);
if ( !v4 )
goto LABEL_98;
v5 = *(_DWORD *)(v4 + 860);
v104 = -1;
v105 = -1;
if ( v5 > 0 )
{
active = GJEffectManager::activeColorForIndex(*((GJEffectManager **)this + 381), v5);
v104 = active;
v105 = BYTE2(active);
}
v7 = *((_DWORD *)this + 2678);
*(_WORD *)(v7 + 864) = v104;
*(_BYTE *)(v7 + 866) = v105;
v8 = *((_DWORD *)this + 2678);
v9 = *(_DWORD *)(v8 + 400);
if ( v9 <= 0 )
{
v11 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 612) + 472))(*((_DWORD *)this + 612));
v12 = *(_BYTE *)(v11 + 2);
*(_WORD *)(v8 + 392) = *(_WORD *)v11;
*(_BYTE *)(v8 + 394) = v12;
}
else
{
v10 = GJEffectManager::activeColorForIndex(*((GJEffectManager **)this + 381), v9);
*(_WORD *)(v8 + 392) = v10;
*(_BYTE *)(v8 + 394) = BYTE2(v10);
}
v13 = *((_DWORD *)this + 2678);
if ( *(_BYTE *)(v13 + 708) )
{
v14 = *(_DWORD *)(v13 + 712);
if ( v14 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v14);
cocos2d::CCPoint::operator=(v13 + 716, &v106);
}
}
v15 = *((_DWORD *)this + 2678);
if ( *(_BYTE *)(v15 + 808) )
{
v16 = *(_DWORD *)(v15 + 812);
if ( v16 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v16);
*(float *)(v15 + 820) = v106;
}
}
v17 = *((_DWORD *)this + 2678);
if ( *(_BYTE *)(v17 + 809) )
{
v18 = *(_DWORD *)(v17 + 816);
if ( v18 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v18);
*(float *)(v17 + 824) = v107;
}
}
v19 = *((_DWORD *)this + 2678);
v20 = *(_DWORD *)(v19 + 456);
if ( v20 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v20);
ShaderLayer::updateShockWaveCenter(v19, &v106);
}
v21 = *((_DWORD *)this + 2678);
v22 = *(_DWORD *)(v21 + 536);
if ( v22 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v22);
ShaderLayer::updateShockLineCenter(v21, &v106);
}
v23 = *((_DWORD *)this + 2678);
v24 = *(_DWORD *)(v23 + 668);
if ( v24 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v24);
cocos2d::CCPoint::operator=(v23 + 684, &v106);
}
v25 = *((_DWORD *)this + 2678);
v26 = *(_DWORD *)(v25 + 776);
if ( v26 )
{
GJBaseGameLayer::positionForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v26);
cocos2d::CCPoint::operator=(v25 + 784, &v106);
}
v27 = *(_DWORD *)(*((_DWORD *)this + 2678) + 672);
if ( v27 <= 0 )
{
v31 = 0;
v30 = 0;
v29 = 0;
shouldBlend = 0;
}
else
{
v28 = GJEffectManager::activeColorForIndex(*((GJEffectManager **)this + 381), v27);
v29 = v28;
v30 = BYTE1(v28);
v31 = BYTE2(v28);
shouldBlend = GJEffectManager::shouldBlend(
*((GJEffectManager **)this + 381),
*(_DWORD *)(*((_DWORD *)this + 2678) + 672));
}
v33 = *((_BYTE **)this + 2678);
v33[678] = v29;
v33[679] = v30;
v33[680] = v31;
*(_BYTE *)(*((_DWORD *)this + 2678) + 677) = shouldBlend;
v34 = *(_DWORD *)(*((_DWORD *)this + 2678) + 756);
if ( v34 )
{
GJBaseGameLayer::speedForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v34);
v35 = v106;
}
else
{
v35 = 0.0;
}
v36 = *(_DWORD *)(*((_DWORD *)this + 2678) + 760);
if ( v36 )
{
GJBaseGameLayer::speedForShaderTarget((GJBaseGameLayer *)&v106, (int)this, v36);
v37 = v107;
}
else
{
v37 = 0.0;
}
ShaderLayer::updateMotionBlurSpeedX(*((ShaderLayer **)this + 2678), v35, a2 * 60.0);
ShaderLayer::updateMotionBlurSpeedY(*((ShaderLayer **)this + 2678), v37, a2 * 60.0);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 2678) + 20))(*((_DWORD *)this + 2678), LODWORD(a2));
ShaderLayer::performCalculations(*((ShaderLayer **)this + 2678));
v38 = *((_BYTE **)this + 2678);
v39 = *(int (**)(void))(*(_DWORD *)v38 + 256);
if ( !v38[950] )
{
if ( !v39() )
goto LABEL_97;
for ( i = 1; ; ++i )
{
if ( i == 1 )
{
v41 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 607) + 244))(*((_DWORD *)this + 607));
v42 = *((cocos2d::CCNode **)this + 610);
v43 = v41;
if ( !v41 )
continue;
}
else
{
v41 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 608) + 244))(*((_DWORD *)this + 608));
v42 = *((cocos2d::CCNode **)this + 611);
v43 = v41;
if ( !v41 )
goto LABEL_43;
}
v45 = (cocos2d::CCArray *)cocos2d::CCArray::create(v41);
cocos2d::CCArray::addObjectsFromArray(v45, v43);
if ( v45 )
{
v46 = *((_DWORD **)v45 + 13);
if ( *v46 )
{
v47 = (cocos2d::CCNode **)v46[3];
v48 = &v47[*v46] + 0x3FFFFFFF;
while ( v47 <= v48 )
{
v50 = *v47++;
v49 = v50;
if ( !v50 )
break;
if ( v49 != v42 )
GJBaseGameLayer::reparentObject(this, v49, *((cocos2d::CCNode **)this + 606));
}
}
}
LABEL_43:
if ( i == 2 )
{
for ( j = 1; ; ++j )
{
if ( j == 1 )
{
v51 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 610) + 244))(*((_DWORD *)this + 610));
v52 = v51;
if ( !v51 )
continue;
}
else
{
v51 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 611) + 244))(*((_DWORD *)this + 611));
v52 = v51;
if ( !v51 )
goto LABEL_55;
}
v53 = (cocos2d::CCArray *)cocos2d::CCArray::create(v51);
cocos2d::CCArray::addObjectsFromArray(v53, v52);
if ( v53 )
{
v54 = *((_DWORD **)v53 + 13);
if ( *v54 )
{
v55 = (cocos2d::CCNode **)v54[3];
v56 = &v55[*v54] + 0x3FFFFFFF;
while ( v55 <= v56 )
{
v58 = *v55++;
v57 = v58;
if ( !v58 )
break;
GJBaseGameLayer::reparentObject(this, v57, *((cocos2d::CCNode **)this + 609));
}
}
}
LABEL_55:
if ( j == 2 )
{
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 606), this);
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 607), this);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 2678) + 264))(*((_DWORD *)this + 2678), 0);
goto LABEL_97;
}
}
}
}
}
if ( v39() && !*(_BYTE *)(*((_DWORD *)this + 2678) + 948) )
goto LABEL_97;
v59 = *((GJBaseGameLayer **)this + 2678);
v60 = *((_DWORD *)v59 + 235);
v61 = *((_DWORD *)v59 + 236);
if ( v60 > 1 )
v59 = this;
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 606), v59);
if ( v60 <= 1 )
v62 = this;
else
v62 = *((cocos2d::CCNode **)this + 2678);
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 607), v62);
v63 = *((cocos2d::CCNode **)this + 616);
if ( v63 )
{
if ( v60 == 2 && v61 > 1 )
v89 = *((cocos2d::CCNode **)this + 607);
else
v89 = *((cocos2d::CCNode **)this + 606);
GJBaseGameLayer::reparentObject(this, v63, v89);
}
v64 = *((cocos2d::CCNode **)this + 606);
if ( v60 <= 1 )
{
v90 = v61 <= 12;
}
else
{
if ( v61 <= 12 )
{
v64 = *((cocos2d::CCNode **)this + 608);
goto LABEL_71;
}
v90 = v60 <= 13;
}
if ( v90 )
v64 = *((cocos2d::CCNode **)this + 607);
LABEL_71:
v65 = *((cocos2d::CCNode **)this + 614);
if ( v65 )
GJBaseGameLayer::reparentObject(this, v65, v64);
v66 = *((cocos2d::CCNode **)this + 615);
if ( v66 )
GJBaseGameLayer::reparentObject(this, v66, v64);
v67 = *((cocos2d::CCNode **)this + 606);
if ( v60 <= 1 )
{
v91 = v61 <= 13;
}
else
{
if ( v61 <= 13 )
{
v67 = *((cocos2d::CCNode **)this + 608);
goto LABEL_78;
}
v91 = v60 <= 14;
}
if ( v91 )
v67 = *((cocos2d::CCNode **)this + 607);
LABEL_78:
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 2813), v67);
v68 = GJBaseGameLayer::minZOrderForShaderZ(this, v60);
v69 = (cocos2d::CCArray *)GJBaseGameLayer::maxZOrderForShaderZ(this, v61);
v70 = *((cocos2d::CCNode **)this + 611);
v71 = *((cocos2d::CCNode **)this + 610);
v72 = (int)v69;
if ( !*(_BYTE *)(*((_DWORD *)this + 2678) + 949) )
{
LABEL_79:
if ( v60 <= 1 )
v70 = *((cocos2d::CCNode **)this + 610);
v100 = v70;
if ( v60 <= 1 )
v71 = *((cocos2d::CCNode **)this + 609);
v101 = v71;
goto LABEL_84;
}
if ( v60 != 8 )
{
if ( v61 == 8 )
v72 = 60;
goto LABEL_79;
}
if ( v61 != 8 )
{
v68 = 40;
goto LABEL_79;
}
v101 = *((cocos2d::CCNode **)this + 610);
v72 = 60;
v100 = *((cocos2d::CCNode **)this + 611);
v68 = 40;
LABEL_84:
v99 = (cocos2d::CCArray *)cocos2d::CCArray::create(v69);
v73 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 609) + 244))(*((_DWORD *)this + 609));
if ( v73 )
{
v74 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 609) + 244))(*((_DWORD *)this + 609));
v73 = (cocos2d::CCArray *)cocos2d::CCArray::addObjectsFromArray(v99, v74);
}
v75 = (cocos2d::CCArray *)cocos2d::CCArray::create(v73);
v76 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 610) + 244))(*((_DWORD *)this + 610));
if ( v76 )
{
v77 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 610) + 244))(*((_DWORD *)this + 610));
v76 = (cocos2d::CCArray *)cocos2d::CCArray::addObjectsFromArray(v75, v77);
}
v78 = (cocos2d::CCArray *)cocos2d::CCArray::create(v76);
if ( (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 611) + 244))(*((_DWORD *)this + 611)) )
{
v79 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 611) + 244))(*((_DWORD *)this + 611));
cocos2d::CCArray::addObjectsFromArray(v78, v79);
}
for ( k = 1; k == 1; ++k )
{
if ( v99 )
{
v92 = v99;
goto LABEL_129;
}
LABEL_125:
;
}
if ( k == 2 )
{
if ( v75 )
{
v92 = v75;
goto LABEL_129;
}
goto LABEL_125;
}
if ( !v78 )
goto LABEL_94;
v92 = v78;
LABEL_129:
v93 = *((_DWORD **)v92 + 13);
if ( *v93 )
{
v94 = (cocos2d::CCNode **)v93[3];
v102 = &v94[*v93] + 0x3FFFFFFF;
while ( v94 <= v102 )
{
v96 = *v94++;
v95 = v96;
if ( !v96 )
break;
v103 = v95;
v97 = (*(int (__fastcall **)(cocos2d::CCNode *))(*(_DWORD *)v95 + 52))(v95);
if ( v97 >= v68 )
{
v98 = v100;
if ( v97 <= v72 )
v98 = v101;
}
else
{
v98 = *((cocos2d::CCNode **)this + 609);
}
GJBaseGameLayer::reparentObject(this, v103, v98);
}
}
LABEL_94:
if ( k != 3 )
goto LABEL_125;
v81 = v60 > 1;
if ( (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 2678) + 256))(*((_DWORD *)this + 2678)) )
{
if ( (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 2678) + 52))(*((_DWORD *)this + 2678)) != v81 )
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 2678) + 44))(*((_DWORD *)this + 2678), v81);
}
else
{
(*(void (__fastcall **)(GJBaseGameLayer *, _DWORD, int))(*(_DWORD *)this + 232))(
this,
*((_DWORD *)this + 2678),
v81);
}
LABEL_97:
*(_BYTE *)(*((_DWORD *)this + 2678) + 948) = 0;
LABEL_98:
v82 = *((_DWORD *)this + 607);
v83 = *(void (__fastcall **)(int, _BOOL4))(*(_DWORD *)v82 + 172);
v84 = (unsigned int)(*(int (__fastcall **)(int))(*(_DWORD *)v82 + 248))(v82) > 1
|| (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 610) + 248))(*((_DWORD *)this + 610)) != 0;
v83(v82, v84);
v85 = *((_DWORD *)this + 608);
v86 = *(int (__fastcall **)(int, _BOOL4))(*(_DWORD *)v85 + 172);
v87 = (unsigned int)(*(int (__fastcall **)(int))(*(_DWORD *)v85 + 248))(v85) > 1
|| (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 611) + 248))(*((_DWORD *)this + 611)) != 0;
return v86(v85, v87);
}