From 179a5c3bb4f0ab395cc60ac69e25f94c871cf6db Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 27 Jun 2014 02:09:17 +0000 Subject: [PATCH] Different controller definition for Game Gear than SMS, since game gear is 1 player and has a start button and no pause button --- .../Consoles/Sega/SMS/Input.cs | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/Input.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/Input.cs index f89d3841f6..d0ff4ca021 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/Input.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/Input.cs @@ -15,7 +15,29 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } }; - public ControllerDefinition ControllerDefinition { get { return SmsController; } } + public static readonly ControllerDefinition GGController = new ControllerDefinition + { + Name = "GG Controller", + BoolButtons = + { + "Reset", + "P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 B1", "P1 B2", "P1 Start" + } + }; + + public ControllerDefinition ControllerDefinition + { + get + { + if (IsGameGear) + { + return GGController; + } + + return SmsController; + } + } + public IController Controller { get; set; } byte ReadControls1() @@ -71,12 +93,22 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem byte ReadPort0() { if (IsGameGear == false) + { return 0xFF; + } + byte value = 0xFF; - if (Controller["Pause"]) + if ((Controller["Pause"] && !IsGameGear) || + (Controller["Start"] && IsGameGear)) + { value ^= 0x80; + } + if (Region == "Japan") + { value ^= 0x40; + } + return value; } }