//
// SetupShaderEffectPopup::setupGlitch from 0x9ff7f0 to 0xa00084 (2196 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0xa086c4
// > ??> @ 0xa3cb0
//
// 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::setupGlitch(SetupShaderEffectPopup *a1)
{
void *v2; // x0
void *v3; // x0
void *v4; // x0
cocos2d::CCDirector *v5; // x0
void *v6; // x0
void *v7; // x0
void *v8; // x0
void *v9; // x0
void *v10; // x0
void *v11; // x0
void *v12; // x0
void *v13; // x19
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x21
int v35; // w0
float v36; // [xsp+80h] [xbp+80h]
float v37; // [xsp+84h] [xbp+84h]
cocos2d::CCPoint v38; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v39; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v40; // [xsp+98h] [xbp+98h] BYREF
__int64 v41; // [xsp+A0h] [xbp+A0h] BYREF
sub_D153B8((int)&v41, "Setup Glitch");
SetupTriggerPopup::addTitle((__int64)a1);
v2 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v41 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v2);
}
sub_D153B8((int)&v40, "Glitch");
sub_D153B8(
(int)&v41,
"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.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v3 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v41 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v3);
}
v4 = (void *)(*(_QWORD *)&v40 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v40 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(*(_QWORD *)&v40 - 8LL);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(*(_QWORD *)&v40 - 8LL);
*(_DWORD *)(*(_QWORD *)&v40 - 8LL) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v4);
}
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
cocos2d::CCPoint::CCPoint(&v38, v36 * 0.5, (float)(v37 * 0.5) + 98.0);
sub_D153B8((int)&v41, "FadeTime:");
cocos2d::CCPoint::CCPoint(&v39, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xAu, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v6 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v41 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v41, "Strength:");
cocos2d::CCPoint::CCPoint(&v39, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xB0u, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v7 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v41 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v41, "Speed:");
cocos2d::CCPoint::CCPoint(&v39, -100.0, -50.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xAFu, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v8 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v41 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v8);
}
sub_D153B8((int)&v41, "MaxSliceXOff:");
cocos2d::CCPoint::CCPoint(&v39, 100.0, -100.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xBFu, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v9 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v41 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v9);
}
sub_D153B8((int)&v41, "SliceHeight:");
cocos2d::CCPoint::CCPoint(&v39, -100.0, -100.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xB3u, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v10 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v41 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v10);
}
sub_D153B8((int)&v41, "MaxColXOff:");
cocos2d::CCPoint::CCPoint(&v39, -100.0, -150.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xB5u, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v11 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v41 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v11);
}
sub_D153B8((int)&v41, "MaxColYOff:");
cocos2d::CCPoint::CCPoint(&v39, 100.0, -150.0);
cocos2d::CCPoint::operator+(&v40, &v38, &v39);
SetupTriggerPopup::createValueControl(a1, 0xB6u, 0.7, 0.0, 0.0, (__int64)&v41, &v40);
v12 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v41 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v41, "Relative");
cocos2d::CCPoint::CCPoint(
&v40,
(float)((float)((float)(a1->m_width * 0.5) + (float)(v36 * 0.5)) - 72.0) - 90.0,
20.0 - (float)((float)(a1->m_height * 0.5) - (float)(v37 * 0.5)));
SetupTriggerPopup::createToggleValueControl(a1, 514, 1.0, (__int64)&v41, &v40, 0, 0, 0);
v13 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(v41 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v13);
}
}