Make ToolFormBase implement IToolForm

This commit is contained in:
YoshiRulz 2020-09-18 06:43:03 +10:00
parent 8aa3dcf72f
commit 727c6bc51f
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
33 changed files with 31 additions and 58 deletions

View File

@ -248,7 +248,7 @@ namespace BizHawk.Client.EmuHawk
CoreTree.EndUpdate();
}
public void Restart()
public override void Restart()
{
var ci = new CoreInfo(Emulator);
KnownCores[ci.CoreName] = ci;

View File

@ -42,8 +42,6 @@ namespace BizHawk.Client.EmuHawk
Attach();
}
public void Restart() { }
private void Attach()
{
_logStream = new LogStream();

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class NESSoundConfig : ToolFormBase, IToolForm
public partial class NESSoundConfig : ToolFormBase
{
[RequiredService]
private NES NES { get; set; }
@ -13,7 +13,7 @@ namespace BizHawk.Client.EmuHawk
private NES.NESSettings _oldSettings;
private NES.NESSettings _settings;
public void Restart()
public override void Restart()
{
NESSoundConfig_Load(null, null);
}

View File

@ -264,7 +264,7 @@ namespace BizHawk.Client.EmuHawk
protected override void UpdateBefore() => Update(fast: false);
protected override void FastUpdateBefore() => Update(fast: true);
public void Restart()
public override void Restart()
{
if (_currentDomain == null
|| MemoryDomains.Contains(_currentDomain))

View File

@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
protected override void UpdateAfter() => UpdateDisplay(false);
public void Restart()
public override void Restart()
{
//don't try to recover the current CDL!
//even though it seems like it might be nice, it might get mixed up between games. even if we use CheckCDL. Switching games with the same memory map will be bad.

View File

@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist]
public CheatsSettings Settings { get; set; }
public void Restart()
public override void Restart()
{
CheatEditor.MemoryDomains = Core;
CheatEditor.Restart();

View File

@ -134,7 +134,7 @@ namespace BizHawk.Client.EmuHawk
BreakPointControl1.UpdateValues();
}
public void Restart()
public override void Restart()
{
DisengageDebugger();
EngageDebugger();

View File

@ -81,7 +81,7 @@ namespace BizHawk.Client.EmuHawk
Spriteback = Color.Lime; // will be overridden from config after construct
}
public void Restart()
public override void Restart()
{
_cgb = Gb.IsCGBMode();
_lcdc = 0;

View File

@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
Gb?.SetPrinterCallback(null);
}
public void Restart()
public override void Restart()
{
// Really, there's not necessarily a reason to clear it at all,
// since the paper would still be there,

View File

@ -697,7 +697,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
var mem = GBA.GetMemoryAreas();
_vram = mem.vram;

View File

@ -30,10 +30,6 @@ namespace BizHawk.Client.EmuHawk
Icon = Properties.Resources.SharkIcon;
}
public void Restart()
{
}
private void Go_Click(object sender, EventArgs e)
{
foreach (var l in txtCheat.Lines)

View File

@ -143,7 +143,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
GeneralUpdate();
}

View File

@ -183,7 +183,7 @@ namespace BizHawk.Client.EmuHawk
AddressLabel.Text = GenerateAddressString();
}
public void Restart()
public override void Restart()
{
if (!(MainForm.CurrentlyOpenRomArgs.OpenAdvanced is OpenAdvanced_MAME))
{

View File

@ -205,7 +205,7 @@ namespace BizHawk.Client.EmuHawk
Settings.SplitDistance = splitContainer1.SplitterDistance;
}
public void Restart()
public override void Restart()
{
var runningScripts = new List<LuaFile>();

View File

@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
if (_initializing)
{

View File

@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
private void MultiGameCreator_Load(object sender, EventArgs e) => Restart();
public void Restart()
public override void Restart()
{
FileSelectorPanel.Controls.Clear();
AddButton_Click(null, null);

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class BarcodeEntry : ToolFormBase, IToolForm
public partial class BarcodeEntry : ToolFormBase
{
[RequiredService]
private DatachBarcode Reader { get; set; }
@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
Icon = Properties.Resources.NesControllerIcon;
}
public void Restart()
public override void Restart()
{
textBox1_TextChanged(null, null);
}

View File

@ -29,10 +29,6 @@ namespace BizHawk.Client.EmuHawk
SyncContents();
}
public void Restart()
{
}
private bool _isRunning;
// http://www.phy.mtu.edu/~suits/notefreqs.html

View File

@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
Generate(true);
}
public void Restart()
public override void Restart()
{
Generate(true);
}

View File

@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk
_ppu.InstallCallback2(() => Generate(), _scanline);
}
public void Restart()
public override void Restart()
{
Generate(true);
ChrRomViewReload();

View File

@ -86,11 +86,6 @@ namespace BizHawk.Client.EmuHawk
});
}
public void Restart()
{
// Nothing to do
}
protected override void UpdateBefore() => Generate();
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)

View File

@ -163,10 +163,6 @@ namespace BizHawk.Client.EmuHawk
private readonly List<PsgEntry> _psgEntries = new List<PsgEntry>();
private readonly Dictionary<string, PsgEntry> _psgEntryTable = new Dictionary<string, PsgEntry>();
public void Restart()
{
}
// 32*16 samples, 16bit, mono, 8khz (but we'll change the sample rate)
private static readonly byte[] EmptyWav = {
0x52, 0x49, 0x46, 0x46, 0x24, 0x04, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20,

View File

@ -143,7 +143,7 @@ namespace BizHawk.Client.EmuHawk
bmp.UnlockBits(lockData);
}
public void Restart()
public override void Restart()
{
if (Viewer.IsSgx)
{

View File

@ -153,7 +153,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
GeneralUpdate();
}

View File

@ -52,11 +52,6 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist]
public int UserBackdropColor { get; set; }
public void Restart()
{
}
protected override string WindowTitleStatic => "Graphics Debugger";
public SNESGraphicsDebugger()

View File

@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk
RefreshDialog(refreshNeeded, refreshBranches: false);
}
public void Restart()
public override void Restart()
{
if (!IsHandleCreated || IsDisposed)
{

View File

@ -40,11 +40,6 @@ namespace BizHawk.Client.EmuHawk
InputManager.ClickyVirtualPadController.Click(name);
}
public void Restart()
{
// Do nothing
}
private void SetToolTips()
{
// Set button hotkey mapping into tooltips

View File

@ -10,7 +10,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class ToolBox : ToolFormBase, IToolForm
public partial class ToolBox : ToolFormBase
{
[RequiredService]
private IEmulator Emulator { get; set; }
@ -31,7 +31,7 @@ namespace BizHawk.Client.EmuHawk
);
}
public void Restart()
public override void Restart()
{
SetTools();
SetSize();

View File

@ -9,7 +9,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public class ToolFormBase : FormBase
public class ToolFormBase : FormBase, IToolForm
{
public ToolManager Tools { get; set; }
@ -21,6 +21,8 @@ namespace BizHawk.Client.EmuHawk
public virtual bool AskSaveChanges() => true;
public virtual void Restart() {}
public virtual void UpdateValues(ToolFormUpdateType type)
{
switch (type)

View File

@ -197,7 +197,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
CloseFile();
ClearList();

View File

@ -128,7 +128,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
if (!IsHandleCreated || IsDisposed)
{

View File

@ -306,7 +306,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
_settings = new SearchEngineSettings(MemoryDomains);
_searches = new RamSearchEngine(_settings, MemoryDomains);

View File

@ -236,7 +236,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void Restart()
public override void Restart()
{
if ((!IsHandleCreated || IsDisposed) && !Config.DisplayRamWatch)
{