//
// SetupShaderEffectPopup::setupGrayscale from 0xa05cb4 to 0xa06354 (1696 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0xa08658
// > ??> @ 0x51300
//
// 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::setupGrayscale(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
float v10; // s3
float v11; // s4
void *v12; // x0
float v13; // s2
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; // x21
int v29; // w1
float v30; // [xsp+B0h] [xbp+80h]
float v31; // [xsp+B4h] [xbp+84h]
cocos2d::CCPoint v32; // [xsp+B8h] [xbp+88h] BYREF
cocos2d::CCPoint v33; // [xsp+C0h] [xbp+90h] BYREF
cocos2d::CCPoint v34; // [xsp+C8h] [xbp+98h] BYREF
__int64 v35; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v36; // 0:s0.4,4:s1.4
cocos2d::CCPoint v37; // 0:s0.4,4:s1.4
sub_D153B8((int)&v35, "Setup Grayscale");
SetupTriggerPopup::addTitle((__int64)a1);
v2 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v35 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v2);
}
sub_D153B8((int)&v34, "Help");
sub_D153B8(
(int)&v35,
"Applies a grayscale filter to the screen.\n"
"Target is how much of the filter to apply.\n"
"FadeTime is time until final state is reached.\n"
"Tint Channel lets you set a color channel to tint towards.\n"
"UseLum uses a different conversion to grayscale.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v3 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v35 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v3);
}
v4 = (void *)(*(_QWORD *)&v34 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v34 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(*(_QWORD *)&v34 - 8LL);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(*(_QWORD *)&v34 - 8LL);
*(_DWORD *)(*(_QWORD *)&v34 - 8LL) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v4);
}
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
cocos2d::CCPoint::CCPoint(&v32, v30 * 0.5, (float)(v31 * 0.5) + 85.0);
sub_D153B8((int)&v35, "Target:");
cocos2d::CCPoint::CCPoint(&v33, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v33);
SetupTriggerPopup::createValueControl(a1, 0xB0u, 0.7, 0.0, 0.0, (__int64)&v35, &v34);
v6 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v35 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v35, "FadeTime:");
cocos2d::CCPoint::CCPoint(&v33, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v33);
SetupTriggerPopup::createValueControl(a1, 0xAu, 0.7, 0.0, 0.0, (__int64)&v35, &v34);
v7 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v35 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v35, "UseLum");
cocos2d::CCPoint::CCPoint(&v33, 55.0, -55.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 188, 1.0, (__int64)&v35, &v34, 0, 0, 0);
v8 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v35 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v8);
}
sub_D153B8((int)&v35, " ");
cocos2d::CCPoint::CCPoint(&v33, -24.0, -55.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 190, 1.0, (__int64)&v35, &v34, 0, 0, 0);
v9 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v35 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v9);
}
sub_D153B8((int)&v35, "Tint\nChannel:");
cocos2d::CCPoint::CCPoint(&v33, -100.0, -55.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v33);
v36.y = 0.0;
v36.x = 0.7;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x33u,
v36,
0.0,
v10,
v11,
(std::string)&v35,
&v34,
Float,
Int,
6,
0,
0,
0,
0,
2,
0);
v12 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v35 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v12);
}
cocos2d::CCPoint::CCPoint(&v34, 0.0, -100.0);
cocos2d::CCPoint::operator+(&v35, &v32, &v34);
v37.x = 1.0;
SetupTriggerPopup::createEasingControls(a1, v37, v13, (int)&v35, 0);
}