//
// SetupShaderEffectPopup::setupGlitch from 0x1405e2e60 to 0x1405e34da (1658 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0x1405dfac3
// > ??> @ 0x14092ee2c
//
// 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:01 +0000
//
// Hidden C++ exception states: #wind=3
double __fastcall SetupShaderEffectPopup::setupGlitch(__int64 a1)
{
_QWORD *v2; // r8
_OWORD *v3; // rcx
const char *v4; // rax
__int64 v5; // rdx
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
int v15; // eax
__int128 *v17; // [rsp+48h] [rbp-59h] BYREF
__int128 *v18; // [rsp+50h] [rbp-51h] BYREF
__int128 v19; // [rsp+58h] [rbp-49h] BYREF
__int64 v20; // [rsp+68h] [rbp-39h]
__int64 v21; // [rsp+70h] [rbp-31h]
__int128 v22; // [rsp+78h] [rbp-29h] BYREF
__int64 v23; // [rsp+88h] [rbp-19h]
__int64 v24; // [rsp+90h] [rbp-11h]
char v25; // [rsp+110h] [rbp+6Fh] BYREF
float v26; // [rsp+118h] [rbp+77h] BYREF
float v27; // [rsp+11Ch] [rbp+7Bh]
__int128 *v28; // [rsp+120h] [rbp+7Fh] BYREF
v20 = 12;
v21 = 15;
strcpy((char *)&v19, "Setup Glitch");
BYTE13(v19) = 0;
HIWORD(v19) = 0;
SetupTriggerPopup::addTitle(a1, &v19);
v28 = &v19;
v19 = 0;
v20 = 0;
v21 = 0;
v2 = sub_14003D460(0x140u);
*(_QWORD *)&v19 = v2;
v20 = 312;
v21 = 319;
v3 = v2;
v4 = "Speed defines how fast the glitch effect happens.\n"
"SliceHeight is how high up objects get sliced.\n"
"MaxSliceXOff sets how much objects get sliced.\n"
"MaxColXOff and MaxColYOff is the max offset for the color effect on each axis.\n"
"Relative makes the effect follow screen movement.";
v5 = 2;
do
{
*v3 = *(_OWORD *)v4;
v3[1] = *((_OWORD *)v4 + 1);
v3[2] = *((_OWORD *)v4 + 2);
v3[3] = *((_OWORD *)v4 + 3);
v3[4] = *((_OWORD *)v4 + 4);
v3[5] = *((_OWORD *)v4 + 5);
v3[6] = *((_OWORD *)v4 + 6);
v3 += 8;
*(v3 - 1) = *((_OWORD *)v4 + 7);
v4 += 128;
--v5;
}
while ( v5 );
*v3 = *(_OWORD *)v4;
v3[1] = *((_OWORD *)v4 + 1);
v3[2] = *((_OWORD *)v4 + 2);
*((_QWORD *)v3 + 6) = *((_QWORD *)v4 + 6);
*((_BYTE *)v2 + 312) = 0;
v22 = 0;
v23 = 6;
v24 = 15;
strcpy((char *)&v22, "Glitch");
SetupTriggerPopup::addHelpButton(a1, &v22, &v19);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v26);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, v26 * 0.5, (float)(v27 * 0.5) + 98.0);
v17 = &v22;
*((_QWORD *)&v22 + 1) = 58;
v23 = 9;
v24 = 15;
*(_QWORD *)&v22 = 0x656D695465646146LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v25, &v28, v8);
SetupTriggerPopup::createValueControl(a1, 10, (unsigned int)&v22, (unsigned int)&v28, 1060320051, 0, 0);
v18 = &v22;
*((_QWORD *)&v22 + 1) = 58;
v23 = 9;
v24 = 15;
*(_QWORD *)&v22 = 0x6874676E65727453LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v25, &v28, v9);
SetupTriggerPopup::createValueControl(a1, 176, (unsigned int)&v22, (unsigned int)&v28, 1060320051, 0, 0);
v18 = &v22;
v22 = 0;
v23 = 6;
v24 = 15;
strcpy((char *)&v22, "Speed:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, -100.0, -50.0);
cocos2d::CCPoint::operator+(&v25, &v28, v10);
SetupTriggerPopup::createValueControl(a1, 175, (unsigned int)&v22, (unsigned int)&v28, 1060320051, 0, 0);
v18 = &v19;
v20 = 13;
v21 = 15;
strcpy((char *)&v19, "MaxSliceXOff:");
HIWORD(v19) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, 100.0, -100.0);
cocos2d::CCPoint::operator+(&v25, &v28, v11);
SetupTriggerPopup::createValueControl(a1, 191, (unsigned int)&v19, (unsigned int)&v28, 1060320051, 0, 0);
v18 = &v22;
v23 = 12;
v24 = 15;
strcpy((char *)&v22, "SliceHeight:");
BYTE13(v22) = 0;
HIWORD(v22) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, -100.0, -100.0);
cocos2d::CCPoint::operator+(&v25, &v28, v12);
SetupTriggerPopup::createValueControl(a1, 179, (unsigned int)&v22, (unsigned int)&v28, 1060320051, 0, 0);
v18 = &v19;
v20 = 11;
v21 = 15;
*(_QWORD *)&v19 = 0x4F586C6F4378614DLL;
*((_QWORD *)&v19 + 1) = 3827302;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, -100.0, -150.0);
cocos2d::CCPoint::operator+(&v25, &v28, v13);
SetupTriggerPopup::createValueControl(a1, 181, (unsigned int)&v19, (unsigned int)&v28, 1060320051, 0, 0);
v18 = &v19;
v20 = 11;
v21 = 15;
*(_QWORD *)&v19 = 0x4F596C6F4378614DLL;
*((_QWORD *)&v19 + 1) = 3827302;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, 100.0, -150.0);
cocos2d::CCPoint::operator+(&v25, &v28, v14);
SetupTriggerPopup::createValueControl(a1, 182, (unsigned int)&v19, (unsigned int)&v28, 1060320051, 0, 0);
v28 = &v22;
v23 = 8;
v24 = 15;
v22 = 0x65766974616C6552uLL;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v18,
(float)((float)((float)(*(float *)(a1 + 732) * 0.5) + (float)(v26 * 0.5)) - 72.0) - 90.0,
(float)((float)(v27 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 20.0);
return SetupTriggerPopup::createToggleValueControl(a1, 514, (unsigned int)&v22, v15, 0, 0, 0, 1065353216);
}