Fix range, def. binds, and Virtual Pad for SEGA Mouse

This commit is contained in:
YoshiRulz 2021-04-17 12:50:56 +10:00
parent 92241b15cf
commit 771b5397fe
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 15 additions and 10 deletions

View File

@ -1182,13 +1182,13 @@
"Deadzone": 0.0
},
"P2 Mouse X": {
"Value": "WMouse X",
"Mult": 1.0,
"Value": "X1 LeftThumbX Axis",
"Mult": 0.1,
"Deadzone": 0.0
},
"P2 Mouse Y": {
"Value": "WMouse Y",
"Mult": 1.0,
"Value": "X1 LeftThumbY Axis",
"Mult": 0.1,
"Deadzone": 0.0
}
},

View File

@ -121,7 +121,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
private void DoMouseAnalog(int idx, int player)
{
ControllerDef.AddXYPair($"P{player} Mouse {{0}}", AxisPairOrientation.RightAndUp, (-256).RangeTo(255), 0); //TODO verify direction against hardware
// In "Genesis Technical Bulletin #27" (last seen at http://techdocs.exodusemulator.com/Console/SegaMegaDrive/Documentation.html), some example code for the Genesis is given which describes the 32 bits of Mouse data:
// ` ignored YXYX XXXXXXXX YYYYYYYY`
// `0-------_oossCMRL_########_########`
// Each axis is represented as 10 bits: 1 `s` bit for sign, 8 bits for the value, and 1 `o` bit indicating whether the value fell outside the range (i.e. abs(val)>=256).
// So the range -256..256 includes every normal state, though nothing outside -10..10 is at all useful based on my in-game testing. (Games probably didn't have special checks for -0 or for the overflow bit being used with a value <=255.)
// The game in question is Eye of the Beholder, you can FFW to the main menu and get a cursor right away.
// --yoshi
ControllerDef.AddXYPair($"P{player} Mouse {{0}}", AxisPairOrientation.RightAndUp, (-256).RangeTo(256), 0);
var nx = $"P{player} Mouse X";
var ny = $"P{player} Mouse Y";
_converts.Add(() =>

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
@ -126,17 +127,14 @@ namespace BizHawk.Emulation.Cores
private static PadSchema Mouse(int controller)
{
AxisSpec range = new((-256).RangeTo(256), 0);
return new PadSchema
{
DisplayName = "Mouse",
Size = new Size(418, 290),
Buttons = new PadSchemaControl[]
{
new AnalogSchema(14, 17, $"P{controller} Mouse X")
{
// MaxValue = 255,
// TargetSize = new Size(520, 570)
},
new AnalogSchema(14, 17, $"P{controller} Mouse X") { Spec = range, SecondarySpec = range },
new ButtonSchema(365, 17, controller, "Mouse Left", "Left"),
new ButtonSchema(365, 40, controller, "Mouse Center", "Center"),
new ButtonSchema(365, 63, controller, "Mouse Right", "Right"),