geneis: fix lightguns with variable screen resolutions
This commit is contained in:
parent
c0da15b002
commit
8b1735ce24
|
@ -372,6 +372,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
if (!LibGPGX.gpgx_get_control(input, inputsize))
|
if (!LibGPGX.gpgx_get_control(input, inputsize))
|
||||||
throw new Exception("gpgx_get_control() failed!");
|
throw new Exception("gpgx_get_control() failed!");
|
||||||
|
|
||||||
|
ControlConverter.ScreenWidth = vwidth;
|
||||||
|
ControlConverter.ScreenHeight = vheight;
|
||||||
ControlConverter.Convert(Controller, input);
|
ControlConverter.Convert(Controller, input);
|
||||||
|
|
||||||
if (!LibGPGX.gpgx_put_control(input, inputsize))
|
if (!LibGPGX.gpgx_put_control(input, inputsize))
|
||||||
|
|
|
@ -66,8 +66,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
};
|
};
|
||||||
|
|
||||||
static ControllerDefinition.FloatRange MouseRange = new ControllerDefinition.FloatRange(-512, 0, 511);
|
static ControllerDefinition.FloatRange MouseRange = new ControllerDefinition.FloatRange(-512, 0, 511);
|
||||||
static ControllerDefinition.FloatRange LightgunX = new ControllerDefinition.FloatRange(0, 160, 319);
|
// lightgun needs to be transformed to match the current screen resolution
|
||||||
static ControllerDefinition.FloatRange LightgunY = new ControllerDefinition.FloatRange(0, 112, 223);
|
static ControllerDefinition.FloatRange LightgunRange = new ControllerDefinition.FloatRange(0, 5000, 10000);
|
||||||
|
|
||||||
LibGPGX.InputData target = null;
|
LibGPGX.InputData target = null;
|
||||||
IController source = null;
|
IController source = null;
|
||||||
|
@ -112,12 +112,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
string NY = string.Format("P{0} Lightgun Y", player);
|
string NY = string.Format("P{0} Lightgun Y", player);
|
||||||
ControllerDef.FloatControls.Add(NX);
|
ControllerDef.FloatControls.Add(NX);
|
||||||
ControllerDef.FloatControls.Add(NY);
|
ControllerDef.FloatControls.Add(NY);
|
||||||
ControllerDef.FloatRanges.Add(LightgunX);
|
ControllerDef.FloatRanges.Add(LightgunRange);
|
||||||
ControllerDef.FloatRanges.Add(LightgunY);
|
ControllerDef.FloatRanges.Add(LightgunRange);
|
||||||
Converts.Add(delegate()
|
Converts.Add(delegate()
|
||||||
{
|
{
|
||||||
target.analog[(2 * idx) + 0] = (short)source.GetFloat(NX);
|
target.analog[(2 * idx) + 0] = (short)(source.GetFloat(NX) / 10000.0f * (ScreenWidth - 1));
|
||||||
target.analog[(2 * idx) + 1] = (short)source.GetFloat(NY);
|
target.analog[(2 * idx) + 1] = (short)(source.GetFloat(NY) / 10000.0f * (ScreenHeight - 1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,5 +180,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
this.target = null;
|
this.target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// must be set for proper lightgun operation
|
||||||
|
/// </summary>
|
||||||
|
public int ScreenWidth { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// must be set for proper lightgun operation
|
||||||
|
/// </summary>
|
||||||
|
public int ScreenHeight { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue