2018-11-04 17:05:20 +00:00
using System ;
using System.Collections.Generic ;
2017-05-17 16:16:55 +00:00
using BizHawk.Emulation.Common ;
2017-06-15 23:00:41 +00:00
using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy ;
2014-05-31 23:17:39 +00:00
using BizHawk.Emulation.Cores.Sega.MasterSystem ;
2017-05-10 18:27:10 +00:00
2017-05-17 16:16:55 +00:00
// ReSharper disable StyleCop.SA1401
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 ;
2013-11-16 16:30:20 +00:00
public static CheatCollection CheatList ;
2013-11-01 23:17:30 +00:00
public static FirmwareManager FirmwareManager ;
2013-12-27 01:19:38 +00:00
public static Rewinder Rewinder ;
2013-10-25 00:59:34 +00:00
2015-02-22 23:23:36 +00:00
public static IMovieSession MovieSession = new MovieSession ( ) ;
2013-10-27 07:54:00 +00:00
/// <summary>
2015-01-13 04:21:32 +00:00
/// 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>
2015-01-13 04:21:32 +00:00
public static bool DisableSecondaryThrottling ;
2013-10-27 16:26:37 +00:00
2015-01-28 00:53:49 +00:00
/// <summary>
2017-05-17 16:16:55 +00:00
/// The maximum number of milliseconds the sound output buffer can go below full before causing a noticeable sound interruption.
2015-01-28 00:53:49 +00:00
/// </summary>
public static int SoundMaxBufferDeficitMs ;
2017-04-14 19:59:01 +00:00
// the movie will be spliced inbetween these if it is present
2017-05-19 18:17:07 +00:00
public static readonly CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter ( ) ;
public static readonly CopyControllerAdapter MovieOutputHardpoint = new CopyControllerAdapter ( ) ;
public static readonly MultitrackRewiringControllerAdapter MultitrackRewiringAdapter = new MultitrackRewiringControllerAdapter ( ) ;
2013-10-27 16:26:37 +00:00
2017-04-14 19:59:01 +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
2013-10-27 16:26:37 +00:00
2017-04-14 19:59:01 +00:00
// the original source controller, bound to the user, sort of the "input" port for the chain, i think
2013-10-27 16:26:37 +00:00
public static Controller ActiveController ;
2017-05-09 18:19:55 +00:00
// rapid fire version on the user controller, has its own key bindings and is OR'ed against ActiveController
2013-10-27 16:26:37 +00:00
public static AutofireController AutoFireController ;
2017-04-14 19:59:01 +00:00
// the "output" port for the controller chain.
2017-05-19 18:17:07 +00:00
public static readonly CopyControllerAdapter ControllerOutput = new CopyControllerAdapter ( ) ;
2013-10-27 16:26:37 +00:00
2017-05-19 18:17:07 +00:00
public static readonly UD_LR_ControllerAdapter UD_LR_ControllerAdapter = new UD_LR_ControllerAdapter ( ) ;
2013-11-03 16:47:21 +00:00
2017-05-19 18:17:07 +00:00
public static readonly AutoFireStickyXorAdapter AutofireStickyXORAdapter = new AutoFireStickyXorAdapter ( ) ;
2013-11-03 16:47:21 +00:00
2013-11-01 22:56:55 +00:00
/// <summary>
/// provides an opportunity to mutate the player's input in an autohold style
/// </summary>
2017-05-19 18:17:07 +00:00
public static readonly StickyXorAdapter StickyXORAdapter = new StickyXorAdapter ( ) ;
2013-11-01 22:56:55 +00:00
/// <summary>
2014-03-29 21:12:04 +00:00
/// Used to AND to another controller, used for Joypad.Set()
2013-11-01 22:56:55 +00:00
/// </summary>
2017-05-19 18:17:07 +00:00
public static readonly OverrideAdaptor LuaAndAdaptor = new OverrideAdaptor ( ) ;
2013-11-01 22:56:55 +00:00
/// <summary>
/// fire off one-frame logical button clicks here. useful for things like ti-83 virtual pad and reset buttons
/// </summary>
2017-05-19 18:17:07 +00:00
public static readonly ClickyVirtualPadController ClickyVirtualPadController = new ClickyVirtualPadController ( ) ;
2013-11-03 16:47:21 +00:00
public static Controller ClientControls ;
2013-12-24 21:37:51 +00:00
// Input state which has been estine for game controller inputs are coalesce here
// This relies on a client specific implementation!
public static SimpleController ControllerInputCoalescer ;
2014-05-30 22:00:16 +00:00
public static SystemInfo SystemInfo
{
get
{
2017-05-09 18:19:55 +00:00
switch ( Emulator . SystemId )
2014-05-30 22:00:16 +00:00
{
default :
case "NULL" :
return SystemInfo . Null ;
case "NES" :
return SystemInfo . Nes ;
2014-05-31 23:05:02 +00:00
case "INTV" :
return SystemInfo . Intellivision ;
case "SG" :
return SystemInfo . SG ;
case "SMS" :
2015-09-30 20:26:09 +00:00
if ( ( Emulator as SMS ) . IsGameGear )
2014-05-31 23:17:39 +00:00
{
return SystemInfo . GG ;
}
2017-04-14 19:59:01 +00:00
if ( ( Emulator as SMS ) . IsSG1000 )
2014-05-31 23:17:39 +00:00
{
return SystemInfo . SG ;
}
2014-05-31 23:05:02 +00:00
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" :
2017-11-09 14:51:39 +00:00
/ *
2017-06-15 23:00:41 +00:00
if ( ( Emulator as IGameboyCommon ) . IsCGBMode ( ) )
2014-05-31 23:30:33 +00:00
{
return SystemInfo . GBC ;
}
2017-11-09 14:51:39 +00:00
* /
2014-05-31 23:05:02 +00:00
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 ;
2019-09-08 20:35:39 +00:00
case "GB3x" :
return SystemInfo . GB3x ;
2019-10-04 17:52:29 +00:00
case "GB4x" :
return SystemInfo . GB4x ;
2014-05-31 23:05:02 +00:00
case "WSWAN" :
return SystemInfo . WonderSwan ;
2014-11-21 01:32:15 +00:00
case "Lynx" :
2014-11-18 12:09:11 +00:00
return SystemInfo . Lynx ;
2014-12-17 19:14:21 +00:00
case "PSX" :
return SystemInfo . PSX ;
2015-02-17 22:58:25 +00:00
case "AppleII" :
return SystemInfo . AppleII ;
2017-04-18 03:43:08 +00:00
case "Libretro" :
return SystemInfo . Libretro ;
2017-05-30 22:42:09 +00:00
case "VB" :
return SystemInfo . VirtualBoy ;
2019-09-08 20:35:39 +00:00
case "VEC" :
return SystemInfo . Vectrex ;
2017-06-01 00:09:31 +00:00
case "NGP" :
return SystemInfo . NeoGeoPocket ;
2019-11-04 01:55:38 +00:00
case "ZXSpectrum" :
return SystemInfo . ZXSpectrum ;
case "AmstradCPC" :
return SystemInfo . AmstradCPC ;
2019-04-16 15:10:56 +00:00
case "ChannelF" :
return SystemInfo . ChannelF ;
2019-11-18 22:33:55 +00:00
case "O2" :
return SystemInfo . O2 ;
2014-05-30 22:00:16 +00:00
}
}
}
2015-06-30 22:54:42 +00:00
public static Dictionary < string , object > UserBag = new Dictionary < string , object > ( ) ;
2013-10-25 00:59:34 +00:00
}
}