Rewrite the configuration system (#831)
The configuration system was quite fragile and too dependent on everything, this fix #812 . The changes: The file configuration is now entirely independent from the internal configuration state. The file configuration is versioned (current version is 1). Every configuration elements are now reactive properties that the emulator can register on to handle initialization and configuration changes. The configuration system is now in Ryujinx.Common to be accessible on every projects. Discord integration is now independent from the UI and can be reloaded. The primary controller is now configurable at runtime (NOTE: the UI currently doesn't have any options to configure real controller). The logger is entirely reloadable. You can now hotplug your controller when the emulator is running. The logger now takes name for every LogTarget to make them removable at runtime. The logger now always add the default "console" target to avoid loosing early init logs. The configuration system now generates a default file configuration if it's missing or too new. General system stability improvements to enhance the user's experience
This commit is contained in:
parent
e5858e2c7d
commit
01a4c80ed5
34 changed files with 1625 additions and 707 deletions
45
Ryujinx.Common/Configuration/Hid/ControllerInputId.cs
Normal file
45
Ryujinx.Common/Configuration/Hid/ControllerInputId.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
namespace Ryujinx.Common.Configuration.Hid
|
||||
{
|
||||
public enum ControllerInputId
|
||||
{
|
||||
Button0,
|
||||
Button1,
|
||||
Button2,
|
||||
Button3,
|
||||
Button4,
|
||||
Button5,
|
||||
Button6,
|
||||
Button7,
|
||||
Button8,
|
||||
Button9,
|
||||
Button10,
|
||||
Button11,
|
||||
Button12,
|
||||
Button13,
|
||||
Button14,
|
||||
Button15,
|
||||
Button16,
|
||||
Button17,
|
||||
Button18,
|
||||
Button19,
|
||||
Button20,
|
||||
Axis0,
|
||||
Axis1,
|
||||
Axis2,
|
||||
Axis3,
|
||||
Axis4,
|
||||
Axis5,
|
||||
Hat0Up,
|
||||
Hat0Down,
|
||||
Hat0Left,
|
||||
Hat0Right,
|
||||
Hat1Up,
|
||||
Hat1Down,
|
||||
Hat1Left,
|
||||
Hat1Right,
|
||||
Hat2Up,
|
||||
Hat2Down,
|
||||
Hat2Left,
|
||||
Hat2Right
|
||||
}
|
||||
}
|
11
Ryujinx.Common/Configuration/Hid/ControllerType.cs
Normal file
11
Ryujinx.Common/Configuration/Hid/ControllerType.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Ryujinx.Configuration.Hid
|
||||
{
|
||||
public enum ControllerType
|
||||
{
|
||||
ProController,
|
||||
Handheld,
|
||||
NpadPair,
|
||||
NpadLeft,
|
||||
NpadRight
|
||||
}
|
||||
}
|
153
Ryujinx.Common/Configuration/Hid/Key.cs
Normal file
153
Ryujinx.Common/Configuration/Hid/Key.cs
Normal file
|
@ -0,0 +1,153 @@
|
|||
namespace Ryujinx.Configuration.Hid
|
||||
{
|
||||
public enum Key
|
||||
{
|
||||
Unknown = 0,
|
||||
ShiftLeft = 1,
|
||||
LShift = 1,
|
||||
ShiftRight = 2,
|
||||
RShift = 2,
|
||||
ControlLeft = 3,
|
||||
LControl = 3,
|
||||
ControlRight = 4,
|
||||
RControl = 4,
|
||||
AltLeft = 5,
|
||||
LAlt = 5,
|
||||
AltRight = 6,
|
||||
RAlt = 6,
|
||||
WinLeft = 7,
|
||||
LWin = 7,
|
||||
WinRight = 8,
|
||||
RWin = 8,
|
||||
Menu = 9,
|
||||
F1 = 10,
|
||||
F2 = 11,
|
||||
F3 = 12,
|
||||
F4 = 13,
|
||||
F5 = 14,
|
||||
F6 = 15,
|
||||
F7 = 16,
|
||||
F8 = 17,
|
||||
F9 = 18,
|
||||
F10 = 19,
|
||||
F11 = 20,
|
||||
F12 = 21,
|
||||
F13 = 22,
|
||||
F14 = 23,
|
||||
F15 = 24,
|
||||
F16 = 25,
|
||||
F17 = 26,
|
||||
F18 = 27,
|
||||
F19 = 28,
|
||||
F20 = 29,
|
||||
F21 = 30,
|
||||
F22 = 31,
|
||||
F23 = 32,
|
||||
F24 = 33,
|
||||
F25 = 34,
|
||||
F26 = 35,
|
||||
F27 = 36,
|
||||
F28 = 37,
|
||||
F29 = 38,
|
||||
F30 = 39,
|
||||
F31 = 40,
|
||||
F32 = 41,
|
||||
F33 = 42,
|
||||
F34 = 43,
|
||||
F35 = 44,
|
||||
Up = 45,
|
||||
Down = 46,
|
||||
Left = 47,
|
||||
Right = 48,
|
||||
Enter = 49,
|
||||
Escape = 50,
|
||||
Space = 51,
|
||||
Tab = 52,
|
||||
BackSpace = 53,
|
||||
Back = 53,
|
||||
Insert = 54,
|
||||
Delete = 55,
|
||||
PageUp = 56,
|
||||
PageDown = 57,
|
||||
Home = 58,
|
||||
End = 59,
|
||||
CapsLock = 60,
|
||||
ScrollLock = 61,
|
||||
PrintScreen = 62,
|
||||
Pause = 63,
|
||||
NumLock = 64,
|
||||
Clear = 65,
|
||||
Sleep = 66,
|
||||
Keypad0 = 67,
|
||||
Keypad1 = 68,
|
||||
Keypad2 = 69,
|
||||
Keypad3 = 70,
|
||||
Keypad4 = 71,
|
||||
Keypad5 = 72,
|
||||
Keypad6 = 73,
|
||||
Keypad7 = 74,
|
||||
Keypad8 = 75,
|
||||
Keypad9 = 76,
|
||||
KeypadDivide = 77,
|
||||
KeypadMultiply = 78,
|
||||
KeypadSubtract = 79,
|
||||
KeypadMinus = 79,
|
||||
KeypadAdd = 80,
|
||||
KeypadPlus = 80,
|
||||
KeypadDecimal = 81,
|
||||
KeypadPeriod = 81,
|
||||
KeypadEnter = 82,
|
||||
A = 83,
|
||||
B = 84,
|
||||
C = 85,
|
||||
D = 86,
|
||||
E = 87,
|
||||
F = 88,
|
||||
G = 89,
|
||||
H = 90,
|
||||
I = 91,
|
||||
J = 92,
|
||||
K = 93,
|
||||
L = 94,
|
||||
M = 95,
|
||||
N = 96,
|
||||
O = 97,
|
||||
P = 98,
|
||||
Q = 99,
|
||||
R = 100,
|
||||
S = 101,
|
||||
T = 102,
|
||||
U = 103,
|
||||
V = 104,
|
||||
W = 105,
|
||||
X = 106,
|
||||
Y = 107,
|
||||
Z = 108,
|
||||
Number0 = 109,
|
||||
Number1 = 110,
|
||||
Number2 = 111,
|
||||
Number3 = 112,
|
||||
Number4 = 113,
|
||||
Number5 = 114,
|
||||
Number6 = 115,
|
||||
Number7 = 116,
|
||||
Number8 = 117,
|
||||
Number9 = 118,
|
||||
Tilde = 119,
|
||||
Grave = 119,
|
||||
Minus = 120,
|
||||
Plus = 121,
|
||||
BracketLeft = 122,
|
||||
LBracket = 122,
|
||||
BracketRight = 123,
|
||||
RBracket = 123,
|
||||
Semicolon = 124,
|
||||
Quote = 125,
|
||||
Comma = 126,
|
||||
Period = 127,
|
||||
Slash = 128,
|
||||
BackSlash = 129,
|
||||
NonUSBackSlash = 130,
|
||||
LastKey = 131
|
||||
}
|
||||
}
|
7
Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs
Normal file
7
Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Ryujinx.Configuration.Hid
|
||||
{
|
||||
public struct KeyboardHotkeys
|
||||
{
|
||||
public Key ToggleVsync;
|
||||
}
|
||||
}
|
35
Ryujinx.Common/Configuration/Hid/NpadController.cs
Normal file
35
Ryujinx.Common/Configuration/Hid/NpadController.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
namespace Ryujinx.Common.Configuration.Hid
|
||||
{
|
||||
public class NpadController
|
||||
{
|
||||
/// <summary>
|
||||
/// Enables or disables controller support
|
||||
/// </summary>
|
||||
public bool Enabled;
|
||||
|
||||
/// <summary>
|
||||
/// Controller Device Index
|
||||
/// </summary>
|
||||
public int Index;
|
||||
|
||||
/// <summary>
|
||||
/// Controller Analog Stick Deadzone
|
||||
/// </summary>
|
||||
public float Deadzone;
|
||||
|
||||
/// <summary>
|
||||
/// Controller Trigger Threshold
|
||||
/// </summary>
|
||||
public float TriggerThreshold;
|
||||
|
||||
/// <summary>
|
||||
/// Left JoyCon Controller Bindings
|
||||
/// </summary>
|
||||
public NpadControllerLeft LeftJoycon;
|
||||
|
||||
/// <summary>
|
||||
/// Right JoyCon Controller Bindings
|
||||
/// </summary>
|
||||
public NpadControllerRight RightJoycon;
|
||||
}
|
||||
}
|
15
Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs
Normal file
15
Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
namespace Ryujinx.Common.Configuration.Hid
|
||||
{
|
||||
public struct NpadControllerLeft
|
||||
{
|
||||
public ControllerInputId Stick;
|
||||
public ControllerInputId StickButton;
|
||||
public ControllerInputId ButtonMinus;
|
||||
public ControllerInputId ButtonL;
|
||||
public ControllerInputId ButtonZl;
|
||||
public ControllerInputId DPadUp;
|
||||
public ControllerInputId DPadDown;
|
||||
public ControllerInputId DPadLeft;
|
||||
public ControllerInputId DPadRight;
|
||||
}
|
||||
}
|
15
Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs
Normal file
15
Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
namespace Ryujinx.Common.Configuration.Hid
|
||||
{
|
||||
public struct NpadControllerRight
|
||||
{
|
||||
public ControllerInputId Stick;
|
||||
public ControllerInputId StickButton;
|
||||
public ControllerInputId ButtonA;
|
||||
public ControllerInputId ButtonB;
|
||||
public ControllerInputId ButtonX;
|
||||
public ControllerInputId ButtonY;
|
||||
public ControllerInputId ButtonPlus;
|
||||
public ControllerInputId ButtonR;
|
||||
public ControllerInputId ButtonZr;
|
||||
}
|
||||
}
|
20
Ryujinx.Common/Configuration/Hid/NpadKeyboard.cs
Normal file
20
Ryujinx.Common/Configuration/Hid/NpadKeyboard.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
namespace Ryujinx.UI.Input
|
||||
{
|
||||
public class NpadKeyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Left JoyCon Keyboard Bindings
|
||||
/// </summary>
|
||||
public Configuration.Hid.NpadKeyboardLeft LeftJoycon;
|
||||
|
||||
/// <summary>
|
||||
/// Right JoyCon Keyboard Bindings
|
||||
/// </summary>
|
||||
public Configuration.Hid.NpadKeyboardRight RightJoycon;
|
||||
|
||||
/// <summary>
|
||||
/// Hotkey Keyboard Bindings
|
||||
/// </summary>
|
||||
public Configuration.Hid.KeyboardHotkeys Hotkeys;
|
||||
}
|
||||
}
|
18
Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs
Normal file
18
Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Configuration.Hid
|
||||
{
|
||||
public struct NpadKeyboardLeft
|
||||
{
|
||||
public Key StickUp;
|
||||
public Key StickDown;
|
||||
public Key StickLeft;
|
||||
public Key StickRight;
|
||||
public Key StickButton;
|
||||
public Key DPadUp;
|
||||
public Key DPadDown;
|
||||
public Key DPadLeft;
|
||||
public Key DPadRight;
|
||||
public Key ButtonMinus;
|
||||
public Key ButtonL;
|
||||
public Key ButtonZl;
|
||||
}
|
||||
}
|
18
Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs
Normal file
18
Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Configuration.Hid
|
||||
{
|
||||
public struct NpadKeyboardRight
|
||||
{
|
||||
public Key StickUp;
|
||||
public Key StickDown;
|
||||
public Key StickLeft;
|
||||
public Key StickRight;
|
||||
public Key StickButton;
|
||||
public Key ButtonA;
|
||||
public Key ButtonB;
|
||||
public Key ButtonX;
|
||||
public Key ButtonY;
|
||||
public Key ButtonPlus;
|
||||
public Key ButtonR;
|
||||
public Key ButtonZr;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue