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,8 +157,9 @@ namespace BizHawk.Client.Common
|
|||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Macros", Path = Path.Combine(".", "Movies", "Macros"), Ordinal = 10 },
|
||||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "TAStudio states", Path = Path.Combine(".", "Movies", "TAStudio states"), Ordinal = 11 },
|
||||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "Multi-Disk Bundles", Path = Path.Combine(".", "Tools"), Ordinal = 12 },
|
||||
new PathEntry { System = "Global_NULL", SystemDisplayName="Global", Type = "GameTools", Path = Path.Combine(".", "GameTools"), Ordinal = 13 },
|
||||
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 },
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "INTV", SystemDisplayName="Intellivision", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
|
||||
|
|
|
@ -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,7 +69,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
var newTool = CreateInstance(toolType);
|
||||
|
||||
if (newTool is Form)
|
||||
if (newTool == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (newTool is Form)
|
||||
{
|
||||
(newTool as Form).Owner = GlobalWin.MainForm;
|
||||
}
|
||||
|
@ -494,16 +499,55 @@ namespace BizHawk.Client.EmuHawk
|
|||
return CreateInstance(typeof(T));
|
||||
}
|
||||
|
||||
private IToolForm CreateInstance(Type toolType)
|
||||
{
|
||||
var tool = (IToolForm)Activator.CreateInstance(toolType);
|
||||
private IToolForm CreateInstance(Type toolType)
|
||||
{
|
||||
IToolForm tool;
|
||||
|
||||
// Add to our list of tools
|
||||
_tools.Add(tool);
|
||||
return tool;
|
||||
}
|
||||
//Specific case for custom tools
|
||||
if (toolType == typeof(ICustomGameTool))
|
||||
{
|
||||
string path = Path.Combine(Global.Config.PathEntries["Global", "GameTools"].Path, string.Format("{0}.dll", Global.Game.Name));
|
||||
if (File.Exists(path)
|
||||
&& MessageBox.Show("A custom plugin has been found for the ROM you're loading. Do you want to load it?\r\nAccept ONLY if you trust the source and if you know what you're doing. In any other case, choose no."
|
||||
, "Answer to life, universe and everything else?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
// As the object is "remote"(external to the project), the CreateInstanceFrom returns a handle.We need to Unwrap in order to make the casting
|
||||
tool = System.Activator.CreateInstanceFrom(path, "BizHawk.Client.EmuHawk.CustomMainForm").Unwrap() as IToolForm;
|
||||
if (tool == null)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not implement IToolForm. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
catch (TypeLoadException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "Boom!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tool = (IToolForm)Activator.CreateInstance(toolType);
|
||||
}
|
||||
|
||||
public void UpdateToolsBefore(bool fromLua = false)
|
||||
// Add to our list of tools
|
||||
_tools.Add(tool);
|
||||
return tool;
|
||||
}
|
||||
|
||||
public void UpdateToolsBefore(bool fromLua = false)
|
||||
{
|
||||
if (Has<LuaConsole>())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue