Merge pull request #524 from Hathor86/master

External custom gametool feature
This commit is contained in:
Hathor86 2015-11-20 13:30:14 +01:00
commit 155a08c7bb
32 changed files with 4934 additions and 4858 deletions

1
.gitignore vendored
View File

@ -246,6 +246,7 @@
/References/*.xml
/output/ELFSharp.dll
/output/dll/ELFSharp.dll
/output/GameTools/*.dll
*.opensdf
*.user
*.suo

View File

@ -157,8 +157,9 @@ namespace BizHawk.Client.Common
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Macros", Path = Path.Combine(".", "Movies", "Macros"), Ordinal = 10 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "TAStudio states", Path = Path.Combine(".", "Movies", "TAStudio states"), Ordinal = 11 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Multi-Disk Bundles", Path = Path.Combine(".", "Tools"), Ordinal = 12 },
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "GameTools", Path = Path.Combine(".", "GameTools"), Ordinal = 13 },
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },

View File

@ -1,196 +1,196 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using BizHawk.Common;
namespace BizHawk.Client.Common
{
public static class StringLogUtil
{
public static bool DefaultToDisk;
public static IStringLog MakeStringLog()
{
if (DefaultToDisk)
return new DiskStringLog();
else return new ListStringLog();
}
}
public interface IStringLog : IDisposable, IEnumerable<string>
{
void RemoveAt(int index);
int Count { get; }
void Clear();
void Add(string str);
string this[int index] { get; set; }
void Insert(int index, string val);
void InsertRange(int index, IEnumerable<string> collection);
void AddRange(IEnumerable<string> collection);
void RemoveRange(int index, int count);
IStringLog Clone();
void CopyTo(string[] array);
void CopyTo(int index, string[] array, int arrayIndex, int count);
}
class ListStringLog : List<string>, IStringLog
{
public IStringLog Clone()
{
ListStringLog ret = new ListStringLog();
ret.AddRange(this);
return ret;
}
public void Dispose() { }
}
/// <summary>
/// A dumb-ish IStringLog with storage on disk with no provision for recovering lost space, except upon Clear()
/// The purpose here is to avoid having too complicated buggy logic or a dependency on sqlite or such.
/// It should be faster than those alternatives, but wasteful of disk space.
/// It should also be easier to add new IList<string>-like methods than dealing with a database
/// </summary>
class DiskStringLog : IStringLog
{
List<long> Offsets = new List<long>();
long cursor = 0;
BinaryWriter bw;
BinaryReader br;
FileStream stream;
public DiskStringLog()
{
var path = TempFileCleaner.GetTempFilename("movieOnDisk");
stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose);
bw = new BinaryWriter(stream);
br = new BinaryReader(stream);
}
public IStringLog Clone()
{
DiskStringLog ret = new DiskStringLog();
for (int i = 0; i < Count; i++)
ret.Add(this[i]);
return ret;
}
public void Dispose()
{
stream.Dispose();
}
public int Count { get { return Offsets.Count; } }
public void Clear()
{
stream.SetLength(0);
Offsets.Clear();
cursor = 0;
}
public void Add(string str)
{
Offsets.Add(stream.Position);
bw.Write(str);
bw.Flush();
}
public void RemoveAt(int index)
{
Offsets.RemoveAt(index);
//no garbage collection in the disk file... oh well.
}
public string this[int index]
{
get
{
stream.Position = Offsets[index];
return br.ReadString();
}
set
{
stream.Position = stream.Length;
Offsets[index] = stream.Position;
bw.Write(value);
bw.Flush();
}
}
public void Insert(int index, string val)
{
Offsets.Insert(index, stream.Position);
bw.Write(val);
bw.Flush();
}
public void InsertRange(int index, IEnumerable<string> collection)
{
foreach(var item in collection)
Insert(index++,item);
}
public void AddRange(IEnumerable<string> collection)
{
foreach (var item in collection)
Add(item);
}
class Enumerator : IEnumerator<string>
{
public DiskStringLog log;
int index;
public string Current { get { return log[index]; } }
object System.Collections.IEnumerator.Current { get { return log[index]; } }
bool System.Collections.IEnumerator.MoveNext()
{
index++;
if (index >= log.Count)
{
index = log.Count;
return false;
}
return true;
}
void System.Collections.IEnumerator.Reset() { index = 0; }
public void Dispose() { }
}
IEnumerator<string> IEnumerable<string>.GetEnumerator()
{
return new Enumerator() { log = this };
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return new Enumerator() { log = this };
}
public void RemoveRange(int index, int count)
{
int end = index + count - 1;
for (int i = 0; i < count; i++)
{
RemoveAt(end);
end--;
}
}
public void CopyTo(string[] array)
{
for (int i = 0; i < Count; i++)
array[i] = this[i];
}
public void CopyTo(int index, string[] array, int arrayIndex, int count)
{
for (int i = 0; i < count; i++)
array[i + arrayIndex] = this[index + i];
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using BizHawk.Common;
namespace BizHawk.Client.Common
{
public static class StringLogUtil
{
public static bool DefaultToDisk;
public static IStringLog MakeStringLog()
{
if (DefaultToDisk)
return new DiskStringLog();
else return new ListStringLog();
}
}
public interface IStringLog : IDisposable, IEnumerable<string>
{
void RemoveAt(int index);
int Count { get; }
void Clear();
void Add(string str);
string this[int index] { get; set; }
void Insert(int index, string val);
void InsertRange(int index, IEnumerable<string> collection);
void AddRange(IEnumerable<string> collection);
void RemoveRange(int index, int count);
IStringLog Clone();
void CopyTo(string[] array);
void CopyTo(int index, string[] array, int arrayIndex, int count);
}
class ListStringLog : List<string>, IStringLog
{
public IStringLog Clone()
{
ListStringLog ret = new ListStringLog();
ret.AddRange(this);
return ret;
}
public void Dispose() { }
}
/// <summary>
/// A dumb-ish IStringLog with storage on disk with no provision for recovering lost space, except upon Clear()
/// The purpose here is to avoid having too complicated buggy logic or a dependency on sqlite or such.
/// It should be faster than those alternatives, but wasteful of disk space.
/// It should also be easier to add new IList<string>-like methods than dealing with a database
/// </summary>
class DiskStringLog : IStringLog
{
List<long> Offsets = new List<long>();
long cursor = 0;
BinaryWriter bw;
BinaryReader br;
FileStream stream;
public DiskStringLog()
{
var path = TempFileCleaner.GetTempFilename("movieOnDisk");
stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose);
bw = new BinaryWriter(stream);
br = new BinaryReader(stream);
}
public IStringLog Clone()
{
DiskStringLog ret = new DiskStringLog();
for (int i = 0; i < Count; i++)
ret.Add(this[i]);
return ret;
}
public void Dispose()
{
stream.Dispose();
}
public int Count { get { return Offsets.Count; } }
public void Clear()
{
stream.SetLength(0);
Offsets.Clear();
cursor = 0;
}
public void Add(string str)
{
Offsets.Add(stream.Position);
bw.Write(str);
bw.Flush();
}
public void RemoveAt(int index)
{
Offsets.RemoveAt(index);
//no garbage collection in the disk file... oh well.
}
public string this[int index]
{
get
{
stream.Position = Offsets[index];
return br.ReadString();
}
set
{
stream.Position = stream.Length;
Offsets[index] = stream.Position;
bw.Write(value);
bw.Flush();
}
}
public void Insert(int index, string val)
{
Offsets.Insert(index, stream.Position);
bw.Write(val);
bw.Flush();
}
public void InsertRange(int index, IEnumerable<string> collection)
{
foreach(var item in collection)
Insert(index++,item);
}
public void AddRange(IEnumerable<string> collection)
{
foreach (var item in collection)
Add(item);
}
class Enumerator : IEnumerator<string>
{
public DiskStringLog log;
int index;
public string Current { get { return log[index]; } }
object System.Collections.IEnumerator.Current { get { return log[index]; } }
bool System.Collections.IEnumerator.MoveNext()
{
index++;
if (index >= log.Count)
{
index = log.Count;
return false;
}
return true;
}
void System.Collections.IEnumerator.Reset() { index = 0; }
public void Dispose() { }
}
IEnumerator<string> IEnumerable<string>.GetEnumerator()
{
return new Enumerator() { log = this };
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return new Enumerator() { log = this };
}
public void RemoveRange(int index, int count)
{
int end = index + count - 1;
for (int i = 0; i < count; i++)
{
RemoveAt(end);
end--;
}
}
public void CopyTo(string[] array)
{
for (int i = 0; i < Count; i++)
array[i] = this[i];
}
public void CopyTo(int index, string[] array, int arrayIndex, int count)
{
for (int i = 0; i < count; i++)
array[i + arrayIndex] = this[index + i];
}
}
}

View File

@ -11,7 +11,7 @@ namespace BizHawk.Client.Common
public class TasBranch
{
public int Frame { get; set; }
public byte[] CoreData { get; set; }
public byte[] CoreData { get; set; }
public IStringLog InputLog { get; set; }
public BitmapBuffer OSDFrameBuffer { get; set; }
public TasLagLog LagLog { get; set; }
@ -63,9 +63,9 @@ namespace BizHawk.Client.Common
});
bs.PutLump(ninput, delegate(TextWriter tw)
{
int todo = b.InputLog.Count;
for (int i = 0; i < todo; i++)
{
int todo = b.InputLog.Count;
for (int i = 0; i < todo; i++)
tw.WriteLine(b.InputLog[i]);
});
@ -146,7 +146,7 @@ namespace BizHawk.Client.Common
});
bl.GetLump(ninput, true, delegate(TextReader tr)
{
{
b.InputLog = StringLogUtil.MakeStringLog();
string line;
while ((line = tr.ReadLine()) != null)

View File

@ -531,9 +531,7 @@
<Compile Include="CustomControls\ViewportPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\VirtualListView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\VirtualListView.cs" />
<Compile Include="CustomControls\Win32.cs" />
<Compile Include="DisplayManager\DisplayManager.cs" />
<Compile Include="DisplayManager\DisplaySurface.cs" />
@ -807,6 +805,7 @@
<Compile Include="tools\HexEditor\HexFind.Designer.cs">
<DependentUpon>HexFind.cs</DependentUpon>
</Compile>
<Compile Include="tools\ICustomGameTool.cs" />
<Compile Include="tools\IToolForm.cs" />
<Compile Include="tools\Lua\EnvironmentSandbox.cs" />
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Client.cs" />

View File

@ -1,148 +1,148 @@
namespace BizHawk.Client.EmuHawk
{
partial class ExceptionBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnOK = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.txtException = new System.Windows.Forms.TextBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnCopy = new System.Windows.Forms.Button();
this.lblDone = new ExceptionBox.MyLabel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnOK.Location = new System.Drawing.Point(625, 304);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.btnOK, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.txtException, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(703, 330);
this.tableLayoutPanel1.TabIndex = 1;
//
// txtException
//
this.tableLayoutPanel1.SetColumnSpan(this.txtException, 2);
this.txtException.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtException.Location = new System.Drawing.Point(3, 3);
this.txtException.Multiline = true;
this.txtException.Name = "txtException";
this.txtException.ReadOnly = true;
this.txtException.Size = new System.Drawing.Size(697, 295);
this.txtException.TabIndex = 1;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.Controls.Add(this.btnCopy);
this.flowLayoutPanel1.Controls.Add(this.lblDone);
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 301);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(87, 29);
this.flowLayoutPanel1.TabIndex = 2;
//
// btnCopy
//
this.btnCopy.Location = new System.Drawing.Point(3, 3);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(75, 23);
this.btnCopy.TabIndex = 3;
this.btnCopy.Text = "Copy";
this.btnCopy.UseVisualStyleBackColor = true;
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
//
// lblDone
//
this.lblDone.AutoSize = true;
this.lblDone.Location = new System.Drawing.Point(84, 10);
this.lblDone.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0);
this.lblDone.Name = "lblDone";
this.lblDone.Size = new System.Drawing.Size(0, 13);
this.lblDone.TabIndex = 4;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ExceptionBox
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnOK;
this.ClientSize = new System.Drawing.Size(703, 330);
this.Controls.Add(this.tableLayoutPanel1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExceptionBox";
this.Text = "Exception";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TextBox txtException;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button btnCopy;
private ExceptionBox.MyLabel lblDone;
}
namespace BizHawk.Client.EmuHawk
{
partial class ExceptionBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnOK = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.txtException = new System.Windows.Forms.TextBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnCopy = new System.Windows.Forms.Button();
this.lblDone = new ExceptionBox.MyLabel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnOK.Location = new System.Drawing.Point(625, 304);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.btnOK, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.txtException, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(703, 330);
this.tableLayoutPanel1.TabIndex = 1;
//
// txtException
//
this.tableLayoutPanel1.SetColumnSpan(this.txtException, 2);
this.txtException.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtException.Location = new System.Drawing.Point(3, 3);
this.txtException.Multiline = true;
this.txtException.Name = "txtException";
this.txtException.ReadOnly = true;
this.txtException.Size = new System.Drawing.Size(697, 295);
this.txtException.TabIndex = 1;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.Controls.Add(this.btnCopy);
this.flowLayoutPanel1.Controls.Add(this.lblDone);
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 301);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(87, 29);
this.flowLayoutPanel1.TabIndex = 2;
//
// btnCopy
//
this.btnCopy.Location = new System.Drawing.Point(3, 3);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(75, 23);
this.btnCopy.TabIndex = 3;
this.btnCopy.Text = "Copy";
this.btnCopy.UseVisualStyleBackColor = true;
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
//
// lblDone
//
this.lblDone.AutoSize = true;
this.lblDone.Location = new System.Drawing.Point(84, 10);
this.lblDone.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0);
this.lblDone.Name = "lblDone";
this.lblDone.Size = new System.Drawing.Size(0, 13);
this.lblDone.TabIndex = 4;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ExceptionBox
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnOK;
this.ClientSize = new System.Drawing.Size(703, 330);
this.Controls.Add(this.tableLayoutPanel1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExceptionBox";
this.Text = "Exception";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TextBox txtException;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button btnCopy;
private ExceptionBox.MyLabel lblDone;
}
}

View File

@ -1,85 +1,85 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class ExceptionBox : Form
{
public ExceptionBox(Exception ex)
{
InitializeComponent();
txtException.Text = ex.ToString();
timer1.Start();
}
private void btnCopy_Click(object sender, EventArgs e)
{
DoCopy();
}
void DoCopy()
{
string txt = txtException.Text;
Clipboard.SetText(txt);
try
{
if (Clipboard.GetText() == txt)
{
lblDone.Text = "Done!";
lblDone.ForeColor = SystemColors.ControlText;
return;
}
}
catch
{
}
lblDone.Text = "ERROR!";
lblDone.ForeColor = SystemColors.ControlText;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.C | Keys.Control))
{
DoCopy();
return true;
}
return false;
}
private void btnOK_Click(object sender, EventArgs e)
{
Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
int a = lblDone.ForeColor.A - 16;
if (a < 0) a = 0;
lblDone.ForeColor = Color.FromArgb(a, lblDone.ForeColor);
}
//http://stackoverflow.com/questions/2636065/alpha-in-forecolor
class MyLabel : Label
{
protected override void OnPaint(PaintEventArgs e)
{
Rectangle rc = this.ClientRectangle;
StringFormat fmt = new StringFormat(StringFormat.GenericTypographic);
using (var br = new SolidBrush(this.ForeColor))
{
e.Graphics.DrawString(this.Text, this.Font, br, rc, fmt);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class ExceptionBox : Form
{
public ExceptionBox(Exception ex)
{
InitializeComponent();
txtException.Text = ex.ToString();
timer1.Start();
}
private void btnCopy_Click(object sender, EventArgs e)
{
DoCopy();
}
void DoCopy()
{
string txt = txtException.Text;
Clipboard.SetText(txt);
try
{
if (Clipboard.GetText() == txt)
{
lblDone.Text = "Done!";
lblDone.ForeColor = SystemColors.ControlText;
return;
}
}
catch
{
}
lblDone.Text = "ERROR!";
lblDone.ForeColor = SystemColors.ControlText;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.C | Keys.Control))
{
DoCopy();
return true;
}
return false;
}
private void btnOK_Click(object sender, EventArgs e)
{
Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
int a = lblDone.ForeColor.A - 16;
if (a < 0) a = 0;
lblDone.ForeColor = Color.FromArgb(a, lblDone.ForeColor);
}
//http://stackoverflow.com/questions/2636065/alpha-in-forecolor
class MyLabel : Label
{
protected override void OnPaint(PaintEventArgs e)
{
Rectangle rc = this.ClientRectangle;
StringFormat fmt = new StringFormat(StringFormat.GenericTypographic);
using (var br = new SolidBrush(this.ForeColor))
{
e.Graphics.DrawString(this.Text, this.Font, br, rc, fmt);
}
}
}
}
}

View File

@ -1,123 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,104 +1,104 @@
using System;
using BizHawk.Bizware.BizwareGL;
namespace BizHawk.Client.EmuHawk
{
/// <summary>
/// This singleton class manages OpenGL contexts, in an effort to minimize context changes.
/// </summary>
public class GLManager : IDisposable
{
private GLManager()
{
}
public void Dispose()
{
}
public static GLManager Instance { get; private set; }
public static void CreateInstance()
{
if (Instance != null) throw new InvalidOperationException("Attempt to create more than one GLManager");
Instance = new GLManager();
}
public ContextRef CreateGLContext()
{
var ret = new ContextRef
{
gl = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK()
};
return ret;
}
public ContextRef GetContextForGraphicsControl(GraphicsControl gc)
{
return new ContextRef
{
gc = gc,
gl = gc.IGL
};
}
/// <summary>
/// This might not be a GL implementation. If it isnt GL, then setting it as active context is just NOP
/// </summary>
public ContextRef GetContextForIGL(IGL gl)
{
return new ContextRef
{
gl = gl
};
}
ContextRef ActiveContext;
public void Invalidate()
{
ActiveContext = null;
}
public void Activate(ContextRef cr)
{
bool begun = false;
//this needs a begin signal to set the swap chain to the next backbuffer
if (cr.gl is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
{
cr.gc.Begin();
begun = true;
}
if (cr == ActiveContext)
return;
ActiveContext = cr;
if (cr.gc != null)
{
//TODO - this is checking the current context inside to avoid an extra NOP context change. make this optional or remove it, since we're tracking it here
if(!begun)
cr.gc.Begin();
}
if (cr.gl != null)
{
if(cr.gl is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)
((BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)cr.gl).MakeDefaultCurrent();
}
}
public void Deactivate()
{
//this is here for future use and tracking purposes.. however.. instead of relying on this, we should just make sure we always activate what we need before we use it
}
public class ContextRef
{
public IGL gl;
public GraphicsControl gc;
}
}
using System;
using BizHawk.Bizware.BizwareGL;
namespace BizHawk.Client.EmuHawk
{
/// <summary>
/// This singleton class manages OpenGL contexts, in an effort to minimize context changes.
/// </summary>
public class GLManager : IDisposable
{
private GLManager()
{
}
public void Dispose()
{
}
public static GLManager Instance { get; private set; }
public static void CreateInstance()
{
if (Instance != null) throw new InvalidOperationException("Attempt to create more than one GLManager");
Instance = new GLManager();
}
public ContextRef CreateGLContext()
{
var ret = new ContextRef
{
gl = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK()
};
return ret;
}
public ContextRef GetContextForGraphicsControl(GraphicsControl gc)
{
return new ContextRef
{
gc = gc,
gl = gc.IGL
};
}
/// <summary>
/// This might not be a GL implementation. If it isnt GL, then setting it as active context is just NOP
/// </summary>
public ContextRef GetContextForIGL(IGL gl)
{
return new ContextRef
{
gl = gl
};
}
ContextRef ActiveContext;
public void Invalidate()
{
ActiveContext = null;
}
public void Activate(ContextRef cr)
{
bool begun = false;
//this needs a begin signal to set the swap chain to the next backbuffer
if (cr.gl is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
{
cr.gc.Begin();
begun = true;
}
if (cr == ActiveContext)
return;
ActiveContext = cr;
if (cr.gc != null)
{
//TODO - this is checking the current context inside to avoid an extra NOP context change. make this optional or remove it, since we're tracking it here
if(!begun)
cr.gc.Begin();
}
if (cr.gl != null)
{
if(cr.gl is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)
((BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)cr.gl).MakeDefaultCurrent();
}
}
public void Deactivate()
{
//this is here for future use and tracking purposes.. however.. instead of relying on this, we should just make sure we always activate what we need before we use it
}
public class ContextRef
{
public IGL gl;
public GraphicsControl gc;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
var font = new System.Drawing.Font(SaveRAMSubMenu.Font, needBold ? FontStyle.Bold : FontStyle.Regular);
SaveRAMSubMenu.Font.Dispose();
SaveRAMSubMenu.Font = font;
}
}
}
private void RecentRomMenuItem_DropDownOpened(object sender, EventArgs e)
@ -1248,8 +1248,10 @@ namespace BizHawk.Client.EmuHawk
AutoHawkMenuItem.Visible = VersionInfo.DeveloperBuild;
BasicBotMenuItem.Enabled = GlobalWin.Tools.IsAvailable<BasicBot>();
gameSharkConverterToolStripMenuItem.Enabled = GlobalWin.Tools.IsAvailable<GameShark>();
string toolPath = Path.Combine(Global.Config.PathEntries["Global", "GameTools"].Path, string.Format("{0}.dll", Global.Game.Name));
customToolToolStripMenuItem.Enabled = File.Exists(toolPath);
gameSharkConverterToolStripMenuItem.Enabled = GlobalWin.Tools.IsAvailable<GameShark>();
}
private void AutoHawkMenuItem_Click(object sender, EventArgs e)
@ -1317,6 +1319,11 @@ namespace BizHawk.Client.EmuHawk
OpenLuaConsole();
}
private void CustomToolMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.Tools.Load<ICustomGameTool>();
}
private void batchRunnerToolStripMenuItem_Click(object sender, EventArgs e)
{
new BatchRun().ShowDialog();

View File

@ -467,7 +467,7 @@ namespace BizHawk.Client.EmuHawk
CheckMessages();
LogConsole.PositionConsole();
for (; ; )
for (;;)
{
Input.Instance.Update();
@ -714,7 +714,7 @@ namespace BizHawk.Client.EmuHawk
{
ControllerInputCoalescer conInput = Global.ControllerInputCoalescer as ControllerInputCoalescer;
for (; ; )
for (;;)
{
// loop through all available events
@ -3505,7 +3505,7 @@ namespace BizHawk.Client.EmuHawk
if (ioa is IOpenAdvancedLibretro)
{
var ioaretro = ioa as IOpenAdvancedLibretro;
//prepare a core specification
//if it wasnt already specified, use the current default
if (ioaretro.CorePath == null) ioaretro.CorePath = Global.Config.LibretroCore;
@ -3999,4 +3999,4 @@ namespace BizHawk.Client.EmuHawk
}
}
}
}

View File

@ -1,62 +1,62 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BizHawk.Client.Common
{
public static class UIHelper
{
private static readonly AutoScaleMode _autoScaleMode = AutoScaleMode.Font;
private static readonly SizeF _autoScaleBaseSize = new SizeF(6F, 13F);
private static readonly SizeF _autoScaleCurrentSize = GetCurrentAutoScaleSize(_autoScaleMode);
private static SizeF GetCurrentAutoScaleSize(AutoScaleMode autoScaleMode)
{
using (Form form = new Form())
{
form.AutoScaleMode = autoScaleMode;
return form.CurrentAutoScaleDimensions;
}
}
public static AutoScaleMode AutoScaleMode
{
get { return _autoScaleMode; }
}
public static SizeF AutoScaleBaseSize
{
get { return _autoScaleBaseSize; }
}
public static float AutoScaleFactorX
{
get { return _autoScaleCurrentSize.Width / _autoScaleBaseSize.Width; }
}
public static float AutoScaleFactorY
{
get { return _autoScaleCurrentSize.Height / _autoScaleBaseSize.Height; }
}
public static int ScaleX(int size)
{
return (int)Math.Round(size * AutoScaleFactorX);
}
public static int ScaleY(int size)
{
return (int)Math.Round(size * AutoScaleFactorY);
}
public static Point Scale(Point p)
{
return new Point(ScaleX(p.X), ScaleY(p.Y));
}
public static Size Scale(Size s)
{
return new Size(ScaleX(s.Width), ScaleY(s.Height));
}
}
}
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BizHawk.Client.Common
{
public static class UIHelper
{
private static readonly AutoScaleMode _autoScaleMode = AutoScaleMode.Font;
private static readonly SizeF _autoScaleBaseSize = new SizeF(6F, 13F);
private static readonly SizeF _autoScaleCurrentSize = GetCurrentAutoScaleSize(_autoScaleMode);
private static SizeF GetCurrentAutoScaleSize(AutoScaleMode autoScaleMode)
{
using (Form form = new Form())
{
form.AutoScaleMode = autoScaleMode;
return form.CurrentAutoScaleDimensions;
}
}
public static AutoScaleMode AutoScaleMode
{
get { return _autoScaleMode; }
}
public static SizeF AutoScaleBaseSize
{
get { return _autoScaleBaseSize; }
}
public static float AutoScaleFactorX
{
get { return _autoScaleCurrentSize.Width / _autoScaleBaseSize.Width; }
}
public static float AutoScaleFactorY
{
get { return _autoScaleCurrentSize.Height / _autoScaleBaseSize.Height; }
}
public static int ScaleX(int size)
{
return (int)Math.Round(size * AutoScaleFactorX);
}
public static int ScaleY(int size)
{
return (int)Math.Round(size * AutoScaleFactorY);
}
public static Point Scale(Point p)
{
return new Point(ScaleX(p.X), ScaleY(p.Y));
}
public static Size Scale(Size s)
{
return new Size(ScaleX(s.Width), ScaleY(s.Height));
}
}
}

View File

@ -1,416 +1,416 @@
namespace BizHawk.Client.EmuHawk
{
partial class CDL
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDL));
this.menuStrip1 = new MenuStripEx();
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NewMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OpenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveAsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AppendMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DisassembleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbLoggingActive = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsbViewUpdate = new System.Windows.Forms.ToolStripButton();
this.tsbViewStyle = new System.Windows.Forms.ToolStripComboBox();
this.lvCDL = new BizHawk.Client.EmuHawk.VirtualListView();
this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colPct = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colMapped = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag01 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag02 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag04 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag08 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.tsbExportText = new System.Windows.Forms.ToolStripButton();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(992, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// FileSubMenu
//
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NewMenuItem,
this.OpenMenuItem,
this.SaveMenuItem,
this.SaveAsMenuItem,
this.AppendMenuItem,
this.RecentSubMenu,
this.toolStripSeparator2,
this.ClearMenuItem,
this.DisassembleMenuItem,
this.toolStripSeparator1,
this.ExitMenuItem});
this.FileSubMenu.Name = "FileSubMenu";
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
this.FileSubMenu.Text = "&File";
this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
//
// NewMenuItem
//
this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile;
this.NewMenuItem.Name = "NewMenuItem";
this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.NewMenuItem.Size = new System.Drawing.Size(193, 22);
this.NewMenuItem.Text = "&New";
this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click);
//
// OpenMenuItem
//
this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile;
this.OpenMenuItem.Name = "OpenMenuItem";
this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.OpenMenuItem.Size = new System.Drawing.Size(193, 22);
this.OpenMenuItem.Text = "&Open...";
this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click);
//
// SaveMenuItem
//
this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
this.SaveMenuItem.Name = "SaveMenuItem";
this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.SaveMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveMenuItem.Text = "&Save";
this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click);
//
// SaveAsMenuItem
//
this.SaveAsMenuItem.Name = "SaveAsMenuItem";
this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.SaveAsMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveAsMenuItem.Text = "&Save As...";
this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click);
//
// AppendMenuItem
//
this.AppendMenuItem.Name = "AppendMenuItem";
this.AppendMenuItem.Size = new System.Drawing.Size(193, 22);
this.AppendMenuItem.Text = "&Append File...";
this.AppendMenuItem.Click += new System.EventHandler(this.AppendMenuItem_Click);
//
// RecentSubMenu
//
this.RecentSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.noneToolStripMenuItem});
this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent;
this.RecentSubMenu.Name = "RecentSubMenu";
this.RecentSubMenu.Size = new System.Drawing.Size(193, 22);
this.RecentSubMenu.Text = "Recent";
this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened);
//
// noneToolStripMenuItem
//
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.noneToolStripMenuItem.Text = "None";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6);
//
// ClearMenuItem
//
this.ClearMenuItem.Name = "ClearMenuItem";
this.ClearMenuItem.Size = new System.Drawing.Size(193, 22);
this.ClearMenuItem.Text = "&Clear";
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
// DisassembleMenuItem
//
this.DisassembleMenuItem.Name = "DisassembleMenuItem";
this.DisassembleMenuItem.Size = new System.Drawing.Size(193, 22);
this.DisassembleMenuItem.Text = "&Disassemble...";
this.DisassembleMenuItem.Click += new System.EventHandler(this.DisassembleMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(193, 22);
this.ExitMenuItem.Text = "&Close";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbLoggingActive,
this.toolStripSeparator3,
this.tsbViewUpdate,
this.tsbViewStyle,
this.toolStripSeparator4,
this.tsbExportText});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(992, 25);
this.toolStrip1.TabIndex = 8;
this.toolStrip1.Text = "toolStrip1";
//
// tsbLoggingActive
//
this.tsbLoggingActive.CheckOnClick = true;
this.tsbLoggingActive.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbLoggingActive.Image = ((System.Drawing.Image)(resources.GetObject("tsbLoggingActive.Image")));
this.tsbLoggingActive.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbLoggingActive.Name = "tsbLoggingActive";
this.tsbLoggingActive.Size = new System.Drawing.Size(41, 22);
this.tsbLoggingActive.Text = "Active";
this.tsbLoggingActive.CheckedChanged += new System.EventHandler(this.tsbLoggingActive_CheckedChanged);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// tsbViewUpdate
//
this.tsbViewUpdate.Checked = true;
this.tsbViewUpdate.CheckOnClick = true;
this.tsbViewUpdate.CheckState = System.Windows.Forms.CheckState.Checked;
this.tsbViewUpdate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbViewUpdate.Image = ((System.Drawing.Image)(resources.GetObject("tsbViewUpdate.Image")));
this.tsbViewUpdate.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbViewUpdate.Name = "tsbViewUpdate";
this.tsbViewUpdate.Size = new System.Drawing.Size(46, 22);
this.tsbViewUpdate.Text = "Update";
//
// tsbViewStyle
//
this.tsbViewStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.tsbViewStyle.Items.AddRange(new object[] {
"Show %",
"Show Bytes",
"Show KBytes"});
this.tsbViewStyle.Name = "tsbViewStyle";
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
//
// lvCDL
//
this.lvCDL.BlazingFast = false;
this.lvCDL.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colAddress,
this.colDomain,
this.colPct,
this.colMapped,
this.colSize,
this.colFlag01,
this.colFlag02,
this.colFlag04,
this.colFlag08,
this.colFlag10,
this.colFlag20,
this.colFlag40,
this.colFlag80});
this.lvCDL.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvCDL.FullRowSelect = true;
this.lvCDL.GridLines = true;
this.lvCDL.ItemCount = 0;
this.lvCDL.Location = new System.Drawing.Point(0, 49);
this.lvCDL.Name = "lvCDL";
this.lvCDL.SelectAllInProgress = false;
this.lvCDL.selectedItem = -1;
this.lvCDL.Size = new System.Drawing.Size(992, 323);
this.lvCDL.TabIndex = 9;
this.lvCDL.UseCompatibleStateImageBehavior = false;
this.lvCDL.UseCustomBackground = true;
this.lvCDL.View = System.Windows.Forms.View.Details;
this.lvCDL.VirtualMode = true;
this.lvCDL.QueryItemText += new BizHawk.Client.EmuHawk.QueryItemTextHandler(this.lvCDL_QueryItemText);
//
// colAddress
//
this.colAddress.Text = "CDL File @";
this.colAddress.Width = 107;
//
// colDomain
//
this.colDomain.Text = "Domain";
this.colDomain.Width = 126;
//
// colPct
//
this.colPct.Text = "%";
this.colPct.Width = 58;
//
// colMapped
//
this.colMapped.Text = "Mapped";
this.colMapped.Width = 64;
//
// colSize
//
this.colSize.Text = "Size";
this.colSize.Width = 102;
//
// colFlag01
//
this.colFlag01.Text = "0x01";
//
// colFlag02
//
this.colFlag02.Text = "0x02";
//
// colFlag04
//
this.colFlag04.Text = "0x04";
//
// colFlag08
//
this.colFlag08.Text = "0x08";
//
// colFlag10
//
this.colFlag10.Text = "0x10";
//
// colFlag20
//
this.colFlag20.Text = "0x20";
//
// colFlag40
//
this.colFlag40.Text = "0x40";
//
// colFlag80
//
this.colFlag80.Text = "0x80";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
//
// tsbExportText
//
this.tsbExportText.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
this.tsbExportText.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbExportText.Name = "tsbExportText";
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
this.tsbExportText.Text = "To Clipboard";
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
//
// CDL
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(992, 372);
this.Controls.Add(this.lvCDL);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(150, 130);
this.Name = "CDL";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Code Data Logger";
this.Load += new System.EventHandler(this.PCECDL_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragEnter);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private MenuStripEx menuStrip1;
private System.Windows.Forms.ToolStripMenuItem FileSubMenu;
private System.Windows.Forms.ToolStripMenuItem ClearMenuItem;
private System.Windows.Forms.ToolStripMenuItem OpenMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveAsMenuItem;
private System.Windows.Forms.ToolStripMenuItem AppendMenuItem;
private System.Windows.Forms.ToolStripMenuItem NewMenuItem;
private System.Windows.Forms.ToolStripMenuItem DisassembleMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveMenuItem;
private System.Windows.Forms.ToolStripMenuItem RecentSubMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton tsbLoggingActive;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripButton tsbViewUpdate;
private System.Windows.Forms.ToolStripComboBox tsbViewStyle;
private VirtualListView lvCDL;
private System.Windows.Forms.ColumnHeader colAddress;
private System.Windows.Forms.ColumnHeader colDomain;
private System.Windows.Forms.ColumnHeader colPct;
private System.Windows.Forms.ColumnHeader colMapped;
private System.Windows.Forms.ColumnHeader colSize;
private System.Windows.Forms.ColumnHeader colFlag01;
private System.Windows.Forms.ColumnHeader colFlag02;
private System.Windows.Forms.ColumnHeader colFlag04;
private System.Windows.Forms.ColumnHeader colFlag08;
private System.Windows.Forms.ColumnHeader colFlag10;
private System.Windows.Forms.ColumnHeader colFlag20;
private System.Windows.Forms.ColumnHeader colFlag40;
private System.Windows.Forms.ColumnHeader colFlag80;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripButton tsbExportText;
}
namespace BizHawk.Client.EmuHawk
{
partial class CDL
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDL));
this.menuStrip1 = new MenuStripEx();
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NewMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OpenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveAsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AppendMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DisassembleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbLoggingActive = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsbViewUpdate = new System.Windows.Forms.ToolStripButton();
this.tsbViewStyle = new System.Windows.Forms.ToolStripComboBox();
this.lvCDL = new BizHawk.Client.EmuHawk.VirtualListView();
this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colPct = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colMapped = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag01 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag02 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag04 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag08 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.tsbExportText = new System.Windows.Forms.ToolStripButton();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(992, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// FileSubMenu
//
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NewMenuItem,
this.OpenMenuItem,
this.SaveMenuItem,
this.SaveAsMenuItem,
this.AppendMenuItem,
this.RecentSubMenu,
this.toolStripSeparator2,
this.ClearMenuItem,
this.DisassembleMenuItem,
this.toolStripSeparator1,
this.ExitMenuItem});
this.FileSubMenu.Name = "FileSubMenu";
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
this.FileSubMenu.Text = "&File";
this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
//
// NewMenuItem
//
this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile;
this.NewMenuItem.Name = "NewMenuItem";
this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.NewMenuItem.Size = new System.Drawing.Size(193, 22);
this.NewMenuItem.Text = "&New";
this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click);
//
// OpenMenuItem
//
this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile;
this.OpenMenuItem.Name = "OpenMenuItem";
this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.OpenMenuItem.Size = new System.Drawing.Size(193, 22);
this.OpenMenuItem.Text = "&Open...";
this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click);
//
// SaveMenuItem
//
this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
this.SaveMenuItem.Name = "SaveMenuItem";
this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.SaveMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveMenuItem.Text = "&Save";
this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click);
//
// SaveAsMenuItem
//
this.SaveAsMenuItem.Name = "SaveAsMenuItem";
this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.SaveAsMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveAsMenuItem.Text = "&Save As...";
this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click);
//
// AppendMenuItem
//
this.AppendMenuItem.Name = "AppendMenuItem";
this.AppendMenuItem.Size = new System.Drawing.Size(193, 22);
this.AppendMenuItem.Text = "&Append File...";
this.AppendMenuItem.Click += new System.EventHandler(this.AppendMenuItem_Click);
//
// RecentSubMenu
//
this.RecentSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.noneToolStripMenuItem});
this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent;
this.RecentSubMenu.Name = "RecentSubMenu";
this.RecentSubMenu.Size = new System.Drawing.Size(193, 22);
this.RecentSubMenu.Text = "Recent";
this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened);
//
// noneToolStripMenuItem
//
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.noneToolStripMenuItem.Text = "None";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6);
//
// ClearMenuItem
//
this.ClearMenuItem.Name = "ClearMenuItem";
this.ClearMenuItem.Size = new System.Drawing.Size(193, 22);
this.ClearMenuItem.Text = "&Clear";
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
// DisassembleMenuItem
//
this.DisassembleMenuItem.Name = "DisassembleMenuItem";
this.DisassembleMenuItem.Size = new System.Drawing.Size(193, 22);
this.DisassembleMenuItem.Text = "&Disassemble...";
this.DisassembleMenuItem.Click += new System.EventHandler(this.DisassembleMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(193, 22);
this.ExitMenuItem.Text = "&Close";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbLoggingActive,
this.toolStripSeparator3,
this.tsbViewUpdate,
this.tsbViewStyle,
this.toolStripSeparator4,
this.tsbExportText});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(992, 25);
this.toolStrip1.TabIndex = 8;
this.toolStrip1.Text = "toolStrip1";
//
// tsbLoggingActive
//
this.tsbLoggingActive.CheckOnClick = true;
this.tsbLoggingActive.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbLoggingActive.Image = ((System.Drawing.Image)(resources.GetObject("tsbLoggingActive.Image")));
this.tsbLoggingActive.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbLoggingActive.Name = "tsbLoggingActive";
this.tsbLoggingActive.Size = new System.Drawing.Size(41, 22);
this.tsbLoggingActive.Text = "Active";
this.tsbLoggingActive.CheckedChanged += new System.EventHandler(this.tsbLoggingActive_CheckedChanged);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// tsbViewUpdate
//
this.tsbViewUpdate.Checked = true;
this.tsbViewUpdate.CheckOnClick = true;
this.tsbViewUpdate.CheckState = System.Windows.Forms.CheckState.Checked;
this.tsbViewUpdate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbViewUpdate.Image = ((System.Drawing.Image)(resources.GetObject("tsbViewUpdate.Image")));
this.tsbViewUpdate.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbViewUpdate.Name = "tsbViewUpdate";
this.tsbViewUpdate.Size = new System.Drawing.Size(46, 22);
this.tsbViewUpdate.Text = "Update";
//
// tsbViewStyle
//
this.tsbViewStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.tsbViewStyle.Items.AddRange(new object[] {
"Show %",
"Show Bytes",
"Show KBytes"});
this.tsbViewStyle.Name = "tsbViewStyle";
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
//
// lvCDL
//
this.lvCDL.BlazingFast = false;
this.lvCDL.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colAddress,
this.colDomain,
this.colPct,
this.colMapped,
this.colSize,
this.colFlag01,
this.colFlag02,
this.colFlag04,
this.colFlag08,
this.colFlag10,
this.colFlag20,
this.colFlag40,
this.colFlag80});
this.lvCDL.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvCDL.FullRowSelect = true;
this.lvCDL.GridLines = true;
this.lvCDL.ItemCount = 0;
this.lvCDL.Location = new System.Drawing.Point(0, 49);
this.lvCDL.Name = "lvCDL";
this.lvCDL.SelectAllInProgress = false;
this.lvCDL.selectedItem = -1;
this.lvCDL.Size = new System.Drawing.Size(992, 323);
this.lvCDL.TabIndex = 9;
this.lvCDL.UseCompatibleStateImageBehavior = false;
this.lvCDL.UseCustomBackground = true;
this.lvCDL.View = System.Windows.Forms.View.Details;
this.lvCDL.VirtualMode = true;
this.lvCDL.QueryItemText += new BizHawk.Client.EmuHawk.QueryItemTextHandler(this.lvCDL_QueryItemText);
//
// colAddress
//
this.colAddress.Text = "CDL File @";
this.colAddress.Width = 107;
//
// colDomain
//
this.colDomain.Text = "Domain";
this.colDomain.Width = 126;
//
// colPct
//
this.colPct.Text = "%";
this.colPct.Width = 58;
//
// colMapped
//
this.colMapped.Text = "Mapped";
this.colMapped.Width = 64;
//
// colSize
//
this.colSize.Text = "Size";
this.colSize.Width = 102;
//
// colFlag01
//
this.colFlag01.Text = "0x01";
//
// colFlag02
//
this.colFlag02.Text = "0x02";
//
// colFlag04
//
this.colFlag04.Text = "0x04";
//
// colFlag08
//
this.colFlag08.Text = "0x08";
//
// colFlag10
//
this.colFlag10.Text = "0x10";
//
// colFlag20
//
this.colFlag20.Text = "0x20";
//
// colFlag40
//
this.colFlag40.Text = "0x40";
//
// colFlag80
//
this.colFlag80.Text = "0x80";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
//
// tsbExportText
//
this.tsbExportText.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
this.tsbExportText.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbExportText.Name = "tsbExportText";
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
this.tsbExportText.Text = "To Clipboard";
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
//
// CDL
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(992, 372);
this.Controls.Add(this.lvCDL);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(150, 130);
this.Name = "CDL";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Code Data Logger";
this.Load += new System.EventHandler(this.PCECDL_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragEnter);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private MenuStripEx menuStrip1;
private System.Windows.Forms.ToolStripMenuItem FileSubMenu;
private System.Windows.Forms.ToolStripMenuItem ClearMenuItem;
private System.Windows.Forms.ToolStripMenuItem OpenMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveAsMenuItem;
private System.Windows.Forms.ToolStripMenuItem AppendMenuItem;
private System.Windows.Forms.ToolStripMenuItem NewMenuItem;
private System.Windows.Forms.ToolStripMenuItem DisassembleMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveMenuItem;
private System.Windows.Forms.ToolStripMenuItem RecentSubMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton tsbLoggingActive;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripButton tsbViewUpdate;
private System.Windows.Forms.ToolStripComboBox tsbViewStyle;
private VirtualListView lvCDL;
private System.Windows.Forms.ColumnHeader colAddress;
private System.Windows.Forms.ColumnHeader colDomain;
private System.Windows.Forms.ColumnHeader colPct;
private System.Windows.Forms.ColumnHeader colMapped;
private System.Windows.Forms.ColumnHeader colSize;
private System.Windows.Forms.ColumnHeader colFlag01;
private System.Windows.Forms.ColumnHeader colFlag02;
private System.Windows.Forms.ColumnHeader colFlag04;
private System.Windows.Forms.ColumnHeader colFlag08;
private System.Windows.Forms.ColumnHeader colFlag10;
private System.Windows.Forms.ColumnHeader colFlag20;
private System.Windows.Forms.ColumnHeader colFlag40;
private System.Windows.Forms.ColumnHeader colFlag80;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripButton tsbExportText;
}
}

View File

@ -1,475 +1,475 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Components.H6280;
using BizHawk.Emulation.Cores.PCEngine;
using BizHawk.Emulation.Cores.Consoles.Sega;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions;
//TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it?
//perhaps missing domains shouldnt fail a check
//OR - just add a contextmenu option to the listview item that selects it for export.
//TODO - add a contextmenu option which warps to the hexeditor with the provided domain selected for visualizing on the hex editor.
//TODO - consider setting colors for columns in CDL
//TODO - option to print domain name in caption instead of 0x01 etc.
//TODO - context menu should have copy option too
namespace BizHawk.Client.EmuHawk
{
public partial class CDL : Form, IToolFormAutoConfig
{
private RecentFiles _recent_fld = new RecentFiles();
[ConfigPersist]
private RecentFiles _recent
{
get
{ return _recent_fld; }
set
{
_recent_fld = value;
if (_recent_fld.AutoLoad)
{
LoadFile(_recent.MostRecent);
SetCurrentFilename(_recent.MostRecent);
}
}
}
void SetCurrentFilename(string fname)
{
_currentFilename = fname;
if (_currentFilename == null)
Text = "Code Data Logger";
else Text = string.Format("Code Data Logger - {0}", fname);
}
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
[RequiredService]
private ICodeDataLogger CodeDataLogger { get; set; }
private string _currentFilename = null;
private CodeDataLog _cdl;
public CDL()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
InitializeComponent();
tsbViewStyle.SelectedIndex = 0;
}
public void UpdateValues()
{
UpdateDisplay(false);
}
public void FastUpdate()
{
// Do nothing
}
public 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.
_cdl = null;
SetCurrentFilename(null);
SetLoggingActiveCheck(false);
UpdateDisplay(true);
}
void SetLoggingActiveCheck(bool value)
{
tsbLoggingActive.Checked = value;
}
string[][] listContents = new string[0][];
private void UpdateDisplay(bool force)
{
if (!tsbViewUpdate.Checked && !force)
return;
if (_cdl == null)
{
lvCDL.BeginUpdate();
lvCDL.Items.Clear();
lvCDL.EndUpdate();
return;
}
lvCDL.BeginUpdate();
listContents = new string[_cdl.Count][];
int idx = 0;
foreach (var kvp in _cdl)
{
int[] totals = new int[8];
int total = 0;
unsafe
{
int* map = stackalloc int[256];
for (int i = 0; i < 256; i++)
map[i] = 0;
fixed (byte* data = kvp.Value)
{
byte* src = data;
byte* end = data + kvp.Value.Length;
while (src < end)
{
byte s = *src++;
map[s]++;
}
}
for (int i = 0; i < 256; i++)
{
if(i!=0) total += map[i];
if ((i & 0x01) != 0) totals[0] += map[i];
if ((i & 0x02) != 0) totals[1] += map[i];
if ((i & 0x04) != 0) totals[2] += map[i];
if ((i & 0x08) != 0) totals[3] += map[i];
if ((i & 0x10) != 0) totals[4] += map[i];
if ((i & 0x20) != 0) totals[5] += map[i];
if ((i & 0x40) != 0) totals[6] += map[i];
if ((i & 0x80) != 0) totals[7] += map[i];
}
}
var bm = _cdl.GetBlockMap();
long addr = bm[kvp.Key];
var lvi = listContents[idx++] = new string[13];
lvi[0] = string.Format("{0:X8}", addr);
lvi[1] = kvp.Key;
lvi[2] = string.Format("{0:0.00}%", total / (float)kvp.Value.Length * 100f);
if (tsbViewStyle.SelectedIndex == 2)
lvi[3] = string.Format("{0:0.00}", total / 1024.0f);
else
lvi[3] = string.Format("{0}", total);
if (tsbViewStyle.SelectedIndex == 2)
{
int n = (int)(kvp.Value.Length / 1024.0f);
float ncheck = kvp.Value.Length / 1024.0f;
lvi[4] = string.Format("of {0}{1} KBytes", n == ncheck ? "" : "~", n);
}
else
lvi[4] = string.Format("of {0} Bytes", kvp.Value.Length);
for (int i = 0; i < 8; i++)
{
if (tsbViewStyle.SelectedIndex == 0)
lvi[5 + i] = string.Format("{0:0.00}%", totals[i] / (float)kvp.Value.Length * 100f);
if (tsbViewStyle.SelectedIndex == 1)
lvi[5 + i] = string.Format("{0}", totals[i]);
if (tsbViewStyle.SelectedIndex == 2)
lvi[5 + i] = string.Format("{0:0.00}", totals[i] / 1024.0f);
}
}
lvCDL.VirtualListSize = _cdl.Count;
lvCDL.EndUpdate();
}
public bool AskSaveChanges()
{
return true;
}
public bool UpdateBefore
{
get { return false; }
}
public void LoadFile(string path)
{
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
var newCDL = new CodeDataLog();
newCDL.Load(fs);
//have the core create a CodeDataLog to check mapping information against
var testCDL = new CodeDataLog();
CodeDataLogger.NewCDL(testCDL);
if (!newCDL.Check(testCDL))
{
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
return;
}
//ok, it's all good:
_cdl = newCDL;
CodeDataLogger.SetCDL(null);
if (tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(_cdl);
SetCurrentFilename(path);
}
UpdateDisplay(true);
}
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
{
SaveMenuItem.Enabled = _currentFilename != null;
SaveAsMenuItem.Enabled =
AppendMenuItem.Enabled =
ClearMenuItem.Enabled =
DisassembleMenuItem.Enabled =
_cdl != null;
}
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
{
RecentSubMenu.DropDownItems.Clear();
RecentSubMenu.DropDownItems.AddRange(_recent.RecentMenu(LoadFile, true));
}
void NewFileLogic()
{
_cdl = new CodeDataLog();
CodeDataLogger.NewCDL(_cdl);
if (tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(_cdl);
else CodeDataLogger.SetCDL(null);
SetCurrentFilename(null);
UpdateDisplay(true);
}
private void NewMenuItem_Click(object sender, EventArgs e)
{
//take care not to clobber an existing CDL
if (_cdl != null)
{
var result = MessageBox.Show(this, "OK to create new CDL?", "Query", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
return;
}
NewFileLogic();
}
private void OpenMenuItem_Click(object sender, EventArgs e)
{
var file = ToolHelpers.OpenFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file == null)
return;
//take care not to clobber an existing CDL
if (_cdl != null)
{
var result = MessageBox.Show(this, "OK to load new CDL?", "Query", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
return;
}
LoadFile(file.FullName);
}
private void SaveMenuItem_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(_currentFilename))
{
RunSaveAs();
return;
}
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
}
}
void RunSaveAs()
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
}
else
{
var file = ToolHelpers.SaveFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file != null)
{
using (var fs = new FileStream(file.FullName, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
_recent.Add(file.FullName);
SetCurrentFilename(file.FullName);
}
}
}
}
private void SaveAsMenuItem_Click(object sender, EventArgs e)
{
RunSaveAs();
}
private void AppendMenuItem_Click(object sender, EventArgs e)
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot append with no CDL loaded!", "Alert");
}
else
{
var file = ToolHelpers.OpenFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file != null)
{
using (var fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
{
var newCDL = new CodeDataLog();
newCDL.Load(fs);
if (!_cdl.Check(newCDL))
{
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
return;
}
_cdl.LogicalOrFrom(newCDL);
UpdateDisplay(true);
}
}
}
}
private void ClearMenuItem_Click(object sender, EventArgs e)
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot clear with no CDL loaded!", "Alert");
}
else
{
var result = MessageBox.Show(this, "OK to clear CDL?", "Query", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
_cdl.ClearData();
UpdateDisplay(true);
}
}
}
private void DisassembleMenuItem_Click(object sender, EventArgs e)
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot disassemble with no CDL loaded!", "Alert");
return;
}
var sfd = new SaveFileDialog();
var result = sfd.ShowDialog(this);
if (result == DialogResult.OK)
{
using (var fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write))
{
CodeDataLogger.DisassembleCDL(fs, _cdl);
}
}
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
Close();
}
protected override void OnClosed(EventArgs e)
{
//deactivate logger
if (CodeDataLogger != null) //just in case...
CodeDataLogger.SetCDL(null);
}
private void PCECDL_Load(object sender, EventArgs e)
{
}
private void PCECDL_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
}
private void PCECDL_DragDrop(object sender, DragEventArgs e)
{
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (Path.GetExtension(filePaths[0]) == ".cdl")
{
LoadFile(filePaths[0]);
}
}
private void tsbViewStyle_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateDisplay(true);
}
private void tsbLoggingActive_CheckedChanged(object sender, EventArgs e)
{
if (tsbLoggingActive.Checked && _cdl == null)
{
//implicitly create a new file
NewFileLogic();
}
if (_cdl != null && tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(_cdl);
else
CodeDataLogger.SetCDL(null);
}
private void lvCDL_QueryItemText(int item, int subItem, out string text)
{
text = listContents[item][subItem];
}
private void tsbExportText_Click(object sender, EventArgs e)
{
StringWriter sw = new StringWriter();
foreach(var line in listContents)
{
foreach (var entry in line)
sw.Write("{0} |", entry);
sw.WriteLine();
}
Clipboard.SetText(sw.ToString());
}
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Components.H6280;
using BizHawk.Emulation.Cores.PCEngine;
using BizHawk.Emulation.Cores.Consoles.Sega;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions;
//TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it?
//perhaps missing domains shouldnt fail a check
//OR - just add a contextmenu option to the listview item that selects it for export.
//TODO - add a contextmenu option which warps to the hexeditor with the provided domain selected for visualizing on the hex editor.
//TODO - consider setting colors for columns in CDL
//TODO - option to print domain name in caption instead of 0x01 etc.
//TODO - context menu should have copy option too
namespace BizHawk.Client.EmuHawk
{
public partial class CDL : Form, IToolFormAutoConfig
{
private RecentFiles _recent_fld = new RecentFiles();
[ConfigPersist]
private RecentFiles _recent
{
get
{ return _recent_fld; }
set
{
_recent_fld = value;
if (_recent_fld.AutoLoad)
{
LoadFile(_recent.MostRecent);
SetCurrentFilename(_recent.MostRecent);
}
}
}
void SetCurrentFilename(string fname)
{
_currentFilename = fname;
if (_currentFilename == null)
Text = "Code Data Logger";
else Text = string.Format("Code Data Logger - {0}", fname);
}
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
[RequiredService]
private ICodeDataLogger CodeDataLogger { get; set; }
private string _currentFilename = null;
private CodeDataLog _cdl;
public CDL()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
InitializeComponent();
tsbViewStyle.SelectedIndex = 0;
}
public void UpdateValues()
{
UpdateDisplay(false);
}
public void FastUpdate()
{
// Do nothing
}
public 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.
_cdl = null;
SetCurrentFilename(null);
SetLoggingActiveCheck(false);
UpdateDisplay(true);
}
void SetLoggingActiveCheck(bool value)
{
tsbLoggingActive.Checked = value;
}
string[][] listContents = new string[0][];
private void UpdateDisplay(bool force)
{
if (!tsbViewUpdate.Checked && !force)
return;
if (_cdl == null)
{
lvCDL.BeginUpdate();
lvCDL.Items.Clear();
lvCDL.EndUpdate();
return;
}
lvCDL.BeginUpdate();
listContents = new string[_cdl.Count][];
int idx = 0;
foreach (var kvp in _cdl)
{
int[] totals = new int[8];
int total = 0;
unsafe
{
int* map = stackalloc int[256];
for (int i = 0; i < 256; i++)
map[i] = 0;
fixed (byte* data = kvp.Value)
{
byte* src = data;
byte* end = data + kvp.Value.Length;
while (src < end)
{
byte s = *src++;
map[s]++;
}
}
for (int i = 0; i < 256; i++)
{
if(i!=0) total += map[i];
if ((i & 0x01) != 0) totals[0] += map[i];
if ((i & 0x02) != 0) totals[1] += map[i];
if ((i & 0x04) != 0) totals[2] += map[i];
if ((i & 0x08) != 0) totals[3] += map[i];
if ((i & 0x10) != 0) totals[4] += map[i];
if ((i & 0x20) != 0) totals[5] += map[i];
if ((i & 0x40) != 0) totals[6] += map[i];
if ((i & 0x80) != 0) totals[7] += map[i];
}
}
var bm = _cdl.GetBlockMap();
long addr = bm[kvp.Key];
var lvi = listContents[idx++] = new string[13];
lvi[0] = string.Format("{0:X8}", addr);
lvi[1] = kvp.Key;
lvi[2] = string.Format("{0:0.00}%", total / (float)kvp.Value.Length * 100f);
if (tsbViewStyle.SelectedIndex == 2)
lvi[3] = string.Format("{0:0.00}", total / 1024.0f);
else
lvi[3] = string.Format("{0}", total);
if (tsbViewStyle.SelectedIndex == 2)
{
int n = (int)(kvp.Value.Length / 1024.0f);
float ncheck = kvp.Value.Length / 1024.0f;
lvi[4] = string.Format("of {0}{1} KBytes", n == ncheck ? "" : "~", n);
}
else
lvi[4] = string.Format("of {0} Bytes", kvp.Value.Length);
for (int i = 0; i < 8; i++)
{
if (tsbViewStyle.SelectedIndex == 0)
lvi[5 + i] = string.Format("{0:0.00}%", totals[i] / (float)kvp.Value.Length * 100f);
if (tsbViewStyle.SelectedIndex == 1)
lvi[5 + i] = string.Format("{0}", totals[i]);
if (tsbViewStyle.SelectedIndex == 2)
lvi[5 + i] = string.Format("{0:0.00}", totals[i] / 1024.0f);
}
}
lvCDL.VirtualListSize = _cdl.Count;
lvCDL.EndUpdate();
}
public bool AskSaveChanges()
{
return true;
}
public bool UpdateBefore
{
get { return false; }
}
public void LoadFile(string path)
{
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
var newCDL = new CodeDataLog();
newCDL.Load(fs);
//have the core create a CodeDataLog to check mapping information against
var testCDL = new CodeDataLog();
CodeDataLogger.NewCDL(testCDL);
if (!newCDL.Check(testCDL))
{
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
return;
}
//ok, it's all good:
_cdl = newCDL;
CodeDataLogger.SetCDL(null);
if (tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(_cdl);
SetCurrentFilename(path);
}
UpdateDisplay(true);
}
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
{
SaveMenuItem.Enabled = _currentFilename != null;
SaveAsMenuItem.Enabled =
AppendMenuItem.Enabled =
ClearMenuItem.Enabled =
DisassembleMenuItem.Enabled =
_cdl != null;
}
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
{
RecentSubMenu.DropDownItems.Clear();
RecentSubMenu.DropDownItems.AddRange(_recent.RecentMenu(LoadFile, true));
}
void NewFileLogic()
{
_cdl = new CodeDataLog();
CodeDataLogger.NewCDL(_cdl);
if (tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(_cdl);
else CodeDataLogger.SetCDL(null);
SetCurrentFilename(null);
UpdateDisplay(true);
}
private void NewMenuItem_Click(object sender, EventArgs e)
{
//take care not to clobber an existing CDL
if (_cdl != null)
{
var result = MessageBox.Show(this, "OK to create new CDL?", "Query", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
return;
}
NewFileLogic();
}
private void OpenMenuItem_Click(object sender, EventArgs e)
{
var file = ToolHelpers.OpenFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file == null)
return;
//take care not to clobber an existing CDL
if (_cdl != null)
{
var result = MessageBox.Show(this, "OK to load new CDL?", "Query", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
return;
}
LoadFile(file.FullName);
}
private void SaveMenuItem_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(_currentFilename))
{
RunSaveAs();
return;
}
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
}
}
void RunSaveAs()
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
}
else
{
var file = ToolHelpers.SaveFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file != null)
{
using (var fs = new FileStream(file.FullName, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
_recent.Add(file.FullName);
SetCurrentFilename(file.FullName);
}
}
}
}
private void SaveAsMenuItem_Click(object sender, EventArgs e)
{
RunSaveAs();
}
private void AppendMenuItem_Click(object sender, EventArgs e)
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot append with no CDL loaded!", "Alert");
}
else
{
var file = ToolHelpers.OpenFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file != null)
{
using (var fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
{
var newCDL = new CodeDataLog();
newCDL.Load(fs);
if (!_cdl.Check(newCDL))
{
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
return;
}
_cdl.LogicalOrFrom(newCDL);
UpdateDisplay(true);
}
}
}
}
private void ClearMenuItem_Click(object sender, EventArgs e)
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot clear with no CDL loaded!", "Alert");
}
else
{
var result = MessageBox.Show(this, "OK to clear CDL?", "Query", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
_cdl.ClearData();
UpdateDisplay(true);
}
}
}
private void DisassembleMenuItem_Click(object sender, EventArgs e)
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot disassemble with no CDL loaded!", "Alert");
return;
}
var sfd = new SaveFileDialog();
var result = sfd.ShowDialog(this);
if (result == DialogResult.OK)
{
using (var fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write))
{
CodeDataLogger.DisassembleCDL(fs, _cdl);
}
}
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
Close();
}
protected override void OnClosed(EventArgs e)
{
//deactivate logger
if (CodeDataLogger != null) //just in case...
CodeDataLogger.SetCDL(null);
}
private void PCECDL_Load(object sender, EventArgs e)
{
}
private void PCECDL_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
}
private void PCECDL_DragDrop(object sender, DragEventArgs e)
{
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (Path.GetExtension(filePaths[0]) == ".cdl")
{
LoadFile(filePaths[0]);
}
}
private void tsbViewStyle_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateDisplay(true);
}
private void tsbLoggingActive_CheckedChanged(object sender, EventArgs e)
{
if (tsbLoggingActive.Checked && _cdl == null)
{
//implicitly create a new file
NewFileLogic();
}
if (_cdl != null && tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(_cdl);
else
CodeDataLogger.SetCDL(null);
}
private void lvCDL_QueryItemText(int item, int subItem, out string text)
{
text = listContents[item][subItem];
}
private void tsbExportText_Click(object sender, EventArgs e)
{
StringWriter sw = new StringWriter();
foreach(var line in listContents)
{
foreach (var entry in line)
sw.Write("{0} |", entry);
sw.WriteLine();
}
Clipboard.SetText(sw.ToString());
}
}
}

View File

@ -1,176 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbLoggingActive.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbViewUpdate.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwAAAAAAAAAAAACMWxApOoZ
jN1ApOoCMWyj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoCMWxApOoZjN0CMWyj
0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWwZjN0CMWwQUHwCMWxApOoCMWxApOouKfCj0/Wj0/XL
PAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UC
MWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQ
UHwCMWwZjN0CMWyj0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWxApOoCMWwQUHwCMWwZjN0CMWyj
0/Wj0/Wj0/VApOpApOpApOpApOpApOoCMWwCMWwZjN1ApOoCMWxApOpApOoCMWyj0/Wj0/Wj0/UCMWwC
MWyj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoZjN0CMWxApOpApOqj0/UCMWyj0/Wj0/Wj0/Wj0/UCMWwA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWyj0/VApOqj0/UCMWwCMWwAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAACMWyj0/VApOqj0/UOOwMOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAOOwMjpQUCMWyj0/UOOwMhhwkjpQUOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMhhwkjpQUC
MWwOOwMjpQUhhwkOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMLAQOOwMOOwMAAAAOOwMhhwkjpQUO
OwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMjpQUOOwMAAADAAwAAgAEAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAP+BAAD/AAAA/wAAAP8QAAD/8QAA
</value>
</data>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbLoggingActive.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbViewUpdate.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwAAAAAAAAAAAACMWxApOoZ
jN1ApOoCMWyj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoCMWxApOoZjN0CMWyj
0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWwZjN0CMWwQUHwCMWxApOoCMWxApOouKfCj0/Wj0/XL
PAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UC
MWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQ
UHwCMWwZjN0CMWyj0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWxApOoCMWwQUHwCMWwZjN0CMWyj
0/Wj0/Wj0/VApOpApOpApOpApOpApOoCMWwCMWwZjN1ApOoCMWxApOpApOoCMWyj0/Wj0/Wj0/UCMWwC
MWyj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoZjN0CMWxApOpApOqj0/UCMWyj0/Wj0/Wj0/Wj0/UCMWwA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWyj0/VApOqj0/UCMWwCMWwAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAACMWyj0/VApOqj0/UOOwMOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAOOwMjpQUCMWyj0/UOOwMhhwkjpQUOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMhhwkjpQUC
MWwOOwMjpQUhhwkOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMLAQOOwMOOwMAAAAOOwMhhwkjpQUO
OwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMjpQUOOwMAAADAAwAAgAEAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAP+BAAD/AAAA/wAAAP8QAAD/8QAA
</value>
</data>
>>>>>>> refs/remotes/TASVideos/master
</root>

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Client.EmuHawk
{
/// <summary>
/// Interface to implements in order to make a custom tool for a specific game
/// </summary>
public interface ICustomGameTool:IToolForm
{
}
}

View File

@ -74,7 +74,12 @@ namespace BizHawk.Client.EmuHawk
var newTool = CreateInstance(toolType);
if (newTool is Form)
if (newTool == null)
{
return null;
}
if (newTool is Form)
{
(newTool as Form).Owner = GlobalWin.MainForm;
}
@ -502,16 +507,55 @@ namespace BizHawk.Client.EmuHawk
return CreateInstance(typeof(T));
}
private IToolForm CreateInstance(Type toolType)
{
var tool = (IToolForm)Activator.CreateInstance(toolType);
private IToolForm CreateInstance(Type toolType)
{
IToolForm tool;
// Add to our list of tools
_tools.Add(tool);
return tool;
}
//Specific case for custom tools
if (toolType == typeof(ICustomGameTool))
{
string path = Path.Combine(Global.Config.PathEntries["Global", "GameTools"].Path, string.Format("{0}.dll", Global.Game.Name));
if (File.Exists(path)
&& MessageBox.Show("A custom plugin has been found for the ROM you're loading. Do you want to load it?\r\nAccept ONLY if you trust the source and if you know what you're doing. In any other case, choose no."
, "Answer to life, universe and everything else?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
// As the object is "remote"(external to the project), the CreateInstanceFrom returns a handle.We need to Unwrap in order to make the casting
tool = System.Activator.CreateInstanceFrom(path, "BizHawk.Client.EmuHawk.CustomMainForm").Unwrap() as IToolForm;
if (tool == null)
{
MessageBox.Show("It seems that the object CustomMainForm does not implement IToolForm. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
}
catch (MissingMethodException)
{
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
catch (TypeLoadException)
{
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
}
else
{
return null;
}
}
else
{
tool = (IToolForm)Activator.CreateInstance(toolType);
}
public void UpdateToolsBefore(bool fromLua = false)
// Add to our list of tools
_tools.Add(tool);
return tool;
}
public void UpdateToolsBefore(bool fromLua = false)
{
if (Has<LuaConsole>())
{

View File

@ -1,72 +1,72 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace BizHawk.Common
{
public class InstanceDll : IDisposable
{
public InstanceDll(string dllPath)
{
//copy the dll to a temp directory
var path = TempFileCleaner.GetTempFilename(string.Format("{0}", Path.GetFileNameWithoutExtension(dllPath)),".dll",false);
using (var stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.ReadWrite | FileShare.Delete, 4 * 1024, FileOptions.None))
using (var sdll = File.OpenRead(dllPath))
sdll.CopyTo(stream);
//try to locate dlls in the current directory (for libretro cores)
//this isnt foolproof but its a little better than nothing
//setting PWD temporarily doesnt work. that'd be ideal since it supposedly gets searched early on,
//but i guess not with SetDllDirectory in effect
var envpath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
try
{
string envpath_new = Path.GetDirectoryName(dllPath) + ";" + envpath;
Environment.SetEnvironmentVariable("PATH", envpath_new, EnvironmentVariableTarget.Process);
_hModule = LoadLibrary(path); //consider using LoadLibraryEx instead of shenanigans?
var newfname = TempFileCleaner.RenameTempFilenameForDelete(path);
File.Move(path, newfname);
}
finally
{
Environment.SetEnvironmentVariable("PATH", envpath, EnvironmentVariableTarget.Process);
}
}
[Flags]
enum LoadLibraryFlags : uint
{
DONT_RESOLVE_DLL_REFERENCES = 0x00000001,
LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010,
LOAD_LIBRARY_AS_DATAFILE = 0x00000002,
LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040,
LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020,
LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hReservedNull, LoadLibraryFlags dwFlags);
[DllImport("kernel32.dll")]
static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll")]
static extern bool FreeLibrary(IntPtr hModule);
public IntPtr GetProcAddress(string procName)
{
return GetProcAddress(_hModule, procName);
}
public void Dispose()
{
if (_hModule != IntPtr.Zero)
{
FreeLibrary(_hModule);
_hModule = IntPtr.Zero;
}
}
IntPtr _hModule;
}
}
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace BizHawk.Common
{
public class InstanceDll : IDisposable
{
public InstanceDll(string dllPath)
{
//copy the dll to a temp directory
var path = TempFileCleaner.GetTempFilename(string.Format("{0}", Path.GetFileNameWithoutExtension(dllPath)),".dll",false);
using (var stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.ReadWrite | FileShare.Delete, 4 * 1024, FileOptions.None))
using (var sdll = File.OpenRead(dllPath))
sdll.CopyTo(stream);
//try to locate dlls in the current directory (for libretro cores)
//this isnt foolproof but its a little better than nothing
//setting PWD temporarily doesnt work. that'd be ideal since it supposedly gets searched early on,
//but i guess not with SetDllDirectory in effect
var envpath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
try
{
string envpath_new = Path.GetDirectoryName(path) + ";" + envpath;
Environment.SetEnvironmentVariable("PATH", envpath_new, EnvironmentVariableTarget.Process);
_hModule = LoadLibrary(path); //consider using LoadLibraryEx instead of shenanigans?
var newfname = TempFileCleaner.RenameTempFilenameForDelete(path);
File.Move(path, newfname);
}
finally
{
Environment.SetEnvironmentVariable("PATH", envpath, EnvironmentVariableTarget.Process);
}
}
[Flags]
enum LoadLibraryFlags : uint
{
DONT_RESOLVE_DLL_REFERENCES = 0x00000001,
LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010,
LOAD_LIBRARY_AS_DATAFILE = 0x00000002,
LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040,
LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020,
LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hReservedNull, LoadLibraryFlags dwFlags);
[DllImport("kernel32.dll")]
static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll")]
static extern bool FreeLibrary(IntPtr hModule);
public IntPtr GetProcAddress(string procName)
{
return GetProcAddress(_hModule, procName);
}
public void Dispose()
{
if (_hModule != IntPtr.Zero)
{
FreeLibrary(_hModule);
_hModule = IntPtr.Zero;
}
}
IntPtr _hModule;
}
}

View File

@ -244,8 +244,8 @@ namespace BizHawk.Common
static double GetDouble(IntPtr first, IntPtr second)
{
var ms = new MemoryStream(8);
var bw = new BinaryWriter(ms);
bw.Write(first.ToInt32());
var bw = new BinaryWriter(ms);
bw.Write(first.ToInt32());
bw.Write(second.ToInt32());
bw.Flush();
ms.Position = 0;
@ -470,7 +470,7 @@ namespace BizHawk.Common
break;
#endregion
#region f - double number
case 'f': // double
case 'f': // double
o = GetDouble(n, fetcher());
w = FormatNumber( ( flagGroupThousands ? "n" : "f" ), flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
@ -480,7 +480,7 @@ namespace BizHawk.Common
break;
#endregion
#region e - exponent number
case 'e': // double / exponent
case 'e': // double / exponent
o = GetDouble(n, fetcher());
w = FormatNumber( "e", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,

View File

@ -1,81 +1,76 @@
using System;
using System.IO;
namespace BizHawk.Common
{
/// <summary>
/// Starts a thread which cleans any filenames in %temp% beginning with bizhawk.bizdelete.
/// Files shouldn't be named that unless they're safe to delete, but notably, they may stil be in use. That won't hurt this component.
/// When they're no longer in use, this component will then be able to delete them.
/// </summary>
public static class TempFileCleaner
{
//todo - manage paths other than %temp%, make not static, or allow adding multiple paths to static instance
public static string GetTempFilename(string friendlyname, string extension = null, bool delete = true)
{
string guidPart = Guid.NewGuid().ToString();
var fname = string.Format("biz-{0}-{1}-{2}{3}", System.Diagnostics.Process.GetCurrentProcess().Id, friendlyname, guidPart, extension ?? "");
if (delete) fname = RenameTempFilenameForDelete(fname);
return Path.Combine(Path.GetTempPath(), fname);
}
public static string RenameTempFilenameForDelete(string path)
{
string filename = Path.GetFileName(path);
string dir = Path.GetDirectoryName(path);
if (!filename.StartsWith("biz-")) throw new InvalidOperationException();
filename = "bizdelete-" + filename.Remove(0, 4);
return Path.Combine(dir, filename);
}
public static void Start()
{
lock (typeof(TempFileCleaner))
{
if (thread != null)
return;
thread = new System.Threading.Thread(ThreadProc);
thread.IsBackground = true;
thread.Priority = System.Threading.ThreadPriority.Lowest;
thread.Start();
}
}
static void ThreadProc()
{
var di = new DirectoryInfo(Path.GetTempPath());
for (; ; )
{
if (!System.Diagnostics.Debugger.IsAttached) //exceptions due to can't-delete are annoying. see this for another approach: http://www.codeproject.com/Articles/14402/Testing-File-Access-Rights-in-NET
{
var fis = di.GetFiles("bizdelete-*");
foreach (var fi in fis)
{
try
{
fi.Delete();
}
catch
{
}
//try not to do more than one thing per frame
System.Threading.Thread.Sleep(100);
}
}
//try not to slam the filesystem too hard, we dont want this to cause any hiccups
System.Threading.Thread.Sleep(5000);
}
}
public static void Stop()
{
}
static System.Threading.Thread thread;
}
}
using System;
using System.IO;
namespace BizHawk.Common
{
/// <summary>
/// Starts a thread which cleans any filenames in %temp% beginning with bizhawk.bizdelete.
/// Files shouldn't be named that unless they're safe to delete, but notably, they may stil be in use. That won't hurt this component.
/// When they're no longer in use, this component will then be able to delete them.
/// </summary>
public static class TempFileCleaner
{
//todo - manage paths other than %temp%, make not static, or allow adding multiple paths to static instance
public static string GetTempFilename(string friendlyname, string extension = null, bool delete = true)
{
string guidPart = Guid.NewGuid().ToString();
var fname = string.Format("biz-{0}-{1}-{2}{3}", System.Diagnostics.Process.GetCurrentProcess().Id, friendlyname, guidPart, extension ?? "");
if (delete) fname = RenameTempFilenameForDelete(fname);
return Path.Combine(Path.GetTempPath(), fname);
}
public static string RenameTempFilenameForDelete(string path)
{
string filename = Path.GetFileName(path);
string dir = Path.GetDirectoryName(path);
if (!filename.StartsWith("biz-")) throw new InvalidOperationException();
filename = "bizdelete-" + filename.Remove(0, 4);
return Path.Combine(dir, filename);
}
public static void Start()
{
lock (typeof(TempFileCleaner))
{
if (thread != null)
return;
thread = new System.Threading.Thread(ThreadProc);
thread.IsBackground = true;
thread.Priority = System.Threading.ThreadPriority.Lowest;
thread.Start();
}
}
static void ThreadProc()
{
var di = new DirectoryInfo(Path.GetTempPath());
for (; ; )
{
var fis = di.GetFiles("bizdelete-*");
foreach (var fi in fis)
{
try
{
fi.Delete();
}
catch
{
}
//try not to do more than one thing per frame
System.Threading.Thread.Sleep(100);
}
//try not to slam the filesystem too hard, we dont want this to cause any hiccups
System.Threading.Thread.Sleep(5000);
}
}
public static void Stop()
{
}
static System.Threading.Thread thread;
}

View File

@ -1,177 +1,178 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Common
{
public class CodeDataLog : Dictionary<string, byte[]>
{
public CodeDataLog()
{
}
/// <summary>
/// Pins the managed arrays. Not that we expect them to be allocated, but in case we do, seeing thish ere will remind us to check for the pin condition and abort
/// </summary>
public void Pin()
{
if (Pins.Count != 0)
throw new InvalidOperationException("incremental astrological examination");
foreach (var kvp in this)
Pins[kvp.Key] = GCHandle.Alloc(kvp.Value, GCHandleType.Pinned);
}
/// <summary>
/// Unpins the managed arrays, to be paired with calls to Pin()
/// </summary>
public void Unpin()
{
foreach (var pin in Pins.Values)
pin.Free();
Pins.Clear();
}
/// <summary>
/// Retrieves the pointer to a managed array
/// </summary>
public IntPtr GetPin(string key)
{
return Pins[key].AddrOfPinnedObject();
}
/// <summary>
/// Pinned managed arrays
/// </summary>
Dictionary<string, GCHandle> Pins = new Dictionary<string, GCHandle>();
/// <summary>
/// Whether the CDL is tracking a block with the given name
/// </summary>
public bool Has(string blockname) { return ContainsKey(blockname); }
/// <summary>
/// This is just a hook, if needed, to readily suspend logging, without having to rewire the core
/// </summary>
public bool Active = true;
public string SubType;
public int SubVer;
/// <summary>
/// Tests whether the other CodeDataLog is structurally identical
/// </summary>
public bool Check(CodeDataLog other)
{
if (SubType != other.SubType)
return false;
if (SubVer != other.SubVer)
return false;
if (this.Count != other.Count)
return false;
foreach (var kvp in this)
{
if (!other.ContainsKey(kvp.Key))
return false;
var oval = other[kvp.Key];
if (oval.Length != kvp.Value.Length)
return false;
}
return true;
}
public void LogicalOrFrom(CodeDataLog other)
{
if (this.Count != other.Count)
throw new InvalidDataException("Dictionaries must have the same number of keys!");
foreach (var kvp in other)
{
byte[] fromdata = kvp.Value;
byte[] todata = this[kvp.Key];
if (fromdata.Length != todata.Length)
throw new InvalidDataException("Memory regions must be the same size!");
for (int i = 0; i < todata.Length; i++)
todata[i] |= fromdata[i];
}
}
public void ClearData()
{
foreach (byte[] data in Values)
Array.Clear(data, 0, data.Length);
}
public void Save(Stream s)
{
_Save(s, true);
}
Dictionary<string, long> _Save(Stream s, bool forReal)
{
var ret = new Dictionary<string, long>();
var w = new BinaryWriter(s);
w.Write("BIZHAWK-CDL-2");
w.Write(SubType.PadRight(15));
w.Write(Count);
w.Flush();
long addr = s.Position;
if (forReal)
{
foreach (var kvp in this)
{
w.Write(kvp.Key);
w.Write(kvp.Value.Length);
w.Write(kvp.Value);
}
}
else
{
foreach (var kvp in this)
{
addr += kvp.Key.Length + 1; //assumes shortly-encoded key names
addr += 4;
ret[kvp.Key] = addr;
addr += kvp.Value.Length;
}
}
w.Flush();
return ret;
}
public Dictionary<string, long> GetBlockMap()
{
return _Save(new MemoryStream(), false);
}
public void Load(Stream s)
{
var br = new BinaryReader(s);
string id = br.ReadString();
if (id == "BIZHAWK-CDL-1")
SubType = "PCE";
else if (id == "BIZHAWK-CDL-2")
SubType = br.ReadString().TrimEnd(' ');
else
throw new InvalidDataException("File is not a Bizhawk CDL file!");
int count = br.ReadInt32();
for (int i = 0; i < count; i++)
{
string key = br.ReadString();
int len = br.ReadInt32();
byte[] data = br.ReadBytes(len);
this[key] = data;
}
}
}
}
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Common
{
public class CodeDataLog : Dictionary<string, byte[]>
{
public CodeDataLog()
{
}
/// <summary>
/// Pins the managed arrays. Not that we expect them to be allocated, but in case we do, seeing thish ere will remind us to check for the pin condition and abort
/// </summary>
public void Pin()
{
if (Pins.Count != 0)
throw new InvalidOperationException("incremental astrological examination");
foreach (var kvp in this)
Pins[kvp.Key] = GCHandle.Alloc(kvp.Value, GCHandleType.Pinned);
}
/// <summary>
/// Unpins the managed arrays, to be paired with calls to Pin()
/// </summary>
public void Unpin()
{
foreach (var pin in Pins.Values)
pin.Free();
Pins.Clear();
}
/// <summary>
/// Retrieves the pointer to a managed array
/// </summary>
public IntPtr GetPin(string key)
{
return Pins[key].AddrOfPinnedObject();
}
/// <summary>
/// Pinned managed arrays
/// </summary>
Dictionary<string, GCHandle> Pins = new Dictionary<string, GCHandle>();
/// <summary>
/// Whether the CDL is tracking a block with the given name
/// </summary>
public bool Has(string blockname) { return ContainsKey(blockname); }
/// <summary>
/// This is just a hook, if needed, to readily suspend logging, without having to rewire the core
/// </summary>
public bool Active = true;
public string SubType;
public int SubVer;
/// <summary>
/// Tests whether the other CodeDataLog is structurally identical
/// </summary>
public bool Check(CodeDataLog other)
{
if (SubType != other.SubType)
return false;
if (SubVer != other.SubVer)
return false;
if (this.Count != other.Count)
return false;
foreach (var kvp in this)
{
if (!other.ContainsKey(kvp.Key))
return false;
var oval = other[kvp.Key];
if (oval.Length != kvp.Value.Length)
return false;
}
return true;
}
public void LogicalOrFrom(CodeDataLog other)
{
if (this.Count != other.Count)
throw new InvalidDataException("Dictionaries must have the same number of keys!");
foreach (var kvp in other)
{
byte[] fromdata = kvp.Value;
byte[] todata = this[kvp.Key];
if (fromdata.Length != todata.Length)
throw new InvalidDataException("Memory regions must be the same size!");
for (int i = 0; i < todata.Length; i++)
todata[i] |= fromdata[i];
}
}
public void ClearData()
{
foreach (byte[] data in Values)
Array.Clear(data, 0, data.Length);
}
public void Save(Stream s)
{
_Save(s, true);
}
Dictionary<string, long> _Save(Stream s, bool forReal)
{
var ret = new Dictionary<string, long>();
var w = new BinaryWriter(s);
w.Write("BIZHAWK-CDL-2");
w.Write(SubType.PadRight(15));
w.Write(Count);
w.Flush();
long addr = s.Position;
if (forReal)
{
foreach (var kvp in this)
{
w.Write(kvp.Key);
w.Write(kvp.Value.Length);
w.Write(kvp.Value);
}
}
else
{
foreach (var kvp in this)
{
addr += kvp.Key.Length + 1; //assumes shortly-encoded key names
addr += 4;
ret[kvp.Key] = addr;
addr += kvp.Value.Length;
}
}
w.Flush();
return ret;
}
public Dictionary<string, long> GetBlockMap()
{
return _Save(new MemoryStream(), false);
}
public void Load(Stream s)
{
var br = new BinaryReader(s);
string id = br.ReadString();
if (id == "BIZHAWK-CDL-1")
SubType = "PCE";
else if (id == "BIZHAWK-CDL-2")
SubType = br.ReadString().TrimEnd(' ');
else
throw new InvalidDataException("File is not a Bizhawk CDL file!");
int count = br.ReadInt32();
for (int i = 0; i < count; i++)
{
string key = br.ReadString();
int len = br.ReadInt32();
byte[] data = br.ReadBytes(len);
this[key] = data;
}
}
}
}

View File

@ -3,21 +3,21 @@
namespace BizHawk.Emulation.Common
{
public interface ICodeDataLogger : IEmulatorService
{
/// <summary>
/// Sets the CodeDataLog as current (and logging) on the core
/// </summary>
void SetCDL(CodeDataLog cdl);
/// <summary>
/// Fills a new CodeDataLog with memory domain information suitable for the core
/// </summary>
void NewCDL(CodeDataLog cdl);
/// <summary>
/// Disassembles the CodeDataLog to an output Stream. Can't be done without a core because there's no code to disassemble otherwise!
/// This could be extended later to produce richer multi-file disassembly
/// </summary>
void DisassembleCDL(Stream s, CodeDataLog cdl);
{
/// <summary>
/// Sets the CodeDataLog as current (and logging) on the core
/// </summary>
void SetCDL(CodeDataLog cdl);
/// <summary>
/// Fills a new CodeDataLog with memory domain information suitable for the core
/// </summary>
void NewCDL(CodeDataLog cdl);
/// <summary>
/// Disassembles the CodeDataLog to an output Stream. Can't be done without a core because there's no code to disassemble otherwise!
/// This could be extended later to produce richer multi-file disassembly
/// </summary>
void DisassembleCDL(Stream s, CodeDataLog cdl);
}
}

View File

@ -1,200 +1,200 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Components.H6280
{
public partial class HuC6280
{
public void DisassembleCDL(Stream s, CodeDataLog cdl, IMemoryDomains mem)
{
var w = new StreamWriter(s);
w.WriteLine("; Bizhawk CDL Disassembly");
w.WriteLine();
foreach (var kvp in cdl)
{
w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length);
byte[] cd = kvp.Value;
var md = mem[kvp.Key];
for (int i = 0; i < kvp.Value.Length; i++)
{
if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0)
{
int unused;
string dis = HuC6280.DisassembleExt(
0,
out unused,
delegate(ushort addr)
{
return md.PeekByte(addr + i);
},
delegate(ushort addr)
{
return md.PeekWord(addr + i, false);
}
);
w.WriteLine("0x{0:x8}: {1}", i, dis);
}
}
w.WriteLine();
}
w.WriteLine("; EOF");
w.Flush();
}
private static Dictionary<string, int> SizesFromHuMap(IEnumerable<HuC6280.MemMapping> mm)
{
Dictionary<string, int> sizes = new Dictionary<string, int>();
foreach (var m in mm)
{
if (!sizes.ContainsKey(m.Name) || m.MaxOffs >= sizes[m.Name])
sizes[m.Name] = m.MaxOffs;
}
List<string> keys = new List<string>(sizes.Keys);
foreach (var key in keys)
{
// becase we were looking at offsets, and each bank is 8192 big, we need to add that size
sizes[key] += 8192;
}
return sizes;
}
}
public partial class HuC6280
{
public struct MemMapping
{
public string Name;
public int Offs;
public int VOffs; // if non-zero, specifies a larger potential offset
public int MaxOffs { get { return Math.Max(Offs, VOffs); } }
}
public MemMapping[] Mappings; // = new MemMapping[256];
public CodeDataLog CDL = null;
[Flags]
public enum CDLUsage : byte
{
// was fetched as an opcode first byte
Code = 0x01,
// was read or written as data
Data = 0x02,
// was read and used as a pointer to data via indirect addressing
DataPtr = 0x04,
// was read or written as stack
Stack = 0x08,
// was read or written as data via indirect addressing
IndirectData = 0x10,
// was read and used as function pointer
// NB: there is no "IndirectCode"; all code is marked simply as code regardless of how it is reached
FcnPtr = 0x20,
// was used as a source or destination (either initial or during the loop) of a block xfer
BlockXFer = 0x40,
// was fetched as an operand byte to an opcode
CodeOperand = 0x80
}
void Mark(ushort addr, CDLUsage flag)
{
var m = Mappings[MPR[addr >> 13]];
CDL[m.Name][addr & 0x1fff | m.Offs] |= (byte)flag;
}
// mark addr as having been fetched for execute
void MarkCode(int addr_, int n)
{
for (int i = 0; i < n; i++)
{
ushort addr = (ushort)(addr_ + i);
Mark(addr, i == 0 ? CDLUsage.Code : CDLUsage.CodeOperand);
}
}
// mark addr as having been seen as data
void MarkAddr(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.Data);
}
// convert address to zero-page, then mark as data
void MarkZP(int addr_)
{
ushort addr = (ushort)(addr_ & 0xff | 0x2000);
Mark(addr, CDLUsage.Data);
}
// convert address to zero-page, then return the pointer stored there
ushort GetIndirect(int addr_)
{
ushort addr = (ushort)(addr_ & 0xff | 0x2000);
return ReadWordPageWrap(addr);
}
// convert address to zero-page, then mark as pointer (two bytes)
void MarkZPPtr(int addr_)
{
ushort addr = (ushort)(addr_ & 0xff | 0x2000);
ushort addr2 = (ushort)(addr & 0xff00 | (addr + 1) & 0x00ff);
Mark(addr, CDLUsage.DataPtr);
Mark(addr2, CDLUsage.DataPtr);
}
// mark address as destination data of an indirect pointer
void MarkIndirect(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.IndirectData);
}
// mark stack space
void MarkPush(int n)
{
for (int i = 0; i < n; i++)
{
ushort addr = (ushort)(S - i);
Mark(addr, CDLUsage.Stack);
}
}
void MarkPop(int n)
{
for (int i = 0; i < n; i++)
{
ushort addr = (ushort)(S + i + 1);
Mark(addr, CDLUsage.Stack);
}
}
// mark addr as function pointer (2 bytes)
void MarkFptr(int addr_)
{
ushort addr = (ushort)addr_;
ushort addr2 = (ushort)(addr & 0xff00 | (addr + 1) & 0x00ff);
Mark(addr, CDLUsage.FcnPtr);
Mark(addr2, CDLUsage.FcnPtr);
}
// block transfer "from"
void MarkBTFrom(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.BlockXFer);
}
// block transfer "to"
void MarkBTTo(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.BlockXFer);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Components.H6280
{
public partial class HuC6280
{
public void DisassembleCDL(Stream s, CodeDataLog cdl, IMemoryDomains mem)
{
var w = new StreamWriter(s);
w.WriteLine("; Bizhawk CDL Disassembly");
w.WriteLine();
foreach (var kvp in cdl)
{
w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length);
byte[] cd = kvp.Value;
var md = mem[kvp.Key];
for (int i = 0; i < kvp.Value.Length; i++)
{
if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0)
{
int unused;
string dis = HuC6280.DisassembleExt(
0,
out unused,
delegate(ushort addr)
{
return md.PeekByte(addr + i);
},
delegate(ushort addr)
{
return md.PeekWord(addr + i, false);
}
);
w.WriteLine("0x{0:x8}: {1}", i, dis);
}
}
w.WriteLine();
}
w.WriteLine("; EOF");
w.Flush();
}
private static Dictionary<string, int> SizesFromHuMap(IEnumerable<HuC6280.MemMapping> mm)
{
Dictionary<string, int> sizes = new Dictionary<string, int>();
foreach (var m in mm)
{
if (!sizes.ContainsKey(m.Name) || m.MaxOffs >= sizes[m.Name])
sizes[m.Name] = m.MaxOffs;
}
List<string> keys = new List<string>(sizes.Keys);
foreach (var key in keys)
{
// becase we were looking at offsets, and each bank is 8192 big, we need to add that size
sizes[key] += 8192;
}
return sizes;
}
}
public partial class HuC6280
{
public struct MemMapping
{
public string Name;
public int Offs;
public int VOffs; // if non-zero, specifies a larger potential offset
public int MaxOffs { get { return Math.Max(Offs, VOffs); } }
}
public MemMapping[] Mappings; // = new MemMapping[256];
public CodeDataLog CDL = null;
[Flags]
public enum CDLUsage : byte
{
// was fetched as an opcode first byte
Code = 0x01,
// was read or written as data
Data = 0x02,
// was read and used as a pointer to data via indirect addressing
DataPtr = 0x04,
// was read or written as stack
Stack = 0x08,
// was read or written as data via indirect addressing
IndirectData = 0x10,
// was read and used as function pointer
// NB: there is no "IndirectCode"; all code is marked simply as code regardless of how it is reached
FcnPtr = 0x20,
// was used as a source or destination (either initial or during the loop) of a block xfer
BlockXFer = 0x40,
// was fetched as an operand byte to an opcode
CodeOperand = 0x80
}
void Mark(ushort addr, CDLUsage flag)
{
var m = Mappings[MPR[addr >> 13]];
CDL[m.Name][addr & 0x1fff | m.Offs] |= (byte)flag;
}
// mark addr as having been fetched for execute
void MarkCode(int addr_, int n)
{
for (int i = 0; i < n; i++)
{
ushort addr = (ushort)(addr_ + i);
Mark(addr, i == 0 ? CDLUsage.Code : CDLUsage.CodeOperand);
}
}
// mark addr as having been seen as data
void MarkAddr(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.Data);
}
// convert address to zero-page, then mark as data
void MarkZP(int addr_)
{
ushort addr = (ushort)(addr_ & 0xff | 0x2000);
Mark(addr, CDLUsage.Data);
}
// convert address to zero-page, then return the pointer stored there
ushort GetIndirect(int addr_)
{
ushort addr = (ushort)(addr_ & 0xff | 0x2000);
return ReadWordPageWrap(addr);
}
// convert address to zero-page, then mark as pointer (two bytes)
void MarkZPPtr(int addr_)
{
ushort addr = (ushort)(addr_ & 0xff | 0x2000);
ushort addr2 = (ushort)(addr & 0xff00 | (addr + 1) & 0x00ff);
Mark(addr, CDLUsage.DataPtr);
Mark(addr2, CDLUsage.DataPtr);
}
// mark address as destination data of an indirect pointer
void MarkIndirect(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.IndirectData);
}
// mark stack space
void MarkPush(int n)
{
for (int i = 0; i < n; i++)
{
ushort addr = (ushort)(S - i);
Mark(addr, CDLUsage.Stack);
}
}
void MarkPop(int n)
{
for (int i = 0; i < n; i++)
{
ushort addr = (ushort)(S + i + 1);
Mark(addr, CDLUsage.Stack);
}
}
// mark addr as function pointer (2 bytes)
void MarkFptr(int addr_)
{
ushort addr = (ushort)addr_;
ushort addr2 = (ushort)(addr & 0xff00 | (addr + 1) & 0x00ff);
Mark(addr, CDLUsage.FcnPtr);
Mark(addr2, CDLUsage.FcnPtr);
}
// block transfer "from"
void MarkBTFrom(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.BlockXFer);
}
// block transfer "to"
void MarkBTTo(int addr_)
{
ushort addr = (ushort)addr_;
Mark(addr, CDLUsage.BlockXFer);
}
}
}

View File

@ -1,56 +1,56 @@
using System;
using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
partial class Gameboy
{
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
CDL = cdl;
if(cdl == null)
LibGambatte.gambatte_setcdcallback(GambatteState, null);
else
LibGambatte.gambatte_setcdcallback(GambatteState, CDCallback);
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
//cdl["HRAM"] = new byte[_memoryDomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
cdl["WRAM"] = new byte[MemoryDomains["WRAM"].Size];
if (MemoryDomains.Has("CartRAM"))
cdl["CartRAM"] = new byte[MemoryDomains["WRAM"].Size];
cdl.SubType = "GB";
cdl.SubVer = 0;
}
//not supported
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { }
CodeDataLog CDL;
LibGambatte.CDCallback CDCallback;
void CDCallbackProc(int addr, LibGambatte.CDLog_AddrType addrtype, LibGambatte.CDLog_Flags flags)
{
if (CDL == null) return;
if (!CDL.Active) return;
string key;
switch (addrtype)
{
case LibGambatte.CDLog_AddrType.ROM: key = "ROM"; break;
case LibGambatte.CDLog_AddrType.HRAM: key = "HRAM"; break;
case LibGambatte.CDLog_AddrType.WRAM: key = "WRAM"; break;
case LibGambatte.CDLog_AddrType.CartRAM: key = "CartRAM"; break;
default: throw new InvalidOperationException("Juniper lightbulb proxy");
}
CDL[key][addr] |= (byte)flags;
}
}
using System;
using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
partial class Gameboy
{
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
CDL = cdl;
if(cdl == null)
LibGambatte.gambatte_setcdcallback(GambatteState, null);
else
LibGambatte.gambatte_setcdcallback(GambatteState, CDCallback);
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
//cdl["HRAM"] = new byte[_memoryDomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
cdl["WRAM"] = new byte[MemoryDomains["WRAM"].Size];
if (MemoryDomains.Has("CartRAM"))
cdl["CartRAM"] = new byte[MemoryDomains["WRAM"].Size];
cdl.SubType = "GB";
cdl.SubVer = 0;
}
//not supported
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { }
CodeDataLog CDL;
LibGambatte.CDCallback CDCallback;
void CDCallbackProc(int addr, LibGambatte.CDLog_AddrType addrtype, LibGambatte.CDLog_Flags flags)
{
if (CDL == null) return;
if (!CDL.Active) return;
string key;
switch (addrtype)
{
case LibGambatte.CDLog_AddrType.ROM: key = "ROM"; break;
case LibGambatte.CDLog_AddrType.HRAM: key = "HRAM"; break;
case LibGambatte.CDLog_AddrType.WRAM: key = "WRAM"; break;
case LibGambatte.CDLog_AddrType.CartRAM: key = "CartRAM"; break;
default: throw new InvalidOperationException("Juniper lightbulb proxy");
}
CDL[key][addr] |= (byte)flags;
}
}
}

View File

@ -1,107 +1,107 @@
using System;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
partial class SMS
{
enum CDLog_AddrType
{
None,
ROM,
MainRAM,
SaveRAM,
CartRAM, //"Cart (Volatile) RAM" aka ExtRam
}
[Flags]
public enum CDLog_Flags
{
ExecFirst = 0x01,
ExecOperand = 0x02,
Data = 0x04
};
struct CDLog_MapResults
{
public CDLog_AddrType Type;
public int Address;
}
delegate CDLog_MapResults MapMemoryDelegate(ushort addr, bool write);
MapMemoryDelegate MapMemory;
void RunCDL(ushort address, CDLog_Flags flags)
{
if (MapMemory != null)
{
CDLog_MapResults results = MapMemory(address, false);
switch (results.Type)
{
case CDLog_AddrType.None: break;
case CDLog_AddrType.ROM: CDL["ROM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.MainRAM: CDL["Main RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.SaveRAM: CDL["Save RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.CartRAM: CDL["Cart (Volatile) RAM"][results.Address] |= (byte)flags; break;
}
}
}
/// <summary>
/// A wrapper for FetchMemory which inserts CDL logic
/// </summary>
public byte FetchMemory_CDL(ushort address, bool first)
{
RunCDL(address, first ? CDLog_Flags.ExecFirst : CDLog_Flags.ExecOperand);
return ReadMemory(address);
}
/// <summary>
/// A wrapper for ReadMemory which inserts CDL logic
/// </summary>
public byte ReadMemory_CDL(ushort address)
{
RunCDL(address, CDLog_Flags.Data);
return ReadMemory(address);
}
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
CDL = cdl;
if (cdl == null)
{
Cpu.ReadMemory = ReadMemory;
Cpu.WriteMemory = WriteMemory;
Cpu.FetchMemory = FetchMemory_StubThunk;
}
else
{
Cpu.ReadMemory = ReadMemory_CDL;
Cpu.WriteMemory = WriteMemory;
Cpu.FetchMemory = FetchMemory_CDL;
}
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
cdl["ROM"] = new byte[memoryDomains["ROM"].Size];
cdl["Main RAM"] = new byte[memoryDomains["Main RAM"].Size];
if (memoryDomains.Has("Save RAM"))
cdl["Save RAM"] = new byte[memoryDomains["Save RAM"].Size];
if (memoryDomains.Has("Cart (Volatile) RAM"))
cdl["Cart (Volatile) RAM"] = new byte[memoryDomains["Cart (Volatile) RAM"].Size];
cdl.SubType = "SMS";
cdl.SubVer = 0;
}
//not supported
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { }
CodeDataLog CDL;
}
using System;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
partial class SMS
{
enum CDLog_AddrType
{
None,
ROM,
MainRAM,
SaveRAM,
CartRAM, //"Cart (Volatile) RAM" aka ExtRam
}
[Flags]
public enum CDLog_Flags
{
ExecFirst = 0x01,
ExecOperand = 0x02,
Data = 0x04
};
struct CDLog_MapResults
{
public CDLog_AddrType Type;
public int Address;
}
delegate CDLog_MapResults MapMemoryDelegate(ushort addr, bool write);
MapMemoryDelegate MapMemory;
void RunCDL(ushort address, CDLog_Flags flags)
{
if (MapMemory != null)
{
CDLog_MapResults results = MapMemory(address, false);
switch (results.Type)
{
case CDLog_AddrType.None: break;
case CDLog_AddrType.ROM: CDL["ROM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.MainRAM: CDL["Main RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.SaveRAM: CDL["Save RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.CartRAM: CDL["Cart (Volatile) RAM"][results.Address] |= (byte)flags; break;
}
}
}
/// <summary>
/// A wrapper for FetchMemory which inserts CDL logic
/// </summary>
public byte FetchMemory_CDL(ushort address, bool first)
{
RunCDL(address, first ? CDLog_Flags.ExecFirst : CDLog_Flags.ExecOperand);
return ReadMemory(address);
}
/// <summary>
/// A wrapper for ReadMemory which inserts CDL logic
/// </summary>
public byte ReadMemory_CDL(ushort address)
{
RunCDL(address, CDLog_Flags.Data);
return ReadMemory(address);
}
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
CDL = cdl;
if (cdl == null)
{
Cpu.ReadMemory = ReadMemory;
Cpu.WriteMemory = WriteMemory;
Cpu.FetchMemory = FetchMemory_StubThunk;
}
else
{
Cpu.ReadMemory = ReadMemory_CDL;
Cpu.WriteMemory = WriteMemory;
Cpu.FetchMemory = FetchMemory_CDL;
}
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
cdl["ROM"] = new byte[memoryDomains["ROM"].Size];
cdl["Main RAM"] = new byte[memoryDomains["Main RAM"].Size];
if (memoryDomains.Has("Save RAM"))
cdl["Save RAM"] = new byte[memoryDomains["Save RAM"].Size];
if (memoryDomains.Has("Cart (Volatile) RAM"))
cdl["Cart (Volatile) RAM"] = new byte[memoryDomains["Cart (Volatile) RAM"].Size];
cdl.SubType = "SMS";
cdl.SubVer = 0;
}
//not supported
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { }
CodeDataLog CDL;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -235,4 +235,4 @@ Global
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = BizHawk.Client.EmuHawk\BizHawk.Client.EmuHawk.csproj
EndGlobalSection
EndGlobal
EndGlobal

View File

@ -9,4 +9,4 @@ static class VersionInfo
{
return DeveloperBuild ? ("GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH) : ("Version " + MAINVERSION);
}
}
}

View File

@ -30,17 +30,17 @@ enum { BG_PALETTE = 0, SP1_PALETTE = 1, SP2_PALETTE = 2 };
typedef void (*CDCallback)(int32_t addr, int32_t addrtype, int32_t flags);
enum eCDLog_AddrType
{
eCDLog_AddrType_ROM, eCDLog_AddrType_HRAM, eCDLog_AddrType_WRAM, eCDLog_AddrType_CartRAM,
eCDLog_AddrType_None
};
enum eCDLog_Flags
{
eCDLog_Flags_ExecFirst = 1,
eCDLog_Flags_ExecOperand = 2,
eCDLog_Flags_Data = 4,
enum eCDLog_AddrType
{
eCDLog_AddrType_ROM, eCDLog_AddrType_HRAM, eCDLog_AddrType_WRAM, eCDLog_AddrType_CartRAM,
eCDLog_AddrType_None
};
enum eCDLog_Flags
{
eCDLog_Flags_ExecFirst = 1,
eCDLog_Flags_ExecOperand = 2,
eCDLog_Flags_Data = 4,
};
class GB {

View File

@ -1,32 +1,32 @@
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
};
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float2 tex : TEXCOORD,
uniform input IN,
out float2 oTexcoord : TEXCOORD
)
{
oPosition = mul(modelViewProj, position);
oTexcoord = tex;
}
uniform float uIntensity;
float4 main_fragment (in float2 texcoord : TEXCOORD, in float2 wpos : WPOS, uniform sampler2D s_p : TEXUNIT0) : COLOR
{
float4 temp = tex2D(s_p,texcoord);
if(floor(wpos.y/2) != floor(wpos.y)/2) temp.rgb *= uIntensity;
return temp;
}
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
};
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float2 tex : TEXCOORD,
uniform input IN,
out float2 oTexcoord : TEXCOORD
)
{
oPosition = mul(modelViewProj, position);
oTexcoord = tex;
}
uniform float uIntensity;
float4 main_fragment (in float2 texcoord : TEXCOORD, in float2 wpos : WPOS, uniform sampler2D s_p : TEXUNIT0) : COLOR
{
float4 temp = tex2D(s_p,texcoord);
if(floor(wpos.y/2) != floor(wpos.y)/2) temp.rgb *= uIntensity;
return temp;
}