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

This commit is contained in:
goyuken 2012-12-16 15:15:54 +00:00
parent c9c3821632
commit f8c9bd98f9
3 changed files with 34 additions and 17 deletions

View File

@ -23,6 +23,13 @@ namespace BizHawk.Emulation
{ {
_frame++; _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); ControlAdapter.Convert(Controller, theMachine.InputState);
theMachine.ComputeNextFrame(avProvider.framebuffer); theMachine.ComputeNextFrame(avProvider.framebuffer);
@ -183,10 +190,8 @@ namespace BizHawk.Emulation
HardReset(); HardReset();
} }
public void HardReset() void HardReset()
{ {
_lagcount = 0;
cart = Cart.Create(rom, GameInfo.CartType); cart = Cart.Create(rom, GameInfo.CartType);
ILogger logger = new ConsoleLogger(); ILogger logger = new ConsoleLogger();
HSC7800 hsc7800 = new HSC7800(hsbios, hsram); 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."); throw new Exception("For now, only Atari 7800 ProLine Joystick games are supported.");
ControllerDefinition = ControlAdapter.ControlType; ControllerDefinition = ControlAdapter.ControlType;
if (avProvider != null)
avProvider.Dispose();
avProvider.ConnectToMachine(theMachine); 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 // 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; CoreComm.VsyncNum = theMachine.FrameHZ;
@ -238,11 +241,6 @@ namespace BizHawk.Emulation
} }
} }
private void SoftReset() //TOOD: hook this up
{
theMachine.Reset();
}
MyAVProvider avProvider = new MyAVProvider(); MyAVProvider avProvider = new MyAVProvider();
class MyAVProvider : IVideoProvider, ISyncSoundProvider, IDisposable class MyAVProvider : IVideoProvider, ISyncSoundProvider, IDisposable
@ -258,7 +256,7 @@ namespace BizHawk.Emulation
uint newsamplerate = (uint)m.SoundSampleFrequency; uint newsamplerate = (uint)m.SoundSampleFrequency;
if (newsamplerate != samplerate) 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) if (resampler != null)
resampler.Dispose(); resampler.Dispose();
resampler = new Emulation.Sound.Utilities.SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null); resampler = new Emulation.Sound.Utilities.SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null);

View File

@ -13,6 +13,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 Joystick Controller", Name = "Atari 7800 Joystick Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",
@ -29,6 +31,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 Paddle Controller", Name = "Atari 7800 Paddle Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",
@ -54,6 +58,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 Keypad Controller", Name = "Atari 7800 Keypad Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",
@ -84,6 +90,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 Driving Controller", Name = "Atari 7800 Driving Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",
@ -105,6 +113,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 Booster Grip Controller", Name = "Atari 7800 Booster Grip Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",
@ -122,6 +132,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 ProLine Joystick Controller", Name = "Atari 7800 ProLine Joystick Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",
@ -136,6 +148,8 @@ namespace BizHawk.Emulation
Name = "Atari 7800 Light Gun Controller", Name = "Atari 7800 Light Gun Controller",
BoolButtons = BoolButtons =
{ {
// hard reset, not passed to EMU7800
"Power",
// on the console // on the console
"Reset", "Reset",
"Select", "Select",

View File

@ -341,7 +341,7 @@ namespace BizHawk.MultiClient
case "A26": case "A26":
return "|..|.....|.....|"; return "|..|.....|.....|";
case "A78": case "A78":
return "|...|......|......|"; return "|....|......|......|";
case "TI83": case "TI83":
return "|..................................................|.|"; return "|..................................................|.|";
case "NES": case "NES":
@ -453,6 +453,7 @@ namespace BizHawk.MultiClient
private string GetA78ControllersAsMnemonic() private string GetA78ControllersAsMnemonic()
{ {
StringBuilder input = new StringBuilder("|"); StringBuilder input = new StringBuilder("|");
input.Append(IsBasePressed("Power") ? 'P' : '.');
input.Append(IsBasePressed("Reset") ? 'r' : '.'); input.Append(IsBasePressed("Reset") ? 'r' : '.');
input.Append(IsBasePressed("Select") ? 's' : '.'); input.Append(IsBasePressed("Select") ? 's' : '.');
input.Append(IsBasePressed("Pause") ? 'p' : '.'); input.Append(IsBasePressed("Pause") ? 'p' : '.');
@ -811,19 +812,23 @@ namespace BizHawk.MultiClient
MnemonicChecker c = new MnemonicChecker(mnemonic); MnemonicChecker c = new MnemonicChecker(mnemonic);
MyBoolButtons.Clear(); MyBoolButtons.Clear();
if (mnemonic.Length < 4) if (mnemonic.Length < 5)
{ {
return; return;
} }
if (mnemonic[1] == 'r') if (mnemonic[1] == 'P')
{
Force("Power", true);
}
if (mnemonic[2] == 'r')
{ {
Force("Reset", true); Force("Reset", true);
} }
if (mnemonic[2] == 's') if (mnemonic[3] == 's')
{ {
Force("Select", true); Force("Select", true);
} }
if (mnemonic[3] == 'p') if (mnemonic[4] == 'p')
{ {
Force("Pause", true); Force("Pause", true);
} }
@ -831,7 +836,7 @@ namespace BizHawk.MultiClient
for (int player = 1; player <= Global.PLAYERS[ControlType]; player++) for (int player = 1; player <= Global.PLAYERS[ControlType]; player++)
{ {
int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1); int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1);
int start = 5; int start = 6;
if (mnemonic.Length < srcindex + start + Global.BUTTONS[ControlType].Count) if (mnemonic.Length < srcindex + start + Global.BUTTONS[ControlType].Count)
{ {
return; return;