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.

This commit is contained in:
goyuken 2013-05-09 00:58:02 +00:00
parent aa73071870
commit 89f61e6daa
1 changed files with 16 additions and 1 deletions

View File

@ -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