GBHawk: make controller setting only effect MBC7 games

This commit is contained in:
alyosha-tas 2020-08-23 20:08:43 -04:00
parent 7d2e18004f
commit 6501c48b13
2 changed files with 19 additions and 9 deletions

View File

@ -72,23 +72,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public enum ControllerType public enum ControllerType
{ {
Default,
Tilt Tilt
} }
[JsonIgnore] [JsonIgnore]
private ControllerType _GBController; private ControllerType _GBController;
[DisplayName("Controller")] [DisplayName("Tilt Controls")]
[Description("Select Controller Type")] [Description("Choose Tilt Control mode, when Applicable (MBC7 games)")]
[DefaultValue(ControllerType.Default)] [DefaultValue(ControllerType.Tilt)]
public ControllerType GBController public ControllerType GBController
{ {
get => _GBController; get => _GBController;
set set
{ {
if (value == ControllerType.Default) { Port1 = GBHawkControllerDeck.DefaultControllerName; } if (value == ControllerType.Tilt) { Port1 = "Gameboy Controller + Tilt"; }
else { Port1 = "Gameboy Controller + Tilt"; }
_GBController = value; _GBController = value;
} }

View File

@ -117,7 +117,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
_settings = (GBSettings)settings ?? new GBSettings(); _settings = (GBSettings)settings ?? new GBSettings();
_syncSettings = (GBSyncSettings)syncSettings ?? new GBSyncSettings(); _syncSettings = (GBSyncSettings)syncSettings ?? new GBSyncSettings();
_controllerDeck = new GBHawkControllerDeck(_syncSettings.Port1);
byte[] Bios = null; byte[] Bios = null;
@ -182,9 +181,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
Console.WriteLine("MD5: " + rom.HashMD5(0, rom.Length)); Console.WriteLine("MD5: " + rom.HashMD5(0, rom.Length));
Console.WriteLine("SHA1: " + rom.HashSHA1(0, rom.Length)); Console.WriteLine("SHA1: " + rom.HashSHA1(0, rom.Length));
_rom = rom; _rom = rom;
Setup_Mapper(); string mppr = Setup_Mapper();
if (cart_RAM != null) { cart_RAM_vbls = new byte[cart_RAM.Length]; } if (cart_RAM != null) { cart_RAM_vbls = new byte[cart_RAM.Length]; }
if (mppr == "MBC7")
{
_controllerDeck = new GBHawkControllerDeck(_syncSettings.Port1);
}
else
{
_controllerDeck = new GBHawkControllerDeck(GBHawkControllerDeck.DefaultControllerName);
}
timer.Core = this; timer.Core = this;
audio.Core = this; audio.Core = this;
ppu.Core = this; ppu.Core = this;
@ -323,7 +333,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
} }
} }
private void Setup_Mapper() public string Setup_Mapper()
{ {
// setup up mapper based on header entry // setup up mapper based on header entry
string mppr; string mppr;
@ -548,6 +558,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
// currently no date / time input for TAMA5 // currently no date / time input for TAMA5
} }
return mppr;
} }
} }
} }