//
// SetupShaderEffectPopup::setupChromaticGlitch from 0xa0080c to 0xa0121c (2576 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0xa086ac
// > ??> @ 0x55c08
//
// 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::setupChromaticGlitch(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; // x0
void *v14; // x0
void *v15; // x0
float v16; // s2
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x21
int v42; // w1
float v43; // [xsp+80h] [xbp+80h]
float v44; // [xsp+84h] [xbp+84h]
cocos2d::CCPoint v45; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v46; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v47; // [xsp+98h] [xbp+98h] BYREF
__int64 v48; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v49; // 0:s0.4,4:s1.4
sub_D153B8((int)&v48, "Setup Chroma Glitch");
SetupTriggerPopup::addTitle((__int64)a1);
v2 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v48 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v2);
}
sub_D153B8((int)&v47, "Help");
sub_D153B8(
(int)&v48,
"Applies chromatic aberration in waves alongside glitch lines.\n"
"Speed is how fast the wave effect happens.\n"
"Strength is how big the waves are.\n"
"LineThickness is how big the lines are.\n"
"LineStrength is the opacity of the lines.\n"
"RGBOff sets color offset.\n"
"FadeTime is time until final state is reached.\n"
"RelativePos changes the shape of the effect based on position.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v3 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v48 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v3);
}
v4 = (void *)(*(_QWORD *)&v47 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v47 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(*(_QWORD *)&v47 - 8LL);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(*(_QWORD *)&v47 - 8LL);
*(_DWORD *)(*(_QWORD *)&v47 - 8LL) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v4);
}
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
cocos2d::CCPoint::CCPoint(&v45, v43 * 0.5, (float)(v44 * 0.5) + 100.0);
sub_D153B8((int)&v48, "Speed:");
cocos2d::CCPoint::CCPoint(&v46, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xAFu, 0.6, 0.0, 5.0, (__int64)&v48, &v47);
v6 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v48 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v48, "RGBOff:");
cocos2d::CCPoint::CCPoint(&v46, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xB4u, 0.6, 0.0, 5.0, (__int64)&v48, &v47);
v7 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v48 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v48, "Strength:");
cocos2d::CCPoint::CCPoint(&v46, -100.0, -40.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xB0u, 0.6, 0.0, 5.0, (__int64)&v48, &v47);
v8 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v48 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v8);
}
sub_D153B8((int)&v48, "FadeTime:");
cocos2d::CCPoint::CCPoint(&v46, 100.0, -40.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xAu, 0.6, 0.0, 5.0, (__int64)&v48, &v47);
v9 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v48 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v9);
}
sub_D153B8((int)&v48, "LineThickness:");
cocos2d::CCPoint::CCPoint(&v46, -100.0, -80.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xB3u, 0.6, 0.0, 2.0, (__int64)&v48, &v47);
v10 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(v48 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v10);
}
sub_D153B8((int)&v48, "SegmentH:");
cocos2d::CCPoint::CCPoint(&v46, 100.0, -80.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xBDu, 0.6, 0.0, 5.0, (__int64)&v48, &v47);
v11 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v48 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v11);
}
sub_D153B8((int)&v48, "LineStrength:");
cocos2d::CCPoint::CCPoint(&v46, -100.0, -120.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createValueControl(a1, 0xBFu, 0.6, 0.0, 2.0, (__int64)&v48, &v47);
v12 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v48 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v48, "Disable");
cocos2d::CCPoint::CCPoint(&v46, 110.0, -125.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createToggleValueControl(a1, 192, 1.0, (__int64)&v48, &v47, 0, 0, 0);
v13 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v48 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v13);
}
sub_D153B8((int)&v48, "Relative\nPos");
cocos2d::CCPoint::CCPoint(&v46, 110.0, -155.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createToggleValueControl(a1, 194, 1.0, (__int64)&v48, &v47, 0, 0, 0);
v14 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v48 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v14);
}
sub_D153B8((int)&v48, "Relative");
cocos2d::CCPoint::CCPoint(
&v47,
(float)((float)((float)(a1->m_width * 0.5) + (float)(v43 * 0.5)) - 72.0) - 90.0,
20.0 - (float)((float)(a1->m_height * 0.5) - (float)(v44 * 0.5)));
SetupTriggerPopup::createToggleValueControl(a1, 514, 1.0, (__int64)&v48, &v47, 0, 0, 0);
v15 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v48 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v15);
}
cocos2d::CCPoint::CCPoint(&v47, 0.0, -160.0);
cocos2d::CCPoint::operator+(&v48, &v45, &v47);
v49.x = 0.8;
SetupTriggerPopup::createEasingControls(a1, v49, v16, (int)&v48, 0);
}