faust - support virtual pads

This commit is contained in:
adelikat 2020-06-15 14:02:34 -05:00
parent cf3e1d51e0
commit e6a2fe39e1
1 changed files with 28 additions and 2 deletions

View File

@ -1,9 +1,11 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
using BizHawk.Emulation.Cores.Waterbox;
namespace BizHawk.Client.EmuHawk
{
@ -18,6 +20,11 @@ namespace BizHawk.Client.EmuHawk
return GetBsnesPadSchemas(bsnes);
}
if (core is NymaCore nyma)
{
return GetFaustSchemas(nyma);
}
return GetSnes9xPadSchemas((Snes9x)core);
}
private IEnumerable<PadSchema> GetSnes9xPadSchemas(Snes9x core)
@ -108,6 +115,25 @@ namespace BizHawk.Client.EmuHawk
yield return ConsoleButtons();
}
private static IEnumerable<PadSchema> GetFaustSchemas(NymaCore nyma)
{
foreach (NymaCore.PortResult result in nyma.ActualPortData)
{
var num = int.Parse(result.Port.ShortName.Last().ToString());
var device = result.Device.ShortName;
if (device == "gamepad")
{
yield return StandardController(num);
}
else if (device != "none")
{
MessageBox.Show($"Controller type {device} not supported yet.");
}
}
yield return ConsoleButtons();
}
private static PadSchema StandardController(int controller)
{
return new PadSchema
@ -249,4 +275,4 @@ namespace BizHawk.Client.EmuHawk
};
}
}
}
}