From 89f61e6daad04e0ab8fa87e363623d390e1fe179 Mon Sep 17 00:00:00 2001 From: goyuken Date: Thu, 9 May 2013 00:58:02 +0000 Subject: [PATCH] gba: throw exceptions if saveram gets accessed when disposed, while i remember about it. will actually fix it some other time, if the core actually gets used. --- .../Consoles/Nintendo/GBA/Meteor.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/GBA/Meteor.cs b/BizHawk.Emulation/Consoles/Nintendo/GBA/Meteor.cs index 9f7161413d..502af50c67 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/GBA/Meteor.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/GBA/Meteor.cs @@ -78,6 +78,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA public byte[] ReadSaveRam() { + if (disposed) + throw new ObjectDisposedException(this.GetType().ToString()); if (!LibMeteor.libmeteor_hassaveram()) return null; IntPtr data = IntPtr.Zero; @@ -92,17 +94,30 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA public void StoreSaveRam(byte[] data) { + if (disposed) + throw new ObjectDisposedException(this.GetType().ToString()); if (!LibMeteor.libmeteor_loadsaveram(data, (uint)data.Length)) throw new Exception("libmeteor_loadsaveram() returned false!"); } public void ClearSaveRam() { + if (disposed) + throw new ObjectDisposedException(this.GetType().ToString()); LibMeteor.libmeteor_clearsaveram(); } public bool SaveRamModified - { get { return LibMeteor.libmeteor_hassaveram(); } set { } } + { + get + { + if (disposed) + throw new ObjectDisposedException(this.GetType().ToString()); + return LibMeteor.libmeteor_hassaveram(); + } + set + { } + } #endregion