diff --git a/Assets/defctrl.json b/Assets/defctrl.json index c0b28cdb6b..80db7678ec 100644 --- a/Assets/defctrl.json +++ b/Assets/defctrl.json @@ -866,22 +866,37 @@ }, "PSX Front Panel": { "P1 Up": "X1 DpadUp, Up", + "P1 D-Pad Up": "X1 DpadUp, Up", + "P1 Thumbstick Up": "X1 DpadUp, Up", "P1 Down": "X1 DpadDown, Down", + "P1 D-Pad Down": "X1 DpadDown, Down", + "P1 Thumbstick Down": "X1 DpadDown, Down", "P1 Left": "X1 DpadLeft, Left", + "P1 D-Pad Left": "X1 DpadLeft, Left", + "P1 Thumbstick Left": "X1 DpadLeft, Left", "P1 Right": "X1 DpadRight, Right", + "P1 D-Pad Right": "X1 DpadRight, Right", + "P1 Thumbstick Right": "X1 DpadRight, Right", "P1 Select": "X1 Back, Space", "P1 Start": "X1 Start, Enter", "P1 Square": "X1 X, A", + "P1 □": "X1 X, A", "P1 Triangle": "X1 Y, S", + "P1 △": "X1 Y, S", "P1 Circle": "X1 B, X", + "P1 ○": "X1 B, X", "P1 Cross": "X1 A, Z", + "P1 X": "X1 A, Z", "P1 L1": "X1 LeftShoulder, Q", "P1 R1": "X1 RightShoulder, W", "P1 L2": "X1 LeftTrigger, E", "P1 R2": "X1 RightTrigger, R", "P1 L3": "X1 LeftThumb, T", + "P1 Left Stick, Button": "X1 LeftThumb, T", "P1 R3": "X1 RightThumb, Y", - "P1 MODE": "D" + "P1 Right Stick, Button": "X1 RightThumb, Y", + "P1 MODE": "D", + "P1 Analog": "D", }, "Lynx Controller": { "Up": "Up", diff --git a/Assets/dll/faust.wbx.gz b/Assets/dll/faust.wbx.gz index 1ff4f0661c..2eec5a2e25 100644 Binary files a/Assets/dll/faust.wbx.gz and b/Assets/dll/faust.wbx.gz differ diff --git a/Assets/dll/hyper.wbx.gz b/Assets/dll/hyper.wbx.gz index 0b2c8e5a17..c0183820ad 100644 Binary files a/Assets/dll/hyper.wbx.gz and b/Assets/dll/hyper.wbx.gz differ diff --git a/Assets/dll/ngp.wbx.gz b/Assets/dll/ngp.wbx.gz index 29754378ac..dac7139f30 100644 Binary files a/Assets/dll/ngp.wbx.gz and b/Assets/dll/ngp.wbx.gz differ diff --git a/Assets/dll/pcfx.wbx.gz b/Assets/dll/pcfx.wbx.gz index 83846a19d9..9c4efeec92 100644 Binary files a/Assets/dll/pcfx.wbx.gz and b/Assets/dll/pcfx.wbx.gz differ diff --git a/Assets/dll/shock.wbx.gz b/Assets/dll/shock.wbx.gz new file mode 100644 index 0000000000..ce447b81f4 Binary files /dev/null and b/Assets/dll/shock.wbx.gz differ diff --git a/Assets/dll/ss.wbx.gz b/Assets/dll/ss.wbx.gz index 19ff48acb9..eae082ffb2 100644 Binary files a/Assets/dll/ss.wbx.gz and b/Assets/dll/ss.wbx.gz differ diff --git a/Assets/dll/turbo.wbx.gz b/Assets/dll/turbo.wbx.gz index becc0b5bbf..76e5e23167 100644 Binary files a/Assets/dll/turbo.wbx.gz and b/Assets/dll/turbo.wbx.gz differ diff --git a/README.md b/README.md index 325bcd0648..45a47b3f11 100644 --- a/README.md +++ b/README.md @@ -305,7 +305,7 @@ Neo Geo Pocket | **NeoPop** NES | **NesHawk**, QuickNes Odyssey² | **O2Hawk** PC-FX | **T.S.T.** -Playstation (PSX) | **Octoshock** +Playstation (PSX) | **Nymashock**, **Octoshock** Sega 32X | **PicoDrive** Sega Game Gear | **SMSHawk** Sega Genesis | **Genplus-gx** diff --git a/src/BizHawk.Client.Common/config/Config.cs b/src/BizHawk.Client.Common/config/Config.cs index a57874ede2..6304619169 100644 --- a/src/BizHawk.Client.Common/config/Config.cs +++ b/src/BizHawk.Client.Common/config/Config.cs @@ -34,6 +34,8 @@ namespace BizHawk.Client.Common new[] { CoreNames.GambatteLink, CoreNames.GBHawkLink, CoreNames.GBHawkLink3x, CoreNames.GBHawkLink4x }), (new[] { VSystemID.Raw.PCE, VSystemID.Raw.PCECD, VSystemID.Raw.SGX }, new[] { CoreNames.TurboNyma, CoreNames.HyperNyma, CoreNames.PceHawk }), + (new[] { VSystemID.Raw.PSX }, + new[] { CoreNames.Octoshock, CoreNames.Nymashock}), (new[] { VSystemID.Raw.TI83 }, new[] { CoreNames.TI83Hawk, CoreNames.Emu83 }), }; @@ -313,7 +315,7 @@ namespace BizHawk.Client.Common public bool GbAsSgb { get; set; } public string LibretroCore { get; set; } - public Dictionary PreferredCores = new Dictionary + public Dictionary PreferredCores = new() { [VSystemID.Raw.NES] = CoreNames.QuickNes, [VSystemID.Raw.SNES] = CoreNames.Snes9X, @@ -324,6 +326,7 @@ namespace BizHawk.Client.Common [VSystemID.Raw.PCE] = CoreNames.TurboNyma, [VSystemID.Raw.PCECD] = CoreNames.TurboNyma, [VSystemID.Raw.SGX] = CoreNames.TurboNyma, + [VSystemID.Raw.PSX] = CoreNames.Nymashock, [VSystemID.Raw.TI83] = CoreNames.Emu83, }; diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs index 9ca435af63..1bb988165a 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs @@ -591,7 +591,33 @@ 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', + }, }; private static readonly Dictionary BaseAxisLookupTable = new Dictionary @@ -619,7 +645,21 @@ namespace BizHawk.Client.Common { ["VPos"] = "X", ["HPos"] = "Y" - } + }, + [VSystemID.Raw.PSX] = new() + { + ["Left Stick Left / Right"] = "lsX", + ["Left Stick Up / Down"] = "lsY", + ["Right Stick Left / Right"] = "rsX", + ["Right Stick Up / Down"] = "rsY", + ["Left Stick, Left / Right"] = "lsX", + ["Left Stick, Fore / Back"] = "lsZ", + ["Right Stick, Left / Right"] = "rsX", + ["Right Stick, Fore / Back"] = "rsZ", + ["Motion Left / Right"] = "mX", + ["Motion Up / Down"] = "mY", + ["Twist | / |"] = "Twist", + }, }; } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 68aca97cda..08751e1694 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -35,6 +35,7 @@ using BizHawk.Emulation.Cores.Nintendo.N64; using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.SNES; using BizHawk.Emulation.Cores.Nintendo.SNES9X; +using BizHawk.Emulation.Cores.Sony.PSX; using BizHawk.Client.EmuHawk.ToolExtensions; using BizHawk.Client.EmuHawk.CoreExtensions; @@ -1983,7 +1984,7 @@ namespace BizHawk.Client.EmuHawk case VSystemID.Raw.NES: NESSubMenu.Visible = true; break; - case VSystemID.Raw.PSX: + case VSystemID.Raw.PSX when Emulator is Octoshock: PSXSubMenu.Visible = true; break; case VSystemID.Raw.TI83: diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs new file mode 100644 index 0000000000..006e30fbe6 --- /dev/null +++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Nymashock.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; + +using BizHawk.Emulation.Common; +using BizHawk.Emulation.Cores.Waterbox; + +namespace BizHawk.Emulation.Cores.Sony.PSX +{ + [PortedCore(CoreNames.Nymashock, "Mednafen Team", "1.27.1", "https://mednafen.github.io/releases/")] + public class Nymashock : NymaCore, IRegionable + { + [CoreConstructor(VSystemID.Raw.PSX)] + public Nymashock(CoreLoadParameters lp) + : base(lp.Comm, VSystemID.Raw.PSX, "PSX Front Panel", lp.Settings, lp.SyncSettings) + { + if (lp.Roms.Count > 0) + throw new InvalidOperationException("To load a PSX game, please load the CUE file and not the BIN file."); + var firmwares = new Dictionary + { + { "FIRMWARE:$J", new("PSX", "J") }, + { "FIRMWARE:$U", new("PSX", "U") }, + { "FIRMWARE:$E", new("PSX", "E") }, + }; + DoInit(lp, "shock.wbx", firmwares); + } + + protected override IDictionary SettingOverrides { get; } = new Dictionary + { + { "psx.bios_jp", new() { Hide = true , Default = "$J" } }, // FIRMWARE: + { "psx.bios_na", new() { Hide = true , Default = "$U" } }, // FIRMWARE: + { "psx.bios_eu", new() { Hide = true , Default = "$E" } }, // FIRMWARE: + + { "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 } }, + { "psx.input.port4.gun_chairs", new() { NonSync = true } }, + { "psx.input.port5.gun_chairs", new() { NonSync = true } }, + { "psx.input.port6.gun_chairs", new() { NonSync = true } }, + { "psx.input.port7.gun_chairs", new() { NonSync = true } }, + { "psx.input.port8.gun_chairs", new() { NonSync = true } }, + + { "psx.dbg_exe_cdpath", new() { Hide = true } }, + + { "psx.spu.resamp_quality", new() { NonSync = true } }, + { "psx.input.mouse_sensitivity", new() { Hide = true } }, + + { "psx.slstart", new() { NonSync = true } }, + { "psx.slend", new() { NonSync = true } }, + { "psx.h_overscan", new() { NonSync = true } }, + { "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 } }, + }; + } +} diff --git a/src/BizHawk.Emulation.Cores/CoreNames.cs b/src/BizHawk.Emulation.Cores/CoreNames.cs index c34aeca5de..7bee7bfb53 100644 --- a/src/BizHawk.Emulation.Cores/CoreNames.cs +++ b/src/BizHawk.Emulation.Cores/CoreNames.cs @@ -40,6 +40,7 @@ namespace BizHawk.Emulation.Cores public const string Mupen64Plus = "Mupen64Plus"; public const string NesHawk = "NesHawk"; public const string NeoPop = "NeoPop"; + public const string Nymashock = "Nymashock"; public const string O2Hawk = "O2Hawk"; public const string Octoshock = "Octoshock"; public const string PceHawk = "PCEHawk"; diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.cs index 82bde4ee8e..ca2d5cac1a 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.cs @@ -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}"); diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs index 550fc0f39f..2567e69e01 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.ComponentModel.cs @@ -48,8 +48,16 @@ namespace BizHawk.Emulation.Cores.Waterbox .Select((p, i) => new PortPropertyDescriptor(p, i)) .Cast(); 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(); 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(); diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.cs index bde09ff9ff..35cc2e186e 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Settings.cs @@ -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)) { diff --git a/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs b/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs index b68b609983..f44268f4ba 100644 --- a/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs +++ b/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs @@ -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 GetPadSchemas(IEmulator core, Action 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,116 @@ 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) + { + DisplayName = "Twist", + 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 +424,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" + }, } }; } diff --git a/waterbox/nyma/NymaCore.cpp b/waterbox/nyma/NymaCore.cpp index 3e000e9f93..2291984147 100644 --- a/waterbox/nyma/NymaCore.cpp +++ b/waterbox/nyma/NymaCore.cpp @@ -187,6 +187,10 @@ ECL_EXPORT void FrameAdvance(MyFrameInfo& frame) if (MDFN_LIKELY(lw > 0)) { memcpy(dst, src, lw * sizeof(uint32_t)); + if (!EES->InterlaceOn && lw < w) + { + memset(dst + lw, 0, (w - lw) * sizeof(uint32_t)); + } src += srcp; dst += dstp; } diff --git a/waterbox/nyma/make-all-released-cores.sh b/waterbox/nyma/make-all-released-cores.sh index 30a8ab6393..3c802271a3 100644 --- a/waterbox/nyma/make-all-released-cores.sh +++ b/waterbox/nyma/make-all-released-cores.sh @@ -7,6 +7,7 @@ make -f ngp.mak $1 -j make -f faust.mak $1 -j make -f pcfx.mak $1 -j make -f ss.mak $1 -j +make -f shock.mak $1 -j # make -f lynx.mak $1 -j # make -f vb.mak $1 -j # make -f wswan.mak $1 -j diff --git a/waterbox/nyma/mednafen b/waterbox/nyma/mednafen index da0946da80..52c06fc2cf 160000 --- a/waterbox/nyma/mednafen +++ b/waterbox/nyma/mednafen @@ -1 +1 @@ -Subproject commit da0946da80e00fae0f1d2d086d67f64df6a7e3e0 +Subproject commit 52c06fc2cfc1f7f0c9d3a5fcbcac3216e40384ca diff --git a/waterbox/nyma/shock.cpp b/waterbox/nyma/shock.cpp new file mode 100644 index 0000000000..fcd2b080c2 --- /dev/null +++ b/waterbox/nyma/shock.cpp @@ -0,0 +1,80 @@ +#include +#include +#include +#include +#include +#include "nyma.h" +#include +#include + +using namespace MDFN_IEN_PSX; + +extern Mednafen::MDFNGI EmulatedPSX; + +void SetupMDFNGameInfo() +{ + EmulatedPSX.LayerNames = NULL; // SetLayerEnableMask is null but not this for w/e reason so this is useless + Mednafen::MDFNGameInfo = &EmulatedPSX; +} + +namespace MDFN_IEN_PSX +{ + extern MultiAccessSizeMem<2048 * 1024, false> MainRAM; + extern PS_GPU GPU; + extern PS_SPU *SPU; + extern PS_CPU *CPU; + extern FrontIO *FIO; + extern MultiAccessSizeMem<512 * 1024, false> *BIOSROM; + extern MultiAccessSizeMem<65536, false> *PIOMem; +} + +static void AccessSystemBus(uint8_t* buffer, int64_t address, int64_t count, bool write) +{ + if (write) + { + while (count--) + PSX_MemPoke8(address++, *buffer++); + } + else + { + while (count--) + *buffer++ = PSX_MemPeek8(address++); + } +} + +ECL_EXPORT void GetMemoryAreas(MemoryArea* m) +{ + int i = 0; + #define AddMemoryDomain(name,data,size,flags) do\ + {\ + m[i].Data = data;\ + m[i].Name = name;\ + m[i].Size = size;\ + m[i].Flags = flags;\ + i++;\ + }\ + while (0) + AddMemoryDomain("MainRAM", MainRAM.data8, 2048*1024, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_PRIMARY); + AddMemoryDomain("GPURAM", GPU.GPURAM, 2*512*1024, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4); + AddMemoryDomain("SPURAM", SPU->SPURAM, 512*1024, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4); + AddMemoryDomain("BiosROM", BIOSROM->data8, 512*1024, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4); + AddMemoryDomain("PIOMem", PIOMem ? PIOMem->data8 : NULL, 64*1024, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4); + AddMemoryDomain("DCache", CPU->ScratchRAM.data8, 1024, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4); + #define AddMemcardDomain(which) do\ + {\ + if (FIO->MCDevices[which-1]->GetNVSize())\ + {\ + AddMemoryDomain("Memcard " #which, (void*)FIO->MCDevices[which-1]->ReadNV(), FIO->MCDevices[which-1]->GetNVSize(), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_SAVERAMMABLE);\ + }\ + }\ + while (0) + AddMemcardDomain(1); + AddMemcardDomain(2); + AddMemcardDomain(3); + AddMemcardDomain(4); + AddMemcardDomain(5); + AddMemcardDomain(6); + AddMemcardDomain(7); + AddMemcardDomain(8); + AddMemoryDomain("System Bus", (void*)AccessSystemBus, 1ull << 32, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_FUNCTIONHOOK); +} diff --git a/waterbox/nyma/shock.mak b/waterbox/nyma/shock.mak new file mode 100644 index 0000000000..f282ba7a29 --- /dev/null +++ b/waterbox/nyma/shock.mak @@ -0,0 +1,11 @@ +include common.mak + +SRCS += \ + $(filter-out %debug.cpp,$(call cppdir,psx)) \ + mednafen/src/cheat_formats/psx.cpp \ + mednafen/src/resampler/resample.c \ + $(CD_SRCS) \ + mednafen/src/PSFLoader.cpp \ + shock.cpp + +include ../common.mak diff --git a/waterbox/nyma/zlib/configure b/waterbox/nyma/zlib/configure old mode 100644 new mode 100755 diff --git a/waterbox/readme.txt b/waterbox/readme.txt index 40b4b0f69c..b96c101ce8 100644 --- a/waterbox/readme.txt +++ b/waterbox/readme.txt @@ -56,6 +56,7 @@ It consists of a modified musl libc, and build scripts to tie it all together. cd nyma && make -f hyper.mak install cd nyma && make -f pcfx.mak install cd nyma && make -f ss.mak install + cd nyma && make -f shock.mak install cd picodrive && make install cd snes9x && make install cd uzem && make install