edited NpadManager to better support auto-assign; updated initialization methods; changed some settings for LED color
This commit is contained in:
parent
5b88a2dd89
commit
62dfbb5dcb
@ -43,6 +43,8 @@ namespace Ryujinx.Input.HLE
|
||||
private bool _enableMouse;
|
||||
private Switch _device;
|
||||
|
||||
public bool AutoAssignEnabled { get; set; } = false;
|
||||
|
||||
public NpadManager(IGamepadDriver keyboardDriver, IGamepadDriver gamepadDriver, IGamepadDriver mouseDriver)
|
||||
{
|
||||
_controllers = new NpadController[MaxControllers];
|
||||
@ -53,7 +55,7 @@ namespace Ryujinx.Input.HLE
|
||||
_mouseDriver = mouseDriver;
|
||||
_inputConfig = new List<InputConfig>();
|
||||
|
||||
//_gamepadDriver.OnGamepadConnected += HandleOnGamepadConnected;
|
||||
_gamepadDriver.OnGamepadConnected += HandleOnGamepadConnected;
|
||||
_gamepadDriver.OnGamepadDisconnected += HandleOnGamepadDisconnected;
|
||||
}
|
||||
|
||||
@ -89,12 +91,14 @@ namespace Ryujinx.Input.HLE
|
||||
}
|
||||
}
|
||||
|
||||
//ReloadConfiguration(_inputConfig, _enableKeyboard, _enableMouse);
|
||||
if (AutoAssignEnabled) return;
|
||||
ReloadConfiguration(_inputConfig, _enableKeyboard, _enableMouse);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleOnGamepadConnected(string id)
|
||||
{
|
||||
if (AutoAssignEnabled) return;
|
||||
// Force input reload
|
||||
ReloadConfiguration(_inputConfig, _enableKeyboard, _enableMouse);
|
||||
}
|
||||
@ -198,11 +202,13 @@ namespace Ryujinx.Input.HLE
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(Switch device, List<InputConfig> inputConfig, bool enableKeyboard, bool enableMouse)
|
||||
public void Initialize(Switch device, List<InputConfig> inputConfig, bool enableKeyboard, bool enableMouse, bool enableAutoAssign)
|
||||
{
|
||||
_device = device;
|
||||
_device.Configuration.RefreshInputConfig = RefreshInputConfigForHLE;
|
||||
|
||||
AutoAssignEnabled = enableAutoAssign;
|
||||
|
||||
ReloadConfiguration(inputConfig, enableKeyboard, enableMouse);
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ namespace Ryujinx.Ava
|
||||
|
||||
DisplaySleep.Prevent();
|
||||
|
||||
NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse, ConfigurationState.Instance.Hid.EnableAutoAssign);
|
||||
TouchScreenManager.Initialize(Device);
|
||||
|
||||
_viewModel.IsGameRunning = true;
|
||||
|
@ -370,7 +370,7 @@ namespace Ryujinx.Headless
|
||||
|
||||
DisplaySleep.Prevent();
|
||||
|
||||
_window.Initialize(_emulationContext, _inputConfiguration, _enableKeyboard, _enableMouse);
|
||||
_window.Initialize(_emulationContext, _inputConfiguration, _enableKeyboard, _enableMouse, _enableAutoAssign);
|
||||
|
||||
_window.Execute();
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace Ryujinx.Headless
|
||||
SDL2Driver.Instance.Initialize();
|
||||
}
|
||||
|
||||
public void Initialize(Switch device, List<InputConfig> inputConfigs, bool enableKeyboard, bool enableMouse)
|
||||
public void Initialize(Switch device, List<InputConfig> inputConfigs, bool enableKeyboard, bool enableMouse, bool enableAutoAssign)
|
||||
{
|
||||
Device = device;
|
||||
|
||||
@ -133,7 +133,7 @@ namespace Ryujinx.Headless
|
||||
|
||||
Renderer = renderer;
|
||||
|
||||
NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse);
|
||||
NpadManager.Initialize(device, inputConfigs, enableKeyboard, enableMouse, enableAutoAssign);
|
||||
TouchScreenManager.Initialize(device);
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace Ryujinx.Ava.Input
|
||||
if (config is StandardControllerInputConfig standardConfig)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Application, $"Setting color for Player{index+1}");
|
||||
standardConfig.Led.LedColor = _playerColors[index];
|
||||
standardConfig.Led = new LedConfigController { EnableLed = true, LedColor = _playerColors[index] };
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
@ -868,6 +868,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
}
|
||||
}
|
||||
|
||||
if (_mainWindow.ViewModel.AppHost != null)
|
||||
{
|
||||
_mainWindow.ViewModel.AppHost.NpadManager.AutoAssignEnabled =
|
||||
ConfigurationState.Instance.Hid.EnableAutoAssign;
|
||||
}
|
||||
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
|
||||
// Atomically replace and signal input change.
|
||||
|
Loading…
x
Reference in New Issue
Block a user