refactor Global.SystemInfo into an extension method class
This commit is contained in:
parent
5002968bd7
commit
98bfcabfe8
|
@ -1,6 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Sega.MasterSystem;
|
||||
|
||||
// ReSharper disable StyleCop.SA1401
|
||||
namespace BizHawk.Client.Common
|
||||
|
@ -70,103 +69,6 @@ namespace BizHawk.Client.Common
|
|||
// This relies on a client specific implementation!
|
||||
public static SimpleController ControllerInputCoalescer;
|
||||
|
||||
public static SystemInfo SystemInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Emulator.SystemId)
|
||||
{
|
||||
default:
|
||||
case "NULL":
|
||||
return SystemInfo.Null;
|
||||
case "NES":
|
||||
return SystemInfo.Nes;
|
||||
case "INTV":
|
||||
return SystemInfo.Intellivision;
|
||||
case "SG":
|
||||
return SystemInfo.SG;
|
||||
case "SMS":
|
||||
if (Emulator is SMS gg && gg.IsGameGear)
|
||||
{
|
||||
return SystemInfo.GG;
|
||||
}
|
||||
|
||||
if (Emulator is SMS sg && sg.IsSG1000)
|
||||
{
|
||||
return SystemInfo.SG;
|
||||
}
|
||||
|
||||
return SystemInfo.SMS;
|
||||
case "PCECD":
|
||||
return SystemInfo.PCECD;
|
||||
case "PCE":
|
||||
return SystemInfo.PCE;
|
||||
case "SGX":
|
||||
return SystemInfo.SGX;
|
||||
case "GEN":
|
||||
return SystemInfo.Genesis;
|
||||
case "TI83":
|
||||
return SystemInfo.TI83;
|
||||
case "SNES":
|
||||
return SystemInfo.SNES;
|
||||
case "GB":
|
||||
/*
|
||||
if ((Emulator as IGameboyCommon).IsCGBMode())
|
||||
{
|
||||
return SystemInfo.GBC;
|
||||
}
|
||||
*/
|
||||
return SystemInfo.GB;
|
||||
case "A26":
|
||||
return SystemInfo.Atari2600;
|
||||
case "A78":
|
||||
return SystemInfo.Atari7800;
|
||||
case "C64":
|
||||
return SystemInfo.C64;
|
||||
case "Coleco":
|
||||
return SystemInfo.Coleco;
|
||||
case "GBA":
|
||||
return SystemInfo.GBA;
|
||||
case "N64":
|
||||
return SystemInfo.N64;
|
||||
case "SAT":
|
||||
return SystemInfo.Saturn;
|
||||
case "DGB":
|
||||
return SystemInfo.DualGB;
|
||||
case "GB3x":
|
||||
return SystemInfo.GB3x;
|
||||
case "GB4x":
|
||||
return SystemInfo.GB4x;
|
||||
case "WSWAN":
|
||||
return SystemInfo.WonderSwan;
|
||||
case "Lynx":
|
||||
return SystemInfo.Lynx;
|
||||
case "PSX":
|
||||
return SystemInfo.PSX;
|
||||
case "AppleII":
|
||||
return SystemInfo.AppleII;
|
||||
case "Libretro":
|
||||
return SystemInfo.Libretro;
|
||||
case "VB":
|
||||
return SystemInfo.VirtualBoy;
|
||||
case "VEC":
|
||||
return SystemInfo.Vectrex;
|
||||
case "NGP":
|
||||
return SystemInfo.NeoGeoPocket;
|
||||
case "ZXSpectrum":
|
||||
return SystemInfo.ZxSpectrum;
|
||||
case "AmstradCPC":
|
||||
return SystemInfo.AmstradCpc;
|
||||
case "ChannelF":
|
||||
return SystemInfo.ChannelF;
|
||||
case "O2":
|
||||
return SystemInfo.O2;
|
||||
case "MAME":
|
||||
return SystemInfo.Mame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> UserBag = new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System.Drawing;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
|
@ -10,6 +10,7 @@ using BizHawk.Emulation.Cores.Nintendo.SNES9X;
|
|||
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
|
||||
using BizHawk.Emulation.Cores.Sony.PSP;
|
||||
using BizHawk.Emulation.Cores.Arcades.MAME;
|
||||
using BizHawk.Emulation.Cores.Sega.MasterSystem;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk.CoreExtensions
|
||||
{
|
||||
|
@ -71,5 +72,99 @@ namespace BizHawk.Client.EmuHawk.CoreExtensions
|
|||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static SystemInfo System(this IEmulator emulator)
|
||||
{
|
||||
switch (emulator.SystemId)
|
||||
{
|
||||
default:
|
||||
case "NULL":
|
||||
return SystemInfo.Null;
|
||||
case "NES":
|
||||
return SystemInfo.Nes;
|
||||
case "INTV":
|
||||
return SystemInfo.Intellivision;
|
||||
case "SG":
|
||||
return SystemInfo.SG;
|
||||
case "SMS":
|
||||
if (emulator is SMS gg && gg.IsGameGear)
|
||||
{
|
||||
return SystemInfo.GG;
|
||||
}
|
||||
|
||||
if (emulator is SMS sg && sg.IsSG1000)
|
||||
{
|
||||
return SystemInfo.SG;
|
||||
}
|
||||
|
||||
return SystemInfo.SMS;
|
||||
case "PCECD":
|
||||
return SystemInfo.PCECD;
|
||||
case "PCE":
|
||||
return SystemInfo.PCE;
|
||||
case "SGX":
|
||||
return SystemInfo.SGX;
|
||||
case "GEN":
|
||||
return SystemInfo.Genesis;
|
||||
case "TI83":
|
||||
return SystemInfo.TI83;
|
||||
case "SNES":
|
||||
return SystemInfo.SNES;
|
||||
case "GB":
|
||||
/*
|
||||
if ((Emulator as IGameboyCommon).IsCGBMode())
|
||||
{
|
||||
return SystemInfo.GBC;
|
||||
}
|
||||
*/
|
||||
return SystemInfo.GB;
|
||||
case "A26":
|
||||
return SystemInfo.Atari2600;
|
||||
case "A78":
|
||||
return SystemInfo.Atari7800;
|
||||
case "C64":
|
||||
return SystemInfo.C64;
|
||||
case "Coleco":
|
||||
return SystemInfo.Coleco;
|
||||
case "GBA":
|
||||
return SystemInfo.GBA;
|
||||
case "N64":
|
||||
return SystemInfo.N64;
|
||||
case "SAT":
|
||||
return SystemInfo.Saturn;
|
||||
case "DGB":
|
||||
return SystemInfo.DualGB;
|
||||
case "GB3x":
|
||||
return SystemInfo.GB3x;
|
||||
case "GB4x":
|
||||
return SystemInfo.GB4x;
|
||||
case "WSWAN":
|
||||
return SystemInfo.WonderSwan;
|
||||
case "Lynx":
|
||||
return SystemInfo.Lynx;
|
||||
case "PSX":
|
||||
return SystemInfo.PSX;
|
||||
case "AppleII":
|
||||
return SystemInfo.AppleII;
|
||||
case "Libretro":
|
||||
return SystemInfo.Libretro;
|
||||
case "VB":
|
||||
return SystemInfo.VirtualBoy;
|
||||
case "VEC":
|
||||
return SystemInfo.Vectrex;
|
||||
case "NGP":
|
||||
return SystemInfo.NeoGeoPocket;
|
||||
case "ZXSpectrum":
|
||||
return SystemInfo.ZxSpectrum;
|
||||
case "AmstradCPC":
|
||||
return SystemInfo.AmstradCpc;
|
||||
case "ChannelF":
|
||||
return SystemInfo.ChannelF;
|
||||
case "O2":
|
||||
return SystemInfo.O2;
|
||||
case "MAME":
|
||||
return SystemInfo.Mame;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1561,7 +1561,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
str += $"{VersionInfo.CustomBuildString} ";
|
||||
}
|
||||
|
||||
str += Emulator.IsNull() ? "BizHawk" : Global.SystemInfo.DisplayName;
|
||||
str += Emulator.IsNull() ? "BizHawk" : Emulator.System().DisplayName;
|
||||
|
||||
if (VersionInfo.DeveloperBuild)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue