//
// SetupShaderEffectPopup::setupGrayscale from 0x1405e7f00 to 0x1405e83fd (1277 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0x1405dfb29
// > ??> @ 0x14092ee98
//
// 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:02 +0000
//
// Hidden C++ exception states: #wind=3
double __fastcall SetupShaderEffectPopup::setupGrayscale(__int64 a1)
{
_QWORD *v2; // r9
_QWORD *v3; // rcx
const char *v4; // rdx
__int64 v5; // r8
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
int v14; // r8d
int v15; // r9d
char v17; // [rsp+80h] [rbp-41h]
__int128 *v18; // [rsp+88h] [rbp-39h] BYREF
__int128 *v19; // [rsp+90h] [rbp-31h] BYREF
__int128 v20; // [rsp+98h] [rbp-29h] BYREF
__int64 v21; // [rsp+A8h] [rbp-19h]
__int64 v22; // [rsp+B0h] [rbp-11h]
__int128 v23; // [rsp+B8h] [rbp-9h] BYREF
__int64 v24; // [rsp+C8h] [rbp+7h]
__int64 v25; // [rsp+D0h] [rbp+Fh]
char v26; // [rsp+130h] [rbp+6Fh] BYREF
float v27; // [rsp+138h] [rbp+77h] BYREF
float v28; // [rsp+13Ch] [rbp+7Bh]
__int128 *v29; // [rsp+140h] [rbp+7Fh] BYREF
v21 = 15;
v22 = 15;
strcpy((char *)&v20, "Setup Grayscale");
SetupTriggerPopup::addTitle(a1, &v20);
v29 = &v20;
v20 = 0;
v21 = 0;
v22 = 0;
v2 = sub_14003D460(0x120u);
*(_QWORD *)&v20 = v2;
v21 = 279;
v22 = 287;
v3 = v2;
v4 = "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.";
v5 = 2;
do
{
*(_OWORD *)v3 = *(_OWORD *)v4;
*((_OWORD *)v3 + 1) = *((_OWORD *)v4 + 1);
*((_OWORD *)v3 + 2) = *((_OWORD *)v4 + 2);
*((_OWORD *)v3 + 3) = *((_OWORD *)v4 + 3);
*((_OWORD *)v3 + 4) = *((_OWORD *)v4 + 4);
*((_OWORD *)v3 + 5) = *((_OWORD *)v4 + 5);
*((_OWORD *)v3 + 6) = *((_OWORD *)v4 + 6);
v3 += 16;
*((_OWORD *)v3 - 1) = *((_OWORD *)v4 + 7);
v4 += 128;
--v5;
}
while ( v5 );
*(_OWORD *)v3 = *(_OWORD *)v4;
*((_DWORD *)v3 + 4) = *((_DWORD *)v4 + 4);
*((_WORD *)v3 + 10) = *((_WORD *)v4 + 10);
*((_BYTE *)v3 + 22) = v4[22];
*((_BYTE *)v2 + 279) = 0;
v23 = 0;
v24 = 4;
v25 = 15;
strcpy((char *)&v23, "Help");
SetupTriggerPopup::addHelpButton(a1, &v23, &v20);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v27);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v26, v27 * 0.5, (float)(v28 * 0.5) + 85.0);
v18 = &v20;
v21 = 7;
v22 = 15;
v20 = 0x3A746567726154uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v26, &v29, v8);
SetupTriggerPopup::createValueControl(a1, 176, (unsigned int)&v20, (unsigned int)&v29, 1060320051, 0, 0);
v19 = &v20;
*((_QWORD *)&v20 + 1) = 58;
v21 = 9;
v22 = 15;
*(_QWORD *)&v20 = 0x656D695465646146LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v26, &v29, v9);
SetupTriggerPopup::createValueControl(a1, 10, (unsigned int)&v20, (unsigned int)&v29, 1060320051, 0, 0);
v19 = &v20;
v20 = 0;
v21 = 6;
v22 = 15;
strcpy((char *)&v20, "UseLum");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, 55.0, -55.0);
cocos2d::CCPoint::operator+(&v26, &v29, v10);
SetupTriggerPopup::createToggleValueControl(a1, 188, (unsigned int)&v20, (unsigned int)&v29, 0, 0, 0, 1065353216);
v19 = &v23;
v23 = 0;
v24 = 1;
v25 = 15;
LOWORD(v23) = 32;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, -24.0, -55.0);
cocos2d::CCPoint::operator+(&v26, &v29, v11);
SetupTriggerPopup::createToggleValueControl(a1, 190, (unsigned int)&v23, (unsigned int)&v29, 0, 0, 0, 1065353216);
v19 = &v20;
v21 = 13;
v22 = 15;
strcpy((char *)&v20, "Tint\nChannel:");
HIWORD(v20) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, -100.0, -55.0);
cocos2d::CCPoint::operator+(&v26, &v29, v12);
v17 = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
51,
(unsigned int)&v20,
(unsigned int)&v29,
1060320051,
1,
2,
6,
0,
0,
0,
0,
0,
0,
2,
v17,
v18);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, 0.0, -100.0);
cocos2d::CCPoint::operator+(&v26, &v29, v13);
return SetupTriggerPopup::createEasingControls(a1, (unsigned int)&v29, v14, v15, 0);
}