Start a core features dialog in Help, only visible in developer mode (currently). Uses reflection to see what ICoreService implementations are implemented by which cores
This commit is contained in:
parent
4582a88798
commit
189de87e8e
|
@ -444,6 +444,12 @@
|
|||
<Compile Include="config\TI83\TI83PaletteConfig.Designer.cs">
|
||||
<DependentUpon>TI83PaletteConfig.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CoreFeatureAnalysis.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CoreFeatureAnalysis.Designer.cs">
|
||||
<DependentUpon>CoreFeatureAnalysis.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CustomControls\FolderBrowserDialogEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -1146,6 +1152,9 @@
|
|||
<EmbeddedResource Include="config\TI83\TI83PaletteConfig.resx">
|
||||
<DependentUpon>TI83PaletteConfig.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CoreFeatureAnalysis.resx">
|
||||
<DependentUpon>CoreFeatureAnalysis.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CustomControls\InputConfigBase.resx">
|
||||
<DependentUpon>InputConfigBase.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class CoreFeatureAnalysis
|
||||
{
|
||||
/// <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(CoreFeatureAnalysis));
|
||||
this.OkBtn = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.TotalCoresLabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.ReleasedCoresLabel = new System.Windows.Forms.Label();
|
||||
this.CoreTree = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OkBtn
|
||||
//
|
||||
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OkBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.OkBtn.Location = new System.Drawing.Point(456, 569);
|
||||
this.OkBtn.Name = "OkBtn";
|
||||
this.OkBtn.Size = new System.Drawing.Size(60, 23);
|
||||
this.OkBtn.TabIndex = 0;
|
||||
this.OkBtn.Text = "&Ok";
|
||||
this.OkBtn.UseVisualStyleBackColor = true;
|
||||
this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(99, 19);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(34, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Total:";
|
||||
//
|
||||
// TotalCoresLabel
|
||||
//
|
||||
this.TotalCoresLabel.AutoSize = true;
|
||||
this.TotalCoresLabel.Location = new System.Drawing.Point(132, 19);
|
||||
this.TotalCoresLabel.Name = "TotalCoresLabel";
|
||||
this.TotalCoresLabel.Size = new System.Drawing.Size(19, 13);
|
||||
this.TotalCoresLabel.TabIndex = 3;
|
||||
this.TotalCoresLabel.Text = "20";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 19);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(55, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Released:";
|
||||
//
|
||||
// ReleasedCoresLabel
|
||||
//
|
||||
this.ReleasedCoresLabel.AutoSize = true;
|
||||
this.ReleasedCoresLabel.Location = new System.Drawing.Point(64, 19);
|
||||
this.ReleasedCoresLabel.Name = "ReleasedCoresLabel";
|
||||
this.ReleasedCoresLabel.Size = new System.Drawing.Size(19, 13);
|
||||
this.ReleasedCoresLabel.TabIndex = 5;
|
||||
this.ReleasedCoresLabel.Text = "20";
|
||||
//
|
||||
// CoreTree
|
||||
//
|
||||
this.CoreTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CoreTree.Location = new System.Drawing.Point(12, 35);
|
||||
this.CoreTree.Name = "CoreTree";
|
||||
this.CoreTree.Size = new System.Drawing.Size(504, 528);
|
||||
this.CoreTree.TabIndex = 0;
|
||||
//
|
||||
// CoreFeatureAnalysis
|
||||
//
|
||||
this.AcceptButton = this.OkBtn;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.OkBtn;
|
||||
this.ClientSize = new System.Drawing.Size(528, 604);
|
||||
this.Controls.Add(this.CoreTree);
|
||||
this.Controls.Add(this.ReleasedCoresLabel);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.TotalCoresLabel);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.OkBtn);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "CoreFeatureAnalysis";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Core Features";
|
||||
this.Load += new System.EventHandler(this.CoreFeatureAnalysis_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button OkBtn;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label TotalCoresLabel;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label ReleasedCoresLabel;
|
||||
private System.Windows.Forms.TreeView CoreTree;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class CoreFeatureAnalysis : Form
|
||||
{
|
||||
public CoreFeatureAnalysis()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CoreFeatureAnalysis_Load(object sender, EventArgs e)
|
||||
{
|
||||
var services = Assembly
|
||||
.GetAssembly(typeof(IEmulator))
|
||||
.GetTypes()
|
||||
.Where(t => t.IsInterface)
|
||||
.Where(t => typeof(ICoreService).IsAssignableFrom(t))
|
||||
.Where(t => t != typeof(ICoreService))
|
||||
.ToList();
|
||||
|
||||
var cores = Assembly
|
||||
.Load("BizHawk.Emulation.Cores")
|
||||
.GetTypes()
|
||||
.Where(t => typeof(IEmulator).IsAssignableFrom(t))
|
||||
.Select(core => new
|
||||
{
|
||||
CoreType = core,
|
||||
CoreAttributes = core.GetCustomAttributes(false)
|
||||
.OfType<CoreAttributes>()
|
||||
.Single()
|
||||
})
|
||||
.OrderBy(c => !c.CoreAttributes.Released)
|
||||
.ThenBy(c => c.CoreAttributes.CoreName)
|
||||
.ToList();
|
||||
|
||||
TotalCoresLabel.Text = cores.Count.ToString();
|
||||
ReleasedCoresLabel.Text = cores.Count(c => c.CoreAttributes.Released).ToString();
|
||||
|
||||
CoreTree.Nodes.Clear();
|
||||
|
||||
foreach (var core in cores)
|
||||
{
|
||||
var coreNode = new TreeNode
|
||||
{
|
||||
Text = core.CoreAttributes.CoreName + (core.CoreAttributes.Released ? string.Empty : " (UNRELEASED)"),
|
||||
ForeColor = core.CoreAttributes.Released ? Color.Black : Color.DarkGray,
|
||||
// TODO
|
||||
//ForeColor = services.All(s => s.IsAssignableFrom(core.CoreType)) ? Color.Black : Color.Red
|
||||
};
|
||||
|
||||
foreach (var service in services)
|
||||
{
|
||||
var serviceNode = new TreeNode
|
||||
{
|
||||
Text = service.Name,
|
||||
ForeColor = (service.IsAssignableFrom(core.CoreType)) ? Color.Black : Color.Red
|
||||
};
|
||||
|
||||
foreach(var field in service.GetProperties())
|
||||
{
|
||||
serviceNode.Nodes.Add(new TreeNode
|
||||
{
|
||||
Text = field.Name
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var field in service.GetMethods())
|
||||
{
|
||||
serviceNode.Nodes.Add(new TreeNode
|
||||
{
|
||||
Text = field.Name
|
||||
});
|
||||
}
|
||||
|
||||
coreNode.Nodes.Add(serviceNode);
|
||||
}
|
||||
|
||||
|
||||
CoreTree.Nodes.Add(coreNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3617,5 +3617,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.Load<BarcodeEntry>();
|
||||
}
|
||||
|
||||
private void FeaturesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
new CoreFeatureAnalysis().Show();
|
||||
}
|
||||
|
||||
private void HelpSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
FeaturesMenuItem.Visible = VersionInfo.DeveloperBuild;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue