// ---- Created with 3Dmigoto v1.3.16 on Sun Dec 06 12:28:11 2020
Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb2 : register(b2)
{
  float4 cb2[18];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[142];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[4];
}




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
  float4 v0 : SV_POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : ORIGINAL_POSITION0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  float Correction : TEXCOORD2,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.z = -0.100000001 * cb1[141].z;
  r0.w = 0;
  r0.xy = v4.xy * v4.zw;
  r1.xy = cb1[141].zz * float2(-0.200000003,0.00200000009) + r0.xy;
  r1.x = t0.Sample(s0_s, r1.xy).x;
  r1.xy = r1.xx * float2(0.0599999987,0.0599999987) + r0.xy;
  r1.xy = r1.xy + r0.zw;
  r1.z = t1.Sample(s1_s, r1.xy).w;
  r1.x = t2.Sample(s2_s, r1.xy).x;
  r1.x = cb2[15].w * r1.x;
  r1.yzw = cb2[11].xyz * r1.zzz;
  r2.xy = t1.Sample(s1_s, r0.xy).xy;
  r2.y = r2.y + -r2.x;
  r2.x = cb2[15].y * r2.y + r2.x;
  r2.yzw = cb2[13].xyz * r2.xxx;
  r2.yzw = cb2[16].yyy * r2.yzw;
  r1.yzw = r1.yzw * cb2[16].xxx + r2.yzw;
  r2.yzw = -cb2[9].xyz + cb2[8].xyz;
  r2.yzw = r1.xxx * r2.yzw + cb2[9].xyz;
  r1.xyz = r2.yzw * r1.xxx + r1.yzw;
  r2.yz = cb1[141].zz * float2(-0.0199999996,0.0199999996) + r0.xy;
  r1.w = t0.Sample(s0_s, r2.yz).x;
  r2.yz = r1.ww * float2(0.0799999982,0.0799999982) + r0.xy;
  r3.z = -0.0199999996 * cb1[141].z;
  r3.w = 0;
  r2.yz = r3.zw + r2.yz;
  r1.w = t1.Sample(s1_s, r2.yz).w;
  r2.yzw = cb2[2].xyz * r1.www;
  r3.xyz = cb2[4].xyz * r2.xxx;
  r3.xyz = cb2[15].zzz * r3.xyz;
  r2.yzw = r2.yzw * cb2[15].xxx + r3.xyz;
  r1.xyz = -r2.yzw + r1.xyz;
  r1.xyz = cb2[16].zzz * r1.xyz + r2.yzw;
  r2.yzw = cb2[14].xyz + -r1.xyz;
  r1.xyz = cb2[16].www * r2.yzw + r1.xyz;
  r1.xyz = max(float3(0,0,0), r1.xyz);
  r2.yz = cb1[141].zz * float2(-0.200000003,0.0500000007) + r0.xy;
  r2.y = t0.Sample(s0_s, r2.yz).x;
  r2.yz = r2.yy * float2(0.0199999996,0.0199999996) + r0.xy;
  r0.x = t2.Sample(s2_s, r0.xy).z;
  r0.x = cb2[17].y * r0.x;
  r0.yz = r2.yz + r0.zw;
  r0.y = t2.Sample(s2_s, r0.yz).x;
  r0.y = cb2[17].x * r0.y;
  r0.x = r0.y * r0.x;
  r0.x = cb2[16].z * r0.x;
  r1.w = saturate(r2.x * 10 + r0.x);
  r0.xyzw = v1.xyzw * r1.xyzw;
  r1.w = dot(float3(0.300000012,0.589999974,0.109999999), r0.xyz);
  r1.xyz = -r1.xyz * v1.xyz + r1.www;
  r1.xyz = r1.xyz * float3(0.800000012,0.800000012,0.800000012) + r0.xyz;
  r2.xyz = float3(-0.100000001,-0.100000001,-0.100000001) + r1.xyz;
  r1.w = dot(r2.xyz, r2.xyz);
  r1.w = sqrt(r1.w);
  r1.w = min(0.800000012, r1.w);
  r2.xyz = float3(0.100000001,0.100000001,0.100000001) + -r1.xyz;
  r1.xyz = r1.www * r2.xyz + r1.xyz;
  r1.w = cmp(cb0[3].x != 0.000000);
  r0.xyz = r1.www ? r1.xyz : r0.xyz;
  o0.w = r0.w;
  r1.xyz = float3(-0.25,-0.25,-0.25) + r0.xyz;
  r1.xyz = saturate(r1.xyz * cb0[1].www + float3(0.25,0.25,0.25));
  r2.xy = cmp(cb0[1].wy != float2(1,1));
  r0.xyz = r2.xxx ? r1.xyz : r0.xyz;
  r1.xyz = log2(r0.xyz);
  r1.xyz = cb0[1].xxx * r1.xyz;
  r2.xzw = float3(0.416666657,0.416666657,0.416666657) * r1.xyz;
  r1.xyz = exp2(r1.xyz);
  r2.xzw = exp2(r2.xzw);
  r2.xzw = r2.xzw * float3(1.05499995,1.05499995,1.05499995) + float3(-0.0549999997,-0.0549999997,-0.0549999997);
  r3.xyz = float3(12.9200001,12.9200001,12.9200001) * r1.xyz;
  r1.xyz = cmp(r1.xyz >= float3(0.00313066994,0.00313066994,0.00313066994));
  r1.xyz = r1.xyz ? r2.xzw : r3.xyz;
  o0.xyz = r2.yyy ? r1.xyz : r0.xyz;


float4 StatusBarsFixOn = IniParams.Load(int2(62,0));
float4 AutoDepthSwith = IniParams.Load(int2(22,0));
float4 LeftHUD_X_ScreenDepth = IniParams.Load(int2(13,0));
float4 RightHUD_X_ScreenDepth = IniParams.Load(int2(14,0));
float4 UpperHUD_Y_ScreenDepth = IniParams.Load(int2(15,0));
float4 LowerHUD_Y_ScreenDepth = IniParams.Load(int2(16,0));

if(StatusBarsFixOn.x==1.0)
{
//This base fix is made by DarkStarSword
float stereo_adjustment = Correction;
// Load the scissor rectangle and stereoise it. Note that since both
// SV_Position and the scissor rectange are in pixels, the adjustment needs to
// be divided by the render target size and again by 2:
float4 scissor_rect = IniParams[114].xyzw;
//if(AutoDepthSwith.x==1.0)
//{
//if(v0.y > -LowerHUD_Y_ScreenDepth.x && v0.y < UpperHUD_Y_ScreenDepth.x && v0.x > -LeftHUD_X_ScreenDepth.x && v0.x < RightHUD_X_ScreenDepth.x)
//{
//scissor_rect.xz += floor(stereo_adjustment * IniParams[112].x * 0.5);
//}
//else
//{
//scissor_rect.xz += floor(stereo_adjustment * IniParams[112].x);
//}
//}
//if(AutoDepthSwith.x==0.0)
//{
scissor_rect.xz += floor(stereo_adjustment * IniParams[112].x * 0.5);
//}
// Perform stereo adjusted scissor clipping:
if (any(v0.xy < scissor_rect.xy) || any(v0.xy >= scissor_rect.zw)) {
        discard;
        return;
}
}
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Dec 06 12:28:11 2020
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// COLOR                    0   xyzw        1     NONE   float   xyzw
// ORIGINAL_POSITION        0   xyzw        2     NONE   float
// TEXCOORD                 0   xy          3     NONE   float
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[142], immediateIndexed
dcl_constantbuffer cb2[18], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v4.xyzw
dcl_output o0.xyzw
dcl_temps 4
mul r0.z, cb1[141].z, l(-0.100000)
mov r0.w, l(0)
mul r0.xy, v4.zwzz, v4.xyxx
mad r1.xy, cb1[141].zzzz, l(-0.200000, 0.002000, 0.000000, 0.000000), r0.xyxx
sample_indexable(texture2d)(float,float,float,float) r1.x, r1.xyxx, t0.xyzw, s0
mad r1.xy, r1.xxxx, l(0.060000, 0.060000, 0.000000, 0.000000), r0.xyxx
add r1.xy, r0.zwzz, r1.xyxx
sample_indexable(texture2d)(float,float,float,float) r1.z, r1.xyxx, t1.xywz, s1
sample_indexable(texture2d)(float,float,float,float) r1.x, r1.xyxx, t2.xyzw, s2
mul r1.x, r1.x, cb2[15].w
mul r1.yzw, r1.zzzz, cb2[11].xxyz
sample_indexable(texture2d)(float,float,float,float) r2.xy, r0.xyxx, t1.xyzw, s1
add r2.y, -r2.x, r2.y
mad r2.x, cb2[15].y, r2.y, r2.x
mul r2.yzw, r2.xxxx, cb2[13].xxyz
mul r2.yzw, r2.yyzw, cb2[16].yyyy
mad r1.yzw, r1.yyzw, cb2[16].xxxx, r2.yyzw
add r2.yzw, cb2[8].xxyz, -cb2[9].xxyz
mad r2.yzw, r1.xxxx, r2.yyzw, cb2[9].xxyz
mad r1.xyz, r2.yzwy, r1.xxxx, r1.yzwy
mad r2.yz, cb1[141].zzzz, l(0.000000, -0.020000, 0.020000, 0.000000), r0.xxyx
sample_indexable(texture2d)(float,float,float,float) r1.w, r2.yzyy, t0.yzwx, s0
mad r2.yz, r1.wwww, l(0.000000, 0.080000, 0.080000, 0.000000), r0.xxyx
mul r3.z, cb1[141].z, l(-0.020000)
mov r3.w, l(0)
add r2.yz, r2.yyzy, r3.zzwz
sample_indexable(texture2d)(float,float,float,float) r1.w, r2.yzyy, t1.xyzw, s1
mul r2.yzw, r1.wwww, cb2[2].xxyz
mul r3.xyz, r2.xxxx, cb2[4].xyzx
mul r3.xyz, r3.xyzx, cb2[15].zzzz
mad r2.yzw, r2.yyzw, cb2[15].xxxx, r3.xxyz
add r1.xyz, r1.xyzx, -r2.yzwy
mad r1.xyz, cb2[16].zzzz, r1.xyzx, r2.yzwy
add r2.yzw, -r1.xxyz, cb2[14].xxyz
mad r1.xyz, cb2[16].wwww, r2.yzwy, r1.xyzx
max r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mad r2.yz, cb1[141].zzzz, l(0.000000, -0.200000, 0.050000, 0.000000), r0.xxyx
sample_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t0.yxzw, s0
mad r2.yz, r2.yyyy, l(0.000000, 0.020000, 0.020000, 0.000000), r0.xxyx
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t2.zxyw, s2
mul r0.x, r0.x, cb2[17].y
add r0.yz, r0.zzwz, r2.yyzy
sample_indexable(texture2d)(float,float,float,float) r0.y, r0.yzyy, t2.yxzw, s2
mul r0.y, r0.y, cb2[17].x
mul r0.x, r0.x, r0.y
mul r0.x, r0.x, cb2[16].z
mad_sat r1.w, r2.x, l(10.000000), r0.x
mul r0.xyzw, r1.xyzw, v1.xyzw
dp3 r1.w, l(0.300000, 0.590000, 0.110000, 0.000000), r0.xyzx
mad r1.xyz, -r1.xyzx, v1.xyzx, r1.wwww
mad r1.xyz, r1.xyzx, l(0.800000, 0.800000, 0.800000, 0.000000), r0.xyzx
add r2.xyz, r1.xyzx, l(-0.100000, -0.100000, -0.100000, 0.000000)
dp3 r1.w, r2.xyzx, r2.xyzx
sqrt r1.w, r1.w
min r1.w, r1.w, l(0.800000)
add r2.xyz, -r1.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000)
mad r1.xyz, r1.wwww, r2.xyzx, r1.xyzx
ne r1.w, cb0[3].x, l(0.000000)
movc r0.xyz, r1.wwww, r1.xyzx, r0.xyzx
mov o0.w, r0.w
add r1.xyz, r0.xyzx, l(-0.250000, -0.250000, -0.250000, 0.000000)
mad_sat r1.xyz, r1.xyzx, cb0[1].wwww, l(0.250000, 0.250000, 0.250000, 0.000000)
ne r2.xy, cb0[1].wyww, l(1.000000, 1.000000, 0.000000, 0.000000)
movc r0.xyz, r2.xxxx, r1.xyzx, r0.xyzx
log r1.xyz, r0.xyzx
mul r1.xyz, r1.xyzx, cb0[1].xxxx
mul r2.xzw, r1.xxyz, l(0.416666657, 0.000000, 0.416666657, 0.416666657)
exp r1.xyz, r1.xyzx
exp r2.xzw, r2.xxzw
mad r2.xzw, r2.xxzw, l(1.055000, 0.000000, 1.055000, 1.055000), l(-0.055000, 0.000000, -0.055000, -0.055000)
mul r3.xyz, r1.xyzx, l(12.920000, 12.920000, 12.920000, 0.000000)
ge r1.xyz, r1.xyzx, l(0.00313066994, 0.00313066994, 0.00313066994, 0.000000)
movc r1.xyz, r1.xyzx, r2.xzwx, r3.xyzx
movc o0.xyz, r2.yyyy, r1.xyzx, r0.xyzx
ret
// Approximately 0 instruction slots used

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
