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

This commit is contained in:
adelikat 2014-05-30 22:00:16 +00:00
parent 866f98c6ce
commit 5ce23c815d
4 changed files with 60 additions and 4 deletions

View File

@ -167,6 +167,7 @@
<Compile Include="SaveSlotManager.cs" />
<Compile Include="SavestateManager.cs" />
<Compile Include="SevenZipSharpArchiveHandler.cs" />
<Compile Include="SystemInfo.cs" />
<Compile Include="tools\Cheat.cs" />
<Compile Include="tools\CheatList.cs" />
<Compile Include="tools\RamSearchEngine.cs" />

View File

@ -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;
}
}
}
}
}

View File

@ -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
};
}
}
}
}

View File

@ -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)";