Make InputManager not static, but make a static instance in globals, phase 1 of some refactoring

This commit is contained in:
adelikat 2020-03-15 17:19:11 -05:00
parent 5617950f50
commit 1f617221fc
4 changed files with 8 additions and 4 deletions

View File

@ -24,6 +24,8 @@ namespace BizHawk.Client.Common
/// </summary>
public static int SoundMaxBufferDeficitMs { get; set; }
public static InputManager InputManager { get; } = new InputManager();
// the movie will be spliced in between these if it is present
public static CopyControllerAdapter MovieInputSourceAdapter { get; } = new CopyControllerAdapter();
public static CopyControllerAdapter MovieOutputHardpoint { get; } = new CopyControllerAdapter();

View File

@ -5,9 +5,9 @@ using BizHawk.Client.Common.InputAdapterExtensions;
namespace BizHawk.Client.Common
{
public static class InputManager
public class InputManager
{
public static void RewireInputChain()
public void RewireInputChain()
{
Global.ControllerInputCoalescer.Clear();
Global.ControllerInputCoalescer.Definition = Global.ActiveController.Definition;
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
}
}
public static void SyncControls(IEmulator emulator, Config config)
public void SyncControls(IEmulator emulator, Config config)
{
var def = emulator.ControllerDefinition;

View File

@ -457,7 +457,7 @@ namespace BizHawk.Client.Common
// Note: this populates MovieControllerAdapter's Type with the appropriate controller
// Don't set it to a movie instance of the adapter or you will lose the definition!
InputManager.RewireInputChain();
Global.InputManager.RewireInputChain();
if (!record && emulator.SystemId == "NES") // For NES we need special logic since the movie will drive which core to load
{

View File

@ -815,6 +815,8 @@ namespace BizHawk.Client.EmuHawk
}
}
private InputManager InputManager => Global.InputManager;
private IVideoProvider _currentVideoProvider = NullVideo.Instance;
private ISoundProvider _currentSoundProvider = new NullSound(44100 / 60); // Reasonable default until we have a core instance