//
// SetupShaderEffectPopup::setupShaderTrigger from 0x1002cf860 to 0x1002d003a (2010 bytes)
//
// 1 xrefs:
// > SetupShaderEffectPopup::init @ 0x1002c61b3
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall SetupShaderEffectPopup::setupShaderTrigger(SetupShaderEffectPopup *a1)
{
SetupShaderEffectPopup *v1; // rbx
cocos2d::CCObject *v2; // rax
cocos2d::CCObject *v3; // rdi
unsigned int i; // r14d
CCMenuItemSpriteExtra *v5; // r15
cocos2d::CCArray *v6; // rdi
char *v7; // rax
ButtonSprite *v8; // r13
const cocos2d::CCPoint *m_buttonMenu; // r14
cocos2d::CCPoint v10; // xmm1_8
const cocos2d::CCPoint *v11; // r14
cocos2d::CCArray *v12; // rdi
float *m_gameObject; // rsi
__int64 m_gameObjects; // r13
__int64 v15; // r14
cocos2d::CCObject *v16; // r12
cocos2d::CCObject *v17; // r12
unsigned int *v18; // rax
unsigned __int64 v19; // r12
int v20; // r14d
unsigned int *v21; // rax
float TriggerValue; // xmm0_4
GameObject **v23; // r13
GameObject **v24; // r15
int v25; // xmm1_4
GameObject *v26; // rdx
bool v27; // zf
unsigned int v28; // r14d
ButtonSprite *v29; // r15
int v30; // eax
int m_zLayerMin; // ecx
const char *v32; // rsi
float v33; // [rsp+8h] [rbp-E8h] BYREF
char v34; // [rsp+10h] [rbp-E0h] BYREF
char v35[15]; // [rsp+11h] [rbp-DFh] BYREF
void *v36; // [rsp+20h] [rbp-D0h]
__int128 v37; // [rsp+28h] [rbp-C8h] BYREF
void *v38; // [rsp+38h] [rbp-B8h]
void *v39[3]; // [rsp+40h] [rbp-B0h] BYREF
__int128 v40; // [rsp+58h] [rbp-98h] BYREF
void *v41; // [rsp+68h] [rbp-88h]
_BYTE v42[24]; // [rsp+70h] [rbp-80h] BYREF
__int64 v43; // [rsp+88h] [rbp-68h]
cocos2d::CCArray *v44; // [rsp+90h] [rbp-60h]
cocos2d::CCArray *v45; // [rsp+98h] [rbp-58h]
int v46; // [rsp+A4h] [rbp-4Ch]
float v47; // [rsp+A8h] [rbp-48h] BYREF
float v48; // [rsp+ACh] [rbp-44h]
float v49; // [rsp+B0h] [rbp-40h] BYREF
char v50; // [rsp+B4h] [rbp-3Ch] BYREF
void *v51; // [rsp+C0h] [rbp-30h]
v1 = a1;
strcpy((char *)v39, "(Setup Shader Trigger");
SetupTriggerPopup::addTitle((__int64)a1, (__int64)v39);
if ( ((__int64)v39[0] & 1) != 0 )
operator delete(v39[2]);
v34 = 8;
strcpy(v35, "Help");
v38 = operator new(0xA0u);
*(_QWORD *)&v37 = 161;
*((_QWORD *)&v37 + 1) = 159;
strcpy(
(char *)v38,
"Edits how other shader effects work. They can be limited to certain layers or disabled entirely.\n"
"Disable All disables all other shader effects.");
SetupTriggerPopup::addHelpButton((__int64)a1, (__int64)&v34, &v37, (__m128)0x3F800000u);
if ( (v37 & 1) != 0 )
operator delete(v38);
if ( (v34 & 1) != 0 )
operator delete(v36);
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v47);
LOBYTE(v40) = 22;
strcpy((char *)&v40 + 1, "Disable All");
sub_10028CBE0(&v49, v47 * 0.5, (float)(v48 * 0.5) + 90.0);
SetupTriggerPopup::createToggleValueControl((int)a1, 192, &v40, 1.0, (__int64)&v49, 0, 0, 0);
if ( (v40 & 1) != 0 )
operator delete(v41);
strcpy(v42, "&No Player\nParticles");
sub_10028CBE0(&v49, v47 * 0.5, (float)(v48 * 0.5) + 50.0);
SetupTriggerPopup::createToggleValueControl((int)a1, 188, (__int128 *)v42, 1.0, (__int64)&v49, 0, 0, 0);
if ( (v42[0] & 1) != 0 )
{
a1 = *(SetupShaderEffectPopup **)&v42[16];
operator delete(*(void **)&v42[16]);
}
v2 = (cocos2d::CCObject *)sub_10071F9E0(a1, 188);
v1->m_zLayerSprites = (cocos2d::CCArray *)v2;
v3 = v2;
cocos2d::CCObject::retain(v2);
v45 = (cocos2d::CCArray *)sub_10071F9E0(v3, 188);
v44 = (cocos2d::CCArray *)sub_10071F9E0(v3, 188);
for ( i = 1; i != 16; ++i )
{
switch ( i )
{
case 1u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 18242;
goto LABEL_32;
case 2u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 18253;
goto LABEL_32;
case 3u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 13634;
goto LABEL_32;
case 4u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 13378;
goto LABEL_32;
case 5u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 13122;
goto LABEL_32;
case 6u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 12866;
goto LABEL_32;
case 7u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 12610;
goto LABEL_32;
case 8u:
LOWORD(v49) = 20482;
v7 = (char *)&v49 + 2;
break;
case 9u:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 12628;
goto LABEL_32;
case 0xAu:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 12884;
goto LABEL_32;
case 0xBu:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 13140;
goto LABEL_32;
case 0xCu:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 13396;
goto LABEL_32;
case 0xDu:
LOWORD(v49) = 18178;
v7 = (char *)&v49 + 2;
break;
case 0xEu:
LOBYTE(v49) = 4;
*(_WORD *)((char *)&v49 + 1) = 18773;
LABEL_32:
v7 = (char *)&v49 + 3;
break;
case 0xFu:
LOBYTE(v49) = 6;
qmemcpy((char *)&v49 + 1, "Max", 3);
v7 = &v50;
break;
default:
LOBYTE(v49) = 0;
v7 = (char *)&v49 + 1;
break;
}
*v7 = 0;
v8 = ButtonSprite::create_1((const char *)&v49 + 1, 220, 0, 0.30000001, 0, "bigFont.fnt", "GJ_button_04.png", 25.0);
if ( (LOBYTE(v49) & 1) != 0 )
operator delete(v51);
sub_10071FCD0(v1->m_zLayerSprites, v8);
v5 = CCMenuItemSpriteExtra::create(
v8,
nullptr,
v1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SetupShaderEffectPopup::onZLayer);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v5->setTag)(v5, i);
((void (__fastcall *)(ButtonSprite *, _QWORD))v8->setTag)(v8, i);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v1->m_buttonMenu->addChild)(v1->m_buttonMenu, v5);
v6 = v45;
if ( i >= 8 )
v6 = v44;
sub_10071FCD0(v6, v5);
}
m_buttonMenu = (const cocos2d::CCPoint *)v1->m_buttonMenu;
v10 = (cocos2d::CCPoint)LODWORD(v48);
v10.x = v48 * 0.5;
sub_10028CBE0(&v33, v47 * 0.5, v48 * 0.5);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v49, m_buttonMenu);
GameToolbox::alignItemsHorisontally(v45, 8.0, v10, (bool)&v49);
v11 = (const cocos2d::CCPoint *)v1->m_buttonMenu;
v10.y = 0.0;
v10.x = (float)(0.5 * v48) + -40.0;
sub_10028CBE0(&v33, v47 * 0.5, v10.x);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v49, v11);
v12 = v44;
m_gameObject = &v49;
GameToolbox::alignItemsHorisontally(v44, 8.0, v10, (bool)&v49);
if ( v1->m_gameObject )
{
m_gameObjects = sub_10071F9E0(v12, &v49);
m_gameObject = (float *)v1->m_gameObject;
sub_10071FCD0(m_gameObjects, m_gameObject);
if ( !m_gameObjects )
goto LABEL_62;
}
else
{
m_gameObjects = (__int64)v1->m_gameObjects;
if ( !m_gameObjects )
goto LABEL_62;
}
if ( (unsigned int)sub_100720070(m_gameObjects) )
{
v15 = sub_10071F9E0(m_gameObjects, m_gameObject);
v16 = (cocos2d::CCObject *)operator new(0x40u);
cocos2d::CCObject::CCObject(v16);
v16->__vftable = (cocos2d::CCObject_vtbl *)off_1008B8348;
LODWORD(v16[1].__vftable) = 196;
cocos2d::CCObject::autorelease(v16);
sub_10071FCD0(v15, v16);
v17 = (cocos2d::CCObject *)operator new(0x40u);
cocos2d::CCObject::CCObject(v17);
v17->__vftable = (cocos2d::CCObject_vtbl *)off_1008B8348;
LODWORD(v17[1].__vftable) = 197;
cocos2d::CCObject::autorelease(v17);
sub_10071FCD0(v15, v17);
if ( v15 )
{
v18 = *(unsigned int **)(v15 + 56);
if ( *v18 )
{
v19 = *((_QWORD *)v18 + 2);
v45 = (cocos2d::CCArray *)(v19 + 8LL * *v18 - 8);
v46 = 0;
v43 = m_gameObjects;
do
{
if ( !*(_QWORD *)v19 )
break;
v20 = *(_DWORD *)(*(_QWORD *)v19 + 56LL);
v21 = *(unsigned int **)(m_gameObjects + 56);
TriggerValue = -9999.0;
if ( !*v21 )
goto LABEL_56;
v23 = *((GameObject ***)v21 + 2);
v24 = &v23[*v21 - 1];
v25 = -971228160;
while ( 1 )
{
v26 = *v23;
if ( !*v23 )
break;
LODWORD(v44) = v25;
TriggerValue = SetupTriggerPopup::getTriggerValue(v1, v20, v26);
if ( *(float *)&v44 != -9999.0 )
{
v27 = *(float *)&v44 == TriggerValue;
TriggerValue = *(float *)&v44;
if ( !v27 )
{
LOBYTE(v21) = 1;
v46 = (int)v21;
m_gameObjects = v43;
goto LABEL_44;
}
}
++v23;
v25 = LODWORD(TriggerValue);
if ( v23 > v24 )
goto LABEL_54;
}
TriggerValue = *(float *)&v25;
LABEL_54:
m_gameObjects = v43;
if ( TriggerValue == -9998.0 )
{
LOBYTE(v21) = 1;
v46 = (int)v21;
}
else
{
LABEL_56:
if ( v20 == 197 )
{
v1->m_zLayerMax = (int)TriggerValue;
}
else if ( v20 == 196 )
{
v1->m_zLayerMin = (int)TriggerValue;
}
}
LABEL_44:
v19 += 8LL;
}
while ( v19 <= (unsigned __int64)v45 );
if ( (v46 & 1) != 0 )
{
*(_QWORD *)&v1->m_zLayerMin = 0;
if ( !(unsigned int)sub_100720070(v1->m_zLayerSprites) )
return;
goto LABEL_68;
}
}
}
}
LABEL_62:
if ( v1->m_zLayerMin <= 0 )
{
v1->m_zLayerMin = 1;
if ( v1->m_zLayerMax > 0 )
{
LABEL_64:
if ( !(unsigned int)sub_100720070(v1->m_zLayerSprites) )
return;
goto LABEL_68;
}
}
else if ( v1->m_zLayerMax > 0 )
{
goto LABEL_64;
}
v1->m_zLayerMax = 15;
if ( !(unsigned int)sub_100720070(v1->m_zLayerSprites) )
return;
LABEL_68:
v28 = 0;
do
{
v29 = (ButtonSprite *)sub_1007200C0(v1->m_zLayerSprites, v28);
v30 = ((__int64 (__fastcall *)(ButtonSprite *))v29->getTag)(v29);
m_zLayerMin = v1->m_zLayerMin;
v32 = "GJ_button_02.png";
if ( v30 != m_zLayerMin )
{
v32 = "GJ_button_02.png";
if ( v30 != v1->m_zLayerMax )
{
v32 = "GJ_button_01.png";
if ( v30 >= v1->m_zLayerMax )
v32 = "GJ_button_04.png";
if ( v30 <= m_zLayerMin )
v32 = "GJ_button_04.png";
}
}
ButtonSprite::updateBGImage(v29, v32);
++v28;
}
while ( v28 < (unsigned int)sub_100720070(v1->m_zLayerSprites) );
}