From f8c9bd98f9ffdd9baf6e8f02a91579cf68611568 Mon Sep 17 00:00:00 2001 From: goyuken Date: Sun, 16 Dec 2012 15:15:54 +0000 Subject: [PATCH] 7800: implemented hard reset to simulate pushing the power button on the console. HSC ram is preserved, ROM is preserved, just about everything else is flushed. added "Power" button to connect to this. changed recording mnemonics --- .../Consoles/Atari/7800/Atari7800.cs | 20 +++++++++---------- .../Consoles/Atari/7800/Atari7800Control.cs | 14 +++++++++++++ BizHawk.MultiClient/movie/InputAdapters.cs | 17 ++++++++++------ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs index 1ba07d247e..9539056a5c 100644 --- a/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs +++ b/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs @@ -23,6 +23,13 @@ namespace BizHawk.Emulation { _frame++; + if (Controller["Power"]) + { + // it seems that theMachine.Reset() doesn't clear ram, etc + // this should leave hsram intact but clear most other things + HardReset(); + } + ControlAdapter.Convert(Controller, theMachine.InputState); theMachine.ComputeNextFrame(avProvider.framebuffer); @@ -183,10 +190,8 @@ namespace BizHawk.Emulation HardReset(); } - public void HardReset() + void HardReset() { - _lagcount = 0; - cart = Cart.Create(rom, GameInfo.CartType); ILogger logger = new ConsoleLogger(); HSC7800 hsc7800 = new HSC7800(hsbios, hsram); @@ -207,8 +212,6 @@ namespace BizHawk.Emulation throw new Exception("For now, only Atari 7800 ProLine Joystick games are supported."); ControllerDefinition = ControlAdapter.ControlType; - if (avProvider != null) - avProvider.Dispose(); avProvider.ConnectToMachine(theMachine); // to sync exactly with audio as this emulator creates and times it, the frame rate should be exactly 60:1 or 50:1 CoreComm.VsyncNum = theMachine.FrameHZ; @@ -238,11 +241,6 @@ namespace BizHawk.Emulation } } - private void SoftReset() //TOOD: hook this up - { - theMachine.Reset(); - } - MyAVProvider avProvider = new MyAVProvider(); class MyAVProvider : IVideoProvider, ISyncSoundProvider, IDisposable @@ -258,7 +256,7 @@ namespace BizHawk.Emulation uint newsamplerate = (uint)m.SoundSampleFrequency; if (newsamplerate != samplerate) { - // really shouldn't happen, but if it does, we're ready + // really shouldn't happen (after init), but if it does, we're ready if (resampler != null) resampler.Dispose(); resampler = new Emulation.Sound.Utilities.SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null); diff --git a/BizHawk.Emulation/Consoles/Atari/7800/Atari7800Control.cs b/BizHawk.Emulation/Consoles/Atari/7800/Atari7800Control.cs index dd21b4cc3e..b507f58243 100644 --- a/BizHawk.Emulation/Consoles/Atari/7800/Atari7800Control.cs +++ b/BizHawk.Emulation/Consoles/Atari/7800/Atari7800Control.cs @@ -13,6 +13,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 Joystick Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", @@ -29,6 +31,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 Paddle Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", @@ -54,6 +58,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 Keypad Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", @@ -84,6 +90,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 Driving Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", @@ -105,6 +113,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 Booster Grip Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", @@ -122,6 +132,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 ProLine Joystick Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", @@ -136,6 +148,8 @@ namespace BizHawk.Emulation Name = "Atari 7800 Light Gun Controller", BoolButtons = { + // hard reset, not passed to EMU7800 + "Power", // on the console "Reset", "Select", diff --git a/BizHawk.MultiClient/movie/InputAdapters.cs b/BizHawk.MultiClient/movie/InputAdapters.cs index 3dcc57c185..9be51f629e 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -341,7 +341,7 @@ namespace BizHawk.MultiClient case "A26": return "|..|.....|.....|"; case "A78": - return "|...|......|......|"; + return "|....|......|......|"; case "TI83": return "|..................................................|.|"; case "NES": @@ -453,6 +453,7 @@ namespace BizHawk.MultiClient private string GetA78ControllersAsMnemonic() { StringBuilder input = new StringBuilder("|"); + input.Append(IsBasePressed("Power") ? 'P' : '.'); input.Append(IsBasePressed("Reset") ? 'r' : '.'); input.Append(IsBasePressed("Select") ? 's' : '.'); input.Append(IsBasePressed("Pause") ? 'p' : '.'); @@ -811,19 +812,23 @@ namespace BizHawk.MultiClient MnemonicChecker c = new MnemonicChecker(mnemonic); MyBoolButtons.Clear(); - if (mnemonic.Length < 4) + if (mnemonic.Length < 5) { return; } - if (mnemonic[1] == 'r') + if (mnemonic[1] == 'P') + { + Force("Power", true); + } + if (mnemonic[2] == 'r') { Force("Reset", true); } - if (mnemonic[2] == 's') + if (mnemonic[3] == 's') { Force("Select", true); } - if (mnemonic[3] == 'p') + if (mnemonic[4] == 'p') { Force("Pause", true); } @@ -831,7 +836,7 @@ namespace BizHawk.MultiClient for (int player = 1; player <= Global.PLAYERS[ControlType]; player++) { int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1); - int start = 5; + int start = 6; if (mnemonic.Length < srcindex + start + Global.BUTTONS[ControlType].Count) { return;