gpgx: implement paddle controller

This commit is contained in:
Morilli 2024-05-23 11:51:23 +02:00
parent fe645025eb
commit 3bab84445c
2 changed files with 23 additions and 1 deletions

View File

@ -177,6 +177,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
return LibGPGX.INPUT_SYSTEM.SYSTEM_WAYPLAY;
case ControlType.Mouse:
return LibGPGX.INPUT_SYSTEM.SYSTEM_MOUSE;
case ControlType.Paddle:
return LibGPGX.INPUT_SYSTEM.SYSTEM_PADDLE;
}
}
@ -206,7 +208,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
Activator,
Teamplayer,
Wayplay,
Mouse
Mouse,
Paddle,
}

View File

@ -118,6 +118,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
new CName("XE E2", LibGPGX.INPUT_KEYS.INPUT_XE_E2),
};
private static readonly CName[] Paddle =
{
new("B1", LibGPGX.INPUT_KEYS.INPUT_BUTTON1)
};
private LibGPGX.InputData _target;
private IController _source;
@ -190,6 +195,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
});
}
private void DoPaddleAnalog(int idx, int player)
{
ControllerDef.AddAxis($"P{player} Paddle", 0.RangeTo(255), 128);
_converts.Add(() =>
{
_target.analog[2 * idx] = (byte)_source.AxisValue($"P{player} Paddle");
});
}
public GPGXControlConverter(LibGPGX.InputData input, string systemId, bool cdButtons)
{
Console.WriteLine("Genesis Controller report:");
@ -240,6 +255,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
player++;
break;
case LibGPGX.INPUT_DEVICE.DEVICE_PADDLE:
AddToController(i, player, Paddle);
DoPaddleAnalog(i, player);
player++;
break;
case LibGPGX.INPUT_DEVICE.DEVICE_SPORTSPAD:
case LibGPGX.INPUT_DEVICE.DEVICE_TEREBI:
throw new NotImplementedException();