Start back from initial release branch
Just to have cleaner changes
This commit is contained in:
parent
24c98ab5ae
commit
8ad8ad2c6a
|
@ -246,6 +246,7 @@
|
|||
/References/*.xml
|
||||
/output/ELFSharp.dll
|
||||
/output/dll/ELFSharp.dll
|
||||
/output/GameTools/*.dll
|
||||
*.opensdf
|
||||
*.user
|
||||
*.suo
|
||||
|
|
|
@ -157,6 +157,7 @@ namespace BizHawk.Client.Common
|
|||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Macros", Path = Path.Combine(".", "Movies", "Macros"), Ordinal = 10 },
|
||||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "TAStudio states", Path = Path.Combine(".", "Movies", "TAStudio states"), Ordinal = 11 },
|
||||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Multi-Disk Bundles", Path = Path.Combine(".", "Tools"), Ordinal = 12 },
|
||||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "GameTools", Path = Path.Combine(".", "GameTools"), Ordinal = 13 },
|
||||
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
|
|
|
@ -3410,6 +3410,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Console.WriteLine(" {0} : {1}", f.FirmwareId, f.Hash);
|
||||
}
|
||||
}
|
||||
GlobalWin.Tools.Load<ICustomGameTool>();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface to implements in order to make a custom tool for a specific game
|
||||
/// </summary>
|
||||
public interface ICustomGameTool:IToolForm
|
||||
{
|
||||
}
|
||||
}
|
|
@ -69,6 +69,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
var newTool = CreateInstance(toolType);
|
||||
|
||||
if (newTool == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (newTool is Form)
|
||||
{
|
||||
(newTool as Form).Owner = GlobalWin.MainForm;
|
||||
|
@ -496,7 +501,46 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private IToolForm CreateInstance(Type toolType)
|
||||
{
|
||||
var tool = (IToolForm)Activator.CreateInstance(toolType);
|
||||
IToolForm tool;
|
||||
|
||||
//Specific case for custom tools
|
||||
if (toolType == typeof(ICustomGameTool))
|
||||
{
|
||||
string path = Path.Combine(Global.Config.PathEntries["Global", "GameTools"].Path, string.Format("{0}.dll", Global.Game.Name));
|
||||
if (File.Exists(path)
|
||||
&& MessageBox.Show("A custom plugin has been found for the ROM you're loading. Do you want to load it?\r\nAccept ONLY if you trust the source and if you know what you're doing. In any other case, choose no."
|
||||
, "Answer to life, universe and everything else?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
// As the object is "remote"(external to the project), the CreateInstanceFrom returns a handle.We need to Unwrap in order to make the casting
|
||||
tool = System.Activator.CreateInstanceFrom(path, "BizHawk.Client.EmuHawk.CustomMainForm").Unwrap() as IToolForm;
|
||||
if (tool == null)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not implement IToolForm. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
catch (TypeLoadException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tool = (IToolForm)Activator.CreateInstance(toolType);
|
||||
}
|
||||
|
||||
// Add to our list of tools
|
||||
_tools.Add(tool);
|
||||
|
|
Loading…
Reference in New Issue