//Original Author: Scanti
//Translation and extension: peachykeen
//Desc: Enables a sepia effect on the scene while in menus

texture lastshader;
sampler s0 = sampler_state{ texture=<lastshader>; };

bool pk_menu;

float4 menu_sepia(in float2 Tex : TEXCOORD ) : COLOR0
{
     float3 color = tex2D(s0, Tex); // tex t0
     if ( pk_menu )
     {
          color = dot(color, float3(0.3, 0.59, 0.11)); // dp3 r0,t0,c2
          color = saturate(lerp(float3(0.2, 0.06, 0), float3(1.0, 0.9, 0.5), color)); // lrp_sat r0,r0,c0,c1
     }
     return float4(color, 1.0); // mov r0.a,c0
}

Technique T0
{
     Pass P0
     {
           /*
           PixelShader=asm
           {
                 ps.1.1
                 def c0,1,0.9,0.5,1
                 def c1,0.2,0.05,0,1
                 def c2,0.3,0.59,0.11,1
                 tex t0
                 dp3 r0,t0,c2
                 lrp_sat r0,r0,c0,c1
                 mov r0.a,c0
           };
           */
           PixelShader = compile ps_1_4 menu_sepia();
     }
}
