Merge branch 'nymashock' of https://github.com/CasualPokePlayer/BizHawk into nymashock

This commit is contained in:
CasualPokePlayer 2022-01-26 15:34:18 -08:00
commit 509096f41c
6 changed files with 382 additions and 33 deletions

View File

@ -590,6 +590,32 @@ namespace BizHawk.Client.Common
["L Gear Shift"] = 'L',
["R Gear Shift"] = 'R',
["Offscreen Shot"] = 'O'
},
[VSystemID.Raw.PSX] = new()
{
["D-Pad Up"] = 'U',
["D-Pad Down"] = 'D',
["D-Pad Left"] = 'L',
["D-Pad Right"] = 'R',
["Thumbstick Up"] = 'U',
["Thumbstick Down"] = 'D',
["Thumbstick Left"] = 'L',
["Thumbstick Right"] = 'R',
["□"] = 'Q',
["△"] = 'T',
["○"] = 'O',
["Left Stick, Button"] = '<',
["Right Stick, Button"] = '>',
["Left Stick, L-Thumb"] = 'L',
["Right Stick, L-Thumb"] = 'l',
["Left Stick, R-Thumb"] = 'R',
["Right Stick, R-Thumb"] = 'r',
["Left Stick, Trigger"] = 'T',
["Right Stick, Trigger"] = 't',
["Left Stick, Pinky"] = 'P',
["Right Stick, Pinky"] = 'p',
["Analog"] = 'M',
["Offscreen Shot"] = 'o',
}
};

View File

@ -33,6 +33,23 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
{ "psx.input.analog_mode_ct", new() { Hide = true } }, // probably don't want this
{ "psx.input.analog_mode_ct.compare", new() { Hide = true } },
{ "Virtual Port 1", new() { Default = "dualshock" } },
{ "Virtual Port 2", new() { Default = "none" } },
{ "Virtual Port 3", new() { Default = "none" } },
{ "Virtual Port 4", new() { Default = "none" } },
{ "Virtual Port 5", new() { Default = "none" } },
{ "Virtual Port 6", new() { Default = "none" } },
{ "Virtual Port 7", new() { Default = "none" } },
{ "Virtual Port 8", new() { Default = "none" } },
{ "psx.input.port2.memcard", new() { Default = "0" } },
{ "psx.input.port3.memcard", new() { Default = "0" } },
{ "psx.input.port4.memcard", new() { Default = "0" } },
{ "psx.input.port5.memcard", new() { Default = "0" } },
{ "psx.input.port6.memcard", new() { Default = "0" } },
{ "psx.input.port7.memcard", new() { Default = "0" } },
{ "psx.input.port8.memcard", new() { Default = "0" } },
{ "psx.input.port1.gun_chairs", new() { NonSync = true } },
{ "psx.input.port2.gun_chairs", new() { NonSync = true } },
{ "psx.input.port3.gun_chairs", new() { NonSync = true } },
@ -53,6 +70,9 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
{ "psx.correct_aspect", new() { NonSync = true } },
{ "psx.slstartp", new() { NonSync = true } },
{ "psx.slendp", new() { NonSync = true } },
{ "nyma.rtcinitialtime", new() { Hide = true } },
{ "nyma.rtcrealtime", new() { Hide = true } },
};
}
}

View File

@ -246,6 +246,9 @@ namespace BizHawk.Emulation.Cores.Waterbox
case InputType.Status:
// TODO: wire up statuses to something (not controller, of course)
break;
case InputType.Rumble:
// TODO: wtf do we do here???
break;
default:
{
throw new NotImplementedException($"Unimplemented button type {input.Type}");

View File

@ -48,8 +48,16 @@ namespace BizHawk.Emulation.Cores.Waterbox
.Select((p, i) => new PortPropertyDescriptor(p, i))
.Cast<PropertyDescriptor>();
var s2 = SettingsInfo.AllSettings
.Where(s => { var o = SettingsInfo.AllOverrides[s.SettingsKey]; return !o.Hide && !o.NonSync; })
.Select(m => MednaPropertyDescriptor.Create(m, true));
.Where(s =>
{
var o = SettingsInfo.AllOverrides[s.SettingsKey];
return !o.Hide && !o.NonSync;
})
.Select(m =>
{
m.DefaultValue = SettingsInfo.AllOverrides[m.SettingsKey].Default ?? m.DefaultValue;
return MednaPropertyDescriptor.Create(m, true);
});
return new PropertyDescriptorCollection(s1.Concat(s2).ToArray());
}
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) => GetProperties();
@ -70,8 +78,16 @@ namespace BizHawk.Emulation.Cores.Waterbox
var s1 = SettingsInfo.LayerNames.Select(l => new LayerPropertyDescriptor(l))
.Cast<PropertyDescriptor>();
var s2 = SettingsInfo.AllSettings
.Where(s => { var o = SettingsInfo.AllOverrides[s.SettingsKey]; return !o.Hide && o.NonSync; })
.Select(m => MednaPropertyDescriptor.Create(m, true));
.Where(s =>
{
var o = SettingsInfo.AllOverrides[s.SettingsKey];
return !o.Hide && o.NonSync;
})
.Select(m =>
{
m.DefaultValue = SettingsInfo.AllOverrides[m.SettingsKey].Default ?? m.DefaultValue;
return MednaPropertyDescriptor.Create(m, false);
});
return new PropertyDescriptorCollection(s1.Concat(s2).ToArray());
}
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) => GetProperties();

View File

@ -268,8 +268,16 @@ namespace BizHawk.Emulation.Cores.Waterbox
{
var s = new NymaSettingsInfo();
foreach (var kvp in ExtraOverrides.Concat(SettingOverrides))
{
s.AllOverrides[kvp.Key] = kvp.Value;
}
foreach (var portInfo in allPorts)
{
if (s.AllOverrides.ContainsKey(portInfo.FullName) && s.AllOverrides[portInfo.FullName].Default != null)
portInfo.DefaultDeviceShortName = s.AllOverrides[portInfo.FullName].Default;
s.Ports.Add(new NymaSettingsInfo.Port
{
Name = portInfo.FullName,
@ -283,10 +291,6 @@ namespace BizHawk.Emulation.Cores.Waterbox
});
}
foreach (var kvp in ExtraOverrides.Concat(SettingOverrides))
{
s.AllOverrides[kvp.Key] = kvp.Value;
}
var originalSettings = GetSettingsData();
foreach (var setting in originalSettings.Concat(ExtraSettings))
{

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using BizHawk.Common;
using BizHawk.Emulation.Common;
@ -14,35 +15,60 @@ namespace BizHawk.Emulation.Cores
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core, Action<string> showMessageBox)
{
var psx = (Octoshock)core;
var settings = psx.GetSyncSettings();
var fioConfig = settings.FIOConfig.ToLogical();
for (int i = 0; i < fioConfig.DevicesPlayer.Length; i++)
if (core is Octoshock octo)
{
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.None)
var settings = octo.GetSyncSettings();
var fioConfig = settings.FIOConfig.ToLogical();
for (int i = 0; i < fioConfig.DevicesPlayer.Length; i++)
{
continue;
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.None)
{
continue;
}
int pNum = i + 1;
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualAnalog || fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualShock)
{
yield return DualShockController(pNum);
}
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.Pad)
{
yield return GamePadController(pNum);
}
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.NegCon)
{
yield return NeGcon(pNum);
}
}
int pNum = i + 1;
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualAnalog || fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualShock)
{
yield return DualShockController(pNum);
}
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.Pad)
{
yield return GamePadController(pNum);
}
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.NegCon)
{
yield return NeGcon(pNum);
}
yield return ConsoleButtons(octo);
}
else if (core is Nymashock nyma)
{
foreach (var result in nyma.ActualPortData)
{
var num = int.Parse(result.Port.ShortName.Last().ToString());
var device = result.Device.ShortName;
if (device is "none") continue;
yield return device switch
{
"gamepad" => NymaGamePadController(num),
"dualshock" or "dualanalog" => NymaDualShockController(num),
"analogjoy" => NymaAnalogJoystick(num),
"mouse" => NymaMouse(num),
"negcon" => NymaNeGcon(num),
"guncon" => NymaGunCon(num),
"justifier" => NymaKonamiJustifier(num),
"dancepad" => NymaDancePad(num),
_ => throw new NotSupportedException($"device {device} is not supported"),
};
}
yield return ConsoleButtons(psx);
yield return NymaConsoleButtons();
}
}
private static PadSchema DualShockController(int controller)
@ -84,6 +110,47 @@ namespace BizHawk.Emulation.Cores
};
}
private static PadSchema NymaDualShockController(int controller)
{
var stickRanges = new[] { new AxisSpec(0.RangeTo(0xFFFF), 0x8000), new AxisSpec(0.RangeTo(0xFFFF), 0x8000, isReversed: true) };
return new PadSchema
{
Size = new Size(500, 290),
DisplayName = $"DualShock Player{controller}",
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(32, 50, $"P{controller} D-Pad Up"),
ButtonSchema.Down(32, 71, $"P{controller} D-Pad Down"),
ButtonSchema.Left(11, 62, $"P{controller} D-Pad Left"),
ButtonSchema.Right(53, 62, $"P{controller} D-Pad Right"),
new ButtonSchema(3, 32, controller, "L1"),
new ButtonSchema(191, 32, controller, "R1"),
new ButtonSchema(3, 10, controller, "L2"),
new ButtonSchema(191, 10, controller, "R2"),
new ButtonSchema(72, 90, controller, "Left Stick, Button", "L3"),
new ButtonSchema(130, 90, controller, "Right Stick, Button", "R3"),
new ButtonSchema(148, 62, controller, "□") { Icon = VGamepadButtonImage.Square },
new ButtonSchema(169, 50, controller, "△") { Icon = VGamepadButtonImage.Triangle },
new ButtonSchema(190, 62, controller, "○") { Icon = VGamepadButtonImage.Circle },
new ButtonSchema(169, 71, controller, "X") { Icon = VGamepadButtonImage.Cross },
new ButtonSchema(112, 62, controller, "Start", "S"),
new ButtonSchema(90, 62, controller, "Select", "s"),
new AnalogSchema(3, 120, $"P{controller} Left Stick Left / Right")
{
SecondaryName = $"P{controller} Left Stick Up / Down",
Spec = stickRanges[0],
SecondarySpec = stickRanges[1]
},
new AnalogSchema(260, 120, $"P{controller} Right Stick Left / Right")
{
SecondaryName = $"P{controller} Right Stick Up / Down",
Spec = stickRanges[0],
SecondarySpec = stickRanges[1]
}
}
};
}
private static PadSchema GamePadController(int controller)
{
return new PadSchema
@ -110,6 +177,90 @@ namespace BizHawk.Emulation.Cores
};
}
private static PadSchema NymaGamePadController(int controller)
{
return new PadSchema
{
Size = new Size(240, 115),
DisplayName = $"Gamepad Player{controller}",
Buttons = new[]
{
ButtonSchema.Up(37, 55, controller),
ButtonSchema.Down(37, 76, controller),
ButtonSchema.Left(16, 67, controller),
ButtonSchema.Right(58, 67, controller),
new ButtonSchema(8, 37, controller, "L1"),
new ButtonSchema(196, 37, controller, "R1"),
new ButtonSchema(8, 15, controller, "L2"),
new ButtonSchema(196, 15, controller, "R2"),
new ButtonSchema(153, 67, controller, "□") { Icon = VGamepadButtonImage.Square },
new ButtonSchema(174, 55, controller, "△") { Icon = VGamepadButtonImage.Triangle },
new ButtonSchema(195, 67, controller, "○") { Icon = VGamepadButtonImage.Circle },
new ButtonSchema(174, 76, controller, "X") { Icon = VGamepadButtonImage.Cross },
new ButtonSchema(112, 67, controller, "Start", "S"),
new ButtonSchema(90, 67, controller, "Select", "s")
}
};
}
private static PadSchema NymaAnalogJoystick(int controller)
{
var stickRanges = new[] { new AxisSpec(0.RangeTo(0xFFFF), 0x8000), new AxisSpec(0.RangeTo(0xFFFF), 0x8000, isReversed: true) };
return new PadSchema
{
Size = new Size(500, 290),
DisplayName = $"Analog Joystick Player{controller}",
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(32 + 130, 50, $"P{controller} Thumbstick Up"),
ButtonSchema.Down(32 + 130, 71, $"P{controller} Thumbstick Down"),
ButtonSchema.Left(11 + 130, 62, $"P{controller} Thumbstick Left"),
ButtonSchema.Right(53 + 130, 62, $"P{controller} Thumbstick Right"),
new ButtonSchema(3, 90, controller, "Left Stick, L-Thumb", "LL"),
new ButtonSchema(3 + 150 + 120, 90, controller, "Right Stick, L-Thumb", "RL"),
new ButtonSchema(3 + 30, 90, controller, "Left Stick, R-Thumb", "LR"),
new ButtonSchema(3 + 150 + 150, 90, controller, "Right Stick, R-Thumb", "RR"),
new ButtonSchema(3 + 60, 90, controller, "Left Stick, Trigger", "LT"),
new ButtonSchema(3 + 150 + 180, 90, controller, "Right Stick, Trigger", "RT"),
new ButtonSchema(3 + 90, 90, controller, "Left Stick, Pinky", "LP"),
new ButtonSchema(3 + 150 + 210, 90, controller, "Right Stick, Pinky", "RP"),
new ButtonSchema(112 + 140, 62, controller, "Start", "S"),
new ButtonSchema(90 + 140, 62, controller, "Select", "s"),
new AnalogSchema(3, 120, $"P{controller} Left Stick, Left / Right")
{
SecondaryName = $"P{controller} Left Stick, Fore / Back",
Spec = stickRanges[0],
SecondarySpec = stickRanges[1]
},
new AnalogSchema(260, 120, $"P{controller} Right Stick, Left / Right")
{
SecondaryName = $"P{controller} Right Stick, Fore / Back",
Spec = stickRanges[0],
SecondarySpec = stickRanges[1]
}
}
};
}
private static PadSchema NymaMouse(int controller)
{
return new PadSchema
{
DisplayName = $"Mouse Player{controller}",
Size = new Size(375, 320),
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} Motion Left / Right", 0xFFFF, 0xFFFF)
{
SecondaryName = $"P{controller} Motion Up / Down",
TargetSize = new Size(256, 256)
},
new ButtonSchema(300, 17, controller, "Left Button", "Left"),
new ButtonSchema(300, 77, controller, "Right Button", "Right"),
}
};
}
private static PadSchema NeGcon(int controller)
{
return new PadSchema
@ -156,7 +307,115 @@ namespace BizHawk.Emulation.Cores
};
}
private static PadSchema ConsoleButtons(Octoshock psx)
private static PadSchema NymaNeGcon(int controller)
{
return new PadSchema
{
Size = new Size(343, 195),
DisplayName = $"NeGcon Player{controller}",
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(36, 83, $"P{controller} D-Pad Up"),
ButtonSchema.Down(36, 104, $"P{controller} D-Pad Down"),
ButtonSchema.Left(15, 95, $"P{controller} D-Pad Left"),
ButtonSchema.Right(57, 95, $"P{controller} D-Pad Right"),
new ButtonSchema(78, 118, controller, "Start", "S"),
new ButtonSchema(278, 38, controller, "B"),
new ButtonSchema(308, 55, controller, "A"),
new ButtonSchema(308, 15, controller, "R"),
new SingleAxisSchema(5, 15, controller, "L")
{
TargetSize = new Size(128, 55),
MinValue = 0,
MaxValue = 65535
},
new SingleAxisSchema(125, 15, controller, "Twist | / |", isVertical: true)
{
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 65535
},
new SingleAxisSchema(180, 60, controller, "II")
{
TargetSize = new Size(128, 55),
MinValue = 0,
MaxValue = 65535
},
new SingleAxisSchema(220, 120, controller, "I")
{
TargetSize = new Size(128, 55),
MinValue = 0,
MaxValue = 65535
}
}
};
}
private static PadSchema NymaGunCon(int controller)
{
return new PadSchema
{
DisplayName = $"GunCon Player{controller}",
Size = new Size(375, 320),
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} X Axis", 0xFFFF, 0xFFFF)
{
SecondaryName = $"P{controller} Y Axis",
TargetSize = new Size(256, 256)
},
new ButtonSchema(300, 17, controller, "Trigger"),
new ButtonSchema(300, 57, controller, "A"),
new ButtonSchema(300, 87, controller, "B"),
new ButtonSchema(300, 290, controller, "Offscreen Shot", "Offscreen")
}
};
}
private static PadSchema NymaKonamiJustifier(int controller)
{
return new PadSchema
{
DisplayName = $"Konami Justifier Player{controller}",
Size = new Size(375, 320),
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} X Axis", 0xFFFF, 0xFFFF)
{
SecondaryName = $"P{controller} Y Axis",
TargetSize = new Size(256, 256)
},
new ButtonSchema(300, 17, controller, "Trigger"),
new ButtonSchema(300, 57, controller, "O"),
new ButtonSchema(300, 87, controller, "Start", "S"),
new ButtonSchema(300, 290, controller, "Offscreen Shot", "Offscreen")
}
};
}
private static PadSchema NymaDancePad(int controller)
{
return new PadSchema
{
Size = new Size(240, 115),
DisplayName = $"Dance Pad Player{controller}",
Buttons = new[]
{
ButtonSchema.Up(37, 55, controller),
ButtonSchema.Down(37, 76, controller),
ButtonSchema.Left(16, 67, controller),
ButtonSchema.Right(58, 67, controller),
new ButtonSchema(153, 67, controller, "□") { Icon = VGamepadButtonImage.Square },
new ButtonSchema(174, 55, controller, "△") { Icon = VGamepadButtonImage.Triangle },
new ButtonSchema(195, 67, controller, "○") { Icon = VGamepadButtonImage.Circle },
new ButtonSchema(174, 76, controller, "X") { Icon = VGamepadButtonImage.Cross },
new ButtonSchema(112, 67, controller, "Start", "S"),
new ButtonSchema(90, 67, controller, "Select", "s")
}
};
}
private static PadSchema ConsoleButtons(Octoshock octo)
{
return new ConsoleSchema
{
@ -164,7 +423,28 @@ namespace BizHawk.Emulation.Cores
Buttons = new PadSchemaControl[]
{
new ButtonSchema(10, 15, "Reset"),
new DiscManagerSchema(10, 54, new Size(300, 300), psx, new[] { "Open", "Close", "Disc Select" })
new DiscManagerSchema(10, 54, new Size(300, 300), octo, new[] { "Open", "Close", "Disc Select" })
}
};
}
private static PadSchema NymaConsoleButtons()
{
return new ConsoleSchema
{
Size = new Size(327, 50),
Buttons = new[]
{
new ButtonSchema(10, 15, "Reset"),
new ButtonSchema(58, 15, "Power"),
new ButtonSchema(108, 15, "Previous Disk")
{
DisplayName = "Prev Disc"
},
new ButtonSchema(175, 15, "Next Disk")
{
DisplayName = "Next Disc"
},
}
};
}