quicknes: add text savestate, and fix savestate crash on some mappers
This commit is contained in:
parent
768b940cfc
commit
1cfa050dba
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using BizHawk.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
|
@ -217,12 +218,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
|
|
||||||
public void SaveStateText(System.IO.TextWriter writer)
|
public void SaveStateText(System.IO.TextWriter writer)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var temp = SaveStateBinary();
|
||||||
|
temp.SaveAsHexFast(writer);
|
||||||
|
// write extra copy of stuff we don't use
|
||||||
|
writer.WriteLine("Frame {0}", Frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadStateText(System.IO.TextReader reader)
|
public void LoadStateText(System.IO.TextReader reader)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
string hex = reader.ReadLine();
|
||||||
|
if (hex.StartsWith("emuVersion")) // movie save
|
||||||
|
{
|
||||||
|
do // theoretically, our portion should start right after StartsFromSavestate, maybe...
|
||||||
|
{
|
||||||
|
hex = reader.ReadLine();
|
||||||
|
} while (!hex.StartsWith("StartsFromSavestate"));
|
||||||
|
hex = reader.ReadLine();
|
||||||
|
}
|
||||||
|
byte[] state = new byte[hex.Length / 2];
|
||||||
|
state.ReadFromHexFast(hex);
|
||||||
|
LoadStateBinary(new System.IO.BinaryReader(new System.IO.MemoryStream(state)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveStateBinary(System.IO.BinaryWriter writer)
|
public void SaveStateBinary(System.IO.BinaryWriter writer)
|
||||||
|
|
Binary file not shown.
|
@ -348,7 +348,7 @@ void Nes_Core::reset( bool full_reset, bool erase_battery_ram )
|
||||||
|
|
||||||
// SRAM
|
// SRAM
|
||||||
lrom_readable = 0;
|
lrom_readable = 0;
|
||||||
sram_present = false;
|
sram_present = true;
|
||||||
enable_sram( false );
|
enable_sram( false );
|
||||||
if ( !cart->has_battery_ram() || erase_battery_ram )
|
if ( !cart->has_battery_ram() || erase_battery_ram )
|
||||||
memset( impl->sram, 0xFF, impl->sram_size );
|
memset( impl->sram, 0xFF, impl->sram_size );
|
||||||
|
|
Loading…
Reference in New Issue