cleanup
This commit is contained in:
parent
d8eaafd47f
commit
a7ccc3fdef
|
@ -1,10 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -15,8 +10,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class BatchRun : Form
|
public partial class BatchRun : Form
|
||||||
{
|
{
|
||||||
Thread thread = null;
|
private Thread _thread;
|
||||||
List<BatchRunner.Result> MostRecentResults = null;
|
private List<BatchRunner.Result> _mostRecentResults;
|
||||||
|
|
||||||
public BatchRun()
|
public BatchRun()
|
||||||
{
|
{
|
||||||
|
@ -25,10 +20,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void listBox1_DragEnter(object sender, DragEventArgs e)
|
private void listBox1_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop)
|
||||||
e.Effect = DragDropEffects.Link;
|
? DragDropEffects.Link
|
||||||
else
|
: DragDropEffects.None;
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetCount()
|
private void SetCount()
|
||||||
|
@ -54,7 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void buttonGo_Click(object sender, EventArgs e)
|
private void buttonGo_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (thread != null)
|
if (_thread != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Old one still running!");
|
MessageBox.Show("Old one still running!");
|
||||||
}
|
}
|
||||||
|
@ -67,23 +61,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label3.Text = "Status: Running...";
|
label3.Text = "Status: Running...";
|
||||||
int nframes = (int)numericUpDownFrames.Value;
|
int numFrames = (int)numericUpDownFrames.Value;
|
||||||
List<string> files = new List<string>(listBox1.Items.Count);
|
List<string> files = new List<string>(listBox1.Items.Count);
|
||||||
foreach (string s in listBox1.Items)
|
foreach (string s in listBox1.Items)
|
||||||
|
{
|
||||||
files.Add(s);
|
files.Add(s);
|
||||||
thread = new Thread(ThreadProc);
|
}
|
||||||
thread.Start(new Tuple<int, List<string>>(nframes, files));
|
|
||||||
|
_thread = new Thread(ThreadProc);
|
||||||
|
_thread.Start(new Tuple<int, List<string>>(numFrames, files));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressUpdate(int curr, int max)
|
private void ProgressUpdate(int curr, int max)
|
||||||
{
|
{
|
||||||
progressBar1.Maximum = max;
|
progressBar1.Maximum = max;
|
||||||
progressBar1.Value = curr;
|
progressBar1.Value = curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadProc(object o)
|
private void ThreadProc(object o)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -91,14 +88,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
BatchRunner br = new BatchRunner(pp.Item2, pp.Item1);
|
BatchRunner br = new BatchRunner(pp.Item2, pp.Item1);
|
||||||
br.OnProgress += br_OnProgress;
|
br.OnProgress += br_OnProgress;
|
||||||
var results = br.Run();
|
var results = br.Run();
|
||||||
this.Invoke(() => { label3.Text = "Status: Finished!"; MostRecentResults = results; });
|
this.Invoke(() => { label3.Text = "Status: Finished!"; _mostRecentResults = results; });
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(e.ToString(), "The Whole Thing Died!");
|
MessageBox.Show(e.ToString(), "The Whole Thing Died!");
|
||||||
this.Invoke(() => label3.Text = "Deaded!");
|
this.Invoke(() => label3.Text = "Deaded!");
|
||||||
}
|
}
|
||||||
this.Invoke(() => thread = null);
|
this.Invoke(() => _thread = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
void br_OnProgress(object sender, BatchRunner.ProgressEventArgs e)
|
void br_OnProgress(object sender, BatchRunner.ProgressEventArgs e)
|
||||||
|
@ -109,7 +106,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void BatchRun_FormClosing(object sender, FormClosingEventArgs e)
|
private void BatchRun_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (thread != null)
|
if (_thread != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Can't close while task is running!");
|
MessageBox.Show("Can't close while task is running!");
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
|
@ -118,18 +115,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void buttonDump_Click(object sender, EventArgs e)
|
private void buttonDump_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (MostRecentResults != null)
|
if (_mostRecentResults != null)
|
||||||
{
|
|
||||||
using (var sfd = new SaveFileDialog())
|
|
||||||
{
|
{
|
||||||
|
using var sfd = new SaveFileDialog();
|
||||||
var result = sfd.ShowDialog(this);
|
var result = sfd.ShowDialog(this);
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
using (TextWriter tw = new StreamWriter(sfd.FileName))
|
using TextWriter tw = new StreamWriter(sfd.FileName);
|
||||||
|
foreach (var r in _mostRecentResults)
|
||||||
{
|
{
|
||||||
foreach (var r in MostRecentResults)
|
r.DumpTo(tw);
|
||||||
r.DumpToTW(tw);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Client.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Emulation.Cores.Nintendo.GBA;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
@ -15,196 +13,198 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public class ProgressEventArgs
|
public class ProgressEventArgs
|
||||||
{
|
{
|
||||||
public int Completed { get; private set; }
|
public int Completed { get; }
|
||||||
public int Total { get; private set; }
|
public int Total { get; }
|
||||||
public bool ShouldCancel { get; set; }
|
public bool ShouldCancel { get; set; }
|
||||||
public ProgressEventArgs(int Completed, int Total)
|
public ProgressEventArgs(int completed, int total)
|
||||||
{
|
{
|
||||||
this.Completed = Completed;
|
Completed = completed;
|
||||||
this.Total = Total;
|
Total = total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void ProgressEventHandler(object sender, ProgressEventArgs e);
|
public delegate void ProgressEventHandler(object sender, ProgressEventArgs e);
|
||||||
public event ProgressEventHandler OnProgress;
|
public event ProgressEventHandler OnProgress;
|
||||||
|
|
||||||
List<string> files;
|
private readonly List<string> _files;
|
||||||
RomLoader ldr;
|
private readonly List<Result> _results = new List<Result>();
|
||||||
CoreComm Comm;
|
private readonly RomLoader _ldr;
|
||||||
int numframes = 0;
|
private readonly CoreComm _comm;
|
||||||
int multiindex = 0;
|
private readonly int _numFrames;
|
||||||
bool multihasnext = false;
|
|
||||||
|
|
||||||
List<Result> Results = new List<Result>();
|
private int _multiIndex;
|
||||||
Result current;
|
private bool _multiHasNext;
|
||||||
|
private Result _current;
|
||||||
|
|
||||||
public class Result
|
public class Result
|
||||||
{
|
{
|
||||||
public string Filename; // name of file
|
public string Filename { get; set; } // name of file
|
||||||
public string Fullname; // filename + subfilename
|
public string Fullname { get; set; } // filename + subfilename
|
||||||
public GameInfo GI;
|
public GameInfo Game { get; set; }
|
||||||
|
|
||||||
public Type CoreType; // actual type of the core that was returned
|
public Type CoreType { get; set; } // actual type of the core that was returned
|
||||||
public enum EStatus
|
public enum EStatus
|
||||||
{
|
{
|
||||||
ExceptOnLoad, // exception thrown on load
|
ExceptOnLoad, // exception thrown on load
|
||||||
ErrorOnLoad, // error method thrown on load
|
ErrorOnLoad, // error method thrown on load
|
||||||
FalseOnLoad, // romloader returned false with no other information
|
FalseOnLoad, // RomLoader returned false with no other information
|
||||||
ExceptOnAdv, // exception thrown on frame advance
|
ExceptOnAdv, // exception thrown on frame advance
|
||||||
Success, // load fully complete
|
Success, // load fully complete
|
||||||
};
|
}
|
||||||
public EStatus Status; // what happened
|
|
||||||
public List<string> Messages = new List<string>();
|
|
||||||
|
|
||||||
public int Frames; // number of frames successfully run
|
public EStatus Status { get; set; } // what happened
|
||||||
public int LaggedFrames; // number of those that were lagged
|
public List<string> Messages { get; set; } = new List<string>();
|
||||||
|
|
||||||
public string BoardName; // iemulator's board name return (could be null!)
|
public int Frames { get; set; } // number of frames successfully run
|
||||||
|
public int LaggedFrames { get; set; } // number of those that were lagged
|
||||||
|
|
||||||
public void DumpToTW(System.IO.TextWriter tw)
|
public string BoardName { get; set; } // IEmulator's board name return (could be null!)
|
||||||
|
|
||||||
|
public void DumpTo(TextWriter tw)
|
||||||
{
|
{
|
||||||
tw.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}", Filename, Fullname, CoreType, Status, Frames, LaggedFrames, GI.Hash, BoardName);
|
tw.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}", Filename, Fullname, CoreType, Status, Frames, LaggedFrames, Game.Hash, BoardName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BatchRunner(IEnumerable<string> files, int numframes)
|
public BatchRunner(IEnumerable<string> files, int numFrames)
|
||||||
{
|
{
|
||||||
this.files = new List<string>(files);
|
_files = new List<string>(files);
|
||||||
this.numframes = numframes;
|
_numFrames = numFrames;
|
||||||
|
|
||||||
ldr = new RomLoader();
|
_ldr = new RomLoader();
|
||||||
ldr.OnLoadError += OnLoadError;
|
_ldr.OnLoadError += OnLoadError;
|
||||||
ldr.ChooseArchive = ChooseArchive;
|
_ldr.ChooseArchive = ChooseArchive;
|
||||||
Comm = new CoreComm(CommMessage, CommMessage);
|
_comm = new CoreComm(CommMessage, CommMessage);
|
||||||
CoreFileProvider.SyncCoreCommInputSignals(Comm);
|
CoreFileProvider.SyncCoreCommInputSignals(_comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLoadError(object sender, RomLoader.RomErrorArgs e)
|
private void OnLoadError(object sender, RomLoader.RomErrorArgs e)
|
||||||
{
|
{
|
||||||
current.Status = Result.EStatus.ErrorOnLoad;
|
_current.Status = Result.EStatus.ErrorOnLoad;
|
||||||
current.Messages.Add($"{nameof(OnLoadError)}: {e.AttemptedCoreLoad}, {e.Message}, {e.Type}");
|
_current.Messages.Add($"{nameof(OnLoadError)}: {e.AttemptedCoreLoad}, {e.Message}, {e.Type}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommMessage(string msg)
|
private void CommMessage(string msg)
|
||||||
{
|
{
|
||||||
current.Messages.Add($"{nameof(CommMessage)}: {msg}");
|
_current.Messages.Add($"{nameof(CommMessage)}: {msg}");
|
||||||
}
|
}
|
||||||
|
|
||||||
int? ChooseArchive(HawkFile hf)
|
private int? ChooseArchive(HawkFile hf)
|
||||||
{
|
{
|
||||||
int ret = multiindex;
|
int ret = _multiIndex;
|
||||||
multiindex++;
|
_multiIndex++;
|
||||||
multihasnext = multiindex < hf.ArchiveItems.Count;
|
_multiHasNext = _multiIndex < hf.ArchiveItems.Count;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Result> Run()
|
public List<Result> Run()
|
||||||
{
|
{
|
||||||
Results.Clear();
|
_results.Clear();
|
||||||
current = null;
|
_current = null;
|
||||||
RunInternal();
|
RunInternal();
|
||||||
return new List<Result>(Results);
|
return new List<Result>(_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunInternal()
|
private void RunInternal()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < files.Count; i++)
|
for (int i = 0; i < _files.Count; i++)
|
||||||
{
|
{
|
||||||
string f = files[i];
|
string f = _files[i];
|
||||||
multihasnext = false;
|
_multiHasNext = false;
|
||||||
multiindex = 0;
|
_multiIndex = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
LoadOne(f);
|
LoadOne(f);
|
||||||
} while (multihasnext);
|
} while (_multiHasNext);
|
||||||
if (OnProgress != null)
|
if (OnProgress != null)
|
||||||
{
|
{
|
||||||
var e = new ProgressEventArgs(i + 1, files.Count);
|
var e = new ProgressEventArgs(i + 1, _files.Count);
|
||||||
OnProgress(this, e);
|
OnProgress(this, e);
|
||||||
if (e.ShouldCancel)
|
if (e.ShouldCancel)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadOne(string f)
|
||||||
void LoadOne(string f)
|
|
||||||
{
|
{
|
||||||
current = new Result { Filename = f };
|
_current = new Result { Filename = f };
|
||||||
bool result = false;
|
bool result;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result = ldr.LoadRom(f, Comm);
|
result = _ldr.LoadRom(f, _comm);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
current.Status = Result.EStatus.ExceptOnLoad;
|
_current.Status = Result.EStatus.ExceptOnLoad;
|
||||||
current.Messages.Add(e.ToString());
|
_current.Messages.Add(e.ToString());
|
||||||
Results.Add(current);
|
_results.Add(_current);
|
||||||
current = null;
|
_current = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current.Fullname = ldr.CanonicalFullPath;
|
|
||||||
if (current.Status == Result.EStatus.ErrorOnLoad)
|
_current.Fullname = _ldr.CanonicalFullPath;
|
||||||
|
if (_current.Status == Result.EStatus.ErrorOnLoad)
|
||||||
{
|
{
|
||||||
Results.Add(current);
|
_results.Add(_current);
|
||||||
current = null;
|
_current = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == false)
|
if (result == false)
|
||||||
{
|
{
|
||||||
current.Status = Result.EStatus.FalseOnLoad;
|
_current.Status = Result.EStatus.FalseOnLoad;
|
||||||
Results.Add(current);
|
_results.Add(_current);
|
||||||
current = null;
|
_current = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IEmulator emu = ldr.LoadedEmulator)
|
using (IEmulator emu = _ldr.LoadedEmulator)
|
||||||
{
|
{
|
||||||
current.GI = ldr.Game;
|
_current.Game = _ldr.Game;
|
||||||
current.CoreType = emu.GetType();
|
_current.CoreType = emu.GetType();
|
||||||
var controller = new Controller(emu.ControllerDefinition);
|
var controller = new Controller(emu.ControllerDefinition);
|
||||||
current.BoardName = emu.HasBoardInfo() ? emu.AsBoardInfo().BoardName : null;
|
_current.BoardName = emu.HasBoardInfo() ? emu.AsBoardInfo().BoardName : null;
|
||||||
// hack
|
// hack
|
||||||
if (emu is Emulation.Cores.Nintendo.GBA.VBANext)
|
if (emu is VBANext vba)
|
||||||
{
|
{
|
||||||
current.BoardName = (emu as Emulation.Cores.Nintendo.GBA.VBANext).GameCode;
|
_current.BoardName = vba.GameCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
current.Frames = 0;
|
_current.Frames = 0;
|
||||||
current.LaggedFrames = 0;
|
_current.LaggedFrames = 0;
|
||||||
|
|
||||||
for (int i = 0; i < numframes; i++)
|
for (int i = 0; i < _numFrames; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int nsamp;
|
emu.FrameAdvance(controller, true);
|
||||||
short[] samp;
|
|
||||||
emu.FrameAdvance(controller, true, true);
|
|
||||||
|
|
||||||
// some cores really really really like it if you drain their audio every frame
|
// some cores really really really like it if you drain their audio every frame
|
||||||
if (emu.HasSoundProvider())
|
if (emu.HasSoundProvider())
|
||||||
{
|
{
|
||||||
emu.AsSoundProvider().GetSamplesSync(out samp, out nsamp);
|
emu.AsSoundProvider().GetSamplesSync(out _, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
current.Frames++;
|
_current.Frames++;
|
||||||
if (emu.CanPollInput() && emu.AsInputPollable().IsLagFrame)
|
if (emu.CanPollInput() && emu.AsInputPollable().IsLagFrame)
|
||||||
current.LaggedFrames++;
|
_current.LaggedFrames++;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
current.Messages.Add(e.ToString());
|
_current.Messages.Add(e.ToString());
|
||||||
current.Status = Result.EStatus.ExceptOnAdv;
|
_current.Status = Result.EStatus.ExceptOnAdv;
|
||||||
Results.Add(current);
|
_results.Add(_current);
|
||||||
current = null;
|
_current = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current.Status = Result.EStatus.Success;
|
_current.Status = Result.EStatus.Success;
|
||||||
Results.Add(current);
|
_results.Add(_current);
|
||||||
current = null;
|
_current = null;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class CDL : ToolFormBase, IToolFormAutoConfig
|
public partial class CDL : ToolFormBase, IToolFormAutoConfig
|
||||||
{
|
{
|
||||||
private RecentFiles _recent_fld = new RecentFiles();
|
private RecentFiles _recentFld = new RecentFiles();
|
||||||
|
|
||||||
[ConfigPersist]
|
[ConfigPersist]
|
||||||
private RecentFiles _recent
|
private RecentFiles _recent
|
||||||
{
|
{
|
||||||
get => _recent_fld;
|
get => _recentFld;
|
||||||
set => _recent_fld = value;
|
set => _recentFld = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCurrentFilename(string fname)
|
void SetCurrentFilename(string fname)
|
||||||
|
@ -42,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[RequiredService]
|
[RequiredService]
|
||||||
private ICodeDataLogger CodeDataLogger { get; set; }
|
private ICodeDataLogger CodeDataLogger { get; set; }
|
||||||
|
|
||||||
private string _currentFilename = null;
|
private string _currentFilename;
|
||||||
private CodeDataLog _cdl;
|
private CodeDataLog _cdl;
|
||||||
|
|
||||||
public CDL()
|
public CDL()
|
||||||
|
@ -95,12 +95,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
UpdateDisplay(true);
|
UpdateDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLoggingActiveCheck(bool value)
|
private void SetLoggingActiveCheck(bool value)
|
||||||
{
|
{
|
||||||
tsbLoggingActive.Checked = value;
|
tsbLoggingActive.Checked = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
string[][] listContents = new string[0][];
|
private string[][] _listContents = new string[0][];
|
||||||
|
|
||||||
private void UpdateDisplay(bool force)
|
private void UpdateDisplay(bool force)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
listContents = new string[_cdl.Count][];
|
_listContents = new string[_cdl.Count][];
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
foreach (var kvp in _cdl)
|
foreach (var kvp in _cdl)
|
||||||
|
@ -155,7 +155,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var bm = _cdl.GetBlockMap();
|
var bm = _cdl.GetBlockMap();
|
||||||
long addr = bm[kvp.Key];
|
long addr = bm[kvp.Key];
|
||||||
|
|
||||||
var lvi = listContents[idx++] = new string[13];
|
var lvi = _listContents[idx++] = new string[13];
|
||||||
lvi[0] = $"{addr:X8}";
|
lvi[0] = $"{addr:X8}";
|
||||||
lvi[1] = kvp.Key;
|
lvi[1] = kvp.Key;
|
||||||
lvi[2] = $"{total / (float)kvp.Value.Length * 100f:0.00}%";
|
lvi[2] = $"{total / (float)kvp.Value.Length * 100f:0.00}%";
|
||||||
|
@ -229,7 +229,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool UpdateBefore => false;
|
public bool UpdateBefore => false;
|
||||||
|
|
||||||
bool autoloading = false;
|
private bool _autoloading;
|
||||||
public void LoadFile(string path)
|
public void LoadFile(string path)
|
||||||
{
|
{
|
||||||
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
|
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
|
||||||
|
@ -242,7 +242,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
CodeDataLogger.NewCDL(testCDL);
|
CodeDataLogger.NewCDL(testCDL);
|
||||||
if (!newCDL.Check(testCDL))
|
if (!newCDL.Check(testCDL))
|
||||||
{
|
{
|
||||||
if(!autoloading)
|
if(!_autoloading)
|
||||||
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
|
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -483,31 +483,33 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
autoloading = true;
|
_autoloading = true;
|
||||||
var autoresume_file = $"{PathManager.FilesystemSafeName(Global.Game)}.cdl";
|
var autoResumeFile = $"{PathManager.FilesystemSafeName(Global.Game)}.cdl";
|
||||||
var autoresume_dir = PathManager.MakeAbsolutePath(Config.PathEntries.LogPathFragment, null);
|
var autoResumeDir = PathManager.MakeAbsolutePath(Config.PathEntries.LogPathFragment, null);
|
||||||
var autoresume_path = Path.Combine(autoresume_dir, autoresume_file);
|
var autoResumePath = Path.Combine(autoResumeDir, autoResumeFile);
|
||||||
if (File.Exists(autoresume_path))
|
if (File.Exists(autoResumePath))
|
||||||
LoadFile(autoresume_path);
|
{
|
||||||
|
LoadFile(autoResumePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
autoloading = false;
|
_autoloading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_recent_fld.AutoLoad && !_recent_fld.Empty)
|
if (_recentFld.AutoLoad && !_recentFld.Empty)
|
||||||
{
|
{
|
||||||
if (File.Exists(_recent.MostRecent))
|
if (File.Exists(_recent.MostRecent))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
autoloading = true;
|
_autoloading = true;
|
||||||
LoadFile(_recent.MostRecent);
|
LoadFile(_recent.MostRecent);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
autoloading = false;
|
_autoloading = false;
|
||||||
}
|
}
|
||||||
SetCurrentFilename(_recent.MostRecent);
|
SetCurrentFilename(_recent.MostRecent);
|
||||||
}
|
}
|
||||||
|
@ -552,13 +554,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void lvCDL_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
private void lvCDL_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||||
{
|
{
|
||||||
var subItem = lvCDL.AllColumns.IndexOf(column);
|
var subItem = lvCDL.AllColumns.IndexOf(column);
|
||||||
text = listContents[index][subItem];
|
text = _listContents[index][subItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsbExportText_Click(object sender, EventArgs e)
|
private void tsbExportText_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var sw = new StringWriter();
|
using var sw = new StringWriter();
|
||||||
foreach(var line in listContents)
|
foreach(var line in _listContents)
|
||||||
{
|
{
|
||||||
foreach (var entry in line)
|
foreach (var entry in line)
|
||||||
sw.Write("{0} |", entry);
|
sw.Write("{0} |", entry);
|
||||||
|
|
|
@ -102,7 +102,6 @@
|
||||||
this.DebugSubMenu.Name = "DebugSubMenu";
|
this.DebugSubMenu.Name = "DebugSubMenu";
|
||||||
this.DebugSubMenu.Size = new System.Drawing.Size(50, 20);
|
this.DebugSubMenu.Size = new System.Drawing.Size(50, 20);
|
||||||
this.DebugSubMenu.Text = "&Debug";
|
this.DebugSubMenu.Text = "&Debug";
|
||||||
this.DebugSubMenu.DropDownOpened += new System.EventHandler(this.DebugSubMenu_DropDownOpened);
|
|
||||||
//
|
//
|
||||||
// StepIntoMenuItem
|
// StepIntoMenuItem
|
||||||
//
|
//
|
||||||
|
@ -367,7 +366,6 @@
|
||||||
this.Name = "GenericDebugger";
|
this.Name = "GenericDebugger";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "Debugger";
|
this.Text = "Debugger";
|
||||||
this.Load += new System.EventHandler(this.GenericDebugger_Load);
|
|
||||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.GenericDebugger_MouseMove);
|
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.GenericDebugger_MouseMove);
|
||||||
this.menuStrip1.ResumeLayout(false);
|
this.menuStrip1.ResumeLayout(false);
|
||||||
this.menuStrip1.PerformLayout();
|
this.menuStrip1.PerformLayout();
|
||||||
|
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Client.Common;
|
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
@ -40,10 +39,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenericDebugger_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EngageDebugger()
|
private void EngageDebugger()
|
||||||
{
|
{
|
||||||
_disassemblyLines.Clear();
|
_disassemblyLines.Clear();
|
||||||
|
@ -185,7 +180,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void OnCpuDropDownIndexChanged(object sender, EventArgs e)
|
private void OnCpuDropDownIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Disassembler.Cpu = (sender as ComboBox).SelectedItem.ToString();
|
Disassembler.Cpu = ((ComboBox) sender).SelectedItem.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region File
|
#region File
|
||||||
|
@ -199,10 +194,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#region Debug
|
#region Debug
|
||||||
|
|
||||||
private void DebugSubMenu_DropDownOpened(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RunBtn_Click(object sender, EventArgs e)
|
private void RunBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.UnpauseEmulator();
|
GlobalWin.MainForm.UnpauseEmulator();
|
||||||
|
|
|
@ -72,9 +72,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
var tsb = new ToolStripButton
|
var tsb = new ToolStripButton
|
||||||
{
|
{
|
||||||
Image = (instance as Form).Icon.ToBitmap(),
|
Image = ((Form) instance).Icon.ToBitmap(),
|
||||||
Text = (instance as Form).Text,
|
Text = ((Form) instance).Text,
|
||||||
DisplayStyle = (instance as Form).ShowIcon ? ToolStripItemDisplayStyle.Image : ToolStripItemDisplayStyle.Text
|
DisplayStyle = ((Form) instance).ShowIcon ? ToolStripItemDisplayStyle.Image : ToolStripItemDisplayStyle.Text
|
||||||
};
|
};
|
||||||
|
|
||||||
tsb.Click += (o, e) =>
|
tsb.Click += (o, e) =>
|
||||||
|
@ -94,13 +94,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provide LINQ capabilities to an outdated form collection
|
// Provide LINQ capabilities to an outdated form collection
|
||||||
private IEnumerable<ToolStripItem> ToolBoxItems
|
private IEnumerable<ToolStripItem> ToolBoxItems => ToolBoxStrip.Items.Cast<ToolStripItem>();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ToolBoxStrip.Items.Cast<ToolStripItem>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||||
{
|
{
|
||||||
|
@ -109,10 +103,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Close();
|
Close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return base.ProcessCmdKey(ref msg, keyData);
|
return base.ProcessCmdKey(ref msg, keyData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -344,6 +344,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stateable/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stateable/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=subdirectory/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=subdirectory/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subfile/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subfile/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=subfilename/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=subframe/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=subframe/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subshell/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subshell/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Syncless/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Syncless/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
Loading…
Reference in New Issue