//
// SetupShaderEffectPopup::setupShaderTrigger from 0x1405dfdb0 to 0x1405e04be (1806 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0x1405dfb65
// > ??> @ 0x14092edb4
//
// This function is hookable on this platform (idp: pc, 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 11:35:00 +0000
//
// Hidden C++ exception states: #wind=5
__int64 __fastcall SetupShaderEffectPopup::setupShaderTrigger(__int64 a1)
{
__int64 v2; // rcx
__int64 v3; // rax
int v4; // eax
int v5; // eax
__int64 v6; // rcx
cocos2d::CCObject *v7; // rax
__int64 v8; // rcx
__int64 v9; // r15
__int64 v10; // rcx
__int64 v11; // r12
unsigned int i; // r14d
__int64 *v13; // rax
__int64 v14; // rbx
cocos2d::CCObject *v15; // rsi
cocos2d::CCObject *v16; // rbx
cocos2d::CCArray *v17; // rcx
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rbx
__int64 v22; // rax
double v23; // xmm0_8
__int64 v24; // rax
__int64 v25; // rcx
char v26; // r14
cocos2d::CCArray *v27; // r13
__int64 v28; // rcx
cocos2d::CCArray *v29; // rbx
struct cocos2d::CCObject *v30; // rax
struct cocos2d::CCObject *v31; // rax
unsigned int *v32; // r15
__int64 v33; // rax
unsigned __int64 v34; // r15
unsigned __int64 v35; // r12
unsigned int v36; // esi
float v37; // xmm6_4
unsigned int *v38; // rbx
__int64 v39; // rax
_QWORD *v40; // rbx
_QWORD *v41; // r14
unsigned int v42; // esi
char v44; // [rsp+58h] [rbp-69h]
float v45; // [rsp+60h] [rbp-61h] BYREF
float v46; // [rsp+64h] [rbp-5Dh]
__int128 v47; // [rsp+68h] [rbp-59h] BYREF
__int64 v48; // [rsp+78h] [rbp-49h]
__int64 v49; // [rsp+80h] [rbp-41h]
__int128 *v50; // [rsp+88h] [rbp-39h] BYREF
__int128 *v51; // [rsp+90h] [rbp-31h] BYREF
__int128 v52; // [rsp+98h] [rbp-29h] BYREF
__int64 v53; // [rsp+A8h] [rbp-19h]
__int64 v54; // [rsp+B0h] [rbp-11h]
v47 = 0;
*(_QWORD *)&v47 = sub_14003D460(0x20u);
v48 = 20;
v49 = 31;
strcpy((char *)v47, "Setup Shader Trigger");
SetupTriggerPopup::addTitle(a1, &v47);
v50 = &v47;
v47 = 0;
v48 = 0;
v49 = 0;
*(_QWORD *)&v47 = sub_14003D460(0xA0u);
v48 = 159;
v49 = 159;
strcpy(
(char *)v47,
"Edits how other shader effects work. They can be limited to certain layers or disabled entirely.\n"
"Disable All disables all other shader effects.");
v52 = 0;
v53 = 4;
v54 = 15;
strcpy((char *)&v52, "Help");
SetupTriggerPopup::addHelpButton(a1, &v52, &v47);
v3 = cocos2d::CCDirector::sharedDirector(v2);
cocos2d::CCDirector::getWinSize(v3, &v45);
v50 = &v47;
v48 = 11;
v49 = 15;
*(_QWORD *)&v47 = 0x20656C6261736944LL;
*((_QWORD *)&v47 + 1) = 7105601;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v51, v45 * 0.5, (float)(v46 * 0.5) + 90.0);
SetupTriggerPopup::createToggleValueControl(a1, 192, (unsigned int)&v47, v4, 0, 0, 0, 1065353216);
v51 = &v47;
v47 = 0;
v48 = 0;
v49 = 0;
*(_QWORD *)&v47 = sub_14003D460(0x20u);
v48 = 19;
v49 = 31;
strcpy((char *)v47, "No Player\nParticles");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, v45 * 0.5, (float)(v46 * 0.5) + 50.0);
SetupTriggerPopup::createToggleValueControl(a1, 188, (unsigned int)&v47, v5, 0, 0, 0, 1065353216);
v7 = (cocos2d::CCObject *)cocos2d::CCArray::create(v6);
*(_QWORD *)(a1 + 1000) = v7;
cocos2d::CCObject::retain(v7);
v9 = cocos2d::CCArray::create(v8);
v11 = cocos2d::CCArray::create(v10);
for ( i = 1; (int)i <= 15; ++i )
{
v13 = (__int64 *)SetupShaderEffectPopup::zLayerToString(&v52, i);
v14 = (__int64)v13;
if ( (unsigned __int64)v13[3] > 0xF )
v14 = *v13;
v51 = (__int128 *)operator new(0x2C8u);
v15 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v51);
if ( v15 )
{
if ( ButtonSprite::init_1(
(__int64)v15,
v14,
220,
0,
1050253722,
0,
&qword_140704F78,
(__int64)"GJ_button_04.png",
1103626240) )
{
cocos2d::CCObject::autorelease(v15);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v15 + 8LL))(v15, 1);
v15 = nullptr;
}
}
sub_14003D310((__int64)&v52);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1000), v15);
v50 = (__int128 *)operator new(0x208u);
v16 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v50);
if ( v16 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v16, (__int64 *)v15, 0, a1, (__int64)SetupShaderEffectPopup::onZLayer) )
{
cocos2d::CCObject::autorelease(v16);
goto LABEL_13;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v16 + 8LL))(v16, 1);
}
v16 = nullptr;
LABEL_13:
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v16 + 64LL))(v16, i);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v15 + 64LL))(v15, i);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v16);
v17 = (cocos2d::CCArray *)v11;
if ( i <= 7 )
v17 = (cocos2d::CCArray *)v9;
cocos2d::CCArray::addObject(v17, v16);
}
v18 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v51, v45 * 0.5, v46 * 0.5);
cocos2d::CCNode::convertToNodeSpace(v18, &v50, v19);
GameToolbox::alignItemsHorisontally(v9, 8.0, v20, 0);
v21 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v51, v45 * 0.5, (float)(v46 * 0.5) - 40.0);
v23 = cocos2d::CCNode::convertToNodeSpace(v21, &v50, v22);
GameToolbox::alignItemsHorisontally(v11, 8.0, v24, 0);
v26 = 0;
v44 = 0;
if ( *(_QWORD *)(a1 + 680) )
{
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v25);
cocos2d::CCArray::addObject(v27, *(struct cocos2d::CCObject **)(a1 + 680));
}
else
{
v27 = *(cocos2d::CCArray **)(a1 + 688);
}
if ( !v27 )
goto LABEL_42;
if ( !cocos2d::CCArray::count(v27) )
goto LABEL_42;
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create(v28);
v30 = cocos2d::CCInteger::create(196);
cocos2d::CCArray::addObject(v29, v30);
v31 = cocos2d::CCInteger::create(197);
cocos2d::CCArray::addObject(v29, v31);
if ( !v29 )
goto LABEL_42;
v32 = *((unsigned int **)v29 + 7);
v33 = *v32;
if ( !(_DWORD)v33 )
goto LABEL_42;
v34 = *((_QWORD *)v32 + 2);
v35 = v34 + 8 * (v33 - 1);
if ( v34 > v35 )
goto LABEL_42;
while ( 2 )
{
if ( *(_QWORD *)v34 )
{
v36 = *(_DWORD *)(*(_QWORD *)v34 + 56LL);
v37 = -9999.0;
v38 = *((unsigned int **)v27 + 7);
v39 = *v38;
if ( (_DWORD)v39 )
{
v40 = *((_QWORD **)v38 + 2);
v41 = &v40[v39 - 1];
if ( v40 <= v41 )
{
do
{
if ( !*v40 )
break;
SetupTriggerPopup::getTriggerValue(a1, v36);
if ( v37 == -9999.0 )
{
v37 = *(float *)&v23;
}
else if ( v37 != *(float *)&v23 )
{
goto LABEL_33;
}
++v40;
}
while ( v40 <= v41 );
if ( v37 != -9998.0 )
goto LABEL_34;
LABEL_33:
v26 = 1;
v44 = 1;
LABEL_39:
v34 += 8LL;
if ( v34 > v35 )
break;
continue;
}
LABEL_34:
v26 = v44;
}
v42 = v36 - 196;
if ( v42 )
{
if ( v42 == 1 )
*(_DWORD *)(a1 + 1012) = (int)v37;
}
else
{
*(_DWORD *)(a1 + 1008) = (int)v37;
}
goto LABEL_39;
}
break;
}
if ( v26 )
{
*(_QWORD *)(a1 + 1008) = 0;
return SetupShaderEffectPopup::updateZLayerButtons(a1);
}
LABEL_42:
if ( *(int *)(a1 + 1008) <= 0 )
*(_DWORD *)(a1 + 1008) = 1;
if ( *(int *)(a1 + 1012) <= 0 )
*(_DWORD *)(a1 + 1012) = 15;
return SetupShaderEffectPopup::updateZLayerButtons(a1);
}