From 9ea78adfdcd4c5e9e659df4bee96043b80f6386d Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 31 Jan 2015 19:37:26 +0000 Subject: [PATCH] PSX - get started on ability to configure controllers, right now the choices are 0-2 DualShock controllers, 1 by default. No ui yet to configure this --- .../Consoles/Sony/PSX/Octoshock.cs | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index dce651b069..405912bde8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -66,6 +66,66 @@ namespace BizHawk.Emulation.Cores.Sony.PSX }, }; + private void SetControllerButtons() + { + ControllerDefinition.BoolButtons.Clear(); + ControllerDefinition.FloatControls.Clear(); + + + for (int i = 0; i < _SyncSettings.Controllers.Length; i++) + { + if (_SyncSettings.Controllers[i].IsConnected) + { + ControllerDefinition.BoolButtons.AddRange(new[] + { + "P" + (i + 1) + " Up", + "P" + (i + 1) + " Down", + "P" + (i + 1) + " Left", + "P" + (i + 1) + " Right", + "P" + (i + 1) + " Select", + "P" + (i + 1) + " Start", + "P" + (i + 1) + " Square", + "P" + (i + 1) + " Triangle", + "P" + (i + 1) + " Circle", + "P" + (i + 1) + " Cross", + "P" + (i + 1) + " L1", + "P" + (i + 1) + " R1", + "P" + (i + 1) + " L2", + "P" + (i + 1) + " R2", + "P" + (i + 1) + " L3", + "P" + (i + 1) + " R3", + "P" + (i + 1) + " MODE", + }); + + ControllerDefinition.FloatControls.AddRange(new[] + { + "P" + (i + 1) + " LStick X", + "P" + (i + 1) + " LStick Y", + "P" + (i + 1) + " RStick X", + "P" + (i + 1) + " RStick Y" + }); + + ControllerDefinition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f }); + ControllerDefinition.FloatRanges.Add(new[] { 255.0f, 128.0f, 0.0f }); + ControllerDefinition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f }); + ControllerDefinition.FloatRanges.Add(new[] { 255.0f, 128.0f, 0.0f }); + } + } + + ControllerDefinition.BoolButtons.AddRange(new[] + { + "Open", + "Close", + "Reset" + }); + + ControllerDefinition.FloatControls.Add("Disc Select"); + + ControllerDefinition.FloatRanges.Add( + new[] {-1f,-1f,-1f} //this is carefully chosen so that we end up with a -1 disc by default (indicating that it's never been set) + ); + } + public string BoardName { get { return null; } } private int[] frameBuffer = new int[0]; @@ -317,6 +377,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX //do this after framebuffers and peripherals and whatever crap are setup. kind of lame, but thats how it is for now StudySaveBufferSize(); + SetControllerButtons(); OctoshockDll.shock_PowerOn(psx); } @@ -853,6 +914,17 @@ namespace BizHawk.Emulation.Cores.Sony.PSX { return (SyncSettings)MemberwiseClone(); } + + public ControllerSetting[] Controllers = + { + new ControllerSetting { IsConnected = true }, + new ControllerSetting { IsConnected = false } + }; + } + + public class ControllerSetting + { + public bool IsConnected { get; set; } } public class Settings