N64 - dynamically generate buttons in controller definition based on connected controllers, Virtualpads - show pads based on connected controllers
This commit is contained in:
parent
7c7182b75d
commit
5f71bf11c8
|
@ -3,6 +3,7 @@ using System.ComponentModel;
|
|||
using System.Drawing;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.N64;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -11,26 +12,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public IEnumerable<VirtualPad> GetPads()
|
||||
{
|
||||
yield return new VirtualPad(StandardController(1))
|
||||
var ss = (N64SyncSettings)Global.Emulator.GetSyncSettings();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Location = new Point(15, 15)
|
||||
};
|
||||
|
||||
yield return new VirtualPad(StandardController(2))
|
||||
if (ss.Controllers[i].IsConnected)
|
||||
{
|
||||
Location = new Point(200, 15)
|
||||
};
|
||||
|
||||
yield return new VirtualPad(StandardController(3))
|
||||
{
|
||||
Location = new Point(385, 15)
|
||||
};
|
||||
|
||||
yield return new VirtualPad(StandardController(4))
|
||||
{
|
||||
Location = new Point(570, 15)
|
||||
};
|
||||
yield return new VirtualPad(StandardController(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static PadSchema StandardController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
|
@ -82,14 +73,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Name = "P" + controller + " L",
|
||||
DisplayName = "L",
|
||||
Location = new Point(3, 148),
|
||||
Location = new Point(3, 150),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "P" + controller + " R",
|
||||
DisplayName = "R",
|
||||
Location = new Point(172, 148),
|
||||
Location = new Point(172, 150),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Common;
|
||||
|
@ -534,9 +535,56 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
public bool PutSyncSettings(object o)
|
||||
{
|
||||
_syncSettings = (N64SyncSettings)o;
|
||||
SetControllerButtons();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetControllerButtons()
|
||||
{
|
||||
ControllerDefinition.BoolButtons.Clear();
|
||||
ControllerDefinition.FloatControls.Clear();
|
||||
|
||||
ControllerDefinition.BoolButtons.AddRange(new[]
|
||||
{
|
||||
"Reset",
|
||||
"Power"
|
||||
});
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (_syncSettings.Controllers[i].IsConnected)
|
||||
{
|
||||
ControllerDefinition.BoolButtons.AddRange(new []
|
||||
{
|
||||
"P" + i + "A Up",
|
||||
"P" + i + "A Down",
|
||||
"P" + i + "A Left",
|
||||
"P" + i + "A Right",
|
||||
"P" + i + "DPad U",
|
||||
"P" + i + "DPad D",
|
||||
"P" + i + "DPad L",
|
||||
"P" + i + "DPad R",
|
||||
"P" + i + "Start",
|
||||
"P" + i + "Z",
|
||||
"P" + i + "B",
|
||||
"P" + i + "A",
|
||||
"P" + i + "C Up",
|
||||
"P" + i + "C Down",
|
||||
"P" + i + "C Right",
|
||||
"P" + i + "C Left",
|
||||
"P" + i + "L",
|
||||
"P" + i + "R",
|
||||
});
|
||||
|
||||
ControllerDefinition.FloatControls.AddRange(new[]
|
||||
{
|
||||
"P" + i + " X Axis",
|
||||
"P" + i + " Y Axis",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
BoolButtons =
|
||||
{
|
||||
"P1 A Up", "P1 A Down", "P1 A Left", "P1 A Right", "P1 DPad U", "P1 DPad D", "P1 DPad L", "P1 DPad R", "P1 Start", "P1 Z", "P1 B", "P1 A", "P1 C Up", "P1 C Down", "P1 C Right", "P1 C Left", "P1 L", "P1 R",
|
||||
"P2 A Up", "P2 A Down", "P2 A Left", "P2 A Right", "P2 DPad U", "P2 DPad D", "P2 DPad L", "P2 DPad R", "P2 Start", "P2 Z", "P2 B", "P2 A", "P2 C Up", "P2 C Down", "P2 C Right", "P2 C Left", "P2 L", "P2 R",
|
||||
"P3 A Up", "P3 A Down", "P3 A Left", "P3 A Right", "P3 DPad U", "P3 DPad D", "P3 DPad L", "P3 DPad R", "P3 Start", "P3 Z", "P3 B", "P3 A", "P3 C Up", "P3 C Down", "P3 C Right", "P3 C Left", "P3 L", "P3 R",
|
||||
"P4 A Up", "P4 A Down", "P4 A Left", "P4 A Right", "P4 DPad U", "P4 DPad D", "P4 DPad L", "P4 DPad R", "P4 Start", "P4 Z", "P4 B", "P4 A", "P4 C Up", "P4 C Down", "P4 C Right", "P4 C Left", "P4 L", "P4 R",
|
||||
//"P2 A Up", "P2 A Down", "P2 A Left", "P2 A Right", "P2 DPad U", "P2 DPad D", "P2 DPad L", "P2 DPad R", "P2 Start", "P2 Z", "P2 B", "P2 A", "P2 C Up", "P2 C Down", "P2 C Right", "P2 C Left", "P2 L", "P2 R",
|
||||
//"P3 A Up", "P3 A Down", "P3 A Left", "P3 A Right", "P3 DPad U", "P3 DPad D", "P3 DPad L", "P3 DPad R", "P3 Start", "P3 Z", "P3 B", "P3 A", "P3 C Up", "P3 C Down", "P3 C Right", "P3 C Left", "P3 L", "P3 R",
|
||||
//"P4 A Up", "P4 A Down", "P4 A Left", "P4 A Right", "P4 DPad U", "P4 DPad D", "P4 DPad L", "P4 DPad R", "P4 Start", "P4 Z", "P4 B", "P4 A", "P4 C Up", "P4 C Down", "P4 C Right", "P4 C Left", "P4 L", "P4 R",
|
||||
"Reset", "Power"
|
||||
},
|
||||
FloatControls =
|
||||
{
|
||||
"P1 X Axis", "P1 Y Axis",
|
||||
"P2 X Axis", "P2 Y Axis",
|
||||
"P3 X Axis", "P3 Y Axis",
|
||||
"P4 X Axis", "P4 Y Axis"
|
||||
//"P2 X Axis", "P2 Y Axis",
|
||||
//"P3 X Axis", "P3 Y Axis",
|
||||
//"P4 X Axis", "P4 Y Axis"
|
||||
},
|
||||
FloatRanges =
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue