Fixup ST-V input device selection

No multi-tap with ST-V, and it'll get overrides for the ports anyways
This commit is contained in:
CasualPokePlayer 2024-11-14 19:49:06 -08:00
parent 7899c9ddce
commit c4bd436c5c
4 changed files with 24 additions and 4 deletions

View File

@ -103,9 +103,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
protected override HashSet<string> ComputeHiddenPorts()
{
var devCount = 12;
if (SettingsQuery("ss.input.sport1.multitap") != "1")
if (_isArcade || SettingsQuery("ss.input.sport1.multitap") != "1")
devCount -= 5;
if (SettingsQuery("ss.input.sport2.multitap") != "1")
if (_isArcade || SettingsQuery("ss.input.sport2.multitap") != "1")
devCount -= 5;
var ret = new HashSet<string>();
for (var i = 1; i <= 12; i++)

View File

@ -123,6 +123,13 @@ namespace BizHawk.Emulation.Cores.Waterbox
[BizImport(CC)]
public abstract void SetLayers(ulong layers);
/// <summary>
/// Gets an input device override for a port
/// Corresponds to Game->DesiredInput[port].device_name
/// </summary>
[BizImport(CC)]
public abstract IntPtr GetInputDeviceOverride(int port);
[BizImport(CC)]
public abstract void DumpInputs();

View File

@ -35,6 +35,9 @@ namespace BizHawk.Emulation.Cores.Waterbox
int thunkWriteOffset)
=> ret.AddAxis(name, 0.RangeTo(0xFFFF), 0x8000, isReversed);
private string GetInputDeviceOverride(int port)
=> Mershul.PtrToStringUtf8(_nyma.GetInputDeviceOverride(port));
private void InitControls(List<NPortInfoT> allPorts, int numCds, ref SystemInfo si)
{
_controllerAdapter = new ControllerAdapter(
@ -43,6 +46,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
OverrideButtonName,
numCds,
ref si,
GetInputDeviceOverride,
ComputeHiddenPorts(),
AddAxis,
_controllerDeckName);
@ -66,6 +70,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
Func<string, string> overrideName,
int numCds,
ref SystemInfo systemInfo,
Func<int, string> getInputDeviceOverride,
HashSet<string> hiddenPorts,
AddAxisHook addAxisHook,
string controllerDeckName)
@ -89,7 +94,15 @@ namespace BizHawk.Emulation.Cores.Waterbox
for (int port = 0, devByteStart = 0; port < allPorts.Count; port++)
{
var portInfo = allPorts[port];
if (!config.TryGetValue(port, out var deviceName)) deviceName = portInfo.DefaultDeviceShortName;
var deviceName = getInputDeviceOverride(port);
if (deviceName == null)
{
if (!config.TryGetValue(port, out deviceName))
{
deviceName = portInfo.DefaultDeviceShortName;
}
}
finalDevices.Add(deviceName);
if (hiddenPorts.Contains(portInfo.ShortName))

View File

@ -255,7 +255,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
private IController _currentController;
private bool _isArcade;
protected bool _isArcade;
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{