diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs index ee2306459e..411b53c989 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs @@ -130,7 +130,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk [CoreConstructor(VSystemID.Raw.GB)] [CoreConstructor(VSystemID.Raw.GBC)] - public GBHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ GBSettings settings, GBSyncSettings syncSettings) + public GBHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ GBSettings settings, GBSyncSettings syncSettings, bool subframe = false) { var ser = new BasicServiceProvider(this); @@ -199,7 +199,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk _controllerDeck = new(mppr is "MBC7" ? typeof(StandardTilt).DisplayName() - : GBHawkControllerDeck.DefaultControllerName); + : GBHawkControllerDeck.DefaultControllerName, subframe); timer.Core = this; audio.Core = this; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllerDeck.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllerDeck.cs index 936cacb418..7353fb9897 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllerDeck.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawkControllerDeck.cs @@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { public class GBHawkControllerDeck { - public GBHawkControllerDeck(string controller1Name) + public GBHawkControllerDeck(string controller1Name, bool subframe) { Port1 = ControllerCtors.TryGetValue(controller1Name, out var ctor1) ? ctor1(1) @@ -24,6 +24,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk foreach (var kvp in Port1.Definition.Axes) Definition.Axes.Add(kvp); + if (subframe) + { + Definition.AddAxis("Input Cycle", 0.RangeTo(70224), 70224); + } + Definition.MakeImmutable(); } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs index b5a3d968ec..8a64289b73 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs @@ -88,7 +88,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public bool CanProvideAsync => false; - internal void ResetControllerDefinition() + internal void ResetControllerDefinition(bool subframe) { ControllerDefinition = null; @@ -115,7 +115,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } // Add in the reset timing axis for subneshawk - if (using_reset_timing && ControllerDefinition.Axes.Count == 0) + if (subframe) { ControllerDefinition.AddAxis("Reset Cycle", 0.RangeTo(500000), 0); } @@ -398,8 +398,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public bool current_strobe; public bool new_strobe; public bool alt_lag; - // variable used with subneshawk to trigger reset at specific cycle after reset - public bool using_reset_timing = false; + // this function will run one step of the ppu // it will return whether the controller is read or not. public void do_single_step(IController controller, out bool cont_read, out bool frame_done) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs index a40c3f34a5..cc80535ac6 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs @@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES IBoardInfo, IRomInfo, ISettable, ICodeDataLogger { [CoreConstructor(VSystemID.Raw.NES)] - public NES(CoreComm comm, GameInfo game, byte[] rom, NESSettings settings, NESSyncSettings syncSettings) + public NES(CoreComm comm, GameInfo game, byte[] rom, NESSettings settings, NESSyncSettings syncSettings, bool subframe = false) { var ser = new BasicServiceProvider(this); ServiceProvider = ser; @@ -71,7 +71,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } } - ResetControllerDefinition(); + ResetControllerDefinition(subframe); } private static readonly bool USE_DATABASE = true; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs index 9384b1ab4d..561ad6a3bd 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs @@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk var subGBSettings = (GBHawk.GBHawk.GBSettings)settings ?? new GBHawk.GBHawk.GBSettings(); var subGBSyncSettings = (GBHawk.GBHawk.GBSyncSettings)syncSettings ?? new GBHawk.GBHawk.GBSyncSettings(); - _GBCore = new GBHawk.GBHawk(comm, game, rom, subGBSettings, subGBSyncSettings); + _GBCore = new GBHawk.GBHawk(comm, game, rom, subGBSettings, subGBSyncSettings, true); HardReset(); current_cycle = 0; @@ -41,9 +41,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk _tracer = new TraceBuffer(_GBCore.cpu.TraceHeader); ser.Register(_tracer); - - _GBCore.ControllerDefinition.AddAxis("Input Cycle", 0.RangeTo(70224), 70224) - .MakeImmutable(); } public GBHawk.GBHawk _GBCore; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs index d7a6d0dc93..76bdd77f52 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs @@ -14,13 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk var subNesSettings = (NES.NES.NESSettings)settings ?? new NES.NES.NESSettings(); var subNesSyncSettings = (NES.NES.NESSyncSettings)syncSettings ?? new NES.NES.NESSyncSettings(); - _nesCore = new NES.NES(comm, game, rom, subNesSettings, subNesSyncSettings) - { - using_reset_timing = true - }; - - // Adds Reset timing control to controller definition - _nesCore.ResetControllerDefinition(); + _nesCore = new NES.NES(comm, game, rom, subNesSettings, subNesSyncSettings, true); HardReset(); current_cycle = 0;