//
// SetupShaderEffectPopup::setupShaderTrigger from 0x9fc4a4 to 0x9fccc4 (2080 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0xa086e8
// > ??> @ 0xad2c8
//
// 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 SetupShaderEffectPopup::setupShaderTrigger(SetupShaderEffectPopup *a1)
{
cocos2d::CCPoint *p_m_textOffset; // x0
cocos2d::CCPoint *v3; // x0
void *v4; // x0
cocos2d::CCDirector *v5; // x0
cocos2d::CCPoint *v6; // x0
cocos2d::CCArray *v7; // x0
cocos2d::CCArray *v8; // x0
unsigned int v9; // w19
cocos2d::CCArray *v10; // x0
const char *v11; // x6
cocos2d::CCNode *v12; // x27
cocos2d::CCPoint *v13; // x0
CCMenuItemSpriteExtra *v14; // x28
cocos2d::CCMenu *m_buttonMenu; // x19
cocos2d::CCMenu *v16; // x19
EffectGameObject *m_gameObject; // x0
cocos2d::CCArray *m_gameObjects; // x24
cocos2d::CCArray *v19; // x0
cocos2d::CCArray *v20; // x22
__int64 v21; // x21
__int64 v22; // x21
cocos2d::ccArray *data; // x0
cocos2d::CCObject **arr; // x23
__int64 v25; // x22
char *v26; // x25
cocos2d::CCObject *v27; // x19
int v28; // w26
cocos2d::ccArray *v29; // x0
int v30; // w22
float TriggerValue; // s8
GameObject **v32; // x19
GameObject **v33; // x21
float v34; // s0
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
unsigned int *p_m_caption; // x1
int m_data; // w2
unsigned int *v45; // x1
int v46; // w2
cocos2d::CCArray *v47; // [xsp+90h] [xbp+90h]
cocos2d::CCArray *v48; // [xsp+98h] [xbp+98h]
float v49; // [xsp+B0h] [xbp+B0h]
float v50; // [xsp+B4h] [xbp+B4h]
cocos2d::CCPoint v51; // [xsp+B8h] [xbp+B8h] BYREF
ButtonSprite *v52; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::SEL_MenuHandler v53; // 0:x2.16
cocos2d::CCPoint v54; // 0:s1.4,4:s2.4
cocos2d::CCPoint v55; // 0:s1.4,4:s2.4
sub_D153B8((int)&v52, "Setup Shader Trigger");
SetupTriggerPopup::addTitle((__int64)a1);
p_m_textOffset = &v52[-1].m_textOffset;
if ( &v52[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_caption = (unsigned int *)&v52[-1].m_caption;
do
m_data = __ldaxr(p_m_caption);
while ( __stlxr(m_data - 1, p_m_caption) );
}
else
{
m_data = (int)v52[-1].m_caption.m_data.m_data;
LODWORD(v52[-1].m_caption.m_data.m_data) = m_data - 1;
}
if ( m_data <= 0 )
operator delete(p_m_textOffset);
}
sub_D153B8((int)&v51, "Help");
sub_D153B8(
(int)&v52,
"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, 1.0);
v3 = &v52[-1].m_textOffset;
if ( &v52[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)&v52[-1].m_caption;
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = (int)v52[-1].m_caption.m_data.m_data;
LODWORD(v52[-1].m_caption.m_data.m_data) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v3);
}
v4 = (void *)(*(_QWORD *)&v51 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v51 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(*(_QWORD *)&v51 - 8LL);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(*(_QWORD *)&v51 - 8LL);
*(_DWORD *)(*(_QWORD *)&v51 - 8LL) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v4);
}
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
sub_D153B8((int)&v52, "Disable All");
cocos2d::CCPoint::CCPoint(&v51, v49 * 0.5, (float)(v50 * 0.5) + 90.0);
SetupTriggerPopup::createToggleValueControl(a1, 192, 1.0, (__int64)&v52, &v51, 0, 0, 0);
v6 = &v52[-1].m_textOffset;
if ( &v52[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)&v52[-1].m_caption;
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = (int)v52[-1].m_caption.m_data.m_data;
LODWORD(v52[-1].m_caption.m_data.m_data) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v52, "No Player\nParticles");
cocos2d::CCPoint::CCPoint(&v51, v49 * 0.5, (float)(v50 * 0.5) + 50.0);
SetupTriggerPopup::createToggleValueControl(a1, 188, 1.0, (__int64)&v52, &v51, 0, 0, 0);
v7 = (cocos2d::CCArray *)&v52[-1].m_textOffset;
if ( &v52[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)&v52[-1].m_caption;
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = (int)v52[-1].m_caption.m_data.m_data;
LODWORD(v52[-1].m_caption.m_data.m_data) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v7);
}
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
a1->m_zLayerSprites = v8;
cocos2d::CCObject::retain(v8);
v9 = 1;
v47 = (cocos2d::CCArray *)cocos2d::CCArray::create(v10);
v48 = (cocos2d::CCArray *)cocos2d::CCArray::create(v47);
do
{
while ( 1 )
{
SetupShaderEffectPopup::zLayerToString((SetupShaderEffectPopup *)v9, (__int64)&v52);
v12 = (cocos2d::CCNode *)ButtonSprite::create(
v52,
(const char *)&qword_D8 + 4,
0,
0,
0.3,
"bigFont.fnt",
"GJ_button_04.png",
v11,
25.0);
v13 = &v52[-1].m_textOffset;
if ( &v52[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)&v52[-1].m_caption;
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = (int)v52[-1].m_caption.m_data.m_data;
LODWORD(v52[-1].m_caption.m_data.m_data) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v13);
}
cocos2d::CCArray::addObject(a1->m_zLayerSprites, v12);
v53.adj = (size_t)SetupShaderEffectPopup::onZLayer;
v53.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v14 = CCMenuItemSpriteExtra::create(v12, nullptr, v53);
v14->setTag(v14, v9);
v12->setTag(v12, v9);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v14);
if ( (int)v9 <= 7 )
break;
++v9;
cocos2d::CCArray::addObject(v48, v14);
if ( v9 == 16 )
goto LABEL_11;
}
++v9;
cocos2d::CCArray::addObject(v47, v14);
}
while ( v9 != 16 );
LABEL_11:
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v51, v49 * 0.5, v50 * 0.5);
LODWORD(v54.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v51).y);
GameToolbox::alignItemsHorisontally(v47, 8.0, v54, (bool)&v52);
v16 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v51, v49 * 0.5, (float)(v50 * 0.5) + -40.0);
LODWORD(v55.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(v16, &v51).y);
GameToolbox::alignItemsHorisontally(v48, 8.0, v55, (bool)&v52);
m_gameObject = a1->m_gameObject;
if ( m_gameObject )
{
m_gameObjects = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)m_gameObject);
cocos2d::CCArray::addObject(m_gameObjects, a1->m_gameObject);
}
else
{
m_gameObjects = a1->m_gameObjects;
}
if ( !m_gameObjects )
goto LABEL_39;
v19 = (cocos2d::CCArray *)cocos2d::CCArray::count(m_gameObjects);
if ( !(_DWORD)v19 )
goto LABEL_39;
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create(v19);
v21 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v21);
*(_DWORD *)(v21 + 56) = 196;
*(_QWORD *)v21 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v21);
cocos2d::CCArray::addObject(v20, (cocos2d::CCObject *)v21);
v22 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v22);
*(_DWORD *)(v22 + 56) = 197;
*(_QWORD *)v22 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v22);
cocos2d::CCArray::addObject(v20, (cocos2d::CCObject *)v22);
if ( !v20
|| (data = v20->data, !data->num)
|| (arr = data->arr,
v25 = 8LL * data->num - 8,
v26 = (char *)arr + v25,
arr > (cocos2d::CCObject **)((char *)arr + v25))
|| (v27 = *arr, v28 = 0, !*arr) )
{
LABEL_39:
if ( a1->m_zLayerMin <= 0 )
{
a1->m_zLayerMin = 1;
if ( a1->m_zLayerMax > 0 )
goto LABEL_33;
}
else if ( a1->m_zLayerMax > 0 )
{
goto LABEL_33;
}
a1->m_zLayerMax = 15;
goto LABEL_33;
}
do
{
v29 = m_gameObjects->data;
v30 = (int)v27[1].__vftable;
TriggerValue = -9999.0;
if ( v29->num )
{
v32 = (GameObject **)v29->arr;
v33 = &v32[v29->num - 1];
if ( v32 > v33 )
{
TriggerValue = -9999.0;
}
else
{
TriggerValue = -9999.0;
if ( *v32 )
{
TriggerValue = SetupTriggerPopup::getTriggerValue(a1, v30, *v32);
LABEL_23:
if ( v33 >= ++v32 )
{
while ( *v32 )
{
v34 = SetupTriggerPopup::getTriggerValue(a1, v30, *v32);
if ( TriggerValue != -9999.0 )
{
if ( TriggerValue == v34 )
goto LABEL_23;
goto LABEL_28;
}
++v32;
TriggerValue = v34;
if ( v33 < v32 )
break;
}
}
if ( TriggerValue == -9998.0 )
{
LABEL_28:
v28 = 1;
goto LABEL_29;
}
}
}
}
if ( v30 == 196 )
{
a1->m_zLayerMin = (int)TriggerValue;
}
else if ( v30 == 197 )
{
a1->m_zLayerMax = (int)TriggerValue;
}
LABEL_29:
if ( v26 < (char *)++arr )
break;
v27 = *arr;
}
while ( *arr );
if ( !v28 )
goto LABEL_39;
a1->m_zLayerMin = 0;
a1->m_zLayerMax = 0;
LABEL_33:
SetupShaderEffectPopup::updateZLayerButtons(a1);
}