From 0d581613e28c80bc0952c26fd58feb0953e2b4cc Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 29 Jun 2014 21:01:57 +0000 Subject: [PATCH] NEShawk - nice button orders for controllers --- .../Consoles/Nintendo/NES/NESControllers.cs | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs index f9b6ad8fb5..d4d935b584 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs @@ -235,15 +235,49 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public ControllerNES() { - Definition = new ControllerDefinition { BoolButtons = new List(Buttons) }; + Definition = new ControllerDefinition + { + BoolButtons = Buttons + .OrderBy(x => ButtonOrdinals[x]) + .ToList() + }; } + + Dictionary ButtonOrdinals = new Dictionary + { + { "0Up", 1 }, + { "0Down", 2 }, + { "0Left", 3 }, + { "0Right", 4 }, + { "0Start", 5 }, + { "0Select", 6 }, + { "0B", 7 }, + { "0A", 8 }, + }; + public ControllerNES(bool famicomP2) { if (famicomP2) - Definition = new ControllerDefinition { BoolButtons = new List(FamicomP2Buttons.Where((s) => s != null)) }; + { + Definition = new ControllerDefinition + { + BoolButtons = FamicomP2Buttons + .Where((s) => s != null) + .OrderBy(x => ButtonOrdinals[x]) + .ToList() + }; + } else - Definition = new ControllerDefinition { BoolButtons = new List(Buttons) }; + { + Definition = new ControllerDefinition + { + BoolButtons = Buttons + .OrderBy(x => ButtonOrdinals[x]) + .ToList() + }; + } + FamicomP2Hack = famicomP2; }