// HUD 3 + Geometry

cbuffer CBufferGlobalConstant_Z : register(b0)
{

  struct
  {
    float4 c[90];
  } Global : packoffset(c0);

}

cbuffer CBufferUserConstant_Z : register(b1)
{

  struct
  {
    float4 c[58];
  } User : packoffset(c0);

}

cbuffer CBufferObjectConstant_Z : register(b2)
{

  struct
  {
    float4 c[32];
  } Object : packoffset(c0);

}



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


void main(
  float4 v0 : POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  float4 v4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float4 v6 : TEXCOORD5,
  float4 v7 : TEXCOORD6,
  float4 v8 : TEXCOORD7,
  out float4 o0 : SV_Position0,
  out float4 o1 : PREVIOUS_POSITION0,
  out float4 o2 : COLOR0,
  out float4 o3 : TEXCOORD0,
  out float3 o4 : TEXSPACE_NORMAL0,
  out float p4 : INSTANCE_COLOR0,
  out float3 o5 : TEXSPACE_POS0,
  out uint2 o6 : INSTANCE_INDEXES0)
{
  float4 r0,r1,r2,r3,r4,r5,r6;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = cmp(v5.w != 1.000000);
  r0.y = cmp(0 < v5.w);
  r0.x = r0.y ? r0.x : 0;
  r0.y = log2(abs(v5.w));
  r0.zw = User.c[0].xz + -v2.xx;
  r1.xy = r0.zw * r0.yy;
  r1.xy = exp2(r1.xy);
  r1.xy = float2(-1,-1) + r1.xy;
  r1.xy = r1.xy / r0.yy;
  r0.xy = r0.xx ? r1.xy : r0.zw;
  r1.x = dot(v3.xyz, Object.c[8].xyz);
  r1.y = dot(v3.xyz, Object.c[9].xyz);
  r1.z = dot(v3.xyz, Object.c[10].xyz);
  r2.xyz = r1.xyz * r0.xxx;
  r3.xy = r0.zw * r0.zw;
  r0.z = saturate(v2.y * r0.z);
  r3.zw = v4.yy * r3.xy;
  r2.xyz = r3.xzx * float3(0,0.5,0) + r2.xyz;
  r4.xyz = r1.xyz * r0.yyy;
  r1.xyz = r1.xyz * r0.xxx + -r4.xyz;
  r3.xyz = r3.ywy * float3(0,0.5,0) + r4.xyz;
  r3.xyz = -r3.xyz + r2.xyz;
  r2.xyz = v2.www * -r2.xyz + r2.xyz;
  r3.xyz = v2.www * -r3.xyz + r3.xyz;
  r1.xyz = r3.xyz + r1.xyz;
  r0.y = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.y);
  r0.y = cmp(0 != r0.y);
  r1.xyz = r1.xyz * r0.www;
  r3.xyz = v0.xyz;
  r3.w = 1;
  r4.x = dot(r3.xyzw, Object.c[0].xyzw);
  r4.y = dot(r3.xyzw, Object.c[1].xyzw);
  r4.z = dot(r3.xyzw, Object.c[2].xyzw);
  r3.xyz = Global.c[35].xyz + r4.xyz;
  r2.xyz = r3.xyz + r2.xyz;
  r3.xyz = -Global.c[2].yzx + r2.yzx;
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = r3.xyz * r0.www;
  r4.xyz = r3.xyz * r1.zxy;
  r3.xyz = r1.yzx * r3.yzx + -r4.xyz;
  r1.xyz = max(float3(-1,-1,-1), r1.xyz);
  r1.xyz = min(float3(1,1,1), r1.xyz);
  r1.xyz = r0.yyy ? r1.xyz : float3(1,0,0);
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = r3.xyz * r0.www;
  r3.xyz = max(float3(-1,-1,-1), r3.xyz);
  r3.xyz = min(float3(1,1,1), r3.xyz);
  r3.xyz = r0.yyy ? r3.xyz : float3(0,1,0);
  r0.yw = v8.zw + -v8.xy;
  r0.y = 1 / r0.y;
  r4.xy = -v8.xz + r0.zz;
  r0.y = r4.x * r0.y;
  r0.y = r0.y * r0.w + v8.y;
  r5.x = 0;
  r5.yz = v8.xz;
  r4.xzw = cmp(r0.zzz >= r5.xyz);
  r4.xzw = r4.xzw ? float3(1,1,1) : 0;
  r0.w = dot(r4.xzw, float3(1,1,1));
  r0.w = (int)r0.w;
  r0.y = User.c[r0.w+2].y * r0.y;
  r1.w = 1 / v8.x;
  r1.w = r1.w * r0.z;
  r1.w = v8.y * r1.w;
  r0.y = User.c[r0.w+2].x * r1.w + r0.y;
  r1.w = 1 + -v8.z;
  r1.w = 1 / r1.w;
  r1.w = r4.y * r1.w;
  r1.w = r1.w * -v8.w + v8.w;
  r0.y = User.c[r0.w+2].z * r1.w + r0.y;
  r0.w = -User.c[7].x + 1;
  r0.y = r0.y * r0.w;
  r0.w = cmp(r0.y >= User.c[7].y);
  o2.w = r0.y;
  r0.y = r0.w ? 1.000000 : 0;
  r4.xy = v7.wz * r0.xx + v7.yx;
  r0.x = v0.w * r0.x + v2.z;
  sincos(r0.x, r0.x, r5.x);
  r4.zw = r4.xy * r0.xx;
  r6.x = r4.y * r5.x + -r4.z;
  r6.y = r4.x * r5.x + r4.w;
  r6.z = -r4.y * r5.x + r4.z;
  r6.xyzw = r6.xyyz * r0.yyyy;
  r4.xzw = r6.www * r3.xyz;
  r1.xyz = r6.zzz * r1.xyz + r4.xzw;
  r1.xyz = v6.www * r1.xyz;
  r3.xyz = r4.yyy * r3.xyz + -r1.xyz;
  r1.xyz = v2.www * r3.xyz + r1.xyz;
  r1.xyz = r2.xyz + r1.xyz;
  r1.w = 1;
  r2.xyzw = -Global.c[35].xyzw + r1.xyzw;
  o5.xyz = r1.xyz;
  r1.x = dot(r2.xyzw, Global.c[31].xyzw);
  r1.y = dot(r2.xyzw, Global.c[32].xyzw);
  r1.z = dot(r2.xyzw, Global.c[33].xyzw);
  r2.xyz = User.c[2].xyz * r6.yyy;
  r2.xyz = r6.xxx * User.c[1].xyz + r2.xyz;
  r2.xyz = v6.www * -r2.xyz + r2.xyz;
  r2.xyz = v2.www * -r2.xyz + r2.xyz;
  r1.xyz = r2.xyz + r1.xyz;
  r1.w = 1;
  r2.x = dot(r1.xyzw, Global.c[49].xyzw);
  r2.y = dot(r1.xyzw, Global.c[50].xyzw);
  r2.z = dot(r1.xyzw, Global.c[51].xyzw);
  r2.w = dot(r1.xyzw, Global.c[52].xyzw);
  o0.xyzw = r2.xyzw;
  
  
  //Fix
  float4 stereo = StereoParams.Load(0);
  float4 iniParams = IniParams.Load(0);
  
  float4 tex_filter = IniParams.Load(int2(10,0));
  float4 tex_filter2 = IniParams.Load(int2(90,0));
  float4 tex_filter3 = IniParams.Load(int2(91,0));
  float4 tex_filter4 = IniParams.Load(int2(92,0));
  float4 tex_filter5 = IniParams.Load(int2(93,0));
  float4 tex_filter6 = IniParams.Load(int2(94,0));
  
  if (tex_filter6.x == 1)
  {
  if (tex_filter4.x == 1)
  {
  if (tex_filter3.x == 1)
  {
  if (tex_filter2.x == 1)
  {
  if (tex_filter.x == 11)
    {
     o0.x -= stereo.x * (o0.w - stereo.y);
      if(tex_filter5.x != 1.0)
      o0.x += stereo.x * iniParams.x*17;
      else
      o0.x += stereo.x * iniParams.x*10;
    }
}
}
}
}

  
  o1.xyzw = r2.xyzw;
  o3.zw = r2.zw;
  r0.y = saturate(r0.z / User.c[7].z);
  r1.xyz = v6.xyz + -v5.xyz;
  o2.xyz = r0.yyy * r1.xyz + v5.xyz;
  r0.yw = v1.zw + -v1.xy;
  r0.yz = r0.zz * r0.yw + v1.xy;
  r0.w = User.c[0].w + -v4.w;
  r1.x = r0.w / v3.w;
  r1.y = cmp(r1.x >= -r1.x);
  r1.x = frac(abs(r1.x));
  r1.x = r1.y ? r1.x : -r1.x;
  r0.w = -r1.x * v3.w + r0.w;
  r1.x = v3.w * r1.x;
  r0.w = r0.w / v3.w;
  r0.w = r0.w / v3.w;
  r1.z = cmp(r0.w >= -r0.w);
  r0.w = frac(abs(r0.w));
  r0.w = r1.z ? r0.w : -r0.w;
  r1.y = v3.w * r0.w;
  r1.xy = r1.xy * v1.zw + v1.xy;
  r0.w = cmp(v3.w == 0.000000);
  o3.xy = r0.ww ? r0.yz : r1.xy;
  r0.y = dot(v7.xy, v7.xy);
  r0.y = rsqrt(r0.y);
  r0.yz = v7.yx * r0.yy;
  r0.xw = r0.yz * r0.xx;
  r0.y = r0.y * r5.x + r0.w;
  r0.x = r0.z * r5.x + -r0.x;
  r0.yzw = Global.c[32].xyz * r0.yyy;
  r0.xyz = r0.xxx * Global.c[31].xyz + r0.yzw;
  r0.xyz = Global.c[33].xyz * float3(-0.5,-0.5,-0.5) + r0.xyz;
  r1.xyz = float3(0,1,0) + -r0.xyz;
  r0.xyz = User.c[0].yyy * r1.xyz + r0.xyz;
  o4.x = dot(r0.xyz, Object.c[8].xyz);
  o4.y = dot(r0.xyz, Object.c[9].xyz);
  o4.z = dot(r0.xyz, Object.c[10].xyz);
  p4.x = 0;
  o6.xy = float2(0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16 on Tue May 14 19:06:35 2019
//
//
// Buffer Definitions:
//
// cbuffer CBufferGlobalConstant_Z
// {
//
//   struct StructGlobalConstant_Z
//   {
//
//       float4 c[90];                  // Offset:    0
//
//   } Global;                          // Offset:    0 Size:  1440
//
// }
//
// cbuffer CBufferUserConstant_Z
// {
//
//   struct StructUserConstant_Z
//   {
//
//       float4 c[58];                  // Offset:    0
//
//   } User;                            // Offset:    0 Size:   928
//
// }
//
// cbuffer CBufferObjectConstant_Z
// {
//
//   struct StructObjectConstant_Z
//   {
//
//       float4 c[32];                  // Offset:    0
//
//   } Object;                          // Offset:    0 Size:   512
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// CBufferGlobalConstant_Z           cbuffer      NA          NA    0        1
// CBufferUserConstant_Z             cbuffer      NA          NA    1        1
// CBufferObjectConstant_Z           cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float    y w
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
// TEXCOORD                 7   xyzw        8     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// PREVIOUS_POSITION        0   xyzw        1     NONE   float   xyzw
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXSPACE_NORMAL          0   xyz         4     NONE   float   xyz
// INSTANCE_COLOR           0      w        4     NONE   float      w
// TEXSPACE_POS             0   xyz         5     NONE   float   xyz
// INSTANCE_INDEXES         0   xy          6     NONE    uint   xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[53], immediateIndexed
dcl_constantbuffer cb1[8], dynamicIndexed
dcl_constantbuffer cb2[11], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_input v4.yw
dcl_input v5.xyzw
dcl_input v6.xyzw
dcl_input v7.xyzw
dcl_input v8.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyz
dcl_output o4.w
dcl_output o5.xyz
dcl_output o6.xy
dcl_temps 7
ne r0.x, v5.w, l(1.000000)
lt r0.y, l(0.000000), v5.w
and r0.x, r0.y, r0.x
log r0.y, |v5.w|
add r0.zw, -v2.xxxx, cb1[0].xxxz
mul r1.xy, r0.yyyy, r0.zwzz
exp r1.xy, r1.xyxx
add r1.xy, r1.xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
div r1.xy, r1.xyxx, r0.yyyy
movc r0.xy, r0.xxxx, r1.xyxx, r0.zwzz
dp3 r1.x, v3.xyzx, cb2[8].xyzx
dp3 r1.y, v3.xyzx, cb2[9].xyzx
dp3 r1.z, v3.xyzx, cb2[10].xyzx
mul r2.xyz, r0.xxxx, r1.xyzx
mul r3.xy, r0.zwzz, r0.zwzz
mul_sat r0.z, r0.z, v2.y
mul r3.zw, r3.xxxy, v4.yyyy
mad r2.xyz, r3.xzxx, l(0.000000, 0.500000, 0.000000, 0.000000), r2.xyzx
mul r4.xyz, r0.yyyy, r1.xyzx
mad r1.xyz, r1.xyzx, r0.xxxx, -r4.xyzx
mad r3.xyz, r3.ywyy, l(0.000000, 0.500000, 0.000000, 0.000000), r4.xyzx
add r3.xyz, r2.xyzx, -r3.xyzx
mad r2.xyz, v2.wwww, -r2.xyzx, r2.xyzx
mad r3.xyz, v2.wwww, -r3.xyzx, r3.xyzx
add r1.xyz, r1.xyzx, r3.xyzx
dp3 r0.y, r1.xyzx, r1.xyzx
rsq r0.w, r0.y
ne r0.y, l(0.000000, 0.000000, 0.000000, 0.000000), r0.y
mul r1.xyz, r0.wwww, r1.xyzx
mov r3.xyz, v0.xyzx
mov r3.w, l(1.000000)
dp4 r4.x, r3.xyzw, cb2[0].xyzw
dp4 r4.y, r3.xyzw, cb2[1].xyzw
dp4 r4.z, r3.xyzw, cb2[2].xyzw
add r3.xyz, r4.xyzx, cb0[35].xyzx
add r2.xyz, r2.xyzx, r3.xyzx
add r3.xyz, r2.yzxy, -cb0[2].yzxy
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r3.xyzx
mul r4.xyz, r1.zxyz, r3.xyzx
mad r3.xyz, r1.yzxy, r3.yzxy, -r4.xyzx
max r1.xyz, r1.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
min r1.xyz, r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
movc r1.xyz, r0.yyyy, r1.xyzx, l(1.000000,0,0,0)
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r3.xyzx
max r3.xyz, r3.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
min r3.xyz, r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
movc r3.xyz, r0.yyyy, r3.xyzx, l(0,1.000000,0,0)
add r0.yw, -v8.xxxy, v8.zzzw
div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
add r4.xy, r0.zzzz, -v8.xzxx
mul r0.y, r0.y, r4.x
mad r0.y, r0.y, r0.w, v8.y
mov r5.x, l(0)
mov r5.yz, v8.xxzx
ge r4.xzw, r0.zzzz, r5.xxyz
and r4.xzw, r4.xxzw, l(0x3f800000, 0, 0x3f800000, 0x3f800000)
dp3 r0.w, r4.xzwx, l(1.000000, 1.000000, 1.000000, 0.000000)
ftoi r0.w, r0.w
mul r0.y, r0.y, cb1[r0.w + 2].y
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), v8.x
mul r1.w, r0.z, r1.w
mul r1.w, r1.w, v8.y
mad r0.y, cb1[r0.w + 2].x, r1.w, r0.y
add r1.w, -v8.z, l(1.000000)
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul r1.w, r1.w, r4.y
mad r1.w, r1.w, -v8.w, v8.w
mad r0.y, cb1[r0.w + 2].z, r1.w, r0.y
add r0.w, l(1.000000), -cb1[7].x
mul r0.y, r0.w, r0.y
ge r0.w, r0.y, cb1[7].y
mov o2.w, r0.y
and r0.y, r0.w, l(0x3f800000)
mad r4.xy, v7.wzww, r0.xxxx, v7.yxyy
mad r0.x, v0.w, r0.x, v2.z
sincos r0.x, r5.x, r0.x
mul r4.zw, r0.xxxx, r4.xxxy
mad r6.x, r4.y, r5.x, -r4.z
mad r6.y, r4.x, r5.x, r4.w
mad r6.z, -r4.y, r5.x, r4.z
mul r6.xyzw, r0.yyyy, r6.xyyz
mul r4.xzw, r3.xxyz, r6.wwww
mad r1.xyz, r6.zzzz, r1.xyzx, r4.xzwx
mul r1.xyz, r1.xyzx, v6.wwww
mad r3.xyz, r4.yyyy, r3.xyzx, -r1.xyzx
mad r1.xyz, v2.wwww, r3.xyzx, r1.xyzx
add r1.xyz, r1.xyzx, r2.xyzx
mov r1.w, l(1.000000)
add r2.xyzw, r1.xyzw, -cb0[35].xyzw
mov o5.xyz, r1.xyzx
dp4 r1.x, r2.xyzw, cb0[31].xyzw
dp4 r1.y, r2.xyzw, cb0[32].xyzw
dp4 r1.z, r2.xyzw, cb0[33].xyzw
mul r2.xyz, r6.yyyy, cb1[2].xyzx
mad r2.xyz, r6.xxxx, cb1[1].xyzx, r2.xyzx
mad r2.xyz, v6.wwww, -r2.xyzx, r2.xyzx
mad r2.xyz, v2.wwww, -r2.xyzx, r2.xyzx
add r1.xyz, r1.xyzx, r2.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[49].xyzw
dp4 r2.y, r1.xyzw, cb0[50].xyzw
dp4 r2.z, r1.xyzw, cb0[51].xyzw
dp4 r2.w, r1.xyzw, cb0[52].xyzw
mov o0.xyzw, r2.xyzw
mov o1.xyzw, r2.xyzw
mov o3.zw, r2.zzzw
div_sat r0.y, r0.z, cb1[7].z
add r1.xyz, -v5.xyzx, v6.xyzx
mad o2.xyz, r0.yyyy, r1.xyzx, v5.xyzx
add r0.yw, -v1.xxxy, v1.zzzw
mad r0.yz, r0.zzzz, r0.yywy, v1.xxyx
add r0.w, -v4.w, cb1[0].w
div r1.x, r0.w, v3.w
ge r1.y, r1.x, -r1.x
frc r1.x, |r1.x|
movc r1.x, r1.y, r1.x, -r1.x
mad r0.w, -r1.x, v3.w, r0.w
mul r1.x, r1.x, v3.w
div r0.w, r0.w, v3.w
div r0.w, r0.w, v3.w
ge r1.z, r0.w, -r0.w
frc r0.w, |r0.w|
movc r0.w, r1.z, r0.w, -r0.w
mul r1.y, r0.w, v3.w
mad r1.xy, r1.xyxx, v1.zwzz, v1.xyxx
eq r0.w, v3.w, l(0.000000)
movc o3.xy, r0.wwww, r0.yzyy, r1.xyxx
dp2 r0.y, v7.xyxx, v7.xyxx
rsq r0.y, r0.y
mul r0.yz, r0.yyyy, v7.yyxy
mul r0.xw, r0.xxxx, r0.yyyz
mad r0.y, r0.y, r5.x, r0.w
mad r0.x, r0.z, r5.x, -r0.x
mul r0.yzw, r0.yyyy, cb0[32].xxyz
mad r0.xyz, r0.xxxx, cb0[31].xyzx, r0.yzwy
mad r0.xyz, cb0[33].xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000), r0.xyzx
add r1.xyz, -r0.xyzx, l(0.000000, 1.000000, 0.000000, 0.000000)
mad r0.xyz, cb1[0].yyyy, r1.xyzx, r0.xyzx
dp3 o4.x, r0.xyzx, cb2[8].xyzx
dp3 o4.y, r0.xyzx, cb2[9].xyzx
dp3 o4.z, r0.xyzx, cb2[10].xyzx
mov o4.w, l(0)
mov o6.xy, l(0,0,0,0)
ret
// Approximately 148 instruction slots used

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