actually delete things instead of removing them from the project

This commit is contained in:
adelikat 2020-02-08 13:09:27 -06:00
parent 5b7b65724a
commit d7f97b1539
40 changed files with 0 additions and 11116 deletions

View File

@ -19,9 +19,5 @@
<ItemGroup>
<ProjectReference Include="$(SolutionDir)BizHawk.Client.Common/BizHawk.Client.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Classes/Api/PluginBase.cs" />
<Compile Remove="Interfaces/IPlugin.cs" />
</ItemGroup>
<Import Project="$(SolutionDir)NamespaceAliasHack.targets" />
</Project>

View File

@ -1,51 +0,0 @@
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.ApiHawk
{
public abstract class PluginBase : IPlugin
{
/// <summary>
/// The base class from which all
/// plugins will be derived
///
/// Actual plugins should implement
/// one of the below callback methods
/// or register memory callbacks in
/// their Init function.
/// </summary>
protected IApiContainer _api;
public PluginBase() { }
public abstract string Name { get; }
public abstract string Description { get; }
public bool Enabled => Running;
public bool Paused => !Running;
public bool Running { get; set; }
public void Stop()
{
Running = false;
}
public void Toggle()
{
Running = !Running;
}
public virtual void PreFrameCallback() { }
public virtual void PostFrameCallback() { }
public virtual void SaveStateCallback(string name) { }
public virtual void LoadStateCallback(string name) { }
public virtual void InputPollCallback() { }
public virtual void ExitCallback() { }
public virtual void Init (IApiContainer api)
{
_api = api;
Running = true;
}
}
}

View File

@ -1,14 +0,0 @@
using BizHawk.Client.Common;
namespace BizHawk.Client.ApiHawk
{
interface IPlugin
{
void PreFrameCallback();
void PostFrameCallback();
void SaveStateCallback(string name);
void LoadStateCallback(string name);
void InputPollCallback();
void Init(IApiContainer api);
}
}

View File

@ -38,10 +38,6 @@
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
</ItemGroup>
<ItemGroup>
<Compile Remove="lua/LuaExamples.cs" />
<Compile Remove="SharpZipWriter.cs" />
</ItemGroup>
<ItemGroup>
<Compile Update="movie/bk2/Bk2Movie.HeaderApi.cs" DependentUpon="Bk2Movie.cs" />
<Compile Update="movie/bk2/Bk2Movie.InputLog.cs" DependentUpon="Bk2Movie.cs" />

View File

@ -1,45 +0,0 @@
using System;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
namespace BizHawk.Client.Common
{
public class SharpZipWriter : IZipWriter
{
private readonly int _level;
private ZipOutputStream _zipOutputStream;
public SharpZipWriter(string path, int compressionlevel)
{
_level = compressionlevel;
_zipOutputStream = new ZipOutputStream(new FileStream(path, FileMode.Create, FileAccess.Write))
{
IsStreamOwner = true,
UseZip64 = UseZip64.Off
};
_zipOutputStream.SetLevel(_level);
}
public void WriteItem(string name, Action<Stream> callback)
{
var e = new ZipEntry(name)
{
CompressionMethod = _level == 0 ? CompressionMethod.Stored : CompressionMethod.Deflated
};
_zipOutputStream.PutNextEntry(e);
callback(_zipOutputStream);
_zipOutputStream.CloseEntry();
}
public void Dispose()
{
if (_zipOutputStream != null)
{
_zipOutputStream.Dispose();
_zipOutputStream = null;
}
}
}
}

View File

@ -1,28 +0,0 @@
using System;
namespace BizHawk.Client.Common
{
[AttributeUsage(AttributeTargets.Method)]
public class LuaMethodExample : Attribute
{
public LuaMethodExample(string name, string example)
{
Name = name;
Example = example;
}
public string Name { get; }
public string Example { get; }
}
[AttributeUsage(AttributeTargets.Class)]
public class LuaLibraryExample : Attribute
{
public LuaLibraryExample(bool released)
{
Released = released;
}
public bool Released { get; }
}
}

View File

@ -94,14 +94,8 @@
<Compile Include="**/*.cs" />
<Compile Include="$(SolutionDir)Version/svnrev.cs" Link="svnrev.cs" />
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" Link="VersionInfo.cs" />
<Compile Remove="DiscoHawkDialog.cs" />
<Compile Remove="DiscoHawkDialog.Designer.cs" />
<Compile Remove="ProgressDialog.cs" />
<Compile Remove="ProgressDialog.Designer.cs" />
<Content Include="discohawk.ico" />
<EmbeddedResource Include="**/*.resx" />
<EmbeddedResource Remove="DiscoHawkDialog.resx" />
<EmbeddedResource Remove="ProgressDialog.resx" />
<None Include="app.config" />
</ItemGroup>
<ItemGroup>

View File

@ -1,481 +0,0 @@
namespace BizHawk.Client.DiscoHawk
{
partial class DiscoHawkDialog
{
/// <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(DiscoHawkDialog));
this.btnAddDisc = new System.Windows.Forms.Button();
this.lvDiscs = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblSize = new System.Windows.Forms.Label();
this.lblTracks = new System.Windows.Forms.Label();
this.lblSessions = new System.Windows.Forms.Label();
this.lblSectors = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.txtCuePreview = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.checkCueProp_OneBlobPerTrack = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.label7 = new System.Windows.Forms.Label();
this.checkCueProp_Annotations = new System.Windows.Forms.CheckBox();
this.panel3 = new System.Windows.Forms.Panel();
this.btnPresetCanonical = new System.Windows.Forms.Button();
this.btnPresetDaemonTools = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label9 = new System.Windows.Forms.Label();
this.treeView1 = new System.Windows.Forms.TreeView();
this.label10 = new System.Windows.Forms.Label();
this.btnExportCue = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.lblMagicDragArea = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// btnAddDisc
//
this.btnAddDisc.Location = new System.Drawing.Point(12, 46);
this.btnAddDisc.Name = "btnAddDisc";
this.btnAddDisc.Size = new System.Drawing.Size(75, 23);
this.btnAddDisc.TabIndex = 0;
this.btnAddDisc.Text = "Add Disc";
this.btnAddDisc.UseVisualStyleBackColor = true;
this.btnAddDisc.Click += new System.EventHandler(this.btnAddDisc_Click);
//
// lvDiscs
//
this.lvDiscs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.lvDiscs.GridLines = true;
this.lvDiscs.HideSelection = false;
this.lvDiscs.Location = new System.Drawing.Point(12, 80);
this.lvDiscs.Name = "lvDiscs";
this.lvDiscs.Size = new System.Drawing.Size(248, 165);
this.lvDiscs.TabIndex = 1;
this.lvDiscs.UseCompatibleStateImageBehavior = false;
this.lvDiscs.View = System.Windows.Forms.View.Details;
this.lvDiscs.SelectedIndexChanged += new System.EventHandler(this.lvDiscs_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Text = "Name";
this.columnHeader1.Width = 240;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
this.groupBox1.Location = new System.Drawing.Point(21, 251);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.groupBox1.Size = new System.Drawing.Size(203, 107);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Quick Info";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.lblSize, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblTracks, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.lblSessions, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.lblSectors, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 19);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
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(184, 79);
this.tableLayoutPanel1.TabIndex = 3;
//
// lblSize
//
this.lblSize.AutoSize = true;
this.lblSize.Location = new System.Drawing.Point(61, 39);
this.lblSize.Name = "lblSize";
this.lblSize.Size = new System.Drawing.Size(30, 13);
this.lblSize.TabIndex = 7;
this.lblSize.Text = "Size:";
//
// lblTracks
//
this.lblTracks.AutoSize = true;
this.lblTracks.Location = new System.Drawing.Point(61, 13);
this.lblTracks.Name = "lblTracks";
this.lblTracks.Size = new System.Drawing.Size(30, 13);
this.lblTracks.TabIndex = 6;
this.lblTracks.Text = "Size:";
//
// lblSessions
//
this.lblSessions.AutoSize = true;
this.lblSessions.Location = new System.Drawing.Point(61, 0);
this.lblSessions.Name = "lblSessions";
this.lblSessions.Size = new System.Drawing.Size(30, 13);
this.lblSessions.TabIndex = 5;
this.lblSessions.Text = "Size:";
//
// lblSectors
//
this.lblSectors.AutoSize = true;
this.lblSectors.Location = new System.Drawing.Point(61, 26);
this.lblSectors.Name = "lblSectors";
this.lblSectors.Size = new System.Drawing.Size(30, 13);
this.lblSectors.TabIndex = 4;
this.lblSectors.Text = "Size:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(52, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Sessions:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 26);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(46, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Sectors:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(43, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Tracks:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 39);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(30, 13);
this.label4.TabIndex = 3;
this.label4.Text = "Size:";
//
// txtCuePreview
//
this.txtCuePreview.Font = new System.Drawing.Font("Courier New", 8F);
this.txtCuePreview.Location = new System.Drawing.Point(284, 25);
this.txtCuePreview.Multiline = true;
this.txtCuePreview.Name = "txtCuePreview";
this.txtCuePreview.ReadOnly = true;
this.txtCuePreview.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtCuePreview.Size = new System.Drawing.Size(375, 571);
this.txtCuePreview.TabIndex = 3;
this.txtCuePreview.WordWrap = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(281, 6);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(102, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Output Cue Preview";
//
// checkCueProp_OneBlobPerTrack
//
this.checkCueProp_OneBlobPerTrack.AutoSize = true;
this.checkCueProp_OneBlobPerTrack.Location = new System.Drawing.Point(7, 6);
this.checkCueProp_OneBlobPerTrack.Name = "checkCueProp_OneBlobPerTrack";
this.checkCueProp_OneBlobPerTrack.Size = new System.Drawing.Size(111, 17);
this.checkCueProp_OneBlobPerTrack.TabIndex = 5;
this.checkCueProp_OneBlobPerTrack.Text = "OneBlobPerTrack";
this.checkCueProp_OneBlobPerTrack.UseVisualStyleBackColor = true;
this.checkCueProp_OneBlobPerTrack.CheckedChanged += new System.EventHandler(this.checkCueProp_CheckedChanged);
//
// label6
//
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(4, 26);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(196, 42);
this.label6.TabIndex = 6;
this.label6.Text = "Should the output be split into several blobs, or just use one?";
//
// panel1
//
this.panel1.AutoSize = true;
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.checkCueProp_OneBlobPerTrack);
this.panel1.Location = new System.Drawing.Point(15, 19);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(203, 68);
this.panel1.TabIndex = 9;
//
// panel2
//
this.panel2.AutoSize = true;
this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.checkCueProp_Annotations);
this.panel2.Location = new System.Drawing.Point(224, 19);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(154, 68);
this.panel2.TabIndex = 10;
//
// label7
//
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(4, 26);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(147, 42);
this.label7.TabIndex = 6;
this.label7.Text = "Annotate cue with non-standard comments";
//
// checkCueProp_Annotations
//
this.checkCueProp_Annotations.AutoSize = true;
this.checkCueProp_Annotations.Location = new System.Drawing.Point(7, 6);
this.checkCueProp_Annotations.Name = "checkCueProp_Annotations";
this.checkCueProp_Annotations.Size = new System.Drawing.Size(82, 17);
this.checkCueProp_Annotations.TabIndex = 5;
this.checkCueProp_Annotations.Text = "Annotations";
this.checkCueProp_Annotations.UseVisualStyleBackColor = true;
this.checkCueProp_Annotations.CheckedChanged += new System.EventHandler(this.checkCueProp_CheckedChanged);
//
// panel3
//
this.panel3.AutoSize = true;
this.panel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel3.Location = new System.Drawing.Point(15, 94);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(0, 0);
this.panel3.TabIndex = 10;
//
// btnPresetCanonical
//
this.btnPresetCanonical.Location = new System.Drawing.Point(720, 210);
this.btnPresetCanonical.Name = "btnPresetCanonical";
this.btnPresetCanonical.Size = new System.Drawing.Size(114, 23);
this.btnPresetCanonical.TabIndex = 11;
this.btnPresetCanonical.Text = "BizHawk Canonical";
this.btnPresetCanonical.UseVisualStyleBackColor = true;
this.btnPresetCanonical.Click += new System.EventHandler(this.btnPresetCanonical_Click);
//
// btnPresetDaemonTools
//
this.btnPresetDaemonTools.Location = new System.Drawing.Point(840, 210);
this.btnPresetDaemonTools.Name = "btnPresetDaemonTools";
this.btnPresetDaemonTools.Size = new System.Drawing.Size(115, 23);
this.btnPresetDaemonTools.TabIndex = 12;
this.btnPresetDaemonTools.Text = "Daemon Tools";
this.btnPresetDaemonTools.UseVisualStyleBackColor = true;
this.btnPresetDaemonTools.Click += new System.EventHandler(this.btnPresetDaemonTools_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.panel1);
this.groupBox2.Controls.Add(this.panel2);
this.groupBox2.Controls.Add(this.panel3);
this.groupBox2.Location = new System.Drawing.Point(665, 25);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(394, 179);
this.groupBox2.TabIndex = 13;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Cue Export Properties";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(672, 214);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(42, 13);
this.label9.TabIndex = 14;
this.label9.Text = "Presets";
//
// treeView1
//
this.treeView1.Location = new System.Drawing.Point(12, 384);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(239, 225);
this.treeView1.TabIndex = 15;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(18, 364);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(137, 13);
this.label10.TabIndex = 16;
this.label10.Text = "tree/list like isobuster (TBD)";
//
// btnExportCue
//
this.btnExportCue.Location = new System.Drawing.Point(665, 335);
this.btnExportCue.Name = "btnExportCue";
this.btnExportCue.Size = new System.Drawing.Size(101, 23);
this.btnExportCue.TabIndex = 17;
this.btnExportCue.Text = "Export Cue+XXX";
this.btnExportCue.UseVisualStyleBackColor = true;
this.btnExportCue.Click += new System.EventHandler(this.btnExportCue_Click);
//
// label11
//
this.label11.Location = new System.Drawing.Point(677, 251);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(297, 81);
this.label11.TabIndex = 18;
this.label11.Text = resources.GetString("label11.Text");
//
// label12
//
this.label12.Location = new System.Drawing.Point(93, 5);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(167, 67);
this.label12.TabIndex = 19;
this.label12.Text = "Why is this a list? Not sure. I thought we might want to make multi-disc archive" +
" format of our own one day. Also disc hopper demo";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(21, 620);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(522, 13);
this.label13.TabIndex = 20;
this.label13.Text = "Wouldnt it be cool if you could edit the disc by deleting and moving and adding t" +
"racks and such .. yeahhhhhh";
//
// lblMagicDragArea
//
this.lblMagicDragArea.AllowDrop = true;
this.lblMagicDragArea.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblMagicDragArea.Location = new System.Drawing.Point(665, 384);
this.lblMagicDragArea.Name = "lblMagicDragArea";
this.lblMagicDragArea.Size = new System.Drawing.Size(147, 70);
this.lblMagicDragArea.TabIndex = 21;
this.lblMagicDragArea.Text = "Drag a cue into the DRAG HERE FOR MAGIC area for magic";
this.lblMagicDragArea.Click += new System.EventHandler(this.lblMagicDragArea_Click);
this.lblMagicDragArea.DragDrop += new System.Windows.Forms.DragEventHandler(this.handleDragDrop);
this.lblMagicDragArea.DragEnter += new System.Windows.Forms.DragEventHandler(this.handleDragEnter);
//
// DiscoHawkDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1151, 645);
this.Controls.Add(this.lblMagicDragArea);
this.Controls.Add(this.label13);
this.Controls.Add(this.label12);
this.Controls.Add(this.label11);
this.Controls.Add(this.btnExportCue);
this.Controls.Add(this.label10);
this.Controls.Add(this.treeView1);
this.Controls.Add(this.label9);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.btnPresetDaemonTools);
this.Controls.Add(this.btnPresetCanonical);
this.Controls.Add(this.label5);
this.Controls.Add(this.txtCuePreview);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.lvDiscs);
this.Controls.Add(this.btnAddDisc);
this.Name = "DiscoHawkDialog";
this.Text = "DiscoHawkDialog";
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnAddDisc;
private System.Windows.Forms.ListView lvDiscs;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblSectors;
private System.Windows.Forms.Label lblSize;
private System.Windows.Forms.Label lblTracks;
private System.Windows.Forms.Label lblSessions;
private System.Windows.Forms.TextBox txtCuePreview;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.CheckBox checkCueProp_OneBlobPerTrack;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.CheckBox checkCueProp_Annotations;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button btnPresetCanonical;
private System.Windows.Forms.Button btnPresetDaemonTools;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button btnExportCue;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label lblMagicDragArea;
}
}

View File

@ -1,224 +0,0 @@
using System;
using System.Threading;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.DiscSystem;
namespace BizHawk.Client.DiscoHawk
{
public partial class DiscoHawkDialog : Form
{
public DiscoHawkDialog()
{
InitializeComponent();
PresetCanonical();
}
private class DiscRecord
{
public Disc Disc;
public string BaseName;
}
private void btnAddDisc_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "CUE files (*.cue)|*.cue|ISO files (*.iso)|*.iso";
ofd.CheckFileExists = true;
ofd.CheckPathExists = true;
ofd.Multiselect = false;
if (ofd.ShowDialog() != DialogResult.OK)
return;
Disc disc = Disc.FromCuePath(ofd.FileName, new CueBinPrefs());
string baseName = Path.GetFileName(ofd.FileName);
ListViewItem lvi = new ListViewItem(baseName);
DiscRecord dr = new DiscRecord();
dr.Disc = disc;
dr.BaseName = baseName;
lvi.Tag = dr;
lvDiscs.SelectedIndices.Clear();
lvDiscs.Items.Add(lvi);
lvDiscs.Items[lvDiscs.Items.Count-1].Selected = true;
}
private void lvDiscs_SelectedIndexChanged(object sender, EventArgs e)
{
UnbindDisc();
if (lvDiscs.SelectedIndices.Count != 0)
{
DiscRecord dr = (DiscRecord) lvDiscs.SelectedItems[0].Tag;
BindDisc(dr);
}
}
void UnbindDisc()
{
btnExportCue.Enabled = false;
lblSessions.Text = "";
lblTracks.Text = "";
lblSectors.Text = "";
lblSize.Text = "";
}
Disc boundDisc;
DiscRecord boundDiscRecord;
void BindDisc(DiscRecord discRecord)
{
Disc disc = discRecord.Disc;
boundDiscRecord = discRecord;
DiscStructure toc = disc.ReadStructure();
boundDisc = disc;
lblSessions.Text = toc.Sessions.Count.ToString();
lblTracks.Text = toc.Sessions.Sum((ses) => ses.Tracks.Count).ToString();
lblSectors.Text = string.Format("{0} ({1})", toc.LengthInSectors, toc.FriendlyLength.Value);
lblSize.Text = string.Format("{0:0.00} MB", toc.BinarySize / 1024.0 / 1024.0);
btnExportCue.Enabled = true;
UpdateCue();
}
void UpdateCue()
{
if (boundDisc == null)
{
txtCuePreview.Text = "";
return;
}
var cueBin = boundDisc.DumpCueBin(boundDiscRecord.BaseName, GetCuePrefs());
txtCuePreview.Text = cueBin.cue.Replace("\n", "\r\n");
}
private void btnPresetCanonical_Click(object sender, EventArgs e)
{
PresetCanonical();
}
void PresetCanonical()
{
checkCueProp_Annotations.Checked = false;
checkCueProp_OneBlobPerTrack.Checked = false;
}
private void btnPresetDaemonTools_Click(object sender, EventArgs e)
{
PresetDaemonTools();
}
void PresetDaemonTools()
{
checkCueProp_Annotations.Checked = false;
}
private void checkCueProp_CheckedChanged(object sender, EventArgs e)
{
UpdateCue();
}
private void Form1_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
{
e.Action = DragAction.Continue;
}
private void handleDragEnter(object sender, DragEventArgs e)
{
List<string> files = validateDrop(e.Data);
if (files.Count > 0)
e.Effect = DragDropEffects.Link;
else e.Effect = DragDropEffects.None;
}
private void handleDragDrop(object sender, DragEventArgs e)
{
List<string> files = validateDrop(e.Data);
if (files.Count == 0) return;
try
{
foreach (var file in files)
{
Disc disc = Disc.FromCuePath(file, new CueBinPrefs());
string baseName = Path.GetFileNameWithoutExtension(file);
baseName += "_hawked";
var prefs = GetCuePrefs();
prefs.ReallyDumpBin = true;
var cueBin = disc.DumpCueBin(baseName, GetCuePrefs());
Dump(cueBin, Path.GetDirectoryName(file), prefs);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "oops! error");
throw;
}
}
List<string> validateDrop(IDataObject ido)
{
List<string> ret = new List<string>();
string[] files = (string[])ido.GetData(System.Windows.Forms.DataFormats.FileDrop);
if (files == null) return new List<string>();
foreach (string str in files)
{
if (Path.GetExtension(str).ToUpper() != ".CUE")
{
return new List<string>();
}
ret.Add(str);
}
return ret;
}
//bool Dump(CueBin cueBin, string directoryTo, CueBinPrefs prefs)
//{
// ProgressReport pr = new ProgressReport();
// Thread workThread = new Thread(() =>
// {
// cueBin.Dump(directoryTo, prefs, pr);
// });
// ProgressDialog pd = new ProgressDialog(pr);
// pd.Show(this);
// this.Enabled = false;
// workThread.Start();
// for (; ; )
// {
// Application.DoEvents();
// Thread.Sleep(10);
// if (workThread.ThreadState != ThreadState.Running)
// break;
// pd.Update();
// }
// this.Enabled = true;
// pd.Dispose();
// return !pr.CancelSignal;
//}
private void btnExportCue_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "CUE files (*.cue)|*.cue";
sfd.OverwritePrompt = true;
if (sfd.ShowDialog() != DialogResult.OK)
return;
string baseName = Path.GetFileNameWithoutExtension(sfd.FileName);
var prefs = GetCuePrefs();
prefs.ReallyDumpBin = true;
var cueBin = boundDisc.DumpCueBin(baseName, prefs);
Dump(cueBin, Path.GetDirectoryName(sfd.FileName), prefs);
}
private void lblMagicDragArea_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -1,123 +0,0 @@
<?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>
<data name="label11.Text" xml:space="preserve">
<value>This stuff is front and center because it is a primary way of visualizing the data. But maybe not later (later it would be tree-and-list). Maybe then all these options and 'output cue preview' will move into another window that pops up when you chooes Export Cue+XXX</value>
</data>
</root>

View File

@ -1,85 +0,0 @@
namespace BizHawk.Client.DiscoHawk
{
partial class ProgressDialog
{
/// <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.progressBar1 = new System.Windows.Forms.ProgressBar();
this.btnCancel = new System.Windows.Forms.Button();
this.lblMessage = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(12, 18);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(353, 23);
this.progressBar1.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(290, 63);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// lblMessage
//
this.lblMessage.AutoSize = true;
this.lblMessage.Location = new System.Drawing.Point(12, 63);
this.lblMessage.Name = "lblMessage";
this.lblMessage.Size = new System.Drawing.Size(31, 13);
this.lblMessage.TabIndex = 2;
this.lblMessage.Text = "Task";
//
// ProgressDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(377, 98);
this.ControlBox = false;
this.Controls.Add(this.lblMessage);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.progressBar1);
this.Name = "ProgressDialog";
this.Text = "Progress";
this.Load += new System.EventHandler(this.ProgressDialog_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label lblMessage;
}
}

View File

@ -1,51 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.DiscSystem;
namespace BizHawk.Client.DiscoHawk
{
public partial class ProgressDialog : Form
{
public ProgressDialog(ProgressReport pr)
{
InitializeComponent();
this.pr = pr;
}
ProgressReport pr;
private void btnCancel_Click(object sender, EventArgs e)
{
btnCancel.Enabled = false;
pr.CancelSignal = true;
}
new public void Update()
{
double curr = pr.ProgressCurrent;
double max = pr.ProgressEstimate;
if (pr.InfoPresent)
{
double value = curr/max*100;
int nValue = (int) value;
if (nValue < 0 || nValue > 100)
nValue = 0;
progressBar1.Value = nValue;
}
lblMessage.Text = pr.Message + " - " + progressBar1.Value.ToString(CultureInfo.CurrentCulture) + "%";
}
private void ProgressDialog_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -1,120 +0,0 @@
<?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>
</root>

View File

@ -12,7 +12,5 @@
Condition=" '$(MachineRunAnalyzersDuringBuild)' != '' " />
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
<Compile Remove="Extensions/BinaryReaderExtensions.cs" />
<Compile Remove="SuperGloballyUniqueID.cs" />
</ItemGroup>
</Project>

View File

@ -1,234 +0,0 @@
using System;
using System.Globalization;
using System.IO;
using System.Text;
using System.Security.Cryptography;
namespace BizHawk.Common.BufferExtensions
{
public static class BufferExtensions
{
public static void SaveAsHex(this byte[] buffer, TextWriter writer)
{
foreach (var b in buffer)
{
writer.Write("{0:X2}", b);
}
writer.WriteLine();
}
public unsafe static void SaveAsHexFast(this byte[] buffer, TextWriter writer)
{
char* table = Util.HexConvPtr;
if (buffer.Length > 0)
{
int len = buffer.Length;
fixed (byte* src = &buffer[0])
for (int i = 0; i < len; i++)
{
writer.Write(table[src[i] >> 4]);
writer.Write(table[src[i] & 15]);
}
}
writer.WriteLine();
}
public static void SaveAsHex(this byte[] buffer, TextWriter writer, int length)
{
for (int i = 0; i < length; i++)
{
writer.Write("{0:X2}", buffer[i]);
}
writer.WriteLine();
}
public static void SaveAsHex(this short[] buffer, TextWriter writer)
{
foreach (var b in buffer)
{
writer.Write("{0:X4}", b);
}
writer.WriteLine();
}
public static void SaveAsHex(this ushort[] buffer, TextWriter writer)
{
foreach (var b in buffer)
{
writer.Write("{0:X4}", b);
}
writer.WriteLine();
}
public static void SaveAsHex(this int[] buffer, TextWriter writer)
{
foreach (int b in buffer)
{
writer.Write("{0:X8}", b);
}
writer.WriteLine();
}
public static void SaveAsHex(this uint[] buffer, TextWriter writer)
{
foreach (var b in buffer)
{
writer.Write("{0:X8}", b);
}
writer.WriteLine();
}
public static void ReadFromHex(this byte[] buffer, string hex)
{
if (hex.Length % 2 != 0)
{
throw new Exception("Hex value string does not appear to be properly formatted.");
}
for (int i = 0; i < buffer.Length && i * 2 < hex.Length; i++)
{
var bytehex = "" + hex[i * 2] + hex[i * 2 + 1];
buffer[i] = byte.Parse(bytehex, NumberStyles.HexNumber);
}
}
public static unsafe void ReadFromHexFast(this byte[] buffer, string hex)
{
if (buffer.Length * 2 != hex.Length)
{
throw new Exception("Data size mismatch");
}
int count = buffer.Length;
fixed (byte* _dst = buffer)
fixed (char* _src = hex)
{
byte* dst = _dst;
char* src = _src;
while (count > 0)
{
// in my tests, replacing Hex2Int() with a 256 entry LUT slowed things down slightly
*dst++ = (byte)(Hex2Int(*src++) << 4 | Hex2Int(*src++));
count--;
}
}
}
public static void ReadFromHex(this short[] buffer, string hex)
{
if (hex.Length % 4 != 0)
{
throw new Exception("Hex value string does not appear to be properly formatted.");
}
for (int i = 0; i < buffer.Length && i * 4 < hex.Length; i++)
{
var shorthex = "" + hex[i * 4] + hex[(i * 4) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3];
buffer[i] = short.Parse(shorthex, NumberStyles.HexNumber);
}
}
public static void ReadFromHex(this ushort[] buffer, string hex)
{
if (hex.Length % 4 != 0)
{
throw new Exception("Hex value string does not appear to be properly formatted.");
}
for (int i = 0; i < buffer.Length && i * 4 < hex.Length; i++)
{
var ushorthex = "" + hex[i * 4] + hex[(i * 4) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3];
buffer[i] = ushort.Parse(ushorthex, NumberStyles.HexNumber);
}
}
public static void ReadFromHex(this int[] buffer, string hex)
{
if (hex.Length % 8 != 0)
{
throw new Exception("Hex value string does not appear to be properly formatted.");
}
for (int i = 0; i < buffer.Length && i * 8 < hex.Length; i++)
{
//string inthex = "" + hex[i * 8] + hex[(i * 8) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3] + hex[(i*4
var inthex = hex.Substring(i * 8, 8);
buffer[i] = int.Parse(inthex, NumberStyles.HexNumber);
}
}
/// <summary>
/// Converts bytes to an uppercase string of hex numbers in upper case without any spacing or anything
/// </summary>
public static string BytesToHexString(this byte[] bytes)
{
var sb = new StringBuilder();
foreach (var b in bytes)
{
sb.AppendFormat("{0:X2}", b);
}
return sb.ToString();
}
public static bool FindBytes(this byte[] array, byte[] pattern)
{
var fidx = 0;
int result = Array.FindIndex(array, 0, array.Length, (byte b) =>
{
fidx = (b == pattern[fidx]) ? fidx + 1 : 0;
return (fidx == pattern.Length);
});
return (result >= pattern.Length - 1);
}
public static string HashMD5(this byte[] data, int offset, int len)
{
using (var md5 = MD5.Create())
{
md5.ComputeHash(data, offset, len);
return md5.Hash.BytesToHexString();
}
}
public static string HashMD5(this byte[] data)
{
return HashMD5(data, 0, data.Length);
}
public static string HashSHA1(this byte[] data, int offset, int len)
{
using (var sha1 = SHA1.Create())
{
sha1.ComputeHash(data, offset, len);
return sha1.Hash.BytesToHexString();
}
}
public static string HashSHA1(this byte[] data)
{
return HashSHA1(data, 0, data.Length);
}
#region Helpers
private static int Hex2Int(char c)
{
if (c <= '9')
{
return c - '0';
}
if (c <= 'F')
{
return c - '7';
}
return c - 'W';
}
#endregion
}
}

View File

@ -1,19 +0,0 @@
namespace BizHawk.Common
{
using System;
using System.Diagnostics;
internal static class SuperGloballyUniqueID
{
private static readonly string StaticPart = $"bizhawk-{Process.GetCurrentProcess().Id}-{Guid.NewGuid()}";
private static int ctr;
public static string Next()
{
int myctr;
lock (typeof(SuperGloballyUniqueID)) myctr = ctr++;
return $"{StaticPart}-{myctr}";
}
}
}

View File

@ -24,7 +24,4 @@
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Interfaces/IHookManager.cs" />
</ItemGroup>
</Project>

View File

@ -1,59 +0,0 @@
using System;
using System.Collections.Generic;
using BizHawk.Common;
namespace BizHawk.Emulation.Common
{
public interface IDebugHookReference
{
}
public interface IDebugHookCallback
{
void Event(int address);
}
public interface IDebugHookManager
{
IDebugHookReference Register(DebugEvent eventType, int address, int size, IDebugHookCallback cb);
void Unregister(IDebugHookReference hookReference);
}
class BasicDebugHookManager
{
WorkingDictionary<DebugEvent, Bag<uint, Reference>> database = new WorkingDictionary<DebugEvent, Bag<uint, Reference>>();
class Reference : IDebugHookReference
{
public IDebugHookCallback cb;
public DebugEvent eventType;
public int address, size;
}
public IDebugHookReference Register(DebugEvent eventType, int address, int size, IDebugHookCallback cb)
{
var r = new Reference();
r.cb = cb;
r.eventType = eventType;
r.address = address;
r.size = size;
for (int i = 0; i < size; i++)
{
uint a = (uint)(address + i);
database[eventType][a].Add(r);
}
return r;
}
public void Unregister(IDebugHookReference hookReference)
{
var hr = hookReference as Reference;
for (int i = 0; i < hr.size; i++)
{
uint a = (uint)(hr.address + i);
database[hr.eventType].Remove(a,hr);
}
}
}
}

View File

@ -66,9 +66,6 @@
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
</ItemGroup>
<ItemGroup>
<Compile Remove="CPUs/MOS 6502X/6502XXX/**/*" />
<Compile Remove="ExternalCores/**/*" />
<Compile Remove="LibretroOld/**/*" />
<None Include="Resources/*" />
</ItemGroup>
<ItemGroup>

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "6502XXX", "6502XXX.vcxproj", "{0EF7FBBC-3CA9-4121-AF6C-C46CD02354B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0EF7FBBC-3CA9-4121-AF6C-C46CD02354B4}.Debug|Win32.ActiveCfg = Debug|Win32
{0EF7FBBC-3CA9-4121-AF6C-C46CD02354B4}.Debug|Win32.Build.0 = Debug|Win32
{0EF7FBBC-3CA9-4121-AF6C-C46CD02354B4}.Release|Win32.ActiveCfg = Release|Win32
{0EF7FBBC-3CA9-4121-AF6C-C46CD02354B4}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0EF7FBBC-3CA9-4121-AF6C-C46CD02354B4}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>My6502XXX</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MY6502XXX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\..\..\output\dll\$(TargetFileName)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MY6502XXX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\..\..\output\dll\$(TargetFileName)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Execute.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="TableNZ.h" />
<ClInclude Include="UopEnum.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Execute.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UopEnum.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TableNZ.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,327 +0,0 @@
using System;
using BizHawk.Common;
using System.Runtime.InteropServices;
using System.Security;
using System.Reflection;
using System.Reflection.Emit;
namespace BizHawk.Emulation.Cores.Components.M6502
{
[StructLayout(LayoutKind.Explicit)] // LayoutKind.Sequential doesn't work right on the managed form of non-blittable structs
public sealed partial class MOS6502X
{
[FieldOffset(0)]
private int _anchor;
[SuppressUnmanagedCodeSecurity]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate byte ReadDel(ushort addr);
[SuppressUnmanagedCodeSecurity]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void WriteDel(ushort addr, byte val);
[SuppressUnmanagedCodeSecurity]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void AddrDel(ushort addr);
// interface
[FieldOffset(16)]private ReadDel _ReadMemory;
[FieldOffset(20)]private ReadDel _DummyReadMemory;
[FieldOffset(24)]private ReadDel _PeekMemory;
[FieldOffset(28)]private WriteDel _WriteMemory;
[FieldOffset(32)]private AddrDel _OnExecFetch; // this only calls when the first byte of an instruction is fetched.
public ReadDel ReadMemory
{
set { _rmp = Marshal.GetFunctionPointerForDelegate(value); _ReadMemory = value; }
get { return _ReadMemory; }
}
public ReadDel DummyReadMemory
{
set { _dmp = Marshal.GetFunctionPointerForDelegate(value); _DummyReadMemory = value; }
get { return _DummyReadMemory; }
}
public ReadDel PeekMemory
{
set { _pmp = Marshal.GetFunctionPointerForDelegate(value); _PeekMemory = value; }
get { return _PeekMemory; }
}
public WriteDel WriteMemory
{
set { _wmp = Marshal.GetFunctionPointerForDelegate(value); _WriteMemory = value; }
get { return _WriteMemory; }
}
public AddrDel OnExecFetch
{
set { _exp = IntPtr.Zero; /* Marshal.GetFunctionPointerForDelegate(value); */ _OnExecFetch = value; }
get { return _OnExecFetch; }
}
[FieldOffset(36)]public Action<string> TraceCallback; // TODOOO
[FieldOffset(40)]private IntPtr _rmp;
[FieldOffset(44)]private IntPtr _dmp;
[FieldOffset(48)]private IntPtr _pmp;
[FieldOffset(52)]private IntPtr _wmp;
[FieldOffset(56)]private IntPtr _exp;
// config
[FieldOffset(60)]public bool BCD_Enabled = true;
[FieldOffset(61)]public bool debug = false;
// state
[FieldOffset(62)]public byte A;
[FieldOffset(63)]public byte X;
[FieldOffset(64)]public byte Y;
//public byte P;
/// <summary>Carry Flag</summary>
[FieldOffset(65)]public bool FlagC;
/// <summary>Zero Flag</summary>
[FieldOffset(66)]public bool FlagZ;
/// <summary>Interrupt Disable Flag</summary>
[FieldOffset(67)]public bool FlagI;
/// <summary>Decimal Mode Flag</summary>
[FieldOffset(68)]public bool FlagD;
/// <summary>Break Flag</summary>
[FieldOffset(69)]public bool FlagB;
/// <summary>T... Flag</summary>
[FieldOffset(70)]public bool FlagT;
/// <summary>Overflow Flag</summary>
[FieldOffset(71)]public bool FlagV;
/// <summary>Negative Flag</summary>
[FieldOffset(72)]public bool FlagN;
[FieldOffset(74)]public ushort PC;
[FieldOffset(76)]public byte S;
[FieldOffset(77)]public bool IRQ;
[FieldOffset(78)]public bool NMI;
[FieldOffset(79)]public bool RDY;
[FieldOffset(80)]public int TotalExecutedCycles;
//opcode bytes.. theoretically redundant with the temp variables? who knows.
[FieldOffset(84)]int opcode;
[FieldOffset(88)]byte opcode2;
[FieldOffset(89)]byte opcode3;
[FieldOffset(92)]int ea;
[FieldOffset(96)]int alu_temp; //cpu internal temp variables
[FieldOffset(100)]int mi; //microcode index
[FieldOffset(104)]bool iflag_pending; //iflag must be stored after it is checked in some cases (CLI and SEI).
[FieldOffset(105)]bool rdy_freeze; //true if the CPU must be frozen
//tracks whether an interrupt condition has popped up recently.
//not sure if this is real or not but it helps with the branch_irq_hack
[FieldOffset(106)]bool interrupt_pending;
[FieldOffset(107)]bool branch_irq_hack; //see Uop.RelBranch_Stage3 for more details
// transient state
[FieldOffset(108)]byte value8;
[FieldOffset(109)]byte temp8;
[FieldOffset(110)]ushort value16;
[FieldOffset(112)]bool branch_taken = false;
[FieldOffset(113)]bool my_iflag;
[FieldOffset(114)]bool booltemp;
[FieldOffset(116)]int tempint;
[FieldOffset(120)]int lo;
[FieldOffset(124)]int hi;
public byte P
{
// NVTB DIZC
get
{
byte ret = 0;
if (FlagC) ret |= 1;
if (FlagZ) ret |= 2;
if (FlagI) ret |= 4;
if (FlagD) ret |= 8;
if (FlagB) ret |= 16;
if (FlagT) ret |= 32;
if (FlagV) ret |= 64;
if (FlagN) ret |= 128;
return ret;
}
set
{
FlagC = (value & 1) != 0;
FlagZ = (value & 2) != 0;
FlagI = (value & 4) != 0;
FlagD = (value & 8) != 0;
FlagB = (value & 16) != 0;
FlagT = (value & 32) != 0;
FlagV = (value & 64) != 0;
FlagN = (value & 128) != 0;
}
}
public MOS6502X()
{
InitOpcodeHandlers();
InitNative();
Reset();
}
public void SyncState(Serializer ser)
{
ser.BeginSection("MOS6502X");
ser.Sync("A", ref A);
ser.Sync("X", ref X);
ser.Sync("Y", ref Y);
{
byte tmp = P;
ser.Sync("P", ref tmp);
P = tmp;
}
ser.Sync("PC", ref PC);
ser.Sync("S", ref S);
ser.Sync("NMI", ref NMI);
ser.Sync("IRQ", ref IRQ);
ser.Sync("RDY", ref RDY);
ser.Sync("TotalExecutedCycles", ref TotalExecutedCycles);
ser.Sync("opcode", ref opcode);
ser.Sync("opcode2", ref opcode2);
ser.Sync("opcode3", ref opcode3);
ser.Sync("ea", ref ea);
ser.Sync("alu_temp", ref alu_temp);
ser.Sync("mi", ref mi);
ser.Sync("iflag_pending", ref iflag_pending);
ser.Sync("rdy_freeze", ref rdy_freeze);
ser.Sync("interrupt_pending", ref interrupt_pending);
ser.Sync("branch_irq_hack", ref branch_irq_hack);
ser.EndSection();
}
public void Reset()
{
A = 0;
X = 0;
Y = 0;
P = 0;
S = 0;
PC = 0;
TotalExecutedCycles = 0;
mi = 0;
opcode = 256;
iflag_pending = true;
RDY = true;
}
public void NESSoftReset()
{
opcode = VOP_RESET;
mi = 0;
iflag_pending = true;
FlagI = true;
}
public string State(bool disassemble = true)
{
int notused;
string a = string.Format("{0:X4} {1:X2} {2} ", PC, _PeekMemory(PC), disassemble ? Disassemble(PC, out notused) : "---").PadRight(30);
string b = string.Format("A:{0:X2} X:{1:X2} Y:{2:X2} P:{3:X2} SP:{4:X2} Cy:{5}", A, X, Y, P, S, TotalExecutedCycles);
string val = a + b + " ";
if (FlagN) val = val + "N";
if (FlagV) val = val + "V";
if (FlagT) val = val + "T";
if (FlagB) val = val + "B";
if (FlagD) val = val + "D";
if (FlagI) val = val + "I";
if (FlagZ) val = val + "Z";
if (FlagC) val = val + "C";
return val;
}
public string TraceState()
{
// only disassemble when we're at the beginning of an opcode
return State(opcode == VOP_Fetch1 || Microcode[opcode][mi] >= Uop.End);
}
public const ushort NMIVector = 0xFFFA;
public const ushort ResetVector = 0xFFFC;
public const ushort BRKVector = 0xFFFE;
public const ushort IRQVector = 0xFFFE;
enum ExceptionType
{
BRK, NMI, IRQ
}
#region native interop
private void InitNative()
{
}
[SuppressUnmanagedCodeSecurity]
[DllImport("6502XXX.dll", CallingConvention = CallingConvention.ThisCall, EntryPoint="_ZN3CPU10ExecuteOneEv")]
//[DllImport("6502XXX.dll", CallingConvention = CallingConvention.ThisCall, EntryPoint="?ExecuteOne@CPU@@QAEXXZ")]
private static extern void ExecuteOneNativeInternal(IntPtr o);
public unsafe void ExecuteOneNative()
{
fixed (int* p = &_anchor)
{
ExecuteOneNativeInternal((IntPtr)p);
}
}
#endregion
public void SetCallbacks
(
ReadDel ReadMemory,
ReadDel DummyReadMemory,
ReadDel PeekMemory,
WriteDel WriteMemory
)
{
this.ReadMemory = ReadMemory;
this.DummyReadMemory = DummyReadMemory;
this.PeekMemory = PeekMemory;
this.WriteMemory = WriteMemory;
}
public ushort ReadWord(ushort address)
{
byte l = _ReadMemory(address);
byte h = _ReadMemory(++address);
return (ushort)((h << 8) | l);
}
public ushort PeekWord(ushort address)
{
byte l = _PeekMemory(address);
byte h = _PeekMemory(++address);
return (ushort)((h << 8) | l);
}
private static readonly byte[] TableNZ =
{
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
};
}
}

View File

@ -1,19 +0,0 @@
const byte TableNZ[] =
{
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
};

View File

@ -1,252 +0,0 @@
// AUTOGENERATED
#ifndef UOPENUM_H
#define UOPENUM_H
enum Uop {
Uop_Unsupported,
Uop_Fetch1,
Uop_Fetch1_Real,
Uop_Fetch2,
Uop_Fetch3,
Uop_FetchDummy,
Uop_NOP,
Uop_JSR,
Uop_IncPC,
Uop_Abs_WRITE_STA,
Uop_Abs_WRITE_STX,
Uop_Abs_WRITE_STY,
Uop_Abs_WRITE_SAX,
Uop_Abs_READ_BIT,
Uop_Abs_READ_LDA,
Uop_Abs_READ_LDY,
Uop_Abs_READ_ORA,
Uop_Abs_READ_LDX,
Uop_Abs_READ_CMP,
Uop_Abs_READ_ADC,
Uop_Abs_READ_CPX,
Uop_Abs_READ_SBC,
Uop_Abs_READ_AND,
Uop_Abs_READ_EOR,
Uop_Abs_READ_CPY,
Uop_Abs_READ_NOP,
Uop_Abs_READ_LAX,
Uop_Abs_RMW_Stage4,
Uop_Abs_RMW_Stage6,
Uop_Abs_RMW_Stage5_INC,
Uop_Abs_RMW_Stage5_DEC,
Uop_Abs_RMW_Stage5_LSR,
Uop_Abs_RMW_Stage5_ROL,
Uop_Abs_RMW_Stage5_ASL,
Uop_Abs_RMW_Stage5_ROR,
Uop_Abs_RMW_Stage5_SLO,
Uop_Abs_RMW_Stage5_RLA,
Uop_Abs_RMW_Stage5_SRE,
Uop_Abs_RMW_Stage5_RRA,
Uop_Abs_RMW_Stage5_DCP,
Uop_Abs_RMW_Stage5_ISC,
Uop_JMP_abs,
Uop_ZpIdx_Stage3_X,
Uop_ZpIdx_Stage3_Y,
Uop_ZpIdx_RMW_Stage4,
Uop_ZpIdx_RMW_Stage6,
Uop_ZP_WRITE_STA,
Uop_ZP_WRITE_STX,
Uop_ZP_WRITE_STY,
Uop_ZP_WRITE_SAX,
Uop_ZP_RMW_Stage3,
Uop_ZP_RMW_Stage5,
Uop_ZP_RMW_DEC,
Uop_ZP_RMW_INC,
Uop_ZP_RMW_ASL,
Uop_ZP_RMW_LSR,
Uop_ZP_RMW_ROR,
Uop_ZP_RMW_ROL,
Uop_ZP_RMW_SLO,
Uop_ZP_RMW_RLA,
Uop_ZP_RMW_SRE,
Uop_ZP_RMW_RRA,
Uop_ZP_RMW_DCP,
Uop_ZP_RMW_ISC,
Uop_ZP_READ_EOR,
Uop_ZP_READ_BIT,
Uop_ZP_READ_ORA,
Uop_ZP_READ_LDA,
Uop_ZP_READ_LDY,
Uop_ZP_READ_LDX,
Uop_ZP_READ_CPX,
Uop_ZP_READ_SBC,
Uop_ZP_READ_CPY,
Uop_ZP_READ_NOP,
Uop_ZP_READ_ADC,
Uop_ZP_READ_AND,
Uop_ZP_READ_CMP,
Uop_ZP_READ_LAX,
Uop_IdxInd_Stage3,
Uop_IdxInd_Stage4,
Uop_IdxInd_Stage5,
Uop_IdxInd_Stage6_READ_ORA,
Uop_IdxInd_Stage6_READ_SBC,
Uop_IdxInd_Stage6_READ_LDA,
Uop_IdxInd_Stage6_READ_EOR,
Uop_IdxInd_Stage6_READ_CMP,
Uop_IdxInd_Stage6_READ_ADC,
Uop_IdxInd_Stage6_READ_AND,
Uop_IdxInd_Stage6_READ_LAX,
Uop_IdxInd_Stage6_WRITE_STA,
Uop_IdxInd_Stage6_WRITE_SAX,
Uop_IdxInd_Stage6_RMW,
Uop_IdxInd_Stage7_RMW_SLO,
Uop_IdxInd_Stage7_RMW_RLA,
Uop_IdxInd_Stage7_RMW_SRE,
Uop_IdxInd_Stage7_RMW_RRA,
Uop_IdxInd_Stage7_RMW_ISC,
Uop_IdxInd_Stage7_RMW_DCP,
Uop_IdxInd_Stage8_RMW,
Uop_AbsIdx_Stage3_X,
Uop_AbsIdx_Stage3_Y,
Uop_AbsIdx_Stage4,
Uop_AbsIdx_WRITE_Stage5_STA,
Uop_AbsIdx_WRITE_Stage5_SHY,
Uop_AbsIdx_WRITE_Stage5_SHX,
Uop_AbsIdx_WRITE_Stage5_ERROR,
Uop_AbsIdx_READ_Stage4,
Uop_AbsIdx_READ_Stage5_LDA,
Uop_AbsIdx_READ_Stage5_CMP,
Uop_AbsIdx_READ_Stage5_SBC,
Uop_AbsIdx_READ_Stage5_ADC,
Uop_AbsIdx_READ_Stage5_EOR,
Uop_AbsIdx_READ_Stage5_LDX,
Uop_AbsIdx_READ_Stage5_AND,
Uop_AbsIdx_READ_Stage5_ORA,
Uop_AbsIdx_READ_Stage5_LDY,
Uop_AbsIdx_READ_Stage5_NOP,
Uop_AbsIdx_READ_Stage5_LAX,
Uop_AbsIdx_READ_Stage5_ERROR,
Uop_AbsIdx_RMW_Stage5,
Uop_AbsIdx_RMW_Stage7,
Uop_AbsIdx_RMW_Stage6_ROR,
Uop_AbsIdx_RMW_Stage6_DEC,
Uop_AbsIdx_RMW_Stage6_INC,
Uop_AbsIdx_RMW_Stage6_ASL,
Uop_AbsIdx_RMW_Stage6_LSR,
Uop_AbsIdx_RMW_Stage6_ROL,
Uop_AbsIdx_RMW_Stage6_SLO,
Uop_AbsIdx_RMW_Stage6_RLA,
Uop_AbsIdx_RMW_Stage6_SRE,
Uop_AbsIdx_RMW_Stage6_RRA,
Uop_AbsIdx_RMW_Stage6_DCP,
Uop_AbsIdx_RMW_Stage6_ISC,
Uop_IncS,
Uop_DecS,
Uop_PushPCL,
Uop_PushPCH,
Uop_PushP,
Uop_PullP,
Uop_PullPCL,
Uop_PullPCH_NoInc,
Uop_PushA,
Uop_PullA_NoInc,
Uop_PullP_NoInc,
Uop_PushP_BRK,
Uop_PushP_NMI,
Uop_PushP_IRQ,
Uop_PushP_Reset,
Uop_PushDummy,
Uop_FetchPCLVector,
Uop_FetchPCHVector,
Uop_Imp_ASL_A,
Uop_Imp_ROL_A,
Uop_Imp_ROR_A,
Uop_Imp_LSR_A,
Uop_Imp_SEC,
Uop_Imp_CLI,
Uop_Imp_SEI,
Uop_Imp_CLD,
Uop_Imp_CLC,
Uop_Imp_CLV,
Uop_Imp_SED,
Uop_Imp_INY,
Uop_Imp_DEY,
Uop_Imp_INX,
Uop_Imp_DEX,
Uop_Imp_TSX,
Uop_Imp_TXS,
Uop_Imp_TAX,
Uop_Imp_TAY,
Uop_Imp_TYA,
Uop_Imp_TXA,
Uop_Imm_CMP,
Uop_Imm_ADC,
Uop_Imm_AND,
Uop_Imm_SBC,
Uop_Imm_ORA,
Uop_Imm_EOR,
Uop_Imm_CPY,
Uop_Imm_CPX,
Uop_Imm_ANC,
Uop_Imm_ASR,
Uop_Imm_ARR,
Uop_Imm_LXA,
Uop_Imm_AXS,
Uop_Imm_LDA,
Uop_Imm_LDX,
Uop_Imm_LDY,
Uop_Imm_Unsupported,
Uop_NZ_X,
Uop_NZ_Y,
Uop_NZ_A,
Uop_RelBranch_Stage2_BNE,
Uop_RelBranch_Stage2_BPL,
Uop_RelBranch_Stage2_BCC,
Uop_RelBranch_Stage2_BCS,
Uop_RelBranch_Stage2_BEQ,
Uop_RelBranch_Stage2_BMI,
Uop_RelBranch_Stage2_BVC,
Uop_RelBranch_Stage2_BVS,
Uop_RelBranch_Stage2,
Uop_RelBranch_Stage3,
Uop_RelBranch_Stage4,
Uop__Eor,
Uop__Bit,
Uop__Cpx,
Uop__Cpy,
Uop__Cmp,
Uop__Adc,
Uop__Sbc,
Uop__Ora,
Uop__And,
Uop__Anc,
Uop__Asr,
Uop__Arr,
Uop__Lxa,
Uop__Axs,
Uop_AbsInd_JMP_Stage4,
Uop_AbsInd_JMP_Stage5,
Uop_IndIdx_Stage3,
Uop_IndIdx_Stage4,
Uop_IndIdx_READ_Stage5,
Uop_IndIdx_WRITE_Stage5,
Uop_IndIdx_WRITE_Stage6_STA,
Uop_IndIdx_WRITE_Stage6_SHA,
Uop_IndIdx_READ_Stage6_LDA,
Uop_IndIdx_READ_Stage6_CMP,
Uop_IndIdx_READ_Stage6_ORA,
Uop_IndIdx_READ_Stage6_SBC,
Uop_IndIdx_READ_Stage6_ADC,
Uop_IndIdx_READ_Stage6_AND,
Uop_IndIdx_READ_Stage6_EOR,
Uop_IndIdx_READ_Stage6_LAX,
Uop_IndIdx_RMW_Stage5,
Uop_IndIdx_RMW_Stage6,
Uop_IndIdx_RMW_Stage7_SLO,
Uop_IndIdx_RMW_Stage7_RLA,
Uop_IndIdx_RMW_Stage7_SRE,
Uop_IndIdx_RMW_Stage7_RRA,
Uop_IndIdx_RMW_Stage7_ISC,
Uop_IndIdx_RMW_Stage7_DCP,
Uop_IndIdx_RMW_Stage8,
Uop_End,
Uop_End_ISpecial,
Uop_End_BranchSpecial,
Uop_End_SuppressInterrupt,
};
#endif // UOPENUM_H

View File

@ -1,268 +0,0 @@
// AUTOGENERATED
#include "UopEnum.h"
const Uop Microcode[264][8] = {
{Uop_Fetch2, Uop_PushPCH, Uop_PushPCL, Uop_PushP_BRK, Uop_FetchPCLVector, Uop_FetchPCHVector, Uop_End_SuppressInterrupt},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_ORA, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_RMW, Uop_IdxInd_Stage7_RMW_SLO, Uop_IdxInd_Stage8_RMW, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_ORA, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_ASL, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_SLO, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_FetchDummy, Uop_PushP, Uop_End},
{Uop_Imm_ORA, Uop_End},
{Uop_Imp_ASL_A, Uop_End},
{Uop_Imm_ANC, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_ORA, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_ASL, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_SLO, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_RelBranch_Stage2_BPL, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_ORA, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_RMW_Stage5, Uop_IndIdx_RMW_Stage6, Uop_IndIdx_RMW_Stage7_SLO, Uop_IndIdx_RMW_Stage8, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_ORA, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_ASL, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_SLO, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Imp_CLC, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_ORA, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_SLO, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_NOP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_ORA, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_ASL, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_SLO, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_NOP, Uop_PushPCH, Uop_PushPCL, Uop_JSR, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_AND, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_RMW, Uop_IdxInd_Stage7_RMW_RLA, Uop_IdxInd_Stage8_RMW, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_BIT, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_AND, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_ROL, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_RLA, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_FetchDummy, Uop_IncS, Uop_PullP_NoInc, Uop_End_ISpecial},
{Uop_Imm_AND, Uop_End},
{Uop_Imp_ROL_A, Uop_End},
{Uop_Imm_ANC, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_BIT, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_AND, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_ROL, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_RLA, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_RelBranch_Stage2_BMI, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_AND, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_RMW_Stage5, Uop_IndIdx_RMW_Stage6, Uop_IndIdx_RMW_Stage7_RLA, Uop_IndIdx_RMW_Stage8, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_AND, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_ROL, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_RLA, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Imp_SEC, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_AND, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_RLA, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_NOP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_AND, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_ROL, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_RLA, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_FetchDummy, Uop_IncS, Uop_PullP, Uop_PullPCL, Uop_PullPCH_NoInc, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_EOR, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_RMW, Uop_IdxInd_Stage7_RMW_SRE, Uop_IdxInd_Stage8_RMW, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_EOR, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_LSR, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_SRE, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_FetchDummy, Uop_PushA, Uop_End},
{Uop_Imm_EOR, Uop_End},
{Uop_Imp_LSR_A, Uop_End},
{Uop_Imm_ASR, Uop_End},
{Uop_Fetch2, Uop_JMP_abs, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_EOR, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_LSR, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_SRE, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_RelBranch_Stage2_BVC, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_EOR, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_RMW_Stage5, Uop_IndIdx_RMW_Stage6, Uop_IndIdx_RMW_Stage7_SRE, Uop_IndIdx_RMW_Stage8, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_EOR, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_LSR, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_SRE, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Imp_CLI, Uop_End_ISpecial},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_EOR, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_SRE, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_NOP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_EOR, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_LSR, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_SRE, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_FetchDummy, Uop_IncS, Uop_PullPCL, Uop_PullPCH_NoInc, Uop_IncPC, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_ADC, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_RMW, Uop_IdxInd_Stage7_RMW_RRA, Uop_IdxInd_Stage8_RMW, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_ADC, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_ROR, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_RRA, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_FetchDummy, Uop_IncS, Uop_PullA_NoInc, Uop_End},
{Uop_Imm_ADC, Uop_End},
{Uop_Imp_ROR_A, Uop_End},
{Uop_Imm_ARR, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_AbsInd_JMP_Stage4, Uop_AbsInd_JMP_Stage5, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_ADC, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_ROR, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_RRA, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_RelBranch_Stage2_BVS, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_ADC, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_RMW_Stage5, Uop_IndIdx_RMW_Stage6, Uop_IndIdx_RMW_Stage7_RRA, Uop_IndIdx_RMW_Stage8, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_ADC, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_ROR, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_RRA, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Imp_SEI, Uop_End_ISpecial},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_ADC, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_RRA, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_NOP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_ADC, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_ROR, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_RRA, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Imm_Unsupported, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_WRITE_STA, Uop_End},
{Uop_Imm_Unsupported, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_WRITE_SAX, Uop_End},
{Uop_Fetch2, Uop_ZP_WRITE_STY, Uop_End},
{Uop_Fetch2, Uop_ZP_WRITE_STA, Uop_End},
{Uop_Fetch2, Uop_ZP_WRITE_STX, Uop_End},
{Uop_Fetch2, Uop_ZP_WRITE_SAX, Uop_End},
{Uop_Imp_DEY, Uop_End},
{Uop_Imm_Unsupported, Uop_End},
{Uop_Imp_TXA, Uop_End},
{Uop_Imm_Unsupported, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_WRITE_STY, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_WRITE_STA, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_WRITE_STX, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_WRITE_SAX, Uop_End},
{Uop_RelBranch_Stage2_BCC, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_WRITE_Stage5, Uop_IndIdx_WRITE_Stage6_STA, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_WRITE_Stage5, Uop_IndIdx_WRITE_Stage6_SHA, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_WRITE_STY, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_WRITE_STA, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_Y, Uop_ZP_WRITE_STX, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_Y, Uop_ZP_WRITE_SAX, Uop_End},
{Uop_Imp_TYA, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_WRITE_Stage5_STA, Uop_End},
{Uop_Imp_TXS, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_WRITE_Stage5_ERROR, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_WRITE_Stage5_SHY, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_WRITE_Stage5_STA, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_WRITE_Stage5_SHX, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_WRITE_Stage5_SHY, Uop_End},
{Uop_Imm_LDY, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_LDA, Uop_End},
{Uop_Imm_LDX, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_LAX, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_LDY, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_LDA, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_LDX, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_LAX, Uop_End},
{Uop_Imp_TAY, Uop_End},
{Uop_Imm_LDA, Uop_End},
{Uop_Imp_TAX, Uop_End},
{Uop_Imm_LXA, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_LDY, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_LDA, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_LDX, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_LAX, Uop_End},
{Uop_RelBranch_Stage2_BCS, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_LDA, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_LAX, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_LDY, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_LDA, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_Y, Uop_ZP_READ_LDX, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_Y, Uop_ZP_READ_LAX, Uop_End},
{Uop_Imp_CLV, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_LDA, Uop_End},
{Uop_Imp_TSX, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_ERROR, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_LDY, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_LDA, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_LDX, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_LAX, Uop_End},
{Uop_Imm_CPY, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_CMP, Uop_End},
{Uop_Imm_Unsupported, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_RMW, Uop_IdxInd_Stage7_RMW_DCP, Uop_IdxInd_Stage8_RMW, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_CPY, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_CMP, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_DEC, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_DCP, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Imp_INY, Uop_End},
{Uop_Imm_CMP, Uop_End},
{Uop_Imp_DEX, Uop_End},
{Uop_Imm_AXS, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_CPY, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_CMP, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_DEC, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_DCP, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_RelBranch_Stage2_BNE, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_CMP, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_RMW_Stage5, Uop_IndIdx_RMW_Stage6, Uop_IndIdx_RMW_Stage7_DCP, Uop_IndIdx_RMW_Stage8, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_CMP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_DEC, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_DCP, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Imp_CLD, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_CMP, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_DCP, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_NOP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_CMP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_DEC, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_DCP, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Imm_CPX, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_READ_SBC, Uop_End},
{Uop_Imm_Unsupported, Uop_End},
{Uop_Fetch2, Uop_IdxInd_Stage3, Uop_IdxInd_Stage4, Uop_IdxInd_Stage5, Uop_IdxInd_Stage6_RMW, Uop_IdxInd_Stage7_RMW_ISC, Uop_IdxInd_Stage8_RMW, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_CPX, Uop_End},
{Uop_Fetch2, Uop_ZP_READ_SBC, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_INC, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Fetch2, Uop_ZP_RMW_Stage3, Uop_ZP_RMW_ISC, Uop_ZP_RMW_Stage5, Uop_End},
{Uop_Imp_INX, Uop_End},
{Uop_Imm_SBC, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Imm_SBC, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_CPX, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_READ_SBC, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_INC, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_Fetch3, Uop_Abs_RMW_Stage4, Uop_Abs_RMW_Stage5_ISC, Uop_Abs_RMW_Stage6, Uop_End},
{Uop_RelBranch_Stage2_BEQ, Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_READ_Stage5, Uop_IndIdx_READ_Stage6_SBC, Uop_End},
{Uop_End},
{Uop_Fetch2, Uop_IndIdx_Stage3, Uop_IndIdx_Stage4, Uop_IndIdx_RMW_Stage5, Uop_IndIdx_RMW_Stage6, Uop_IndIdx_RMW_Stage7_ISC, Uop_IndIdx_RMW_Stage8, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_NOP, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZP_READ_SBC, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_INC, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Fetch2, Uop_ZpIdx_Stage3_X, Uop_ZpIdx_RMW_Stage4, Uop_ZP_RMW_ISC, Uop_ZpIdx_RMW_Stage6, Uop_End},
{Uop_Imp_SED, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_SBC, Uop_End},
{Uop_FetchDummy, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_Y, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_ISC, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_NOP, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_READ_Stage4, Uop_AbsIdx_READ_Stage5_SBC, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_INC, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch2, Uop_AbsIdx_Stage3_X, Uop_AbsIdx_Stage4, Uop_AbsIdx_RMW_Stage5, Uop_AbsIdx_RMW_Stage6_ISC, Uop_AbsIdx_RMW_Stage7, Uop_End},
{Uop_Fetch1},
{Uop_RelBranch_Stage3, Uop_End_BranchSpecial},
{Uop_RelBranch_Stage4, Uop_End},
{Uop_End_SuppressInterrupt},
{Uop_FetchDummy, Uop_FetchDummy, Uop_PushPCH, Uop_PushPCL, Uop_PushP_NMI, Uop_FetchPCLVector, Uop_FetchPCHVector, Uop_End_SuppressInterrupt},
{Uop_FetchDummy, Uop_FetchDummy, Uop_PushPCH, Uop_PushPCL, Uop_PushP_IRQ, Uop_FetchPCLVector, Uop_FetchPCHVector, Uop_End_SuppressInterrupt},
{Uop_FetchDummy, Uop_FetchDummy, Uop_PushDummy, Uop_PushDummy, Uop_PushP_Reset, Uop_FetchPCLVector, Uop_FetchPCHVector, Uop_End_SuppressInterrupt},
{Uop_Fetch1_Real},
};

View File

@ -1,26 +0,0 @@
CXX = g++
CXXFLAGS = -Wall -I.. -O3 -fno-exceptions -fomit-frame-pointer -std=c++11
TARGET = 6502XXX.dll
LDFLAGS = -shared -static-libgcc -static-libstdc++ $(CXXFLAGS)
RM = rm
CP = cp
SRCS = \
../execute.cpp
OBJS = $(SRCS:.cpp=.o)
all: $(TARGET)
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS)
$(TARGET) : $(OBJS)
$(CXX) -o $@ $(LDFLAGS) $(OBJS)
clean:
$(RM) $(OBJS)
$(RM) $(TARGET)
install:
$(CP) $(TARGET) ../../../../../output/dll

View File

@ -1,193 +0,0 @@
using System;
using System.Security;
using System.Runtime.InteropServices;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Reflection.Emit;
using System.Threading;
using BizHawk.DiscSystem;
namespace BizHawk
{
/// <summary>
/// represents an external core's interface to a disc
/// </summary>
public class DiscInterface : ExternalCore
{
public DiscInterface(IExternalCoreAccessor accessor)
: base(accessor)
{
UnmanagedOpaque = QueryCoreCall<Func<IntPtr, IntPtr>>("DiscInterface.Construct")(ManagedOpaque);
SetFp("Dispose", new disposeDelegate(Dispose));
SetFp("GetNumSessions", new GetNumSessionsDelegate(GetNumSessions));
SetFp("GetNumTracks", new GetNumTracksDelegate(GetNumTracks));
SetFp("GetTrack", new GetTrackDelegate(GetTrack));
}
bool disposed = false;
public override void Dispose()
{
if (disposed) return;
disposed = true;
QueryCoreCall<Action>("DiscInterface.Delete")();
base.Dispose();
}
public DiscHopper DiscHopper;
void SetFp(string name, Delegate del)
{
QueryCoreCall<Action<string, IntPtr>>("DiscInterface.Set_fp")(name, ExportDelegate(del));
}
struct TrackInfo
{
public ETrackType TrackType;
public int length_lba;
public int start_lba;
}
int GetNumSessions()
{
return DiscHopper.CurrentDisc.ReadTOC().Sessions.Count;
}
int GetNumTracks(int session)
{
return DiscHopper.CurrentDisc.ReadTOC().Sessions[session].Tracks.Count;
}
TrackInfo GetTrack(int session, int track)
{
var ti = new TrackInfo();
var toc_track = DiscHopper.CurrentDisc.ReadTOC().Sessions[session].Tracks[track];
ti.TrackType = toc_track.TrackType;
ti.length_lba = toc_track.length_aba;
return ti;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void disposeDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate int GetNumSessionsDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate int GetNumTracksDelegate(int session);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate TrackInfo GetTrackDelegate(int session, int track);
}
public class EmuFile : ExternalCore
{
public EmuFile(IExternalCoreAccessor accessor)
: base(accessor)
{
UnmanagedOpaque = QueryCoreCall<Func<IntPtr, IntPtr>>("EmuFile.Construct")(ManagedOpaque);
SetFp("fgetc", new fgetcDelegate(fgetc));
SetFp("fread", new freadDelegate(fread));
SetFp("fwrite", new fwriteDelegate(fwrite));
SetFp("fseek", new fseekDelegate(fseek));
SetFp("ftell", new ftellDelegate(ftell));
SetFp("size", new sizeDelegate(size));
SetFp("dispose", new disposeDelegate(Dispose));
}
void SetFp(string name, Delegate del)
{
QueryCoreCall<Action<string, IntPtr>>("EmuFile.Set_fp")(name, ExportDelegate(del));
}
public Stream BaseStream { get; set; }
//do we want to have a finalizer? not sure.
bool disposed = false;
public override void Dispose()
{
if (disposed) return;
disposed = true;
//we will call Delete in the c++ side, which will delete the object, and cause Dispose() to get called.
//but, Dispose() can never be called again due to setting the flag above
QueryCoreCall<Action>("EmuFile.Delete")();
//do we always want to do this? not sure. but usually.
BaseStream.Dispose();
base.Dispose();
}
int fgetc()
{
return BaseStream.ReadByte();
}
IntPtr fread(
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]
byte[] ptr,
IntPtr bytes)
{
long len = bytes.ToInt64();
if (len >= int.MaxValue || len < 0) throw new ArgumentException();
int ret = BaseStream.Read(ptr, 0, (int)len);
return new IntPtr(ret);
}
IntPtr fseek(IntPtr offset, IntPtr origin)
{
SeekOrigin so = (SeekOrigin)origin.ToInt32();
long loffset = offset.ToInt64();
return new IntPtr(BaseStream.Seek(loffset, so));
}
IntPtr ftell() { return new IntPtr(BaseStream.Position); }
IntPtr size() { return new IntPtr(BaseStream.Length); }
void fwrite(
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]
byte[] ptr,
IntPtr bytes)
{
long len = bytes.ToInt64();
if (len >= int.MaxValue || len < 0) throw new ArgumentException();
BaseStream.Write(ptr, 0, (int)len);
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate int fgetcDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void disposeDelegate();
//TODO - for more speed fread and fwrite might appreciate taking pointers
//(although, we'll have to convert it to an array to deal with an underlying stream anyway -- or will we?
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr freadDelegate(
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]
byte[] ptr,
IntPtr bytes);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void fwriteDelegate(
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]
byte[] ptr,
IntPtr bytes);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr fseekDelegate(IntPtr offset, IntPtr origin);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr ftellDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr sizeDelegate();
}
}

View File

@ -1,254 +0,0 @@
using System;
using System.Security;
using System.Threading;
using System.Text;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
namespace BizHawk
{
/// <summary>
/// universal interface to a shared library
/// </summary>
public interface ILibAccessor : IDisposable
{
IntPtr GetProcAddress(string name);
bool IsOpen { get; }
}
/// <summary>
/// universal access to an external emulator core
/// </summary>
public interface IExternalCoreAccessor : IDisposable
{
IntPtr Signal(string type, IntPtr obj, string param, IntPtr value);
bool IsOpen { get; }
void RegisterCore(ExternalCore core, bool register);
}
public class CoreAccessor : IExternalCoreAccessor
{
ILibAccessor mLibAccessor;
public CoreAccessor(ILibAccessor accessor)
{
mLibAccessor = accessor;
if (accessor.IsOpen)
{
mSignal = (SignalCallbackDelegate)Marshal.GetDelegateForFunctionPointer(accessor.GetProcAddress("Core_signal"), typeof(SignalCallbackDelegate));
IsOpen = true;
}
}
public void RegisterCore(ExternalCore core, bool register)
{
if (core is StaticCoreCommon) return;
//defer initialization until the core is needed, to avoid pointless costs for cores the user isnt using
if (!IsInitialized)
{
IsInitialized = true;
scc = new StaticCoreCommon(this);
scc.RegisterClientSignal(new SignalCallbackDelegate(ClientSignal));
scc.Initialize();
}
if (register)
{
mCoreRegistry[core.ManagedOpaque] = core;
}
else
{
mCoreRegistry.Remove(core.ManagedOpaque);
}
}
StaticCoreCommon scc;
Dictionary<IntPtr, ExternalCore> mCoreRegistry = new Dictionary<IntPtr, ExternalCore>();
public void Dispose()
{
if (mLibAccessor == null) return;
scc.Dispose();
mLibAccessor.Dispose();
mLibAccessor = null;
IsOpen = false;
}
public bool IsOpen { get; private set; }
bool IsInitialized;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IntPtr SignalCallbackDelegate(string type, IntPtr obj, string param, IntPtr value);
SignalCallbackDelegate mSignal;
//external cores call into the client from here
public IntPtr ClientSignal(string type, IntPtr obj, string param, IntPtr value)
{
//static calls
if (obj == IntPtr.Zero)
{
return scc.ClientSignal(type, obj, param, value);
}
else
{
return mCoreRegistry[obj].ClientSignal(type, obj, param, value);
}
}
public IntPtr Signal(string type, IntPtr obj, string param, IntPtr value)
{
if (!IsOpen) throw new InvalidOperationException("core accessor is open");
return mSignal(type, obj, param, value);
}
}
//todo - make abstract
public class ExternalCore : IDisposable
{
//rename to managed and unmanaged
public IntPtr ManagedOpaque;
public IntPtr UnmanagedOpaque;
static int _ManagedOpaque_Counter = 1;
private static object oLock = new object();
protected IExternalCoreAccessor mAccessor;
public ExternalCore(IExternalCoreAccessor accessor)
{
mAccessor = accessor;
lock (oLock)
{
ManagedOpaque = new IntPtr(_ManagedOpaque_Counter);
_ManagedOpaque_Counter++;
}
mAccessor.RegisterCore(this, true);
}
public virtual void Dispose()
{
mAccessor.RegisterCore(this, false);
//universal delete mechanism?
//probably not.
}
/// <summary>
/// cores call into the client from here. this system is not fully baked yet, though
/// </summary>
public virtual IntPtr ClientSignal(string type, IntPtr obj, string param, IntPtr value)
{
//if (type == "FACTORY")
//{
// return new DiscInterface(mAccessor).UnmanagedOpaque;
//}
//else return IntPtr.Zero;
return IntPtr.Zero;
}
/// <summary>
/// merely emits an integer of the current system int size to an ILGenerator
/// </summary>
static void EmitIntPtr(ILGenerator gen, IntPtr val)
{
if (IntPtr.Size == 4) gen.Emit(OpCodes.Ldc_I4, val.ToInt32());
else gen.Emit(OpCodes.Ldc_I8, val.ToInt64());
}
/// <summary>
/// retrieves a function pointer from the core and returns it as the specified delegate type
/// </summary>
protected void QueryCoreCall<T>(out T del, string name)
{
del = QueryCoreCall<T>(name);
}
/// <summary>
/// retrieves a function pointer from the core and returns it as the specified delegate type
/// </summary>
protected T QueryCoreCall<T>(string name)
{
MethodInfo mi = typeof(T).GetMethod("Invoke");
ParameterInfo[] pis = mi.GetParameters();
Type[] unmanagedParamTypes = new Type[pis.Length + 1];
Type[] managedParamTypes = new Type[pis.Length];
unmanagedParamTypes[0] = typeof(int);
for (int i = 0; i < pis.Length; i++)
{
unmanagedParamTypes[i + 1] = pis[i].ParameterType;
managedParamTypes[i] = pis[i].ParameterType;
}
IntPtr fptr = mAccessor.Signal("QUERY_FUNCTION", IntPtr.Zero, name, IntPtr.Zero);
if (fptr == IntPtr.Zero)
throw new InvalidOperationException("external core was missing requested function: " + name);
DynamicMethod dm = new DynamicMethod("", mi.ReturnType, managedParamTypes, GetType().Module);
ILGenerator gen = dm.GetILGenerator();
EmitIntPtr(gen, UnmanagedOpaque);
for (int i = 0; i < pis.Length; i++) gen.Emit(OpCodes.Ldarg, i);
EmitIntPtr(gen, fptr);
gen.EmitCalli(OpCodes.Calli, CallingConvention.ThisCall, mi.ReturnType, unmanagedParamTypes);
gen.Emit(OpCodes.Ret);
Delegate d = dm.CreateDelegate(typeof(T));
return (T)(object)d;
}
/// <summary>
/// exports a delegate as an IntPtr for use in unmanaged code and manages its life cycle to keep it from getting freed
/// </summary>
protected IntPtr ExportDelegate(Delegate d)
{
IntPtr retPtr = Marshal.GetFunctionPointerForDelegate(d);
listLiveDelegates.Add(d);
return retPtr;
}
//need to hold on to these callbacks to make sure they dont get GCed while unmanaged code has a pointer to them
List<Delegate> listLiveDelegates = new List<Delegate>();
}
public class StaticCoreCommon : ExternalCore
{
//keep in mind that we may need to make the console thread safe if we ever do any zany multithreaded things
public StaticCoreCommon(IExternalCoreAccessor accessor)
: base(accessor)
{
}
EmuFile Console;
public void Initialize()
{
Console = new EmuFile(mAccessor);
if (Log.HACK_LOG_STREAM != null)
Console.BaseStream = Log.HACK_LOG_STREAM;
else
Console.BaseStream = System.Console.OpenStandardOutput();
mAccessor.Signal("SET_CONSOLE", IntPtr.Zero, null, Console.UnmanagedOpaque);
}
public void RegisterClientSignal(CoreAccessor.SignalCallbackDelegate ClientSignal)
{
mAccessor.Signal("SET_CLIENT_SIGNAL", IntPtr.Zero, null, ExportDelegate(ClientSignal));
}
public override IntPtr ClientSignal(string type, IntPtr obj, string param, IntPtr value)
{
return IntPtr.Zero;
}
}
}

View File

@ -1,101 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using BizHawk.DiscSystem;
namespace BizHawk
{
public class PsxCore : ExternalCore, IEmulator, IVideoProvider, ISoundProvider
{
public PsxCore(IExternalCoreAccessor accessor)
: base(accessor)
{
var domains = new List<MemoryDomain>(1);
memoryDomains = domains.AsReadOnly();
CoreOutputComm = new CoreOutputComm();
CoreInputComm = new CoreInputComm();
mDiscInterface = new DiscInterface(mAccessor);
UnmanagedOpaque = QueryCoreCall<Func<IntPtr,IntPtr>>("PsxCore.Construct")(ManagedOpaque);
QueryCoreCall(out cGetResolution, "PsxCore.GetResolution");
QueryCoreCall(out cUpdateVideoBuffer, "PsxCore.UpdateVideoBuffer");
QueryCoreCall(out cFrameAdvance, "PsxCore.FrameAdvance");
}
DiscInterface mDiscInterface;
public void SetDiscHopper(DiscHopper hopper)
{
mDiscInterface.DiscHopper = hopper;
}
public override IntPtr ClientSignal(string type, IntPtr obj, string param, IntPtr value)
{
if (param == "GetDiscInterface")
{
return mDiscInterface.UnmanagedOpaque;
}
return base.ClientSignal(type, obj, param, value);
}
Func<System.Drawing.Size> cGetResolution;
Action cFrameAdvance;
Action<IntPtr> cUpdateVideoBuffer;
//video provider
int[] videoBuffer = new int[256 * 256];
public int[] GetVideoBuffer() { return videoBuffer; }
public int BufferWidth { get { return 256; } }
public int BufferHeight { get { return 192; } }
public int BackgroundColor { get { return 0; } }
public void ResetFrameCounter()
{
Frame = 0;
}
public string SystemId { get { return "PSX"; } }
public static readonly ControllerDefinition NullController = new ControllerDefinition { Name = "Null Controller" };
private Random rand = new Random();
public CoreInputComm CoreInputComm { get; set; }
public CoreOutputComm CoreOutputComm { get; private set; }
public IVideoProvider VideoProvider { get { return this; } }
public ISoundProvider SoundProvider { get { return this; } }
public unsafe void FrameAdvance(bool render)
{
//if (render == false) return;
cFrameAdvance();
fixed (int* vidbuf = &videoBuffer[0])
cUpdateVideoBuffer(new IntPtr(vidbuf));
}
public ControllerDefinition ControllerDefinition { get { return NullController; } }
public IController Controller { get; set; }
public int Frame { get; set; }
public int LagCount { get { return 0; } set { return; } }
public bool IsLagFrame { get { return false; } }
public byte[] SaveRam { get { return new byte[0]; } }
public bool DeterministicEmulation { get; set; }
public bool SaveRamModified { get; set; }
public void SaveStateText(TextWriter writer) { }
public void LoadStateText(TextReader reader) { }
public void SaveStateBinary(BinaryWriter writer) { }
public void LoadStateBinary(BinaryReader reader) { }
public byte[] SaveStateBinary() { return new byte[1]; }
public void GetSamples(short[] samples) { }
public void DiscardSamples() { }
public int MaxVolume { get; set; }
private IList<MemoryDomain> memoryDomains;
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
public void Dispose() { }
}
}

View File

@ -1,103 +0,0 @@
////////////////////////////
//we can't use these because we need more clever control over the delegate type (marshalling attributes, for one thing)
Delegate MyMakeDelegate(string methodName)
{
MethodInfo mi = GetType().GetMethod(methodName,BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
var parameters = mi.GetParameters()
.Select(p => p.ParameterType)
.ToArray();
Type t = DelegateCreator.MakeNewCustomDelegate(mi.ReturnType, parameters);
return Delegate.CreateDelegate(t, this, mi);
}
static class DelegateCreator
{
public static Type MakeNewCustomDelegate(Type ret_type, Type[] argtypes)
{
var _DelegateCtorSignature = new Type[] { typeof(object), typeof(IntPtr) };
Type returnType = ret_type;
Type[] parameterTypes = argtypes;
TypeBuilder builder = DefineDelegateType("Delegate" + argtypes.Length);
builder.DefineConstructor(MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(MethodImplAttributes.CodeTypeMask);
builder.DefineMethod("Invoke", MethodAttributes.VtableLayoutMask | MethodAttributes.HideBySig | MethodAttributes.Virtual | MethodAttributes.Public, returnType, parameterTypes).SetImplementationFlags(MethodImplAttributes.CodeTypeMask);
//[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
//builder.SetCustomAttribute(new CustomAttributeBuilder(new ConstructorInfo(
ConstructorInfo ci = typeof(UnmanagedFunctionPointerAttribute).GetConstructor(new[] { typeof(CallingConvention) });
CustomAttributeBuilder cab = new CustomAttributeBuilder(ci, new object[] { CallingConvention.ThisCall });
builder.SetCustomAttribute(cab);
return builder.CreateType();
}
internal static TypeBuilder DefineDelegateType(string name)
{
return DefineType(name, typeof(MulticastDelegate), TypeAttributes.AutoClass | TypeAttributes.Sealed | TypeAttributes.Public);
}
static int _index;
private static TypeBuilder DefineType(string name, Type parent, TypeAttributes attr)
{
StringBuilder builder = new StringBuilder(name);
int num = Interlocked.Increment(ref _index);
builder.Append("$");
builder.Append(num);
builder.Replace('+', '_').Replace('[', '_').Replace(']', '_').Replace('*', '_').Replace('&', '_').Replace(',', '_').Replace('\\', '_');
name = builder.ToString();
return _myModule.DefineType(name, attr, parent);
}
static AssemblyBuilder _myAssembly;
static ModuleBuilder _myModule;
static void InitializeAssemblyGen()
{
AssemblyName name = new AssemblyName("Snippets");
CustomAttributeBuilder[] assemblyAttributes = new CustomAttributeBuilder[] { new CustomAttributeBuilder(typeof(SecurityTransparentAttribute).GetConstructor(Type.EmptyTypes), new object[0]) };
_myAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run, assemblyAttributes);
_myModule = _myAssembly.DefineDynamicModule(name.Name, false);
_myAssembly.DefineVersionInfoResource();
}
static DelegateCreator()
{
InitializeAssemblyGen();
}
}
////////////////
these are members of external core. theyre deprecated.
public IntPtr Signal(string param, IntPtr value)
{
return mAccessor.Signal(null, IntPtr.Zero, param, value);
}
public IntPtr Signal(string param)
{
return mAccessor.Signal(null, IntPtr.Zero, param, IntPtr.Zero);
}
public IntPtr Signal(string type, IntPtr obj, string param, Delegate value)
{
liveDelegates[value.Target ?? ostatic][param] = value;
return mAccessor.Signal(type, obj, param, Marshal.GetFunctionPointerForDelegate(value));
}
public IntPtr Signal(string param, Delegate value)
{
return Signal(null, IntPtr.Zero, param, value);
}
public IntPtr Signal(string param, int value)
{
return mAccessor.Signal(null, IntPtr.Zero, param, new IntPtr(value));
}
public IntPtr Signal(string type, IntPtr obj, string param, IntPtr value)
{
return mAccessor.Signal(type, obj, param, value);
}

View File

@ -1,672 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
#pragma warning disable 649, 169
using BizHawk.Common;
namespace BizHawk.Emulation.Cores
{
/// <summary>
/// libretro related shims
/// </summary>
public class LibRetro : IDisposable
{
public const int RETRO_API_VERSION = 1;
public enum RETRO_ROTATION
{
ROTATION_0_CCW = 0,
ROTATION_90_CCW = 1,
ROTATION_180_CCW = 2,
ROTATION_270_CCW = 3,
}
public enum RETRO_DEVICE
{
NONE = 0,
JOYPAD = 1,
MOUSE = 2,
KEYBOARD = 3,
LIGHTGUN = 4,
ANALOG = 5,
POINTER = 6,
SENSOR_ACCELEROMETER = 7
};
public enum RETRO_DEVICE_ID_JOYPAD
{
B = 0,
Y = 1,
SELECT = 2,
START = 3,
UP = 4,
DOWN = 5,
LEFT = 6,
RIGHT = 7,
A = 8,
X = 9,
L = 10,
R = 11,
L2 = 12,
R2 = 13,
L3 = 14,
R3 = 15
};
public enum RETRO_LOG_LEVEL : int //exact type size is unclear
{
DEBUG = 0,
INFO,
WARN,
ERROR,
DUMMY = Int32.MaxValue
};
public enum RETRO_DEVICE_ID_ANALOG
{
// LEFT / RIGHT?
X = 0,
Y = 1
};
public enum RETRO_DEVICE_ID_MOUSE
{
X = 0,
Y = 1,
LEFT = 2,
RIGHT = 3
};
public enum RETRO_DEVICE_ID_LIGHTGUN
{
X = 0,
Y = 1,
TRIGGER = 2,
CURSOR = 3,
TURBO = 4,
PAUSE = 5,
START = 6
};
public enum RETRO_DEVICE_ID_POINTER
{
X = 0,
Y = 1,
PRESSED = 2
};
public enum RETRO_DEVICE_ID_SENSOR_ACCELEROMETER
{
X = 0,
Y = 1,
Z = 2
};
public enum RETRO_REGION
{
NTSC = 0,
PAL = 1
};
public enum RETRO_MEMORY
{
SAVE_RAM = 0,
RTC = 1,
SYSTEM_RAM = 2,
VIDEO_RAM = 3,
};
public enum RETRO_KEY
{
UNKNOWN = 0,
FIRST = 0,
BACKSPACE = 8,
TAB = 9,
CLEAR = 12,
RETURN = 13,
PAUSE = 19,
ESCAPE = 27,
SPACE = 32,
EXCLAIM = 33,
QUOTEDBL = 34,
HASH = 35,
DOLLAR = 36,
AMPERSAND = 38,
QUOTE = 39,
LEFTPAREN = 40,
RIGHTPAREN = 41,
ASTERISK = 42,
PLUS = 43,
COMMA = 44,
MINUS = 45,
PERIOD = 46,
SLASH = 47,
_0 = 48,
_1 = 49,
_2 = 50,
_3 = 51,
_4 = 52,
_5 = 53,
_6 = 54,
_7 = 55,
_8 = 56,
_9 = 57,
COLON = 58,
SEMICOLON = 59,
LESS = 60,
EQUALS = 61,
GREATER = 62,
QUESTION = 63,
AT = 64,
LEFTBRACKET = 91,
BACKSLASH = 92,
RIGHTBRACKET = 93,
CARET = 94,
UNDERSCORE = 95,
BACKQUOTE = 96,
a = 97,
b = 98,
c = 99,
d = 100,
e = 101,
f = 102,
g = 103,
h = 104,
i = 105,
j = 106,
k = 107,
l = 108,
m = 109,
n = 110,
o = 111,
p = 112,
q = 113,
r = 114,
s = 115,
t = 116,
u = 117,
v = 118,
w = 119,
x = 120,
y = 121,
z = 122,
DELETE = 127,
KP0 = 256,
KP1 = 257,
KP2 = 258,
KP3 = 259,
KP4 = 260,
KP5 = 261,
KP6 = 262,
KP7 = 263,
KP8 = 264,
KP9 = 265,
KP_PERIOD = 266,
KP_DIVIDE = 267,
KP_MULTIPLY = 268,
KP_MINUS = 269,
KP_PLUS = 270,
KP_ENTER = 271,
KP_EQUALS = 272,
UP = 273,
DOWN = 274,
RIGHT = 275,
LEFT = 276,
INSERT = 277,
HOME = 278,
END = 279,
PAGEUP = 280,
PAGEDOWN = 281,
F1 = 282,
F2 = 283,
F3 = 284,
F4 = 285,
F5 = 286,
F6 = 287,
F7 = 288,
F8 = 289,
F9 = 290,
F10 = 291,
F11 = 292,
F12 = 293,
F13 = 294,
F14 = 295,
F15 = 296,
NUMLOCK = 300,
CAPSLOCK = 301,
SCROLLOCK = 302,
RSHIFT = 303,
LSHIFT = 304,
RCTRL = 305,
LCTRL = 306,
RALT = 307,
LALT = 308,
RMETA = 309,
LMETA = 310,
LSUPER = 311,
RSUPER = 312,
MODE = 313,
COMPOSE = 314,
HELP = 315,
PRINT = 316,
SYSREQ = 317,
BREAK = 318,
MENU = 319,
POWER = 320,
EURO = 321,
UNDO = 322,
LAST
};
[Flags]
public enum RETRO_MOD
{
NONE = 0,
SHIFT = 1,
CTRL = 2,
ALT = 4,
META = 8,
NUMLOCK = 16,
CAPSLOCK = 32,
SCROLLLOCK = 64
};
[Flags]
public enum RETRO_SIMD
{
SSE = (1 << 0),
SSE2 = (1 << 1),
VMX = (1 << 2),
VMX128 = (1 << 3),
AVX = (1 << 4),
NEON = (1 << 5),
SSE3 = (1 << 6),
SSSE3 = (1 << 7),
MMX = (1 << 8),
MMXEXT = (1 << 9),
SSE4 = (1 << 10),
SSE42 = (1 << 11),
AVX2 = (1 << 12),
VFPU = (1 << 13),
PS = (1 << 14),
AES = (1 << 15),
VFPV3 = (1 << 16),
VFPV4 = (1 << 17),
}
public enum RETRO_ENVIRONMENT
{
SET_ROTATION = 1,
GET_OVERSCAN = 2,
GET_CAN_DUPE = 3,
SET_MESSAGE = 6,
SHUTDOWN = 7,
SET_PERFORMANCE_LEVEL = 8,
GET_SYSTEM_DIRECTORY = 9,
SET_PIXEL_FORMAT = 10,
SET_INPUT_DESCRIPTORS = 11,
SET_KEYBOARD_CALLBACK = 12,
SET_DISK_CONTROL_INTERFACE = 13,
SET_HW_RENDER = 14,
GET_VARIABLE = 15,
SET_VARIABLES = 16,
GET_VARIABLE_UPDATE = 17,
SET_SUPPORT_NO_GAME = 18,
GET_LIBRETRO_PATH = 19,
SET_AUDIO_CALLBACK = 22,
SET_FRAME_TIME_CALLBACK = 21,
GET_RUMBLE_INTERFACE = 23,
GET_INPUT_DEVICE_CAPABILITIES = 24,
//25,26 are experimental
GET_LOG_INTERFACE = 27,
GET_PERF_INTERFACE = 28,
GET_LOCATION_INTERFACE = 29,
GET_CORE_ASSETS_DIRECTORY = 30,
GET_SAVE_DIRECTORY = 31,
SET_SYSTEM_AV_INFO = 32,
SET_PROC_ADDRESS_CALLBACK = 33,
SET_SUBSYSTEM_INFO = 34,
SET_CONTROLLER_INFO = 35,
SET_MEMORY_MAPS = 36 | EXPERIMENTAL,
SET_GEOMETRY = 37,
GET_USERNAME = 38,
GET_LANGUAGE = 39,
EXPERIMENTAL = 0x10000
};
public enum retro_hw_context_type
{
RETRO_HW_CONTEXT_NONE = 0,
RETRO_HW_CONTEXT_OPENGL = 1,
RETRO_HW_CONTEXT_OPENGLES2 = 2,
RETRO_HW_CONTEXT_OPENGL_CORE = 3,
RETRO_HW_CONTEXT_OPENGLES3 = 4,
RETRO_HW_CONTEXT_OPENGLES_VERSION = 5,
RETRO_HW_CONTEXT_DUMMY = Int32.MaxValue
};
public struct retro_hw_render_callback
{
public uint context_type; //retro_hw_context_type
public IntPtr context_reset; //retro_hw_context_reset_t
public IntPtr get_current_framebuffer; //retro_hw_get_current_framebuffer_t
public IntPtr get_proc_address; //retro_hw_get_proc_address_t
[MarshalAs(UnmanagedType.U1)] public byte depth;
[MarshalAs(UnmanagedType.U1)] public bool stencil;
[MarshalAs(UnmanagedType.U1)] public bool bottom_left_origin;
public uint version_major;
public uint version_minor;
[MarshalAs(UnmanagedType.U1)] public bool cache_context;
public IntPtr context_destroy; //retro_hw_context_reset_t
[MarshalAs(UnmanagedType.U1)] public bool debug_context;
};
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate long retro_hw_context_reset_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IntPtr retro_hw_get_current_framebuffer_t();
//not used
//[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
//public delegate void retro_proc_address_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IntPtr retro_hw_get_proc_address_t(string sym);
struct retro_memory_map
{
public IntPtr descriptors; //retro_memory_descriptor *
public uint num_descriptors;
};
struct retro_memory_descriptor
{
ulong flags;
IntPtr ptr;
IntPtr offset; //size_t
IntPtr start; //size_t
IntPtr select; //size_t
IntPtr disconnect; //size_t
IntPtr len; //size_t
string addrspace;
};
public enum RETRO_PIXEL_FORMAT
{
XRGB1555 = 0,
XRGB8888 = 1,
RGB565 = 2
};
public struct retro_message
{
public string msg;
public uint frames;
}
public struct retro_input_descriptor
{
public uint port;
public uint device;
public uint index;
public uint id;
}
public struct retro_system_info
{
public string library_name;
public string library_version;
public string valid_extensions;
[MarshalAs(UnmanagedType.U1)]
public bool need_fullpath;
[MarshalAs(UnmanagedType.U1)]
public bool block_extract;
}
public struct retro_game_geometry
{
public uint base_width;
public uint base_height;
public uint max_width;
public uint max_height;
public float aspect_ratio;
}
public struct retro_system_timing
{
public double fps;
public double sample_rate;
}
public struct retro_system_av_info
{
public retro_game_geometry geometry;
public retro_system_timing timing;
}
public struct retro_variable
{
public string key;
public string value;
}
public struct retro_game_info
{
public string path;
public IntPtr data;
public uint size;
public string meta;
}
//untested
public struct retro_perf_counter
{
public string ident;
public ulong start;
public ulong total;
public ulong call_cnt;
[MarshalAs(UnmanagedType.U1)]
public bool registered;
};
//perf callbacks
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate long retro_perf_get_time_usec_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate long retro_perf_get_counter_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate ulong retro_get_cpu_features_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_perf_log_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_perf_register_t(ref retro_perf_counter counter);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_perf_start_t(ref retro_perf_counter counter);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_perf_stop_t(ref retro_perf_counter counter);
//for GET_PERF_INTERFACE
public struct retro_perf_callback
{
public retro_perf_get_time_usec_t get_time_usec;
public retro_get_cpu_features_t get_cpu_features;
public retro_perf_get_counter_t get_perf_counter;
public retro_perf_register_t perf_register;
public retro_perf_start_t perf_start;
public retro_perf_stop_t perf_stop;
public retro_perf_log_t perf_log;
}
#region callback prototypes
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate void retro_log_printf_t(RETRO_LOG_LEVEL level, string fmt, IntPtr a0, IntPtr a1, IntPtr a2, IntPtr a3, IntPtr a4, IntPtr a5, IntPtr a6, IntPtr a7, IntPtr a8, IntPtr a9, IntPtr a10, IntPtr a11, IntPtr a12, IntPtr a13, IntPtr a14, IntPtr a15);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return:MarshalAs(UnmanagedType.U1)]
public delegate bool retro_environment_t(RETRO_ENVIRONMENT cmd, IntPtr data);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_video_refresh_t(IntPtr data, uint width, uint height, uint pitch);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_audio_sample_t(short left, short right);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate uint retro_audio_sample_batch_t(IntPtr data, uint frames);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void retro_input_poll_t();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate short retro_input_state_t(uint port, uint device, uint index, uint id);
#endregion
#region entry point prototypes
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_environment(retro_environment_t cb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_video_refresh(retro_video_refresh_t cb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_audio_sample(retro_audio_sample_t cb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_audio_sample_batch(retro_audio_sample_batch_t cb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_input_poll(retro_input_poll_t cb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_input_state(retro_input_state_t cb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_init();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_deinit();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate uint epretro_api_version();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_get_system_info(ref retro_system_info info);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_get_system_av_info(ref retro_system_av_info info);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_set_controller_port_device(uint port, uint device);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_reset();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_run();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate uint epretro_serialize_size();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public delegate bool epretro_serialize(IntPtr data, uint size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public delegate bool epretro_unserialize(IntPtr data, uint size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_cheat_reset();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_cheat_set(uint index, [MarshalAs(UnmanagedType.U1)]bool enabled, string code);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public delegate bool epretro_load_game(ref retro_game_info game);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public delegate bool epretro_load_game_special(uint game_type, ref retro_game_info info, uint num_info);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void epretro_unload_game();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate uint epretro_get_region();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IntPtr epretro_get_memory_data(RETRO_MEMORY id);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate uint epretro_get_memory_size(RETRO_MEMORY id);
#endregion
#region entry points
// these are all hooked up by reflection on dll load
public epretro_set_environment retro_set_environment;
public epretro_set_video_refresh retro_set_video_refresh;
public epretro_set_audio_sample retro_set_audio_sample;
public epretro_set_audio_sample_batch retro_set_audio_sample_batch;
public epretro_set_input_poll retro_set_input_poll;
public epretro_set_input_state retro_set_input_state;
public epretro_init retro_init;
/// <summary>
/// Dispose() calls this, so you shouldn't
/// </summary>
public epretro_deinit retro_deinit;
public epretro_api_version retro_api_version;
public epretro_get_system_info retro_get_system_info;
public epretro_get_system_av_info retro_get_system_av_info;
public epretro_set_controller_port_device retro_set_controller_port_device;
public epretro_reset retro_reset;
public epretro_run retro_run;
public epretro_serialize_size retro_serialize_size;
public epretro_serialize retro_serialize;
public epretro_unserialize retro_unserialize;
public epretro_cheat_reset retro_cheat_reset;
public epretro_cheat_set retro_cheat_set;
public epretro_load_game retro_load_game;
public epretro_load_game_special retro_load_game_special;
public epretro_unload_game retro_unload_game;
public epretro_get_region retro_get_region;
public epretro_get_memory_data retro_get_memory_data;
public epretro_get_memory_size retro_get_memory_size;
#endregion
public void Dispose()
{
dll.Dispose();
}
InstanceDll dll;
public LibRetro(string modulename)
{
dll = new InstanceDll(modulename);
if (!ConnectAllEntryPoints())
{
dll.Dispose();
throw new Exception("ConnectAllEntryPoints() failed. The console may contain more details.");
}
}
private static IEnumerable<FieldInfo> GetAllEntryPoints()
{
return typeof(LibRetro).GetFields().Where((field) => field.FieldType.Name.StartsWith("epretro"));
}
private void ClearAllEntryPoints()
{
foreach (var field in GetAllEntryPoints())
{
field.SetValue(this, null);
}
}
private bool ConnectAllEntryPoints()
{
bool succeed = true;
foreach (var field in GetAllEntryPoints())
{
string fieldname = field.Name;
IntPtr entry = dll.GetProcAddress(fieldname);
if (entry != IntPtr.Zero)
{
field.SetValue(this, Marshal.GetDelegateForFunctionPointer(entry, field.FieldType));
}
else
{
Console.WriteLine("Couldn't bind libretro entry point {0}", fieldname);
succeed = false;
}
}
return succeed;
}
}
}

View File

@ -1,219 +0,0 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using Newtonsoft.Json;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Common.BufferExtensions;
namespace BizHawk.Emulation.Cores
{
partial class LibRetroEmulator
{
//meanings (they are kind of hazy, but once we're done implementing this it will be completely defined by example)
//port = console physical port?
//device = logical device type
//index = sub device index? (multitap?)
//id = button id (or key id)
short retro_input_state(uint port, uint device, uint index, uint id)
{
//helpful debugging
//Console.WriteLine("{0} {1} {2} {3}", port, device, index, id);
switch ((LibRetro.RETRO_DEVICE)device)
{
case LibRetro.RETRO_DEVICE.POINTER:
{
switch ((LibRetro.RETRO_DEVICE_ID_POINTER)id)
{
case LibRetro.RETRO_DEVICE_ID_POINTER.X: return (short)Controller.GetFloat("Pointer X");
case LibRetro.RETRO_DEVICE_ID_POINTER.Y: return (short)Controller.GetFloat("Pointer Y");
case LibRetro.RETRO_DEVICE_ID_POINTER.PRESSED: return (short)(Controller.IsPressed("Pointer Pressed") ? 1 : 0);
}
return 0;
}
case LibRetro.RETRO_DEVICE.KEYBOARD:
{
string button = "";
switch ((LibRetro.RETRO_KEY)id)
{
case LibRetro.RETRO_KEY.BACKSPACE: button = "Backspace"; break;
case LibRetro.RETRO_KEY.TAB: button = "Tab"; break;
case LibRetro.RETRO_KEY.CLEAR: button = "Clear"; break;
case LibRetro.RETRO_KEY.RETURN: button = "Return"; break;
case LibRetro.RETRO_KEY.PAUSE: button = "Pause"; break;
case LibRetro.RETRO_KEY.ESCAPE: button = "Escape"; break;
case LibRetro.RETRO_KEY.SPACE: button = "Space"; break;
case LibRetro.RETRO_KEY.EXCLAIM: button = "Exclaim"; break;
case LibRetro.RETRO_KEY.QUOTEDBL: button = "QuoteDbl"; break;
case LibRetro.RETRO_KEY.HASH: button = "Hash"; break;
case LibRetro.RETRO_KEY.DOLLAR: button = "Dollar"; break;
case LibRetro.RETRO_KEY.AMPERSAND: button = "Ampersand"; break;
case LibRetro.RETRO_KEY.QUOTE: button = "Quote"; break;
case LibRetro.RETRO_KEY.LEFTPAREN: button = "LeftParen"; break;
case LibRetro.RETRO_KEY.RIGHTPAREN: button = "RightParen"; break;
case LibRetro.RETRO_KEY.ASTERISK: button = "Asterisk"; break;
case LibRetro.RETRO_KEY.PLUS: button = "Plus"; break;
case LibRetro.RETRO_KEY.COMMA: button = "Comma"; break;
case LibRetro.RETRO_KEY.MINUS: button = "Minus"; break;
case LibRetro.RETRO_KEY.PERIOD: button = "Period"; break;
case LibRetro.RETRO_KEY.SLASH: button = "Slash"; break;
case LibRetro.RETRO_KEY._0: button = "0"; break;
case LibRetro.RETRO_KEY._1: button = "1"; break;
case LibRetro.RETRO_KEY._2: button = "2"; break;
case LibRetro.RETRO_KEY._3: button = "3"; break;
case LibRetro.RETRO_KEY._4: button = "4"; break;
case LibRetro.RETRO_KEY._5: button = "5"; break;
case LibRetro.RETRO_KEY._6: button = "6"; break;
case LibRetro.RETRO_KEY._7: button = "7"; break;
case LibRetro.RETRO_KEY._8: button = "8"; break;
case LibRetro.RETRO_KEY._9: button = "9"; break;
case LibRetro.RETRO_KEY.COLON: button = "Colon"; break;
case LibRetro.RETRO_KEY.SEMICOLON: button = "Semicolon"; break;
case LibRetro.RETRO_KEY.LESS: button = "Less"; break;
case LibRetro.RETRO_KEY.EQUALS: button = "Equals"; break;
case LibRetro.RETRO_KEY.GREATER: button = "Greater"; break;
case LibRetro.RETRO_KEY.QUESTION: button = "Question"; break;
case LibRetro.RETRO_KEY.AT: button = "At"; break;
case LibRetro.RETRO_KEY.LEFTBRACKET: button = "LeftBracket"; break;
case LibRetro.RETRO_KEY.BACKSLASH: button = "Backslash"; break;
case LibRetro.RETRO_KEY.RIGHTBRACKET: button = "RightBracket"; break;
case LibRetro.RETRO_KEY.CARET: button = "Caret"; break;
case LibRetro.RETRO_KEY.UNDERSCORE: button = "Underscore"; break;
case LibRetro.RETRO_KEY.BACKQUOTE: button = "Backquote"; break;
case LibRetro.RETRO_KEY.a: button = "A"; break;
case LibRetro.RETRO_KEY.b: button = "B"; break;
case LibRetro.RETRO_KEY.c: button = "C"; break;
case LibRetro.RETRO_KEY.d: button = "D"; break;
case LibRetro.RETRO_KEY.e: button = "E"; break;
case LibRetro.RETRO_KEY.f: button = "F"; break;
case LibRetro.RETRO_KEY.g: button = "G"; break;
case LibRetro.RETRO_KEY.h: button = "H"; break;
case LibRetro.RETRO_KEY.i: button = "I"; break;
case LibRetro.RETRO_KEY.j: button = "J"; break;
case LibRetro.RETRO_KEY.k: button = "K"; break;
case LibRetro.RETRO_KEY.l: button = "L"; break;
case LibRetro.RETRO_KEY.m: button = "M"; break;
case LibRetro.RETRO_KEY.n: button = "N"; break;
case LibRetro.RETRO_KEY.o: button = "O"; break;
case LibRetro.RETRO_KEY.p: button = "P"; break;
case LibRetro.RETRO_KEY.q: button = "Q"; break;
case LibRetro.RETRO_KEY.r: button = "R"; break;
case LibRetro.RETRO_KEY.s: button = "S"; break;
case LibRetro.RETRO_KEY.t: button = "T"; break;
case LibRetro.RETRO_KEY.u: button = "U"; break;
case LibRetro.RETRO_KEY.v: button = "V"; break;
case LibRetro.RETRO_KEY.w: button = "W"; break;
case LibRetro.RETRO_KEY.x: button = "X"; break;
case LibRetro.RETRO_KEY.y: button = "Y"; break;
case LibRetro.RETRO_KEY.z: button = "Z"; break;
case LibRetro.RETRO_KEY.DELETE: button = "Delete"; break;
case LibRetro.RETRO_KEY.KP0: button = "KP0"; break;
case LibRetro.RETRO_KEY.KP1: button = "KP1"; break;
case LibRetro.RETRO_KEY.KP2: button = "KP2"; break;
case LibRetro.RETRO_KEY.KP3: button = "KP3"; break;
case LibRetro.RETRO_KEY.KP4: button = "KP4"; break;
case LibRetro.RETRO_KEY.KP5: button = "KP5"; break;
case LibRetro.RETRO_KEY.KP6: button = "KP6"; break;
case LibRetro.RETRO_KEY.KP7: button = "KP7"; break;
case LibRetro.RETRO_KEY.KP8: button = "KP8"; break;
case LibRetro.RETRO_KEY.KP9: button = "KP9"; break;
case LibRetro.RETRO_KEY.KP_PERIOD: button = "KP_Period"; break;
case LibRetro.RETRO_KEY.KP_DIVIDE: button = "KP_Divide"; break;
case LibRetro.RETRO_KEY.KP_MULTIPLY: button = "KP_Multiply"; break;
case LibRetro.RETRO_KEY.KP_MINUS: button = "KP_Minus"; break;
case LibRetro.RETRO_KEY.KP_PLUS: button = "KP_Plus"; break;
case LibRetro.RETRO_KEY.KP_ENTER: button = "KP_Enter"; break;
case LibRetro.RETRO_KEY.KP_EQUALS: button = "KP_Equals"; break;
case LibRetro.RETRO_KEY.UP: button = "Up"; break;
case LibRetro.RETRO_KEY.DOWN: button = "Down"; break;
case LibRetro.RETRO_KEY.RIGHT: button = "Right"; break;
case LibRetro.RETRO_KEY.LEFT: button = "Left"; break;
case LibRetro.RETRO_KEY.INSERT: button = "Insert"; break;
case LibRetro.RETRO_KEY.HOME: button = "Home"; break;
case LibRetro.RETRO_KEY.END: button = "End"; break;
case LibRetro.RETRO_KEY.PAGEUP: button = "PageUp"; break;
case LibRetro.RETRO_KEY.PAGEDOWN: button = "PageDown"; break;
case LibRetro.RETRO_KEY.F1: button = "F1"; break;
case LibRetro.RETRO_KEY.F2: button = "F2"; break;
case LibRetro.RETRO_KEY.F3: button = "F3"; break;
case LibRetro.RETRO_KEY.F4: button = "F4"; break;
case LibRetro.RETRO_KEY.F5: button = "F5"; break;
case LibRetro.RETRO_KEY.F6: button = "F6"; break;
case LibRetro.RETRO_KEY.F7: button = "F7"; break;
case LibRetro.RETRO_KEY.F8: button = "F8"; break;
case LibRetro.RETRO_KEY.F9: button = "F9"; break;
case LibRetro.RETRO_KEY.F10: button = "F10"; break;
case LibRetro.RETRO_KEY.F11: button = "F11"; break;
case LibRetro.RETRO_KEY.F12: button = "F12"; break;
case LibRetro.RETRO_KEY.F13: button = "F13"; break;
case LibRetro.RETRO_KEY.F14: button = "F14"; break;
case LibRetro.RETRO_KEY.F15: button = "F15"; break;
case LibRetro.RETRO_KEY.NUMLOCK: button = "NumLock"; break;
case LibRetro.RETRO_KEY.CAPSLOCK: button = "CapsLock"; break;
case LibRetro.RETRO_KEY.SCROLLOCK: button = "ScrollLock"; break;
case LibRetro.RETRO_KEY.RSHIFT: button = "RShift"; break;
case LibRetro.RETRO_KEY.LSHIFT: button = "LShift"; break;
case LibRetro.RETRO_KEY.RCTRL: button = "RCtrl"; break;
case LibRetro.RETRO_KEY.LCTRL: button = "LCtrl"; break;
case LibRetro.RETRO_KEY.RALT: button = "RAlt"; break;
case LibRetro.RETRO_KEY.LALT: button = "LAlt"; break;
case LibRetro.RETRO_KEY.RMETA: button = "RMeta"; break;
case LibRetro.RETRO_KEY.LMETA: button = "LMeta"; break;
case LibRetro.RETRO_KEY.LSUPER: button = "LSuper"; break;
case LibRetro.RETRO_KEY.RSUPER: button = "RSuper"; break;
case LibRetro.RETRO_KEY.MODE: button = "Mode"; break;
case LibRetro.RETRO_KEY.COMPOSE: button = "Compose"; break;
case LibRetro.RETRO_KEY.HELP: button = "Help"; break;
case LibRetro.RETRO_KEY.PRINT: button = "Print"; break;
case LibRetro.RETRO_KEY.SYSREQ: button = "SysReq"; break;
case LibRetro.RETRO_KEY.BREAK: button = "Break"; break;
case LibRetro.RETRO_KEY.MENU: button = "Menu"; break;
case LibRetro.RETRO_KEY.POWER: button = "Power"; break;
case LibRetro.RETRO_KEY.EURO: button = "Euro"; break;
case LibRetro.RETRO_KEY.UNDO: button = "Undo"; break;
}
return (short)(Controller.IsPressed("Key " + button) ? 1 : 0);
}
case LibRetro.RETRO_DEVICE.JOYPAD:
{
//The JOYPAD is sometimes called RetroPad (and we'll call it that in user-facing stuff cos retroarch does)
//It is essentially a Super Nintendo controller, but with additional L2/R2/L3/R3 buttons, similar to a PS1 DualShock.
string button = "";
switch ((LibRetro.RETRO_DEVICE_ID_JOYPAD)id)
{
case LibRetro.RETRO_DEVICE_ID_JOYPAD.A: button = "A"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.B: button = "B"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.X: button = "X"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.Y: button = "Y"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.UP: button = "Up"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.DOWN: button = "Down"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.LEFT: button = "Left"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.RIGHT: button = "Right"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.L: button = "L"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.R: button = "R"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.SELECT: button = "Select"; break;
case LibRetro.RETRO_DEVICE_ID_JOYPAD.START: button = "Start"; break;
}
return (short)(GetButton(port+1, "RetroPad", button) ? 1 : 0);
}
default:
return 0;
}
}
}
}

View File

@ -1,954 +0,0 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using Newtonsoft.Json;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Common.BufferExtensions;
namespace BizHawk.Emulation.Cores
{
[CoreAttributes("Libretro", "natt&zeromus")]
public unsafe partial class LibRetroEmulator : IEmulator, ISettable<LibRetroEmulator.Settings, LibRetroEmulator.SyncSettings>,
ISaveRam, IStatable, IVideoProvider, IInputPollable
{
#region Settings
Settings _Settings = new Settings();
SyncSettings _SyncSettings;
public class SyncSettings
{
public SyncSettings Clone()
{
return JsonConvert.DeserializeObject<SyncSettings>(JsonConvert.SerializeObject(this));
}
public SyncSettings()
{
}
}
public class Settings
{
public void Validate()
{
}
public Settings()
{
SettingsUtil.SetDefaultValues(this);
}
public Settings Clone()
{
return (Settings)MemberwiseClone();
}
}
public Settings GetSettings()
{
return _Settings.Clone();
}
public SyncSettings GetSyncSettings()
{
return _SyncSettings.Clone();
}
public bool PutSettings(Settings o)
{
_Settings.Validate();
_Settings = o;
//TODO - store settings into core? or we can just keep doing it before frameadvance
return false;
}
public bool PutSyncSettings(SyncSettings o)
{
bool reboot = false;
//we could do it this way roughly if we need to
//if(JsonConvert.SerializeObject(o.FIOConfig) != JsonConvert.SerializeObject(_SyncSettings.FIOConfig)
_SyncSettings = o;
return reboot;
}
#endregion
#region callbacks
unsafe void retro_log_printf(LibRetro.RETRO_LOG_LEVEL level, string fmt, IntPtr a0, IntPtr a1, IntPtr a2, IntPtr a3, IntPtr a4, IntPtr a5, IntPtr a6, IntPtr a7, IntPtr a8, IntPtr a9, IntPtr a10, IntPtr a11, IntPtr a12, IntPtr a13, IntPtr a14, IntPtr a15)
{
//avert your eyes, these things were not meant to be seen in c#
//I'm not sure this is a great idea. It would suck for silly logging to be unstable. But.. I dont think this is unstable. The sprintf might just print some garbledy stuff.
var args = new IntPtr[] { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 };
int idx = 0;
Console.Write(Sprintf.sprintf(fmt, () => args[idx++]));
}
unsafe bool retro_environment(LibRetro.RETRO_ENVIRONMENT cmd, IntPtr data)
{
Console.WriteLine(cmd);
switch (cmd)
{
case LibRetro.RETRO_ENVIRONMENT.SET_ROTATION:
{
var rotation = (LibRetro.RETRO_ROTATION)(*(int*)data.ToPointer());
if (rotation == LibRetro.RETRO_ROTATION.ROTATION_0_CCW) environmentInfo.Rotation_CCW = 0;
if (rotation == LibRetro.RETRO_ROTATION.ROTATION_90_CCW) environmentInfo.Rotation_CCW = 90;
if (rotation == LibRetro.RETRO_ROTATION.ROTATION_180_CCW) environmentInfo.Rotation_CCW = 180;
if (rotation == LibRetro.RETRO_ROTATION.ROTATION_270_CCW) environmentInfo.Rotation_CCW = 270;
return true;
}
case LibRetro.RETRO_ENVIRONMENT.GET_OVERSCAN:
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_CAN_DUPE:
//gambatte requires this
*(bool*)data.ToPointer() = true;
return true;
case LibRetro.RETRO_ENVIRONMENT.SET_MESSAGE:
{
LibRetro.retro_message msg = new LibRetro.retro_message();
Marshal.PtrToStructure(data, msg);
if (!string.IsNullOrEmpty(msg.msg))
Console.WriteLine("LibRetro Message: {0}", msg.msg);
return true;
}
case LibRetro.RETRO_ENVIRONMENT.SHUTDOWN:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_PERFORMANCE_LEVEL:
Console.WriteLine("Core suggested SET_PERFORMANCE_LEVEL {0}", *(uint*)data.ToPointer());
return true;
case LibRetro.RETRO_ENVIRONMENT.GET_SYSTEM_DIRECTORY:
//mednafen NGP neopop fails to launch with no system directory
Directory.CreateDirectory(SystemDirectory); //just to be safe, it seems likely that cores will crash without a created system directory
Console.WriteLine("returning system directory: " + SystemDirectory);
*((IntPtr*)data.ToPointer()) = SystemDirectoryAtom;
return true;
case LibRetro.RETRO_ENVIRONMENT.SET_PIXEL_FORMAT:
{
LibRetro.RETRO_PIXEL_FORMAT fmt = 0;
int[] tmp = new int[1];
Marshal.Copy(data, tmp, 0, 1);
fmt = (LibRetro.RETRO_PIXEL_FORMAT)tmp[0];
switch (fmt)
{
case LibRetro.RETRO_PIXEL_FORMAT.RGB565:
case LibRetro.RETRO_PIXEL_FORMAT.XRGB1555:
case LibRetro.RETRO_PIXEL_FORMAT.XRGB8888:
pixelfmt = fmt;
Console.WriteLine("New pixel format set: {0}", pixelfmt);
return true;
default:
Console.WriteLine("Unrecognized pixel format: {0}", (int)pixelfmt);
return false;
}
}
case LibRetro.RETRO_ENVIRONMENT.SET_INPUT_DESCRIPTORS:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_KEYBOARD_CALLBACK:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_DISK_CONTROL_INTERFACE:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_HW_RENDER:
{
//mupen64plus needs this, as well as 3dengine
LibRetro.retro_hw_render_callback* info = (LibRetro.retro_hw_render_callback*)data.ToPointer();
Console.WriteLine("SET_HW_RENDER: {0}, version={1}.{2}, dbg/cache={3}/{4}, depth/stencil = {5}/{6}{7}", info->context_type, info->version_minor, info->version_major, info->debug_context, info->cache_context, info->depth, info->stencil, info->bottom_left_origin ? " (bottomleft)" : "");
return true;
}
case LibRetro.RETRO_ENVIRONMENT.GET_VARIABLE:
{
void** variables = (void**)data.ToPointer();
IntPtr pKey = new IntPtr(*variables++);
string key = Marshal.PtrToStringAnsi(pKey);
Console.WriteLine("Requesting variable: {0}", key);
//always return default
//TODO: cache settings atoms
if(!Description.Variables.ContainsKey(key))
return false;
//HACK: return pointer for desmume mouse, i want to implement that first
if (key == "desmume_pointer_type")
{
*variables = unmanagedResources.StringToHGlobalAnsi("touch").ToPointer();
return true;
}
*variables = unmanagedResources.StringToHGlobalAnsi(Description.Variables[key].DefaultOption).ToPointer();
return true;
}
case LibRetro.RETRO_ENVIRONMENT.SET_VARIABLES:
{
void** variables = (void**)data.ToPointer();
for (; ; )
{
IntPtr pKey = new IntPtr(*variables++);
IntPtr pValue = new IntPtr(*variables++);
if(pKey == IntPtr.Zero)
break;
string key = Marshal.PtrToStringAnsi(pKey);
string value = Marshal.PtrToStringAnsi(pValue);
var vd = new VariableDescription() { Name = key};
var parts = value.Split(';');
vd.Description = parts[0];
vd.Options = parts[1].TrimStart(' ').Split('|');
Description.Variables[vd.Name] = vd;
}
}
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_VARIABLE_UPDATE:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_SUPPORT_NO_GAME:
environmentInfo.SupportNoGame = true;
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_LIBRETRO_PATH:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_AUDIO_CALLBACK:
return false;
case LibRetro.RETRO_ENVIRONMENT.SET_FRAME_TIME_CALLBACK:
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_RUMBLE_INTERFACE:
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_INPUT_DEVICE_CAPABILITIES:
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_LOG_INTERFACE:
*(IntPtr*)data = Marshal.GetFunctionPointerForDelegate(retro_log_printf_cb);
return true;
case LibRetro.RETRO_ENVIRONMENT.GET_PERF_INTERFACE:
//some builds of fmsx core crash without this set
Marshal.StructureToPtr(retro_perf_callback, data, false);
return true;
case LibRetro.RETRO_ENVIRONMENT.GET_LOCATION_INTERFACE:
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_CORE_ASSETS_DIRECTORY:
return false;
case LibRetro.RETRO_ENVIRONMENT.GET_SAVE_DIRECTORY:
//supposedly optional like everything else here, but without it ?? crashes (please write which case)
//this will suffice for now. if we find evidence later it's needed we can stash a string with
//unmanagedResources and CoreFileProvider
//mednafen NGP neopop, desmume, and others, request this, and falls back on the system directory if it isn't provided
//desmume crashes if the directory doesn't exist
Directory.CreateDirectory(SaveDirectory);
Console.WriteLine("returning save directory: " + SaveDirectory);
*((IntPtr*)data.ToPointer()) = SaveDirectoryAtom;
return true;
case LibRetro.RETRO_ENVIRONMENT.SET_CONTROLLER_INFO:
return true;
case LibRetro.RETRO_ENVIRONMENT.SET_MEMORY_MAPS:
return false;
default:
Console.WriteLine("Unknkown retro_environment command {0}", (int)cmd);
return false;
}
}
void retro_input_poll()
{
IsLagFrame = false;
}
private bool GetButton(uint pnum, string type, string button)
{
string key = string.Format("P{0} {1} {2}", pnum, type, button);
bool b = Controller.IsPressed(key);
if (b == true)
{
return true; //debugging placeholder
}
else return false;
}
LibRetro.retro_environment_t retro_environment_cb;
LibRetro.retro_video_refresh_t retro_video_refresh_cb;
LibRetro.retro_audio_sample_t retro_audio_sample_cb;
LibRetro.retro_audio_sample_batch_t retro_audio_sample_batch_cb;
LibRetro.retro_input_poll_t retro_input_poll_cb;
LibRetro.retro_input_state_t retro_input_state_cb;
LibRetro.retro_log_printf_t retro_log_printf_cb;
LibRetro.retro_perf_callback retro_perf_callback = new LibRetro.retro_perf_callback();
#endregion
class RetroEnvironmentInfo
{
public bool SupportNoGame;
public int Rotation_CCW;
}
//disposable resources
private LibRetro retro;
private UnmanagedResourceHeap unmanagedResources = new UnmanagedResourceHeap();
/// <summary>
/// Cached information sent to the frontend by environment calls
/// </summary>
RetroEnvironmentInfo environmentInfo = new RetroEnvironmentInfo();
public class RetroDescription
{
/// <summary>
/// String containing a friendly display name for the core, but we probably shouldn't use this. I decided it's better to get the user used to using filenames as core 'codenames' instead.
/// </summary>
public string LibraryName;
/// <summary>
/// String containing a friendly version number for the core library
/// </summary>
public string LibraryVersion;
/// <summary>
/// List of extensions as "sfc|smc|fig" which this core accepts.
/// </summary>
public string ValidExtensions;
/// <summary>
/// Whether the core needs roms to be specified as paths (can't take rom data buffersS)
/// </summary>
public bool NeedsRomAsPath;
/// <summary>
/// Whether the core needs roms stored as archives (e.g. arcade roms). We probably shouldn't employ the dearchiver prompts when opening roms for these cores.
/// </summary>
public bool NeedsArchives;
/// <summary>
/// Whether the core can be run without a game provided (e.g. stand-alone games, like 2048)
/// </summary>
public bool SupportsNoGame;
/// <summary>
/// Variables defined by the core
/// </summary>
public Dictionary<string, VariableDescription> Variables = new Dictionary<string, VariableDescription>();
}
public class VariableDescription
{
public string Name;
public string Description;
public string[] Options;
public string DefaultOption { get { return Options[0]; } }
public override string ToString()
{
return string.Format("{0} ({1}) = ({2})", Name, Description, string.Join("|", Options));
}
}
public readonly RetroDescription Description = new RetroDescription();
//path configuration
string SystemDirectory, SaveDirectory;
IntPtr SystemDirectoryAtom, SaveDirectoryAtom;
public LibRetroEmulator(CoreComm nextComm, string modulename)
{
ServiceProvider = new BasicServiceProvider(this);
_SyncSettings = new SyncSettings();
retro_environment_cb = new LibRetro.retro_environment_t(retro_environment);
retro_video_refresh_cb = new LibRetro.retro_video_refresh_t(retro_video_refresh);
retro_audio_sample_cb = new LibRetro.retro_audio_sample_t(retro_audio_sample);
retro_audio_sample_batch_cb = new LibRetro.retro_audio_sample_batch_t(retro_audio_sample_batch);
retro_input_poll_cb = new LibRetro.retro_input_poll_t(retro_input_poll);
retro_input_state_cb = new LibRetro.retro_input_state_t(retro_input_state);
retro_log_printf_cb = new LibRetro.retro_log_printf_t(retro_log_printf);
//no way (need new mechanism) to check for SSSE3, MMXEXT, SSE4, SSE42
retro_perf_callback.get_cpu_features = new LibRetro.retro_get_cpu_features_t(() => (ulong)(
(Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsXMMIAvailable) ? LibRetro.RETRO_SIMD.SSE : 0) |
(Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsXMMI64Available) ? LibRetro.RETRO_SIMD.SSE2 : 0) |
(Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsSSE3Available) ? LibRetro.RETRO_SIMD.SSE3 : 0) |
(Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsMMXAvailable) ? LibRetro.RETRO_SIMD.MMX : 0)
) );
retro_perf_callback.get_perf_counter = new LibRetro.retro_perf_get_counter_t(() => System.Diagnostics.Stopwatch.GetTimestamp());
retro_perf_callback.get_time_usec = new LibRetro.retro_perf_get_time_usec_t(() => DateTime.Now.Ticks / 10);
retro_perf_callback.perf_log = new LibRetro.retro_perf_log_t( () => {} );
retro_perf_callback.perf_register = new LibRetro.retro_perf_register_t((ref LibRetro.retro_perf_counter counter) => { });
retro_perf_callback.perf_start = new LibRetro.retro_perf_start_t((ref LibRetro.retro_perf_counter counter) => { });
retro_perf_callback.perf_stop = new LibRetro.retro_perf_stop_t((ref LibRetro.retro_perf_counter counter) => { });
retro = new LibRetro(modulename);
try
{
CoreComm = nextComm;
//this series of steps may be mystical.
LibRetro.retro_system_info system_info = new LibRetro.retro_system_info();
retro.retro_get_system_info(ref system_info);
//the dosbox core calls GET_SYSTEM_DIRECTORY and GET_SAVE_DIRECTORY from retro_set_environment.
//so, lets set some temporary values (which we'll replace)
SystemDirectory = Path.GetDirectoryName(modulename);
SystemDirectoryAtom = unmanagedResources.StringToHGlobalAnsi(SystemDirectory);
SaveDirectory = Path.GetDirectoryName(modulename);
SaveDirectoryAtom = unmanagedResources.StringToHGlobalAnsi(SaveDirectory);
retro.retro_set_environment(retro_environment_cb);
retro.retro_set_video_refresh(retro_video_refresh_cb);
retro.retro_set_audio_sample(retro_audio_sample_cb);
retro.retro_set_audio_sample_batch(retro_audio_sample_batch_cb);
retro.retro_set_input_poll(retro_input_poll_cb);
retro.retro_set_input_state(retro_input_state_cb);
//compile descriptive information
Description.NeedsArchives = system_info.block_extract;
Description.NeedsRomAsPath = system_info.need_fullpath;
Description.LibraryName = system_info.library_name;
Description.LibraryVersion = system_info.library_version;
Description.ValidExtensions = system_info.valid_extensions;
Description.SupportsNoGame = environmentInfo.SupportNoGame;
}
catch
{
retro.Dispose();
retro = null;
throw;
}
}
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public bool LoadData(byte[] data)
{
LibRetro.retro_game_info gi = new LibRetro.retro_game_info();
fixed (byte* p = &data[0])
{
gi.data = (IntPtr)p;
gi.meta = "";
gi.path = "";
gi.size = (uint)data.Length;
return LoadWork(ref gi);
}
}
public bool LoadPath(string path)
{
LibRetro.retro_game_info gi = new LibRetro.retro_game_info();
gi.path = path; //is this the right encoding? seems to be ok
return LoadWork(ref gi);
}
public bool LoadNoGame()
{
LibRetro.retro_game_info gi = new LibRetro.retro_game_info();
return LoadWork(ref gi);
}
bool LoadWork(ref LibRetro.retro_game_info gi)
{
//defer this until loading because during the LibRetroEmulator constructor, we dont have access to the game name and so paths can't be selected
//this cannot be done until set_environment is complete
if (CoreComm.CoreFileProvider == null)
{
SaveDirectory = SystemDirectory = "";
}
else
{
SystemDirectory = CoreComm.CoreFileProvider.GetRetroSystemPath();
SaveDirectory = CoreComm.CoreFileProvider.GetRetroSaveRAMDirectory();
SystemDirectoryAtom = unmanagedResources.StringToHGlobalAnsi(SystemDirectory);
SaveDirectoryAtom = unmanagedResources.StringToHGlobalAnsi(SaveDirectory);
}
//defer this until loading because it triggers the core to read save and system paths
//if any cores did that from set_environment then i'm assured we can call set_environment again here before retro_init and it should work
//--alcaro says any cores that can't handle that should be considered a bug
//UPDATE: dosbox does that, so lets try it
retro.retro_set_environment(retro_environment_cb);
retro.retro_init();
if (!retro.retro_load_game(ref gi))
{
Console.WriteLine("retro_load_game() failed");
return false;
}
//TODO - libretro cores can return a varying serialize size over time. I tried to get them to write it in the docs...
savebuff = new byte[retro.retro_serialize_size()];
savebuff2 = new byte[savebuff.Length + 13];
LibRetro.retro_system_av_info av = new LibRetro.retro_system_av_info();
retro.retro_get_system_av_info(ref av);
BufferWidth = (int)av.geometry.base_width;
BufferHeight = (int)av.geometry.base_height;
vidbuff = new int[av.geometry.max_width * av.geometry.max_height];
dar = av.geometry.aspect_ratio;
// TODO: more precise
CoreComm.VsyncNum = (int)(10000000 * av.timing.fps);
CoreComm.VsyncDen = 10000000;
SetupResampler(av.timing.fps, av.timing.sample_rate);
(ServiceProvider as BasicServiceProvider).Register<ISoundProvider>(resampler);
ControllerDefinition = CreateControllerDefinition(_SyncSettings);
return true;
}
public static ControllerDefinition CreateControllerDefinition(SyncSettings syncSettings)
{
ControllerDefinition definition = new ControllerDefinition();
definition.Name = "LibRetro Controls"; // <-- for compatibility
foreach(var item in new[] {
"P1 {0} Up", "P1 {0} Down", "P1 {0} Left", "P1 {0} Right", "P1 {0} Select", "P1 {0} Start", "P1 {0} Y", "P1 {0} B", "P1 {0} X", "P1 {0} A", "P1 {0} L", "P1 {0} R",
"P2 {0} Up", "P2 {0} Down", "P2 {0} Left", "P2 {0} Right", "P2 {0} Select", "P2 {0} Start", "P2 {0} Y", "P2 {0} B", "P2 {0} X", "P2 {0} A", "P2 {0} L", "P2 {0} R",
})
definition.BoolButtons.Add(string.Format(item,"RetroPad"));
definition.BoolButtons.Add("Pointer Pressed"); //TODO: this isnt showing up in the binding panel. I dont want to find out why.
definition.FloatControls.Add("Pointer X");
definition.FloatControls.Add("Pointer Y");
definition.FloatRanges.Add(new ControllerDefinition.FloatRange(-32767, 0, 32767));
definition.FloatRanges.Add(new ControllerDefinition.FloatRange(-32767, 0, 32767));
foreach (var key in new[]{
"Key Backspace", "Key Tab", "Key Clear", "Key Return", "Key Pause", "Key Escape",
"Key Space", "Key Exclaim", "Key QuoteDbl", "Key Hash", "Key Dollar", "Key Ampersand", "Key Quote", "Key LeftParen", "Key RightParen", "Key Asterisk", "Key Plus", "Key Comma", "Key Minus", "Key Period", "Key Slash",
"Key 0", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9",
"Key Colon", "Key Semicolon", "Key Less", "Key Equals", "Key Greater", "Key Question", "Key At", "Key LeftBracket", "Key Backslash", "Key RightBracket", "Key Caret", "Key Underscore", "Key Backquote",
"Key A", "Key B", "Key C", "Key D", "Key E", "Key F", "Key G", "Key H", "Key I", "Key J", "Key K", "Key L", "Key M", "Key N", "Key O", "Key P", "Key Q", "Key R", "Key S", "Key T", "Key U", "Key V", "Key W", "Key X", "Key Y", "Key Z",
"Key Delete",
"Key KP0", "Key KP1", "Key KP2", "Key KP3", "Key KP4", "Key KP5", "Key KP6", "Key KP7", "Key KP8", "Key KP9",
"Key KP_Period", "Key KP_Divide", "Key KP_Multiply", "Key KP_Minus", "Key KP_Plus", "Key KP_Enter", "Key KP_Equals",
"Key Up", "Key Down", "Key Right", "Key Left", "Key Insert", "Key Home", "Key End", "Key PageUp", "Key PageDown",
"Key F1", "Key F2", "Key F3", "Key F4", "Key F5", "Key F6", "Key F7", "Key F8", "Key F9", "Key F10", "Key F11", "Key F12", "Key F13", "Key F14", "Key F15",
"Key NumLock", "Key CapsLock", "Key ScrollLock", "Key RShift", "Key LShift", "Key RCtrl", "Key LCtrl", "Key RAlt", "Key LAlt", "Key RMeta", "Key LMeta", "Key LSuper", "Key RSuper", "Key Mode", "Key Compose",
"Key Help", "Key Print", "Key SysReq", "Key Break", "Key Menu", "Key Power", "Key Euro", "Key Undo"
})
{
definition.BoolButtons.Add(key);
definition.CategoryLabels[key] = "RetroKeyboard";
}
return definition;
}
public ControllerDefinition ControllerDefinition { get; private set; }
public IController Controller { get; set; }
public void FrameAdvance(bool render, bool rendersound = true)
{
//TODO - consider changing directory and using Libretro subdir of bizhawk as a kind of sandbox, for the duration of the run?
IsLagFrame = true;
Frame++;
nsamprecv = 0;
retro.retro_run();
//Console.WriteLine("[{0}]", nsamprecv);
}
public int Frame { get; private set; }
public string SystemId
{
get { return "Libretro"; }
}
public bool DeterministicEmulation
{
// who knows
get { return true; }
}
public string BoardName
{
get { return null; }
}
#region ISaveRam
//TODO - terrible things will happen if this changes at runtime
byte[] saverambuff = new byte[0];
public byte[] CloneSaveRam()
{
int size = (int)retro.retro_get_memory_size(LibRetro.RETRO_MEMORY.SAVE_RAM);
if (saverambuff.Length != size)
saverambuff = new byte[size];
IntPtr src = retro.retro_get_memory_data(LibRetro.RETRO_MEMORY.SAVE_RAM);
if (src == IntPtr.Zero)
return null;
Marshal.Copy(src, saverambuff, 0, size);
return (byte[])saverambuff.Clone();
}
public void StoreSaveRam(byte[] data)
{
int size = (int)retro.retro_get_memory_size(LibRetro.RETRO_MEMORY.SAVE_RAM);
if (size == 0)
return;
IntPtr dst = retro.retro_get_memory_data(LibRetro.RETRO_MEMORY.SAVE_RAM);
if (dst == IntPtr.Zero)
throw new Exception("retro_get_memory_data(RETRO_MEMORY_SAVE_RAM) returned NULL");
Marshal.Copy(data, 0, dst, size);
}
public bool SaveRamModified
{
[FeatureNotImplemented]
get
{
//if we dont have saveram, it isnt modified. otherwise, assume it is
int size = (int)retro.retro_get_memory_size(LibRetro.RETRO_MEMORY.SAVE_RAM);
if (size == 0)
return false;
return true;
}
[FeatureNotImplemented]
set { throw new NotImplementedException(); }
}
#endregion
public void ResetCounters()
{
Frame = 0;
LagCount = 0;
IsLagFrame = false;
}
#region savestates
private byte[] savebuff;
private byte[] savebuff2;
public void SaveStateText(System.IO.TextWriter writer)
{
var temp = SaveStateBinary();
temp.SaveAsHex(writer);
}
public void LoadStateText(System.IO.TextReader reader)
{
string hex = reader.ReadLine();
byte[] state = new byte[hex.Length / 2];
state.ReadFromHex(hex);
LoadStateBinary(new BinaryReader(new MemoryStream(state)));
}
public void SaveStateBinary(System.IO.BinaryWriter writer)
{
//is this the only way we know of to detect unavailable savestates?
if (savebuff.Length > 0)
{
fixed (byte* ptr = &savebuff[0])
{
if (!retro.retro_serialize((IntPtr)ptr, (uint)savebuff.Length))
throw new Exception("retro_serialize() failed");
}
}
writer.Write(savebuff.Length);
writer.Write(savebuff);
// other variables
writer.Write(Frame);
writer.Write(LagCount);
writer.Write(IsLagFrame);
}
public void LoadStateBinary(System.IO.BinaryReader reader)
{
int newlen = reader.ReadInt32();
if (newlen > savebuff.Length)
throw new Exception("Unexpected buffer size");
reader.Read(savebuff, 0, newlen);
if (savebuff.Length > 0)
{
fixed (byte* ptr = &savebuff[0])
{
if (!retro.retro_unserialize((IntPtr)ptr, (uint)newlen))
throw new Exception("retro_unserialize() failed");
}
}
// other variables
Frame = reader.ReadInt32();
LagCount = reader.ReadInt32();
IsLagFrame = reader.ReadBoolean();
}
public byte[] SaveStateBinary()
{
var ms = new System.IO.MemoryStream(savebuff2, true);
var bw = new System.IO.BinaryWriter(ms);
SaveStateBinary(bw);
bw.Flush();
ms.Close();
return savebuff2;
}
public bool BinarySaveStatesPreferred { get { return true; } }
#endregion
public CoreComm CoreComm
{
get;
private set;
}
#region memory access
void SetupDebuggingStuff()
{
}
public MemoryDomainList MemoryDomains { get; private set; }
#endregion
public void Dispose()
{
if (resampler != null)
{
resampler.Dispose();
resampler = null;
}
if (retro != null)
{
retro.Dispose();
retro = null;
}
unmanagedResources.Dispose();
unmanagedResources = null;
}
#region ISoundProvider
SpeexResampler resampler;
short[] sampbuff = new short[0];
// debug
int nsamprecv = 0;
void SetupResampler(double fps, double sps)
{
Console.WriteLine("FPS {0} SPS {1}", fps, sps);
// todo: more precise?
uint spsnum = (uint)sps * 1000;
uint spsden = (uint)1000;
resampler = new SpeexResampler(5, 44100 * spsden, spsnum, (uint)sps, 44100, null, null);
}
void retro_audio_sample(short left, short right)
{
resampler.EnqueueSample(left, right);
nsamprecv++;
}
uint retro_audio_sample_batch(IntPtr data, uint frames)
{
if (sampbuff.Length < frames * 2)
sampbuff = new short[frames * 2];
Marshal.Copy(data, sampbuff, 0, (int)(frames * 2));
resampler.EnqueueSamples(sampbuff, (int)frames);
nsamprecv += (int)frames;
// what is the return from this used for?
return frames;
}
#endregion
#region IVideoProvider
float dar;
int[] vidbuff, rawvidbuff;
LibRetro.RETRO_PIXEL_FORMAT pixelfmt = LibRetro.RETRO_PIXEL_FORMAT.XRGB1555;
void Blit555(short* src, int* dst, int width, int height, int pitch)
{
for (int j = 0; j < height; j++)
{
short* row = src;
for (int i = 0; i < width; i++)
{
short ci = *row;
int r = ci & 0x001f;
int g = ci & 0x03e0;
int b = ci & 0x7c00;
r = (r << 3) | (r >> 2);
g = (g >> 2) | (g >> 7);
b = (b >> 7) | (b >> 12);
int co = r | g | b | unchecked((int)0xff000000);
*dst = co;
dst++;
row++;
}
src += pitch;
}
}
void Blit565(short* src, int* dst, int width, int height, int pitch)
{
for (int j = 0; j < height; j++)
{
short* row = src;
for (int i = 0; i < width; i++)
{
short ci = *row;
int r = ci & 0x001f;
int g = (ci & 0x07e0)>>5;
int b = (ci & 0xf800)>>11;
r = (r << 3) | (r >> 2);
g = (g << 2) | (g >> 4);
b = (b << 3) | (b >> 2);
int co = (b<<16) | (g<<8) | r;
*dst = co;
dst++;
row++;
}
src += pitch;
}
}
void Blit888(int* src, int* dst, int width, int height, int pitch)
{
for (int j = 0; j < height; j++)
{
int* row = src;
for (int i = 0; i < width; i++)
{
int ci = *row;
int co = ci | unchecked((int)0xff000000);
*dst = co;
dst++;
row++;
}
src += pitch;
}
}
void retro_video_refresh(IntPtr data, uint width, uint height, uint pitch)
{
if (data == IntPtr.Zero) // dup frame
return;
//if (BufferWidth != width) BufferWidth = (int)width;
//if (BufferHeight != height) BufferHeight = (int)height;
//if (BufferWidth * BufferHeight != rawvidbuff.Length)
// rawvidbuff = new int[BufferWidth * BufferHeight];
//if we have rotation, we might have a geometry mismatch and in any event we need a temp buffer to do the rotation from
//but that's a general problem, isnt it?
if (rawvidbuff == null || rawvidbuff.Length != width * height)
{
rawvidbuff = new int[width * height];
}
int[] target = vidbuff;
if (environmentInfo.Rotation_CCW != 0)
target = rawvidbuff;
fixed (int* dst = &target[0])
{
if (pixelfmt == LibRetro.RETRO_PIXEL_FORMAT.XRGB8888)
Blit888((int*)data, dst, (int)width, (int)height, (int)pitch / 4);
else if (pixelfmt == LibRetro.RETRO_PIXEL_FORMAT.RGB565)
Blit565((short*)data, dst, (int)width, (int)height, (int)pitch / 2);
else
Blit555((short*)data, dst, (int)width, (int)height, (int)pitch / 2);
}
int dw = BufferWidth, dh = BufferHeight;
if (environmentInfo.Rotation_CCW == 0) { }
else if (environmentInfo.Rotation_CCW == 270)
{
for(int y=0;y<height;y++)
for (int x = 0; x < width; x++)
{
int dx = dw-y-1;
int dy = x;
vidbuff[dy * dw + dx] = rawvidbuff[y * width + x];
}
}
else if (environmentInfo.Rotation_CCW == 90)
{
throw new InvalidOperationException("PLEASE REPORT THIS BUG: CANTANKEROUS IMAGEBOUND NINJA");
}
else if (environmentInfo.Rotation_CCW == 180)
{
throw new InvalidOperationException("PLEASE REPORT THIS BUG: STAPH REGULARIZATION PROTOCOL");
}
}
public int[] GetVideoBuffer()
{
return vidbuff;
}
public int VirtualWidth
{
get
{
if(dar<=0)
return BufferWidth;
else if (dar > 1.0f)
return (int)(BufferHeight * dar);
else
return BufferWidth;
}
}
public int VirtualHeight
{
get
{
if(dar<=0)
return BufferHeight;
if (dar < 1.0f)
return (int)(BufferWidth / dar);
else
return BufferHeight;
}
}
public int BufferWidth { get; private set; }
public int BufferHeight { get; private set; }
public int BackgroundColor { get { return unchecked((int)0xff000000); } }
#endregion
#region IInputPollable
public int LagCount { get; set; }
public bool IsLagFrame { get; set; }
public IInputCallbackSystem InputCallbacks
{
[FeatureNotImplemented]
get
{ throw new NotImplementedException(); }
}
#endregion
}
}

View File

@ -14,11 +14,6 @@
Private="true" />
<ProjectReference Include="$(SolutionDir)BizHawk.Common/BizHawk.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="CacheBlendState.cs" />
<Compile Remove="GuiRendererBase.cs" />
<Compile Remove="RetroShader_OpenTK.cs" />
</ItemGroup>
<ItemGroup>
<Compile Update="GLControlWrapper_GdiPlus.cs" SubType="Component" />
<Compile Update="GLControlWrapper_SlimDX9.cs" SubType="Component" />

View File

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Bizware.BizwareGL
{
}

View File

@ -1,414 +0,0 @@
//http://stackoverflow.com/questions/6893302/decode-rgb-value-to-single-float-without-bit-shift-in-glsl
using System;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using sd=System.Drawing;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace BizHawk.Bizware.BizwareGL
{
public class GDIPlusGuiRenderer : IGuiRenderer
{
public GDIPlusGuiRenderer(IGL owner)
{
Owner = owner;
VertexLayout = owner.CreateVertexLayout();
VertexLayout.DefineVertexAttribute("aPosition", 0, 2, VertexAttribPointerType.Float, false, 32, 0);
VertexLayout.DefineVertexAttribute("aTexcoord", 1, 2, VertexAttribPointerType.Float, false, 32, 8);
VertexLayout.DefineVertexAttribute("aColor", 2, 4, VertexAttribPointerType.Float, false, 32, 16);
VertexLayout.Close();
_Projection = new MatrixStack();
_Modelview = new MatrixStack();
var vs = Owner.CreateVertexShader(DefaultVertexShader,true);
var ps = Owner.CreateFragmentShader(DefaultPixelShader, true);
CurrPipeline = DefaultPipeline = Owner.CreatePipeline(VertexLayout, vs, ps, true);
}
OpenTK.Graphics.Color4[] CornerColors = new OpenTK.Graphics.Color4[4] {
new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f)
};
/// <summary>
/// Sets the specified corner color (for the gradient effect)
/// </summary>
public void SetCornerColor(int which, OpenTK.Graphics.Color4 color)
{
Flush(); //dont really need to flush with current implementation. we might as well roll modulate color into it too.
CornerColors[which] = color;
}
/// <summary>
/// Sets all four corner colors at once
/// </summary>
public void SetCornerColors(OpenTK.Graphics.Color4[] colors)
{
Flush(); //dont really need to flush with current implementation. we might as well roll modulate color into it too.
if (colors.Length != 4) throw new ArgumentException("array must be size 4", "colors");
for (int i = 0; i < 4; i++)
CornerColors[i] = colors[i];
}
public void Dispose()
{
VertexLayout.Dispose();
VertexLayout = null;
DefaultPipeline.Dispose();
DefaultPipeline = null;
}
/// <summary>
/// Sets the pipeline for this GuiRenderer to use. We won't keep possession of it.
/// This pipeline must work in certain ways, which can be discerned by inspecting the built-in one
/// </summary>
public void SetPipeline(Pipeline pipeline)
{
if (IsActive)
throw new InvalidOperationException("Can't change pipeline while renderer is running!");
Flush();
CurrPipeline = pipeline;
//clobber state cache
sTexture = null;
//save the modulate color? user beware, I guess, for now.
}
/// <summary>
/// Restores the pipeline to the default
/// </summary>
public void SetDefaultPipeline()
{
SetPipeline(DefaultPipeline);
}
public void SetModulateColorWhite()
{
SetModulateColor(sd.Color.White);
}
public void SetModulateColor(sd.Color color)
{
Flush();
CurrPipeline["uModulateColor"].Set(new Vector4(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f));
}
public void SetBlendState(IBlendState rsBlend)
{
#if DEBUG
BlendStateSet = true;
#endif
Flush();
Owner.SetBlendState(rsBlend);
}
MatrixStack _Projection, _Modelview;
public MatrixStack Projection
{
get { return _Projection; }
set
{
_Projection = value;
_Projection.IsDirty = true;
}
}
public MatrixStack Modelview
{
get { return _Modelview; }
set
{
_Modelview = value;
_Modelview.IsDirty = true;
}
}
public void Begin(sd.Size size) { Begin(size.Width, size.Height); }
/// <summary>
/// begin rendering, initializing viewport and projections to the given dimensions
/// </summary>
/// <param name="yflipped">Whether the matrices should be Y-flipped, for use with render targets</param>
public void Begin(int width, int height, bool yflipped = false)
{
Begin();
Projection = Owner.CreateGuiProjectionMatrix(width, height);
Modelview = Owner.CreateGuiViewMatrix(width, height);
if (yflipped)
{
//not sure this is the best way to do it. could be done in the view matrix creation
Modelview.Scale(1, -1);
Modelview.Translate(0, -height);
}
Owner.SetViewport(width, height);
}
/// <summary>
/// Begins rendering
/// </summary>
public void Begin()
{
//uhhmmm I want to throw an exception if its already active, but its annoying.
if(CurrPipeline == null)
throw new InvalidOperationException("Pipeline hasn't been set!");
IsActive = true;
Owner.BindPipeline(CurrPipeline);
//clear state cache
sTexture = null;
CurrPipeline["uSamplerEnable"].Set(false);
Modelview.Clear();
Projection.Clear();
SetModulateColorWhite();
#if DEBUG
BlendStateSet = false;
#endif
}
/// <summary>
/// Use this, if you must do something sneaky to openGL without this GuiRenderer knowing.
/// It might be faster than End and Beginning again, and certainly prettier
/// </summary>
public void Flush()
{
//no batching, nothing to do here yet
}
/// <summary>
/// Ends rendering
/// </summary>
public void End()
{
if (!IsActive)
throw new InvalidOperationException("GuiRenderer is not active!");
IsActive = false;
}
public void RectFill(float x, float y, float w, float h)
{
PrepDrawSubrectInternal(null);
EmitRectangleInternal(x, y, w, h, 0, 0, 0, 0);
}
/// <summary>
/// Draws a subrectangle from the provided texture. For advanced users only
/// </summary>
public void DrawSubrect(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
{
DrawSubrectInternal(tex, x, y, w, h, u0, v0, u1, v1);
}
/// <summary>
/// draws the specified Art resource
/// </summary>
public void Draw(Art art) { DrawInternal(art, 0, 0, art.Width, art.Height, false, false); }
/// <summary>
/// draws the specified Art resource with the specified offset. This could be tricky if youve applied other rotate or scale transforms first.
/// </summary>
public void Draw(Art art, float x, float y) { DrawInternal(art, x, y, art.Width, art.Height, false, false); }
/// <summary>
/// draws the specified Art resource with the specified offset, with the specified size. This could be tricky if youve applied other rotate or scale transforms first.
/// </summary>
public void Draw(Art art, float x, float y, float width, float height) { DrawInternal(art, x, y, width, height, false, false); }
/// <summary>
/// draws the specified Art resource with the specified offset. This could be tricky if youve applied other rotate or scale transforms first.
/// </summary>
public void Draw(Art art, Vector2 pos) { DrawInternal(art, pos.X, pos.Y, art.Width, art.Height, false, false); }
/// <summary>
/// draws the specified texture2d resource.
/// </summary>
public void Draw(Texture2d tex) { DrawInternal(tex, 0, 0, tex.Width, tex.Height); }
/// <summary>
/// draws the specified texture2d resource.
/// </summary>
public void Draw(Texture2d tex, float x, float y) { DrawInternal(tex, x, y, tex.Width, tex.Height); }
/// <summary>
/// draws the specified Art resource with the given flip flags
/// </summary>
public void DrawFlipped(Art art, bool xflip, bool yflip) { DrawInternal(art, 0, 0, art.Width, art.Height, xflip, yflip); }
public void Draw(Texture2d art, float x, float y, float width, float height)
{
DrawInternal(art, x, y, width, height);
}
unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h)
{
Art art = new Art(null);
art.Width = w;
art.Height = h;
art.u0 = art.v0 = 0;
art.u1 = art.v1 = 1;
art.BaseTexture = tex;
DrawInternal(art,x,y,w,h,false,tex.IsUpsideDown);
}
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy)
{
float u0,v0,u1,v1;
if(fx) { u0 = art.u1; u1 = art.u0; }
else { u0 = art.u0; u1 = art.u1; }
if(fy) { v0 = art.v1; v1 = art.v0; }
else { v0 = art.v0; v1 = art.v1; }
float[] data = new float[32] {
x,y, u0,v0, CornerColors[0].R, CornerColors[0].G, CornerColors[0].B, CornerColors[0].A,
x+art.Width,y, u1,v0, CornerColors[1].R, CornerColors[1].G, CornerColors[1].B, CornerColors[1].A,
x,y+art.Height, u0,v1, CornerColors[2].R, CornerColors[2].G, CornerColors[2].B, CornerColors[2].A,
x+art.Width,y+art.Height, u1,v1, CornerColors[3].R, CornerColors[3].G, CornerColors[3].B, CornerColors[3].A,
};
Texture2d tex = art.BaseTexture;
PrepDrawSubrectInternal(tex);
fixed (float* pData = &data[0])
{
Owner.BindArrayData(pData);
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
}
}
unsafe void PrepDrawSubrectInternal(Texture2d tex)
{
if (sTexture != tex)
{
sTexture = tex;
CurrPipeline["uSampler0"].Set(tex);
if (sTexture == null)
{
CurrPipeline["uSamplerEnable"].Set(false);
}
else
{
CurrPipeline["uSamplerEnable"].Set(true);
}
}
if (_Projection.IsDirty)
{
CurrPipeline["um44Projection"].Set(ref _Projection.Top);
_Projection.IsDirty = false;
}
if (_Modelview.IsDirty)
{
CurrPipeline["um44Modelview"].Set(ref _Modelview.Top);
_Modelview.IsDirty = false;
}
}
unsafe void EmitRectangleInternal(float x, float y, float w, float h, float u0, float v0, float u1, float v1)
{
float* pData = stackalloc float[32];
pData[0] = x;
pData[1] = y;
pData[2] = u0;
pData[3] = v0;
pData[4] = CornerColors[0].R;
pData[5] = CornerColors[0].G;
pData[6] = CornerColors[0].B;
pData[7] = CornerColors[0].A;
pData[8] = x + w;
pData[9] = y;
pData[10] = u1;
pData[11] = v0;
pData[12] = CornerColors[1].R;
pData[13] = CornerColors[1].G;
pData[14] = CornerColors[1].B;
pData[15] = CornerColors[1].A;
pData[16] = x;
pData[17] = y + h;
pData[18] = u0;
pData[19] = v1;
pData[20] = CornerColors[2].R;
pData[21] = CornerColors[2].G;
pData[22] = CornerColors[2].B;
pData[23] = CornerColors[2].A;
pData[24] = x + w;
pData[25] = y + h;
pData[26] = u1;
pData[27] = v1;
pData[28] = CornerColors[3].R;
pData[29] = CornerColors[3].G;
pData[30] = CornerColors[3].B;
pData[31] = CornerColors[3].A;
Owner.BindArrayData(pData);
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
#if DEBUG
Debug.Assert(BlendStateSet);
#endif
}
unsafe void DrawSubrectInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
{
PrepDrawSubrectInternal(tex);
EmitRectangleInternal(x, y, w, h, u0, v0, u1, v1);
}
public bool IsActive { get; private set; }
public IGL Owner { get; private set; }
VertexLayout VertexLayout;
Pipeline CurrPipeline, DefaultPipeline;
//state cache
Texture2d sTexture;
#if DEBUG
bool BlendStateSet;
#endif
public readonly string DefaultVertexShader = @"
#version 110 //opengl 2.0 ~ 2004
uniform mat4 um44Modelview, um44Projection;
uniform vec4 uModulateColor;
attribute vec2 aPosition;
attribute vec2 aTexcoord;
attribute vec4 aColor;
varying vec2 vTexcoord0;
varying vec4 vCornerColor;
void main()
{
vec4 temp = vec4(aPosition,0,1);
gl_Position = um44Projection * (um44Modelview * temp);
vTexcoord0 = aTexcoord;
vCornerColor = aColor * uModulateColor;
}";
public readonly string DefaultPixelShader = @"
#version 110 //opengl 2.0 ~ 2004
uniform bool uSamplerEnable;
uniform sampler2D uSampler0;
varying vec2 vTexcoord0;
varying vec4 vCornerColor;
void main()
{
vec4 temp = vCornerColor;
if(uSamplerEnable) temp *= texture2D(uSampler0,vTexcoord0);
gl_FragColor = temp;
}";
}
}

View File

@ -1,95 +0,0 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
{
/// <summary>
/// Handles RetroArch's GLSL shader pass format
/// This isnt implemented in BizwareGL abstract layer because it relies too much on GLSL peculiarities
/// </summary>
public class RetroShader_OpenTK : IDisposable
{
public RetroShader_OpenTK(IGL owner, string source, bool debug = false)
{
Owner = owner as IGL_TK;
VertexLayout = owner.CreateVertexLayout();
VertexLayout.DefineVertexAttribute("VertexCoord", 0, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 0); //VertexCoord
VertexLayout.DefineVertexAttribute("ColorShit", 1, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 16); //COLOR
VertexLayout.DefineVertexAttribute("TexCoord", 2, 2, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 32); //TexCoord (is this vec2 or vec4? the glsl converted from cg had vec4 but the cg had vec2...)
VertexLayout.Close();
string vsSource = "#define VERTEX\r\n" + source;
string psSource = "#define FRAGMENT\r\n" + source;
var vs = Owner.CreateVertexShader(vsSource, debug);
var ps = Owner.CreateFragmentShader(psSource, debug);
Pipeline = Owner.CreatePipeline(VertexLayout, vs, ps, debug);
}
public void Dispose()
{
Pipeline.Dispose();
}
public void Bind()
{
//lame...
Owner.BindPipeline(Pipeline);
}
public unsafe void Run(Texture2d tex, Size InputSize, Size OutputSize, bool flip)
{
//ack! make sure to set the pipeline before setting
Bind();
Pipeline["InputSize"].Set(new Vector2(InputSize.Width,InputSize.Height));
Pipeline["TextureSize"].Set(new Vector2(InputSize.Width, InputSize.Height));
Pipeline["OutputSize"].Set(new Vector2(OutputSize.Width, OutputSize.Height));
Pipeline["FrameCount"].Set(0); //todo
Pipeline["FrameDirection"].Set(1); //todo
var Projection = Owner.CreateGuiProjectionMatrix(OutputSize);
var Modelview = Owner.CreateGuiViewMatrix(OutputSize);
Pipeline["MVPMatrix"].Set(Modelview * Projection, false);
Owner.SetTextureWrapMode(tex, true);
Pipeline["Texture"].Set(tex);
Owner.SetViewport(OutputSize);
int w = OutputSize.Width;
int h = OutputSize.Height;
float v0,v1;
if (flip) { v0 = 1; v1 = 0; }
else { v0 = 0; v1 = 1; }
float* pData = stackalloc float[10*4];
int i=0;
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 1; //topleft vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //junk
pData[i++] = 0; pData[i++] = v0; //texcoord
pData[i++] = w; pData[i++] = 0; pData[i++] = 0; pData[i++] = 1; //topright vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //junk
pData[i++] = 1; pData[i++] = v0; //texcoord
pData[i++] = 0; pData[i++] = h; pData[i++] = 0; pData[i++] = 1; //bottomleft vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //junk
pData[i++] = 0; pData[i++] = v1; //texcoord
pData[i++] = w; pData[i++] = h; pData[i++] = 0; pData[i++] = 1; //bottomright vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //junk
pData[i++] = 1; pData[i++] = v1; //texcoord
Owner.SetBlendState(Owner.BlendNoneCopy);
Owner.BindArrayData(pData);
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
}
public IGL_TK Owner { get; private set; }
VertexLayout VertexLayout;
public Pipeline Pipeline;
}
}