//
// SetupShaderEffectPopup::setupGrayscale from 0x140452660 to 0x140452b5d (1277 bytes)
//
// 2 xrefs:
// > SetupShaderEffectPopup::init @ 0x14044a410
// > ??> @ 0x1406da7fc
//
// 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
//
// Hidden C++ exception states: #wind=3
void SetupShaderEffectPopup::setupGrayscale(SetupShaderEffectPopup *a1)
{
_QWORD *v2; // r9
_QWORD *v3; // rcx
const char *v4; // rdx
__int64 v5; // r8
double v6; // xmm0_8
__int64 v7; // rcx
cocos2d::CCDirector *v8; // rax
double v9; // xmm0_8
double v10; // xmm0_8
int v11; // r9d
char v12; // [rsp+80h] [rbp-41h]
__int128 v13; // [rsp+98h] [rbp-29h] BYREF
__int64 v14; // [rsp+A8h] [rbp-19h]
__int64 v15; // [rsp+B0h] [rbp-11h]
__int128 v16; // [rsp+B8h] [rbp-9h] BYREF
__int64 v17; // [rsp+C8h] [rbp+7h]
__int64 v18; // [rsp+D0h] [rbp+Fh]
char v19; // [rsp+130h] [rbp+6Fh] BYREF
float v20; // [rsp+138h] [rbp+77h]
__int128 *v21; // [rsp+140h] [rbp+7Fh] BYREF
v14 = 15;
v15 = 15;
strcpy((char *)&v13, "Setup Grayscale");
SetupTriggerPopup::addTitle(a1, &v13);
v21 = &v13;
v13 = 0;
v14 = 0;
v15 = 15;
v2 = sub_14003AA10(0x120u);
*(_QWORD *)&v13 = v2;
v14 = 279;
v15 = 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;
v16 = 0;
v17 = 4;
v18 = 15;
strcpy((char *)&v16, "Help");
v6 = SetupTriggerPopup::addHelpButton(a1, &v16, &v13);
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8);
v9 = cocos2d::CCPoint::CCPoint(*(float *)&v6, v20 * 0.5);
v14 = 7;
v15 = 15;
v13 = 0x3A746567726154uLL;
cocos2d::CCPoint::CCPoint(*(float *)&v9, -100.0);
cocos2d::CCPoint::operator+(&v19, &v21);
SetupTriggerPopup::createValueControl((_DWORD)a1, 176, (unsigned int)&v13, (unsigned int)&v21, 1060320051, 0, 0);
*((_QWORD *)&v13 + 1) = 58;
v14 = 9;
v15 = 15;
*(_QWORD *)&v13 = 0x656D695465646146LL;
cocos2d::CCPoint::CCPoint(6.7405871e22, 100.0);
cocos2d::CCPoint::operator+(&v19, &v21);
SetupTriggerPopup::createValueControl((_DWORD)a1, 10, (unsigned int)&v13, (unsigned int)&v21, 1060320051, 0, 0);
v13 = 0;
v14 = 6;
v15 = 15;
strcpy((char *)&v13, "UseLum");
cocos2d::CCPoint::CCPoint(0.0, 55.0);
cocos2d::CCPoint::operator+(&v19, &v21);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
188,
(unsigned int)&v13,
(unsigned int)&v21,
0,
0,
0,
1065353216);
v16 = 0;
v17 = 1;
v18 = 15;
LOWORD(v16) = 32;
cocos2d::CCPoint::CCPoint(0.0, -24.0);
cocos2d::CCPoint::operator+(&v19, &v21);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
190,
(unsigned int)&v16,
(unsigned int)&v21,
0,
0,
0,
1065353216);
v14 = 13;
v15 = 15;
strcpy((char *)&v13, "Tint\nChannel:");
HIWORD(v13) = 0;
cocos2d::CCPoint::CCPoint(7.5555601e31, -100.0);
cocos2d::CCPoint::operator+(&v19, &v21);
v12 = 0;
v10 = SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
51,
(unsigned int)&v13,
(unsigned int)&v21,
1060320051,
1,
2,
6,
0,
0,
0,
0,
0,
0,
2,
v12,
&v13,
&v13);
cocos2d::CCPoint::CCPoint(*(float *)&v10, 0.0);
cocos2d::CCPoint::operator+(&v19, &v21);
SetupTriggerPopup::createEasingControls(a1, (cocos2d::CCPoint)&v21, 1.0, v11, 0);
}