BizHawk/BizHawk.Client.Common/Global.cs

151 lines
5.0 KiB
C#
Raw Normal View History

using BizHawk.Emulation.Common;
2014-05-31 23:30:33 +00:00
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Sega.MasterSystem;
using BizHawk.Emulation.DiscSystem;
2013-10-27 16:26:37 +00:00
namespace BizHawk.Client.Common
2013-10-25 00:59:34 +00:00
{
public static class Global
{
public static IEmulator Emulator;
public static Config Config;
public static GameInfo Game;
public static CheatCollection CheatList;
public static FirmwareManager FirmwareManager;
public static Rewinder Rewinder;
2013-10-25 00:59:34 +00:00
public static IMovieSession MovieSession = new MovieSession();
2013-10-27 07:54:00 +00:00
/// <summary>
/// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind).
2013-10-27 07:54:00 +00:00
/// </summary>
public static bool DisableSecondaryThrottling;
2013-10-27 16:26:37 +00:00
/// <summary>
2015-01-31 04:49:53 +00:00
/// The maximum number of millseconds the sound output buffer can go below full before causing a noticable sound interruption.
/// </summary>
public static int SoundMaxBufferDeficitMs;
2013-10-27 16:26:37 +00:00
public static AutofireController AutofireNullControls;
//the movie will be spliced inbetween these if it is present
public static CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter();
public static CopyControllerAdapter MovieOutputHardpoint = new CopyControllerAdapter();
2014-08-17 16:00:46 +00:00
public static MultitrackRewiringControllerAdapter MultitrackRewiringAdapter = new MultitrackRewiringControllerAdapter();
2013-10-27 16:26:37 +00:00
//dont take my word for it, since the final word is actually in RewireInputChain, but here is a guide...
//user -> Input -> ActiveController -> UDLR -> StickyXORPlayerInputAdapter -> TurboAdapter(TBD) -> Lua(?TBD?) -> ..
//.. -> MultitrackRewiringControllerAdapter -> MovieInputSourceAdapter -> (MovieSession) -> MovieOutputAdapter -> ControllerOutput(1) -> Game
//(1)->Input Display
//the original source controller, bound to the user, sort of the "input" port for the chain, i think
public static Controller ActiveController;
//rapid fire version on the user controller, has its own key bindings and is OR'ed against ActiveController
public static AutofireController AutoFireController;
//the "output" port for the controller chain.
public static CopyControllerAdapter ControllerOutput = new CopyControllerAdapter();
2013-11-03 16:47:21 +00:00
public static UD_LR_ControllerAdapter UD_LR_ControllerAdapter = new UD_LR_ControllerAdapter();
public static AutoFireStickyXorAdapter AutofireStickyXORAdapter = new AutoFireStickyXorAdapter();
2013-11-03 16:47:21 +00:00
/// <summary>
/// provides an opportunity to mutate the player's input in an autohold style
/// </summary>
public static StickyXorAdapter StickyXORAdapter = new StickyXorAdapter();
/// <summary>
2014-03-29 21:12:04 +00:00
/// Used to AND to another controller, used for Joypad.Set()
/// </summary>
2014-03-29 21:12:04 +00:00
public static OverrideAdaptor LuaAndAdaptor = new OverrideAdaptor();
/// <summary>
/// fire off one-frame logical button clicks here. useful for things like ti-83 virtual pad and reset buttons
/// </summary>
public static ClickyVirtualPadController ClickyVirtualPadController = new ClickyVirtualPadController();
2013-11-03 16:47:21 +00:00
public static SimpleController MovieOutputController = new SimpleController();
public static Controller ClientControls;
// 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;
case "INTV":
return SystemInfo.Intellivision;
case "SG":
return SystemInfo.SG;
case "SMS":
if ((Global.Emulator as SMS).IsGameGear)
{
return SystemInfo.GG;
}
else if ((Global.Emulator as SMS).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":
2014-05-31 23:30:33 +00:00
if ((Global.Emulator as Gameboy).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 "WSWAN":
return SystemInfo.WonderSwan;
case "Lynx":
2014-11-18 12:09:11 +00:00
return SystemInfo.Lynx;
case "PSX":
return SystemInfo.PSX;
2015-02-17 22:58:25 +00:00
case "AppleII":
return SystemInfo.AppleII;
}
}
}
2013-10-25 00:59:34 +00:00
}
}