From 5ce23c815d99ecb7b16315a6437b7d03ff9dc86e Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 30 May 2014 22:00:16 +0000 Subject: [PATCH] Proof of concept for a SystemInfo object to have a singular place to have system specific info as opposed to SystemID switches stattered throughout the codebase --- .../BizHawk.Client.Common.csproj | 1 + BizHawk.Client.Common/Global.cs | 16 +++++++- BizHawk.Client.Common/SystemInfo.cs | 40 +++++++++++++++++++ BizHawk.Client.EmuHawk/MainForm.cs | 7 ++-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 BizHawk.Client.Common/SystemInfo.cs diff --git a/BizHawk.Client.Common/BizHawk.Client.Common.csproj b/BizHawk.Client.Common/BizHawk.Client.Common.csproj index 5cdcfe8580..36a7edcc6d 100644 --- a/BizHawk.Client.Common/BizHawk.Client.Common.csproj +++ b/BizHawk.Client.Common/BizHawk.Client.Common.csproj @@ -167,6 +167,7 @@ + diff --git a/BizHawk.Client.Common/Global.cs b/BizHawk.Client.Common/Global.cs index e609fbf7b8..b8b0d46af9 100644 --- a/BizHawk.Client.Common/Global.cs +++ b/BizHawk.Client.Common/Global.cs @@ -7,7 +7,6 @@ namespace BizHawk.Client.Common { public static IEmulator Emulator; public static CoreComm CoreComm; - public static Config Config; public static GameInfo Game; public static CheatCollection CheatList; @@ -89,5 +88,20 @@ namespace BizHawk.Client.Common // Input state which has been estine for game controller inputs are coalesce here // This relies on a client specific implementation! public static SimpleController ControllerInputCoalescer; + + public static SystemInfo SystemInfo + { + get + { + switch(Global.Emulator.SystemId) + { + default: + case "NULL": + return SystemInfo.Null; + case "NES": + return SystemInfo.Nes; + } + } + } } } diff --git a/BizHawk.Client.Common/SystemInfo.cs b/BizHawk.Client.Common/SystemInfo.cs new file mode 100644 index 0000000000..ec17bed392 --- /dev/null +++ b/BizHawk.Client.Common/SystemInfo.cs @@ -0,0 +1,40 @@ +using System; +using BizHawk.Emulation.Common; + +namespace BizHawk.Client.Common +{ + public class SystemInfo + { + public SystemInfo() { } + + public string DisplayName { get; set; } + public int ByteSize { get; set; } // For Ram tools, whether it is a 8/16/32 bit system + public MemoryDomain.Endian Endian { get; set; } //Big endian/little endian, etc + + public static SystemInfo Null + { + get + { + return new SystemInfo + { + DisplayName = "", + ByteSize = 1, + Endian = MemoryDomain.Endian.Little + }; + } + } + + public static SystemInfo Nes + { + get + { + return new SystemInfo + { + DisplayName = "Nintendo", + ByteSize = 1, + Endian = MemoryDomain.Endian.Big + }; + } + } + } +} diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 9c7a705a33..9b2e91592c 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -1386,8 +1386,9 @@ namespace BizHawk.Client.EmuHawk private static string DisplayNameForSystem(string system) { - var str = string.Empty; - switch (system) + var str = Global.SystemInfo.DisplayName; + /* + switch (Global.SystemInfo.DisplayName) { case "INTV": str = "Intellivision"; break; case "SG": str = "SG-1000"; break; @@ -1412,7 +1413,7 @@ namespace BizHawk.Client.EmuHawk case "DGB": str = "Game Boy Link"; break; case "WSWAN": str = "WonderSwan"; break; } - + */ if (VersionInfo.INTERIM) { str += " (interim)";