Using a #define keydef in uniform key var

More
4 years 7 months ago - 4 years 7 months ago #1 by OtisInf
I defined in the cfg file:
#define DOF_MouseAFFocusPointToggleKey VK_PAUSE //[undef] //- <<<<<<< line 82

and used it in the shader fx: (inside the namespace def)
uniform bool PauseKeyDown < source = "key"; keycode = DOF_MouseAFFocusPointToggleKey; toggle=true; >;

(var name should of course change, but it's for testing ;)).

If I do this, I get:
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'
C:\Games\Assassin's Creed Syndicate\ReShade/Presets/Default/Shaders_by_MartyMcFly.cfg(82, 9): preprocessor error: redefinition of 'DOF_MouseAFFocusPointToggleKey'

Which is kind of odd, as it's not defined anywhere else. Does the uniform inside the fx already define it somehow? That would be a shame as it then can't depend on a configured key but only a hardcoded one. (it works if I remove the #define and hard-code VK_PAUSE as the key in the uniform).

(for the rest, the small tweak I added with the mouse works great, so glad you added that mousepoint uniform source! much easier for taking screenshots now as you don't need to have the subject dead-center anymore ;))
Last edit: 4 years 7 months ago by OtisInf.

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago - 4 years 7 months ago #2 by crosire
Replied by crosire on topic Using a #define keydef in uniform key var
Add an "#undef DOF_MouseAFFocusPointToggleKey" to the .undef file. The cfg file is included in each of your shaders ("#include EFFECT_CONFIG(Otis)"), so without undefining the value (done via "#include EFFECT_CONFIG_UNDEF(Otis)") before reincluding it, the redefinition error will show up.
Last edit: 4 years 7 months ago by crosire.

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #3 by OtisInf
Replied by OtisInf on topic Using a #define keydef in uniform key var
Doh, totally forgot that. Thanks :) Solved it in a different way but for next time it's good to know ;)

Please Log in or Create an account to join the conversation.