Clean out ClearSaveRam() calls since they are no longer used

This commit is contained in:
adelikat 2014-11-24 15:00:54 +00:00
parent baa1556836
commit 0e82fff3ff
28 changed files with 9 additions and 191 deletions

View File

@ -30,20 +30,6 @@ namespace BizHawk.Client.Common
public void StartNewRecording()
{
// adelikat: ClearSaveRam shouldn't be here at all most likely, especially considering this is an implementation detail
// If Starting a new recording requires clearing sram it shoudl be done at a higher layer and not rely on all IMovies doing this
// Haven't removed it yet because I coudln't guarantee that power-on movies coudl live without it
// And the immediate fire is that Savestate movies are breaking
/*
* natt: in light of more recent changes, the front end is no longer errantly loading saveram for new movies. so, as best as i
* can tell through snaking through the debugger, this is no longer needed.
*
if (!StartsFromSavestate)
{
Global.Emulator.ClearSaveRam();
}
*/
_mode = Moviemode.Record;
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Any())
{
@ -56,13 +42,6 @@ namespace BizHawk.Client.Common
public void StartNewPlayback()
{
// See StartNewRecording for details as to why this code is gone
/*
if (!StartsFromSavestate)
{
Global.Emulator.ClearSaveRam();
}*/
_mode = Moviemode.Play;
}

View File

@ -68,7 +68,6 @@ namespace BizHawk.Emulation.Common
public byte[] CloneSaveRam() { return null; }
public void StoreSaveRam(byte[] data) { }
public void ClearSaveRam() { }
public bool DeterministicEmulation { get { return true; } }
public bool SaveRamModified { get; set; }
public void SaveStateText(TextWriter writer) { }

View File

@ -526,7 +526,7 @@ namespace BizHawk.Emulation.Cores.Calculators
public byte[] CloneSaveRam() { return null; }
public void StoreSaveRam(byte[] data) { }
public void ClearSaveRam() { }
public bool SaveRamModified
{
get { return false; }

View File

@ -7,10 +7,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
sealed public partial class C64 : IEmulator
{
public void ClearSaveRam()
{
}
public void LoadStateBinary(BinaryReader br)
{
SyncState(new Serializer(br));

View File

@ -159,8 +159,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public void StoreSaveRam(byte[] data) { }
public void ClearSaveRam() { }
public void SaveStateText(TextWriter writer)
{
SyncState(Serializer.CreateTextWriter(writer));

View File

@ -81,11 +81,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
{
Buffer.BlockCopy(data, 0, hsram, 0, data.Length);
}
public void ClearSaveRam()
{
for (int i = 0; i < hsram.Length; i++)
hsram[i] = 0;
}
public bool SaveRamModified
{
get

View File

@ -304,12 +304,6 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
Marshal.Copy(srcdata, 0, data, size);
}
[FeatureNotImplemented]
public void ClearSaveRam()
{
throw new NotImplementedException();
}
public bool SaveRamModified
{
get

View File

@ -172,7 +172,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision
public byte[] CloneSaveRam() { return null; }
public void StoreSaveRam(byte[] data) { }
public void ClearSaveRam() { }
public bool SaveRamModified { get; set; }
public bool DeterministicEmulation { get { return true; } }

View File

@ -164,12 +164,6 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
[FeatureNotImplemented]
public void ClearSaveRam()
{
}
public bool SaveRamModified
{
[FeatureNotImplemented]

View File

@ -132,13 +132,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
#endif
}
public void ClearSaveRam()
{
if (disposed)
throw new ObjectDisposedException(this.GetType().ToString());
LibMeteor.libmeteor_clearsaveram();
}
public bool SaveRamModified
{
get

View File

@ -154,12 +154,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
throw new InvalidOperationException("SaveRamLoad() failed!");
}
[FeatureNotImplemented]
public void ClearSaveRam()
{
throw new NotImplementedException();
}
public bool SaveRamModified
{
get

View File

@ -477,23 +477,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
LibGambatte.gambatte_loadsavedata(GambatteState, data);
}
/// <summary>
/// reset cart save ram, if any, to initial state
/// </summary>
public void ClearSaveRam()
{
int length = LibGambatte.gambatte_savesavedatalength(GambatteState);
if (length == 0)
return;
byte[] clear = new byte[length];
for (int i = 0; i < clear.Length; i++)
clear[i] = 0xff; // this exactly matches what gambatte core does
StoreSaveRam(clear);
}
public bool SaveRamModified
{
get

View File

@ -274,12 +274,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
R.StoreSaveRam(rb);
}
public void ClearSaveRam()
{
L.ClearSaveRam();
R.ClearSaveRam();
}
public bool SaveRamModified
{
get

View File

@ -301,11 +301,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
api.LoadSaveram(data);
}
public void ClearSaveRam()
{
api.InitSaveram();
}
public bool SaveRamModified { get { return true; } set { } }
#region Savestates

View File

@ -222,17 +222,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
diskdrive.ApplyDiff(diskdiffs[(int)currentside]);
}
public void ClearSaveRam()
{
// be careful with this; it can only really be done in frame 0
//if (currentside != null)
// throw new Exception("FDS Saveram: Can't clear when a disk is active!");
for (int i = 0; i < diskdiffs.Length; i++)
diskdiffs[i] = null;
if (currentside != null)
InsertSide((int)currentside);
}
public override byte[] SaveRam
{ get { throw new Exception("FDS Saveram: Must access with method api!"); } }

View File

@ -348,20 +348,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Array.Copy(data, board.SaveRam, data.Length);
}
public void ClearSaveRam()
{
if (board is FDS)
{
(board as FDS).ClearSaveRam();
return;
}
if (board == null || board.SaveRam == null)
return;
for (int i = 0; i < board.SaveRam.Length; i++)
board.SaveRam[i] = 0;
}
public bool SaveRamModified
{
get

View File

@ -234,11 +234,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
LibQuickNES.ThrowStringError(LibQuickNES.qn_battery_ram_load(Context, data, data.Length));
}
public void ClearSaveRam()
{
LibQuickNES.ThrowStringError(LibQuickNES.qn_battery_ram_clear(Context));
}
public bool SaveRamModified
{
get

View File

@ -745,12 +745,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
Marshal.Copy(data, 0, (IntPtr)buf, size);
}
public void ClearSaveRam()
{
byte[] cleardata = new byte[(int)api.QUERY_get_memory_size(LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM)];
StoreSaveRam(cleardata);
}
public void ResetCounters()
{
timeFrameCounter = 0;

View File

@ -63,19 +63,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
#region saveram
[FeatureNotImplemented]
public byte[] CloneSaveRam()
{
return new byte[0];
}
[FeatureNotImplemented]
public void StoreSaveRam(byte[] data)
{
}
public void ClearSaveRam()
{
}
public bool SaveRamModified
{
get

View File

@ -366,16 +366,13 @@ namespace BizHawk.Emulation.Cores.PCEngine
else
return null;
}
public void StoreSaveRam(byte[] data)
{
if (BRAM != null)
Array.Copy(data, BRAM, data.Length);
}
public void ClearSaveRam()
{
if (BRAM != null)
BRAM = new byte[BRAM.Length];
}
public bool SaveRamModified { get; set; }
public bool BinarySaveStatesPreferred { get { return false; } }

View File

@ -43,7 +43,6 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
public byte[] CloneSaveRam() { return (byte[])SaveRAM.Clone(); }
public void StoreSaveRam(byte[] data) { Array.Copy(data, SaveRAM, data.Length); }
public void ClearSaveRam() { SaveRAM = new byte[SaveRAM.Length]; }
public bool SaveRamModified { get; set; }
}

View File

@ -56,11 +56,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (SaveRAM != null)
Array.Copy(data, SaveRAM, data.Length);
}
public void ClearSaveRam()
{
if (SaveRAM != null)
SaveRAM = new byte[SaveRAM.Length];
}
public bool SaveRamModified { get; set; }
// Machine resources

View File

@ -345,18 +345,6 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
}
}
public void ClearSaveRam()
{
if (Disposed)
{
throw new Exception("It's a bit late for that");
}
else
{
LibYabause.libyabause_clearsaveram();
}
}
public bool SaveRamModified
{
get

View File

@ -480,18 +480,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
}
}
public void ClearSaveRam()
{
if (disposed)
{
throw new ObjectDisposedException(typeof(GPGX).ToString());
}
else
{
LibGPGX.gpgx_clear_sram();
}
}
public bool SaveRamModified
{
get

View File

@ -155,11 +155,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
{
}
[FeatureNotImplemented]
public void ClearSaveRam()
{
}
public bool SaveRamModified
{
[FeatureNotImplemented]

View File

@ -288,9 +288,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
[FeatureNotImplemented]
public void StoreSaveRam(byte[] data) { }
[FeatureNotImplemented]
public void ClearSaveRam() { }
[FeatureNotImplemented]
public bool DeterministicEmulation { get { return true; } }

View File

@ -108,6 +108,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
if (!BizSwan.bizswan_load(Core, file, file.Length, ref ss, ref rotate))
throw new InvalidOperationException("bizswan_load() returned FALSE!");
// adelikat: TODO: ClearSaveRam() doesn't exist anymore, do we still need this?
// for future uses of ClearSaveRam(), it's important that we save this
_DONTTOUCHME = ss;
@ -200,12 +201,6 @@ namespace BizHawk.Emulation.Cores.WonderSwan
throw new InvalidOperationException("bizswan_saveramload() returned false!");
}
public void ClearSaveRam()
{
BizSwan.bizswan_saveramclearhacky(Core, ref _DONTTOUCHME);
//throw new InvalidOperationException("A new core starts with a clear saveram. Instantiate a new core if you want this.");
}
public bool SaveRamModified
{
get { return BizSwan.bizswan_saveramsize(Core) > 0; }

View File

@ -271,22 +271,9 @@ namespace BizHawk.Emulation.Cores
Marshal.Copy(data, 0, dst, size);
}
public void ClearSaveRam()
{
// this is sort of wrong, because we should be clearing saveram to whatever the default state is
// which may or may not be 0-fill
int size = (int)retro.retro_get_memory_size(LibRetro.RETRO_MEMORY.SAVE_RAM);
IntPtr dst = retro.retro_get_memory_data(LibRetro.RETRO_MEMORY.SAVE_RAM);
if (dst == IntPtr.Zero)
throw new Exception("retro_get_memory_data(RETRO_MEMORY_SAVE_RAM) returned NULL");
byte* p = (byte*)dst;
for (int i = 0; i < size; i++)
p[i] = 0;
}
public bool SaveRamModified
{
[FeatureNotImplemented]
get { return true; }
[FeatureNotImplemented]