IEmulator now implements IDisposable; client now disposes cores
This commit is contained in:
parent
013487bf77
commit
9283a9f37d
|
@ -366,8 +366,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
||||||
}
|
}
|
||||||
public IVideoProvider VideoProvider { get { return new MyVideoProvider(this); } }
|
public IVideoProvider VideoProvider { get { return new MyVideoProvider(this); } }
|
||||||
|
|
||||||
|
public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } }
|
||||||
public ISoundProvider SoundProvider { get { return new NullEmulator(); } }
|
|
||||||
|
|
||||||
public static readonly ControllerDefinition TI83Controller =
|
public static readonly ControllerDefinition TI83Controller =
|
||||||
new ControllerDefinition
|
new ControllerDefinition
|
||||||
|
@ -575,5 +574,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -855,5 +855,7 @@ namespace BizHawk.Emulation.Consoles.Gameboy
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -460,6 +460,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
bw.Flush();
|
bw.Flush();
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,5 +308,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,5 +195,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -379,5 +379,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
||||||
return DisplayType == DisplayType.NTSC ? 60d : 50d;
|
return DisplayType == DisplayType.NTSC ? 60d : 50d;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,9 +29,6 @@ namespace BizHawk
|
||||||
public ControllerDefinition ControllerDefinition { get { return NullController; } }
|
public ControllerDefinition ControllerDefinition { get { return NullController; } }
|
||||||
public IController Controller { get; set; }
|
public IController Controller { get; set; }
|
||||||
|
|
||||||
//public string GetControllersAsMnemonic() { return "|.|.|"; }
|
|
||||||
//public void SetControllersAsMnemonic(string mnemonic) { return; }
|
|
||||||
|
|
||||||
public int Frame { get; set; }
|
public int Frame { get; set; }
|
||||||
public int LagCount { get { return 0; } set { return; } }
|
public int LagCount { get { return 0; } set { return; } }
|
||||||
public bool IsLagFrame { get { return false; } }
|
public bool IsLagFrame { get { return false; } }
|
||||||
|
@ -53,10 +50,18 @@ namespace BizHawk
|
||||||
private IList<MemoryDomain> memoryDomains;
|
private IList<MemoryDomain> memoryDomains;
|
||||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||||
|
public void Dispose() { }
|
||||||
public object Query(EmulatorQuery query)
|
public object Query(EmulatorQuery query)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class NullSound : ISoundProvider
|
||||||
|
{
|
||||||
|
public static readonly NullSound SilenceProvider = new NullSound();
|
||||||
|
|
||||||
|
public void GetSamples(short[] samples) { }
|
||||||
|
public void DiscardSamples() { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.IO;
|
||||||
|
|
||||||
namespace BizHawk
|
namespace BizHawk
|
||||||
{
|
{
|
||||||
public interface IEmulator
|
public interface IEmulator : IDisposable
|
||||||
{
|
{
|
||||||
IVideoProvider VideoProvider { get; }
|
IVideoProvider VideoProvider { get; }
|
||||||
ISoundProvider SoundProvider { get; }
|
ISoundProvider SoundProvider { get; }
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
@ -720,6 +719,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseGame();
|
CloseGame();
|
||||||
|
Global.Emulator.Dispose();
|
||||||
Global.Emulator = nextEmulator;
|
Global.Emulator = nextEmulator;
|
||||||
Global.Game = game;
|
Global.Game = game;
|
||||||
SyncControls();
|
SyncControls();
|
||||||
|
@ -795,6 +795,7 @@ namespace BizHawk.MultiClient
|
||||||
writer.Write(Global.Emulator.SaveRam, 0, len);
|
writer.Write(Global.Emulator.SaveRam, 0, len);
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
|
Global.Emulator.Dispose();
|
||||||
Global.Emulator = new NullEmulator();
|
Global.Emulator = new NullEmulator();
|
||||||
Global.ActiveController = Global.NullControls;
|
Global.ActiveController = Global.NullControls;
|
||||||
UserMovie.StopMovie();
|
UserMovie.StopMovie();
|
||||||
|
@ -1151,11 +1152,10 @@ namespace BizHawk.MultiClient
|
||||||
InputLog.GetMnemonic();
|
InputLog.GetMnemonic();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(genSound)
|
if (genSound)
|
||||||
Global.Sound.UpdateSound(Global.Emulator.SoundProvider);
|
Global.Sound.UpdateSound(Global.Emulator.SoundProvider);
|
||||||
else
|
else
|
||||||
Global.Sound.UpdateSound(new NullEmulator()); //generates silence
|
Global.Sound.UpdateSound(NullSound.SilenceProvider);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MakeScreenshot(string path)
|
private void MakeScreenshot(string path)
|
||||||
|
|
Loading…
Reference in New Issue