[Config]
# As of 1 November 2019, this is just data about config, to be used for UI generation and default values.
# User config data is stored in ShaderPatchConfig.ini

# Patches to remove glitching with modern GPUs.
# Appropriate patches will automatically be selected based on your GPU.
Compat=1

# Lyb's toon shader improvements (24 sept 2019)
# Toon_Improve: Adjusts toon shader lighting
Toon_Improve=0
# Specular Multiplier
Toon_Improve_Val1=0.9
# Specular Offset
Toon_Improve_Val2=-0.5

# Lyb's toon shader improvements (24 sept 2019)
# Toon_Eyes_Improve: Adjusts toon shader eyes
Toon_Eyes_Improve=0

# Lyb's toon shader improvements (24 sept 2019)
# Toon_Hair_Improve: Adjusts toon shader hair
Toon_Hair_Improve=0
# Diffuse Brightness
Toon_Hair_Improve_Val1=1.25

# Lyb's toon shader improvements (24 sept 2019)
# Toon_Lines_Improve: Adjusts toon shader outlines
Toon_Lines_Improve=0
# ???
Toon_Lines_Improve_Val1=0.75
# Thickness Multiplier(?)
Toon_Lines_Improve_Val2=0.75
# Thickness Offset(?)
Toon_Lines_Improve_Val3=0.75

[Patches]
# Compatibility patches:
# Star Story (and etc.) stage corruption (Maxwell+)
blinn_per_vert\.0010010[23]00[01]\.fp=arch:AD,GA,GV,TU,GP,GM||cfg:compat||from:TEX tex_col, a_tex_color0, texture\[0\], 2D; ALIAS||to:TEX tex_col, a_tex_color0, texture[0], 2D; MUL tex_col, 1, tex_col; ALIAS
# Turing shading lines (new patch by samyuu, hopefully ported to here correctly)
.*=arch:AD,GA,GV,TU||cfg:compat||from:SHORT ||to:
# Turing NPR cloth noise
cloth_npr1.*=arch:AD,GA,GV,TU||cfg:compat||from:SSG _tmp0.yw, ybr.xxzz;||to:TEMP _tmpForSSG; SGE _tmpForSSG.xz, ybr.xxzz, 0; SUB _tmpForSSG.xz, _tmpForSSG.xxzz, 1; SGT _tmpForSSG.yw, ybr.xxzz, 0; ADD _tmp0.yw, _tmpForSSG.xxzz, _tmpForSSG.yyww;
# Turing auto-exposure fix by samyuu
stage_blinn.*\.fp=arch:AD,GA,GV,TU||cfg:compat||from:NRMH normal, a_normal;||to:NRM normal, a_normal;

# Lyb's toon shader improvements:
cloth_npr1.*=cfg:toon_improve||from:MAD tmp.y, lc.z, 1.2, -0.5;||to:MAD tmp.y, lc.z, <val1>, <val2>;
skin_default.*=cfg:toon_improve||from:MAD diff.xyz, spec, spec_ratio, diff;||to:
.*eye.*=cfg:toon_eyes_improve||from:ADD o_color_f0.w, diff.x, diff.y;||to:
.*eye.*=cfg:toon_eyes_improve||from:ADD result.color.w, diff.x, diff.y;||to:
hair_npr1.*=cfg:toon_hair_improve||from:MUL spec.x, tmp.x, 0.7;||to:MUL spec.x, tmp.x, 0.7; MUL diff, diff, <val1>;
tone_map_npr1.*=cfg:toon_lines_improve||from:MUL density.y, density.y, 0.25;||to:MUL density.y, density.y, <val1>;
tone_map_npr1.*=cfg:toon_lines_improve||from:MAD density.w, density.x, 0.7, 0.25;||to:MAD density.w, density.x, <val2>, <val3>;

# Intel related patches
(?:movie|sprite|imgfilter).*=cfg:intel||from:; ||to:;\n
(?:movie|sprite|imgfilter).*=cfg:intel||from:(?:RET|TXL|NRM|OPTION NV_fragment|PARAM p_charfragment.color|ATTRIB).*?||to:##
(?:movie|sprite|imgfilter).*=cfg:intel||from:(?:SHORT |LONG ).*?||to:
.*sprite.100.fp.*=cfg:intel||from:MUL result.color, col1, fragment.color;||to:##MUL result.color, col1, fragment.color;

# Debug patches:
# Nametags
# Adds comments with the shader file name to the shader text. Useful for debugging issues
# `nametags_val1` and `nametags_val2` are a dirty hack to hide this in launcher (options ending in _val. must belong to a parent to be displayed)
# `nametags_val2` is a bit faster, but the tags are placed at the end of the file and you may not like that
# Notes:
# * `(\r?\n)` is used to capture the line ending type used and ensure we're at the start of a line
# * `[^!]` ensures the comment is inserted after all start program lines (not sure if this even matters)
# * `[\s\S]` matches all characters *including* new lines
.*=cfg:nametags1||from:(\r?\n)([^!][\s\S]*)||to:$1#<fname>$1$2
.*=cfg:nametags2||from:[\s\S]*?(\r?\n)[\s\S]*||to:$&$1#<fname>