//
// GJBaseGameLayer::updateShaderLayer from 0x9a2588 to 0x9a2fe0 (2648 bytes)
//
// 7 xrefs:
// > PlayLayer::resetLevel @ 0x711604
// > LevelEditorLayer::onPlaytest @ 0x7966f8
// > LevelEditorLayer::updateGameObjects @ 0x79e75c
// > GJBaseGameLayer::resetLevelVariables @ 0x9e7510
// > GJBaseGameLayer::update @ 0x9ed5c4
// > GJBaseGameLayer::update @ 0x9ee18c
// > ??> @ 0x534a0
//
// 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:08 +0000
//
__int64 __fastcall GJBaseGameLayer::updateShaderLayer(GJBaseGameLayer *this, float a2)
{
__int64 v3; // x2
int v5; // w1
__int64 active; // x0
__int64 v7; // x2
__int64 v8; // x20
int v9; // w1
__int64 v10; // x0
__int64 v11; // x21
__int64 v12; // x20
int v13; // w1
int v14; // w1
int v15; // w1
int v16; // w1
int v17; // w1
int v18; // w1
int v19; // w1
int v20; // w1
int v21; // w0
char v22; // w24
char v23; // w23
char v24; // w20
char shouldBlend; // w0
float v26; // s0
ShaderLayer *v27; // x0
_DWORD *v28; // x2
int v29; // w1
int v30; // w1
float v31; // s10
_BYTE *v32; // x0
__int64 v33; // x0
cocos2d::CCNode *v34; // x2
__int64 v35; // x0
int v36; // w20
int v37; // w21
cocos2d::CCNode *v38; // x1
cocos2d::CCNode *v39; // x1
cocos2d::CCNode *v40; // x2
cocos2d::CCNode *v41; // x1
cocos2d::CCNode *v42; // x2
cocos2d::CCNode *v43; // x23
cocos2d::CCNode *v44; // x1
cocos2d::CCNode *v45; // x1
cocos2d::CCNode *v46; // x2
int v47; // w24
int v48; // w26
cocos2d::CCArray *v49; // x0
cocos2d::CCNode *v50; // x27
cocos2d::CCNode *v51; // x28
cocos2d::CCArray *v52; // x20
cocos2d::CCArray *v53; // x0
cocos2d::CCArray *v54; // x0
cocos2d::CCArray *v55; // x20
cocos2d::CCArray *v56; // x0
cocos2d::CCArray *v57; // x0
cocos2d::CCArray *v58; // x20
cocos2d::CCArray *v59; // x0
int v60; // w23
int j; // w25
cocos2d::CCArray *v62; // x0
unsigned int *v63; // x0
cocos2d::CCNode **v64; // x20
cocos2d::CCNode **v65; // x21
int v66; // w0
cocos2d::CCNode *v67; // x2
int v68; // w0
_BYTE *v69; // x2
__int64 v70; // x20
void (__fastcall *v71)(__int64); // x21
__int64 v72; // x20
void (__fastcall *v73)(__int64); // x21
__int64 v75; // x0
int v76; // w23
cocos2d::CCArray *v77; // x0
cocos2d::CCNode *v78; // x24
cocos2d::CCArray *v79; // x1
cocos2d::CCArray *v80; // x20
unsigned int *v81; // x0
cocos2d::CCNode **v82; // x20
cocos2d::CCNode **i; // x21
cocos2d::CCNode *v84; // x1
int v85; // w21
cocos2d::CCArray *v86; // x0
cocos2d::CCArray *v87; // x1
cocos2d::CCArray *v88; // x20
unsigned int *v89; // x0
cocos2d::CCNode **v90; // x20
cocos2d::CCNode **v91; // x23
cocos2d::CCNode *v92; // x1
cocos2d::CCArray *v93; // [xsp+80h] [xbp+80h]
cocos2d::CCArray *v94; // [xsp+88h] [xbp+88h]
unsigned int v95; // [xsp+94h] [xbp+94h]
cocos2d::CCArray *v96; // [xsp+98h] [xbp+98h]
cocos2d::CCNode *v97; // [xsp+A0h] [xbp+A0h]
cocos2d::CCArray *v98; // [xsp+A0h] [xbp+A0h]
cocos2d::CCArray *v99; // [xsp+A0h] [xbp+A0h]
float v100; // [xsp+A0h] [xbp+A0h]
float v101; // [xsp+C0h] [xbp+C0h] BYREF
float v102; // [xsp+C4h] [xbp+C4h]
v3 = *((_QWORD *)this + 1552);
if ( !v3 )
goto LABEL_79;
v5 = *(_DWORD *)(v3 + 988);
if ( v5 <= 0 )
{
*(_BYTE *)(v3 + 994) = -1;
*(_BYTE *)(v3 + 993) = -1;
*(_BYTE *)(v3 + 992) = -1;
v8 = *((_QWORD *)this + 1552);
v9 = *(_DWORD *)(v8 + 528);
if ( v9 > 0 )
goto LABEL_4;
LABEL_85:
v75 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 493) + 944LL))(*((_QWORD *)this + 493));
*(_WORD *)(v8 + 520) = *(_WORD *)v75;
*(_BYTE *)(v8 + 522) = *(_BYTE *)(v75 + 2);
goto LABEL_5;
}
active = GJEffectManager::activeColorForIndex(*((GJEffectManager **)this + 269), v5);
v7 = *((_QWORD *)this + 1552);
*(_WORD *)(v7 + 992) = active;
*(_BYTE *)(v7 + 994) = BYTE2(active);
v8 = *((_QWORD *)this + 1552);
v9 = *(_DWORD *)(v8 + 528);
if ( v9 <= 0 )
goto LABEL_85;
LABEL_4:
v10 = GJEffectManager::activeColorForIndex(*((GJEffectManager **)this + 269), v9);
*(_WORD *)(v8 + 520) = v10;
*(_BYTE *)(v8 + 522) = BYTE2(v10);
LABEL_5:
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
if ( *(_BYTE *)(v11 + 836) )
{
v13 = *(_DWORD *)(v11 + 840);
if ( v13 )
{
GJBaseGameLayer::positionForShaderTarget(this, v13, (cocos2d::CCPoint *)&v101);
cocos2d::CCPoint::operator=(v11 + 844, &v101);
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
}
if ( *(_BYTE *)(v12 + 528) )
{
v14 = *(_DWORD *)(v12 + 532);
if ( v14 )
{
GJBaseGameLayer::positionForShaderTarget(this, v14, (cocos2d::CCPoint *)&v101);
*(float *)(v12 + 540) = v101;
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
}
if ( *(_BYTE *)(v12 + 529) )
{
v15 = *(_DWORD *)(v12 + 536);
if ( v15 )
{
GJBaseGameLayer::positionForShaderTarget(this, v15, (cocos2d::CCPoint *)&v101);
*(float *)(v12 + 544) = v102;
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
}
v16 = *(_DWORD *)(v12 + 176);
if ( v16 )
{
GJBaseGameLayer::positionForShaderTarget(this, v16, (cocos2d::CCPoint *)&v101);
ShaderLayer::updateShockWaveCenter(v11, &v101);
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
v17 = *(_DWORD *)(v12 + 256);
if ( v17 )
{
GJBaseGameLayer::positionForShaderTarget(this, v17, (cocos2d::CCPoint *)&v101);
ShaderLayer::updateShockLineCenter(v11, &v101);
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
v18 = *(_DWORD *)(v12 + 388);
if ( v18 )
{
GJBaseGameLayer::positionForShaderTarget(this, v18, (cocos2d::CCPoint *)&v101);
cocos2d::CCPoint::operator=(v11 + 812, &v101);
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
v19 = *(_DWORD *)(v12 + 496);
if ( v19 )
{
GJBaseGameLayer::positionForShaderTarget(this, v19, (cocos2d::CCPoint *)&v101);
cocos2d::CCPoint::operator=(v11 + 912, &v101);
v11 = *((_QWORD *)this + 1552);
v12 = v11 + 408;
}
v20 = *(_DWORD *)(v12 + 392);
if ( v20 <= 0 )
{
v24 = 0;
v23 = 0;
v22 = 0;
shouldBlend = 0;
}
else
{
v21 = GJEffectManager::activeColorForIndex(*((GJEffectManager **)this + 269), v20);
v22 = v21;
v23 = BYTE1(v21);
v24 = BYTE2(v21);
shouldBlend = GJEffectManager::shouldBlend(
*((GJEffectManager **)this + 269),
*(_DWORD *)(*((_QWORD *)this + 1552) + 800LL));
v11 = *((_QWORD *)this + 1552);
}
*(_BYTE *)(v11 + 806) = v22;
*(_BYTE *)(v11 + 807) = v23;
*(_BYTE *)(v11 + 808) = v24;
v26 = 0.0;
*(_BYTE *)(*((_QWORD *)this + 1552) + 805LL) = shouldBlend;
v27 = *((ShaderLayer **)this + 1552);
v28 = (_DWORD *)((char *)v27 + 408);
v29 = *((_DWORD *)v27 + 221);
if ( v29 )
{
GJBaseGameLayer::speedForShaderTarget(this, v29, (cocos2d::CCPoint *)&v101);
v27 = *((ShaderLayer **)this + 1552);
v26 = v101;
v28 = (_DWORD *)((char *)v27 + 408);
}
v30 = v28[120];
v31 = 0.0;
if ( v30 )
{
v100 = v26;
GJBaseGameLayer::speedForShaderTarget(this, v30, (cocos2d::CCPoint *)&v101);
v27 = *((ShaderLayer **)this + 1552);
v31 = v102;
v26 = v100;
}
ShaderLayer::updateMotionBlurSpeedX(v27, v26, a2 * 60.0);
ShaderLayer::updateMotionBlurSpeedY(*((ShaderLayer **)this + 1552), v31, a2 * 60.0);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 1552) + 40LL))(*((_QWORD *)this + 1552), a2);
ShaderLayer::performCalculations(*((ShaderLayer **)this + 1552));
v32 = *((_BYTE **)this + 1552);
if ( !v32[1078] )
{
v76 = 1;
if ( !(*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v32 + 512LL))(v32) )
goto LABEL_109;
while ( v76 == 1 )
{
v77 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 488) + 488LL))(*((_QWORD *)this + 488));
v78 = *((cocos2d::CCNode **)this + 491);
v79 = v77;
if ( v77 )
{
LABEL_89:
v98 = v79;
v80 = (cocos2d::CCArray *)cocos2d::CCArray::create(v77);
cocos2d::CCArray::addObjectsFromArray(v80, v98);
if ( v80 )
{
v81 = *((unsigned int **)v80 + 7);
if ( *v81 )
{
v82 = *((cocos2d::CCNode ***)v81 + 2);
for ( i = &v82[*v81 - 1]; i >= v82; ++v82 )
{
v84 = *v82;
if ( !*v82 )
break;
if ( v84 != v78 )
GJBaseGameLayer::reparentObject(this, v84, *((cocos2d::CCNode **)this + 487));
}
}
}
LABEL_96:
if ( v76 == 2 )
{
v85 = 1;
while ( v85 == 1 )
{
v86 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 491) + 488LL))(*((_QWORD *)this + 491));
v87 = v86;
if ( v86 )
{
LABEL_101:
v99 = v87;
v88 = (cocos2d::CCArray *)cocos2d::CCArray::create(v86);
cocos2d::CCArray::addObjectsFromArray(v88, v99);
if ( v88 )
{
v89 = *((unsigned int **)v88 + 7);
if ( *v89 )
{
v90 = *((cocos2d::CCNode ***)v89 + 2);
v91 = &v90[*v89 - 1];
while ( v91 >= v90 )
{
v92 = *v90;
if ( !*v90 )
break;
++v90;
GJBaseGameLayer::reparentObject(this, v92, *((cocos2d::CCNode **)this + 490));
}
}
}
LABEL_106:
if ( v85 == 2 )
{
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 487), this);
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 488), this);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 1552) + 528LL))(
*((_QWORD *)this + 1552),
0);
LABEL_109:
v69 = *((_BYTE **)this + 1552);
LABEL_110:
v69[1076] = 0;
goto LABEL_79;
}
++v85;
}
else
{
v85 = 2;
}
}
v86 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 492) + 488LL))(*((_QWORD *)this + 492));
v87 = v86;
if ( !v86 )
goto LABEL_106;
goto LABEL_101;
}
++v76;
}
else
{
v76 = 2;
}
}
v77 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 489) + 488LL))(*((_QWORD *)this + 489));
v78 = *((cocos2d::CCNode **)this + 492);
v79 = v77;
if ( !v77 )
goto LABEL_96;
goto LABEL_89;
}
v33 = (*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v32 + 512LL))(v32);
v34 = *((cocos2d::CCNode **)this + 1552);
if ( v33 )
{
v35 = (__int64)v34 + 408;
if ( !*((_BYTE *)v34 + 1076) )
goto LABEL_78;
}
else
{
v35 = (__int64)v34 + 408;
}
v36 = *(_DWORD *)(v35 + 660);
v37 = *(_DWORD *)(v35 + 664);
v38 = *((cocos2d::CCNode **)this + 487);
if ( v36 <= 1 )
{
GJBaseGameLayer::reparentObject(this, v38, v34);
v39 = *((cocos2d::CCNode **)this + 488);
v40 = this;
}
else
{
GJBaseGameLayer::reparentObject(this, v38, this);
v39 = *((cocos2d::CCNode **)this + 488);
v40 = *((cocos2d::CCNode **)this + 1552);
}
GJBaseGameLayer::reparentObject(this, v39, v40);
v41 = *((cocos2d::CCNode **)this + 497);
if ( v41 )
{
v42 = *((cocos2d::CCNode **)this + 488);
if ( v37 <= 1 || v36 != 2 )
v42 = *((cocos2d::CCNode **)this + 487);
GJBaseGameLayer::reparentObject(this, v41, v42);
}
v43 = *((cocos2d::CCNode **)this + 487);
v95 = v36 > 1;
if ( v37 > 12 || v36 <= 1 )
{
if ( v36 > 1 || v37 > 12 )
{
if ( v36 <= 13 && v36 > 1 && v37 > 12 )
v43 = *((cocos2d::CCNode **)this + 488);
}
else
{
v43 = *((cocos2d::CCNode **)this + 488);
}
}
else
{
v43 = *((cocos2d::CCNode **)this + 489);
}
v44 = *((cocos2d::CCNode **)this + 495);
if ( v44 )
GJBaseGameLayer::reparentObject(this, v44, v43);
v45 = *((cocos2d::CCNode **)this + 496);
if ( v45 )
GJBaseGameLayer::reparentObject(this, v45, v43);
v46 = *((cocos2d::CCNode **)this + 487);
if ( v37 > 13 || v36 <= 1 )
{
if ( v36 > 1 || v37 > 13 )
{
if ( v36 <= 14 && v36 > 1 && v37 > 13 )
v46 = *((cocos2d::CCNode **)this + 488);
}
else
{
v46 = *((cocos2d::CCNode **)this + 488);
}
}
else
{
v46 = *((cocos2d::CCNode **)this + 489);
}
GJBaseGameLayer::reparentObject(this, *((cocos2d::CCNode **)this + 1664), v46);
v47 = GJBaseGameLayer::minZOrderForShaderZ(this, v36);
v48 = GJBaseGameLayer::maxZOrderForShaderZ(this, v37);
v49 = (cocos2d::CCArray *)*(unsigned __int8 *)(*((_QWORD *)this + 1552) + 1077LL);
if ( !*(_BYTE *)(*((_QWORD *)this + 1552) + 1077LL) )
goto LABEL_51;
if ( v36 != 8 )
{
if ( v37 == 8 )
v48 = 60;
LABEL_51:
v50 = *((cocos2d::CCNode **)this + 491);
v51 = *((cocos2d::CCNode **)this + 492);
v49 = *((cocos2d::CCArray **)this + 490);
if ( v36 <= 1 )
{
v51 = *((cocos2d::CCNode **)this + 491);
v50 = *((cocos2d::CCNode **)this + 490);
}
goto LABEL_53;
}
v50 = *((cocos2d::CCNode **)this + 491);
if ( v37 == 8 )
{
v48 = 60;
v51 = *((cocos2d::CCNode **)this + 492);
v47 = 40;
}
else
{
v47 = 40;
v51 = *((cocos2d::CCNode **)this + 492);
}
LABEL_53:
v52 = (cocos2d::CCArray *)cocos2d::CCArray::create(v49);
v94 = v52;
v53 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 490) + 488LL))(*((_QWORD *)this + 490));
if ( v53 )
{
v54 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 490) + 488LL))(*((_QWORD *)this + 490));
v53 = (cocos2d::CCArray *)cocos2d::CCArray::addObjectsFromArray(v52, v54);
}
v55 = (cocos2d::CCArray *)cocos2d::CCArray::create(v53);
v93 = v55;
v56 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 491) + 488LL))(*((_QWORD *)this + 491));
if ( v56 )
{
v57 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 491) + 488LL))(*((_QWORD *)this + 491));
v56 = (cocos2d::CCArray *)cocos2d::CCArray::addObjectsFromArray(v55, v57);
}
v58 = (cocos2d::CCArray *)cocos2d::CCArray::create(v56);
v96 = v58;
if ( (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 492) + 488LL))(*((_QWORD *)this + 492)) )
{
v59 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 492) + 488LL))(*((_QWORD *)this + 492));
cocos2d::CCArray::addObjectsFromArray(v58, v59);
}
v60 = 1;
for ( j = 0; ; ++j )
{
if ( !j )
{
v62 = v94;
if ( v94 )
goto LABEL_63;
goto LABEL_74;
}
if ( j != 1 )
break;
v62 = v93;
if ( v93 )
goto LABEL_63;
LABEL_74:
++v60;
}
v62 = v96;
if ( !v96 )
goto LABEL_73;
LABEL_63:
v63 = *((unsigned int **)v62 + 7);
if ( *v63 )
{
v64 = *((cocos2d::CCNode ***)v63 + 2);
v65 = &v64[*v63 - 1];
if ( v64 <= v65 )
{
while ( *v64 )
{
v97 = *v64;
v66 = (*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)*v64 + 104LL))(*v64);
if ( v47 > v66 )
{
++v64;
GJBaseGameLayer::reparentObject(this, v97, *((cocos2d::CCNode **)this + 490));
if ( v65 < v64 )
break;
}
else
{
if ( v48 >= v66 )
v67 = v50;
else
v67 = v51;
++v64;
GJBaseGameLayer::reparentObject(this, v97, v67);
if ( v65 < v64 )
break;
}
}
}
}
LABEL_73:
if ( v60 != 3 )
goto LABEL_74;
if ( !(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 1552) + 512LL))(*((_QWORD *)this + 1552)) )
{
(*(void (__fastcall **)(GJBaseGameLayer *, _QWORD, _QWORD))(*(_QWORD *)this + 464LL))(
this,
*((_QWORD *)this + 1552),
v95);
*(_BYTE *)(*((_QWORD *)this + 1552) + 1076LL) = 0;
goto LABEL_79;
}
v68 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 1552) + 104LL))(*((_QWORD *)this + 1552));
v69 = *((_BYTE **)this + 1552);
if ( v95 == v68 )
goto LABEL_110;
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)v69 + 88LL))(*((_QWORD *)this + 1552), v95);
v35 = *((_QWORD *)this + 1552) + 408LL;
LABEL_78:
*(_BYTE *)(v35 + 668) = 0;
LABEL_79:
v70 = *((_QWORD *)this + 488);
v71 = *(void (__fastcall **)(__int64))(*(_QWORD *)v70 + 344LL);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v70 + 496LL))(v70) <= 1 )
(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 491) + 496LL))(*((_QWORD *)this + 491));
v71(v70);
v72 = *((_QWORD *)this + 489);
v73 = *(void (__fastcall **)(__int64))(*(_QWORD *)v72 + 344LL);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v72 + 496LL))(v72) <= 1 )
(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 492) + 496LL))(*((_QWORD *)this + 492));
v73(v72);
return _stack_chk_guard;
}