diff --git a/BizHawk.Client.EmuHawk/LogWindow.cs b/BizHawk.Client.EmuHawk/LogWindow.cs
index dfb35a0893..af5d0d8968 100644
--- a/BizHawk.Client.EmuHawk/LogWindow.cs
+++ b/BizHawk.Client.EmuHawk/LogWindow.cs
@@ -5,11 +5,10 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
-using BizHawk.Common;
-using BizHawk.Client.Common;
-using BizHawk.Emulation.Common;
-
using BizHawk.Common.ReflectionExtensions;
+using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Common.IEmulatorExtensions;
+using BizHawk.Client.Common;
//todo - perks - pause, copy to clipboard, backlog length limiting
@@ -138,7 +137,7 @@ namespace BizHawk.Client.EmuHawk
private void HideShowGameDbButton()
{
- AddToGameDbBtn.Visible = Global.Emulator.HasExposedMethod("GenerateGameDbEntry")
+ AddToGameDbBtn.Visible = Global.Emulator.CanGenerateGameDBEntries()
&& (Global.Game.Status == RomStatus.Unknown || Global.Game.Status == RomStatus.NotInDatabase);
}
@@ -148,10 +147,10 @@ namespace BizHawk.Client.EmuHawk
var result = picker.ShowDialog();
if (result == DialogResult.OK)
{
- var entryObj = (CompactGameInfo)Global.Emulator.InvokeMethod("GenerateGameDbEntry", null);
+ var gameDbEntry = Global.Emulator.AsGameDBEntryGenerator().GenerateGameDbEntry();
var userDb = Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb_user.txt");
- Global.Game.Status = entryObj.Status = picker.PickedStatus;
- Database.SaveDatabaseEntry(userDb, entryObj);
+ Global.Game.Status = gameDbEntry.Status = picker.PickedStatus;
+ Database.SaveDatabaseEntry(userDb, gameDbEntry);
GlobalWin.MainForm.UpdateDumpIcon();
HideShowGameDbButton();
}
diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
index 508fdec95e..d3045c5a35 100644
--- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
+++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
@@ -125,6 +125,7 @@
+
diff --git a/BizHawk.Emulation.Common/Extensions.cs b/BizHawk.Emulation.Common/Extensions.cs
index 75b268ce33..5c16fe6d22 100644
--- a/BizHawk.Emulation.Common/Extensions.cs
+++ b/BizHawk.Emulation.Common/Extensions.cs
@@ -325,6 +325,21 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
return core.ServiceProvider.HasService();
}
+ public static bool CanGenerateGameDBEntries(this IEmulator core)
+ {
+ if (core == null)
+ {
+ return false;
+ }
+
+ return core.ServiceProvider.HasService();
+ }
+
+ public static ICreateGameDBEntries AsGameDBEntryGenerator(this IEmulator core)
+ {
+ return core.ServiceProvider.GetService();
+ }
+
// TODO: a better place for these
public static bool IsImplemented(this MethodInfo info)
{
diff --git a/BizHawk.Emulation.Common/Interfaces/Services/ICreateGameDBEntries.cs b/BizHawk.Emulation.Common/Interfaces/Services/ICreateGameDBEntries.cs
new file mode 100644
index 0000000000..bb14b5a328
--- /dev/null
+++ b/BizHawk.Emulation.Common/Interfaces/Services/ICreateGameDBEntries.cs
@@ -0,0 +1,16 @@
+namespace BizHawk.Emulation.Common
+{
+ ///
+ /// This service provides a means for the current core to generate a
+ /// game database entry and return the result
+ /// If available, the client will expose functionality for the user to add the current rom
+ /// to the user game database if it is currently unknown. This UI should expose a feature
+ /// that allow them to set to override the unknown status and set it to something they feel
+ /// is more accurate. The intent of the feature is to easily allow users
+ /// to mark unknown ROMs themselves (in their local database for their personal use)
+ ///
+ public interface ICreateGameDBEntries : ISpecializedEmulatorService
+ {
+ CompactGameInfo GenerateGameDbEntry();
+ }
+}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
index b777ef74ee..c2207e614d 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
@@ -16,7 +16,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
isReleased: true
)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))]
- public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, IRegionable, ISettable
+ public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable,
+ IRegionable, ICreateGameDBEntries, ISettable
{
private readonly GameInfo _game;
private int _frame;
@@ -100,6 +101,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
};
+ // ICreateGameDBEntries
public CompactGameInfo GenerateGameDbEntry()
{
return new CompactGameInfo