// ---- Created with geo-11 v0.7.9 on Mon Jul  6 08:12:40 2026
cbuffer cb3 : register(b3)
{
  float4 cb3[21];
}

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

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

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



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

static const float near = 0.0001;
static const float far = 1;

float world_z_from_depth_buffer(float x, float y)
{
    uint width, height;
    float z;

    DepthBuffer.GetDimensions(width, height);

    x = min(max((x / 2 + 0.5) * width, 0), width - 1);
    y = min(max((-y / 2 + 0.5) * height, 0), height - 1);
    z = DepthBuffer.Load(int3(x, y, 0)).x;
    if (z == 1)
        return 0;

    return (far*near/((z)*near) + (far*z));
}

float adjust_from_depth_buffer(float x, float y)
{
    float4 stereo = StereoParams.Load(0);
    if (stereo.x==0) {return 0;}
    
    float separation = stereo.x; 
    float convergence = stereo.y;
    float old_offset, offset, w, sampled_w, distance;
    uint i;

    offset = (near - convergence) * separation ;
    distance = separation - offset;

    old_offset = offset;
    
    for (i = 0; i < 255; i++) {
        offset += distance / 255.0;
        w = (separation * convergence*20) / (separation - offset);
        sampled_w = world_z_from_depth_buffer(x + offset, y);
        
        if (sampled_w == 0)
            return separation;

        if (w > sampled_w)
            break;

        old_offset = offset;
    }

    return old_offset;
}


void main(
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float4 v3 : TEXCOORD0,
  float2 v4 : TEXCOORD1,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : COLOR0,
  out float4 o2 : TEXCOORD0,
  out float4 o3 : TEXCOORD1,
  out float4 o4 : TEXCOORD2,
  out float4 o5 : TEXCOORD3,
  out float4 o6 : TEXCOORD4,
  out float4 o7 : COLOR1,
  out float4 o8 : TEXCOORD5)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;
  
float4 s = StereoParams.Load(0);
//float4 texFilter = IniParams.Load(int2(14,0));
//float4 testeo = IniParams.Load(int2(90,0));
//float4 Map = IniParams.Load(int2(81,0));
float cursor_showing = IniParams[1].z;    

  r0.xy = cb0[23].zw + v0.xy;
  r1.xyzw = cb2[1].xyzw * r0.yyyy;
  r1.xyzw = cb2[0].xyzw * r0.xxxx + r1.xyzw;
  r1.xyzw = cb2[2].xyzw * v0.zzzz + r1.xyzw;
  r2.xyzw = cb2[3].xyzw + r1.xyzw;
  r1.xyz = cb2[3].xyz * v0.www + r1.xyz;
  r1.xyz = cb1[4].xyz + -r1.xyz;
  r3.xyzw = cb3[18].xyzw * r2.yyyy;
  r3.xyzw = cb3[17].xyzw * r2.xxxx + r3.xyzw;
  r3.xyzw = cb3[19].xyzw * r2.zzzz + r3.xyzw;
  r2.xyzw = cb3[20].xyzw * r2.wwww + r3.xyzw;
  o0.xyzw = r2.xyzw;
  o1.xyzw = v2.xyzw;
  o2.xy = v3.xy;
  r0.zw = cb3[6].xy * cb1[6].yy;
  r0.zw = cb3[5].xy * cb1[6].xx + r0.zw;
  r0.zw = cb0[28].yz * abs(r0.zw);
  r0.zw = r2.ww / r0.zw;
  r1.w = dot(r0.zw, r0.zw);
  r0.zw = cb0[27].xy * float2(0.25,0.25) + r0.zw;
  o4.zw = float2(0.25,0.25) / r0.zw;
  r0.z = rsqrt(r1.w);
  r0.w = cb0[28].x * abs(v4.y);
  r1.w = 1 + cb0[29].x;
  r0.w = r1.w * r0.w;
  r1.w = r0.z * r0.w;
  r2.x = 1 + -cb0[28].w;
  r2.x = r2.x * abs(r1.w);
  r0.z = r0.z * r0.w + -r2.x;
  r3.x = dot(v1.xyz, cb2[4].xyz);
  r3.y = dot(v1.xyz, cb2[5].xyz);
  r3.z = dot(v1.xyz, cb2[6].xyz);
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = rsqrt(r0.w);
  r2.yzw = r3.xyz * r0.www;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = r1.xyz * r0.www;
  r0.w = dot(r2.yzw, r3.xyz);
  r0.z = abs(r0.w) * r0.z + r2.x;
  r0.w = cmp(cb3[8].w == 0.000000);
  r2.y = r0.w ? r0.z : r1.w;
  r0.z = cmp(0 >= v4.y);
  r0.z = r0.z ? 1.000000 : 0;
  r0.w = cb0[22].z + -cb0[22].y;
  r0.z = r0.z * r0.w + cb0[22].y;
  r0.z = r0.z * 0.25 + cb0[4].x;
  r0.z = cb0[22].w * r0.z;
  r2.w = 0.5 * r0.z;
  o3.yw = r2.yw;
  r0.w = 0.5 / r2.y;
  r1.w = -cb0[6].x * cb0[22].w + 1;
  r1.w = -cb0[4].y * cb0[22].w + r1.w;
  r1.w = r1.w * 0.5 + -r0.w;
  o3.x = -r0.z * 0.5 + r1.w;
  r0.z = -r0.z * 0.5 + 0.5;
  o3.z = r0.z + r0.w;
  r3.xyzw = max(float4(-2e+10,-2e+10,-2e+10,-2e+10), cb0[26].xyzw);
  r3.xyzw = min(float4(2e+10,2e+10,2e+10,2e+10), r3.xyzw);
  r0.xy = r0.xy * float2(2,2) + -r3.xy;
  o4.xy = r0.xy + -r3.zw;
  r0.xyw = cb0[12].xyz * r1.yyy;
  r0.xyw = cb0[11].xyz * r1.xxx + r0.xyw;
  o5.xyz = cb0[13].xyz * r1.zzz + r0.xyw;
  r1.xyzw = cb0[23].yyyy * cb0[19].wzxy;
  r0.x = r1.x * r2.y + 1;
  r0.x = r2.y / r0.x;
  r0.y = r0.z * r0.x + -0.5;
  r0.z = r1.y * r0.x;
  r1.xy = cb0[28].xx * -r1.zw;
  r1.xy = r1.xy / cb0[27].zw;
  o6.xy = v3.xy + r1.xy;
  o6.z = r0.x;
  o6.w = -r0.z * 0.5 + r0.y;
  o7.xyz = cb0[18].xyz * cb0[18].www;
  o7.w = cb0[18].w;
  r0.x = 0.000244140625 * v4.x;
  r0.z = floor(r0.x);
  r0.w = -r0.z * 4096 + v4.x;
  r0.xy = float2(0.001953125,0.001953125) * r0.zw;
  o8.xy = r0.xy * cb0[30].xy + cb0[30].zw;
  o8.zw = r0.xy * cb0[31].xy + cb0[31].zw;
  
  
if (!cursor_showing ){  
	if (o0.w == 1){
		if (o0.y > -0.8 && o0.y < 0.8 && o0.x > -0.5 && o0.x < 0.5){
    float adjustment = adjust_from_depth_buffer(0, 0);
    o0.x += adjustment;  
		}
	}
}  
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v0.7.9 on Mon Jul  6 08:12:40 2026
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float   xyz
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy
// TEXCOORD                 1   xy          4     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   xyzw        4     NONE   float   xyzw
// TEXCOORD                 3   xyz         5     NONE   float   xyz
// TEXCOORD                 4   xyzw        6     NONE   float   xyzw
// COLOR                    1   xyzw        7     NONE   float   xyzw
// TEXCOORD                 5   xyzw        8     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer CB0[32], immediateIndexed
dcl_constantbuffer CB1[7], immediateIndexed
dcl_constantbuffer CB2[7], immediateIndexed
dcl_constantbuffer CB3[21], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyz
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_temps 4
add r0.xy, v0.xyxx, cb0[23].zwzz
mul r1.xyzw, r0.yyyy, cb2[1].xyzw
mad r1.xyzw, cb2[0].xyzw, r0.xxxx, r1.xyzw
mad r1.xyzw, cb2[2].xyzw, v0.zzzz, r1.xyzw
add r2.xyzw, r1.xyzw, cb2[3].xyzw
mad r1.xyz, cb2[3].xyzx, v0.wwww, r1.xyzx
add r1.xyz, -r1.xyzx, cb1[4].xyzx
mul r3.xyzw, r2.yyyy, cb3[18].xyzw
mad r3.xyzw, cb3[17].xyzw, r2.xxxx, r3.xyzw
mad r3.xyzw, cb3[19].xyzw, r2.zzzz, r3.xyzw
mad r2.xyzw, cb3[20].xyzw, r2.wwww, r3.xyzw
mov o0.xyzw, r2.xyzw
mov o1.xyzw, v2.xyzw
mov o2.xy, v3.xyxx
mul r0.zw, cb1[6].yyyy, cb3[6].xxxy
mad r0.zw, cb3[5].xxxy, cb1[6].xxxx, r0.zzzw
mul r0.zw, |r0.zzzw|, cb0[28].yyyz
div r0.zw, r2.wwww, r0.zzzw
dp2 r1.w, r0.zwzz, r0.zwzz
mad r0.zw, cb0[27].xxxy, l(0.000000, 0.000000, 0.250000, 0.250000), r0.zzzw
div o4.zw, l(0.000000, 0.000000, 0.250000, 0.250000), r0.zzzw
rsq r0.z, r1.w
mul r0.w, |v4.y|, cb0[28].x
add r1.w, cb0[29].x, l(1.000000)
mul r0.w, r0.w, r1.w
mul r1.w, r0.w, r0.z
add r2.x, -cb0[28].w, l(1.000000)
mul r2.x, |r1.w|, r2.x
mad r0.z, r0.z, r0.w, -r2.x
dp3 r3.x, v1.xyzx, cb2[4].xyzx
dp3 r3.y, v1.xyzx, cb2[5].xyzx
dp3 r3.z, v1.xyzx, cb2[6].xyzx
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r2.yzw, r0.wwww, r3.xxyz
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r1.xyzx
dp3 r0.w, r2.yzwy, r3.xyzx
mad r0.z, |r0.w|, r0.z, r2.x
eq r0.w, cb3[8].w, l(0.000000)
movc r2.y, r0.w, r0.z, r1.w
ge r0.z, l(0.000000), v4.y
and r0.z, r0.z, l(0x3f800000)
add r0.w, -cb0[22].y, cb0[22].z
mad r0.z, r0.z, r0.w, cb0[22].y
mad r0.z, r0.z, l(0.250000), cb0[4].x
mul r0.z, r0.z, cb0[22].w
mul r2.w, r0.z, l(0.500000)
mov o3.yw, r2.yyyw
div r0.w, l(0.500000), r2.y
mad r1.w, -cb0[6].x, cb0[22].w, l(1.000000)
mad r1.w, -cb0[4].y, cb0[22].w, r1.w
mad r1.w, r1.w, l(0.500000), -r0.w
mad o3.x, -r0.z, l(0.500000), r1.w
mad r0.z, -r0.z, l(0.500000), l(0.500000)
add o3.z, r0.w, r0.z
max r3.xyzw, cb0[26].xyzw, l(-20000000000.000000, -20000000000.000000, -20000000000.000000, -20000000000.000000)
min r3.xyzw, r3.xyzw, l(20000000000.000000, 20000000000.000000, 20000000000.000000, 20000000000.000000)
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), -r3.xyxx
add o4.xy, -r3.zwzz, r0.xyxx
mul r0.xyw, r1.yyyy, cb0[12].xyxz
mad r0.xyw, cb0[11].xyxz, r1.xxxx, r0.xyxw
mad o5.xyz, cb0[13].xyzx, r1.zzzz, r0.xywx
mul r1.xyzw, cb0[19].wzxy, cb0[23].yyyy
mad r0.x, r1.x, r2.y, l(1.000000)
div r0.x, r2.y, r0.x
mad r0.y, r0.z, r0.x, l(-0.500000)
mul r0.z, r0.x, r1.y
mul r1.xy, -r1.zwzz, cb0[28].xxxx
div r1.xy, r1.xyxx, cb0[27].zwzz
add o6.xy, r1.xyxx, v3.xyxx
mov o6.z, r0.x
mad o6.w, -r0.z, l(0.500000), r0.y
mul o7.xyz, cb0[18].wwww, cb0[18].xyzx
mov o7.w, cb0[18].w
mul r0.x, v4.x, l(0.000244140625)
round_ni r0.z, r0.x
mad r0.w, -r0.z, l(4096.000000), v4.x
mul r0.xy, r0.zwzz, l(0.00195312500, 0.00195312500, 0.000000, 0.000000)
mad o8.xy, r0.xyxx, cb0[30].xyxx, cb0[30].zwzz
mad o8.zw, r0.xxxy, cb0[31].xxxy, cb0[31].zzzw
ret
// Approximately 0 instruction slots used

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