Resolve style nits
This commit is contained in:
parent
c7735aa66d
commit
b74849f1e1
8 changed files with 61 additions and 58 deletions
|
@ -33,8 +33,8 @@ namespace Ryujinx.Common.Logging
|
||||||
|
|
||||||
public AsyncLogTargetWrapper(ILogTarget target, int queueLimit, AsyncLogTargetOverflowAction overflowAction)
|
public AsyncLogTargetWrapper(ILogTarget target, int queueLimit, AsyncLogTargetOverflowAction overflowAction)
|
||||||
{
|
{
|
||||||
_target = target;
|
_target = target;
|
||||||
_messageQueue = new BlockingCollection<LogEventArgs>(queueLimit);
|
_messageQueue = new BlockingCollection<LogEventArgs>(queueLimit);
|
||||||
_overflowTimeout = overflowAction == AsyncLogTargetOverflowAction.Block ? -1 : 0;
|
_overflowTimeout = overflowAction == AsyncLogTargetOverflowAction.Block ? -1 : 0;
|
||||||
|
|
||||||
_messageThread = new Thread(() => {
|
_messageThread = new Thread(() => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Common.Logging
|
||||||
|
|
||||||
public JsonLogTarget(Stream stream, bool leaveOpen)
|
public JsonLogTarget(Stream stream, bool leaveOpen)
|
||||||
{
|
{
|
||||||
_stream = stream;
|
_stream = stream;
|
||||||
_leaveOpen = leaveOpen;
|
_leaveOpen = leaveOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ namespace Ryujinx.Common
|
||||||
|
|
||||||
public ObjectPool(Func<T> factory, int size)
|
public ObjectPool(Func<T> factory, int size)
|
||||||
{
|
{
|
||||||
|
_items = new T[size - 1];
|
||||||
_factory = factory;
|
_factory = factory;
|
||||||
_items = new T[size - 1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Allocate()
|
public T Allocate()
|
||||||
|
@ -69,7 +69,6 @@ namespace Ryujinx.Common
|
||||||
if (items[i] == null)
|
if (items[i] == null)
|
||||||
{
|
{
|
||||||
items[i] = obj;
|
items[i] = obj;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ namespace Ryujinx.Common
|
||||||
public static readonly ObjectPool<T> Instance = new ObjectPool<T>(() => new T(), 20);
|
public static readonly ObjectPool<T> Instance = new ObjectPool<T>(() => new T(), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ObjectPool<T> Default<T>() where T : class, new()
|
public static ObjectPool<T> Default<T>()
|
||||||
|
where T : class, new()
|
||||||
{
|
{
|
||||||
return DefaultPool<T>.Instance;
|
return DefaultPool<T>.Instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"$schema": "./_schema.json",
|
"$schema": "./_schema.json",
|
||||||
|
|
||||||
// Dump shaders in local directory (e.g. `C:\ShaderDumps`)
|
// Dump shaders in local directory (e.g. `C:\ShaderDumps`)
|
||||||
"graphics_shaders_dump_path": "WowHello",
|
"graphics_shaders_dump_path": "",
|
||||||
|
|
||||||
// Enable print debug logs
|
// Enable print debug logs
|
||||||
"logging_enable_debug": false,
|
"logging_enable_debug": false,
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
// Enable print error logs
|
// Enable print error logs
|
||||||
"logging_enable_error": true,
|
"logging_enable_error": true,
|
||||||
|
|
||||||
// Filtered log classes, in a JSON array, eg. `[ "Loader", "ServiceFS" ]`
|
// Filtered log classes, in a JSON array, eg. `[ "Loader", "ServiceFs" ]`
|
||||||
"logging_filtered_classes": [ ],
|
"logging_filtered_classes": [ ],
|
||||||
|
|
||||||
// Enable file logging
|
// Enable file logging
|
||||||
|
@ -41,12 +41,12 @@
|
||||||
// Enable integrity checks on Switch content files
|
// Enable integrity checks on Switch content files
|
||||||
"enable_fs_integrity_checks": true,
|
"enable_fs_integrity_checks": true,
|
||||||
|
|
||||||
// The primary controller's type.
|
// The primary controller's type
|
||||||
// Supported Values: Handheld, ProController, NpadPair, NpadLeft, NpadRight
|
// Supported Values: Handheld, ProController, NpadPair, NpadLeft, NpadRight
|
||||||
"controller_type": "Handheld",
|
"controller_type": "Handheld",
|
||||||
|
|
||||||
// Keyboard Controls
|
// Keyboard Controls
|
||||||
// https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs
|
// https://github.com/opentk/opentk/blob/master/src/OpenTK/Input/Key.cs
|
||||||
"keyboard_controls": {
|
"keyboard_controls": {
|
||||||
// Left JoyCon Keyboard Bindings
|
// Left JoyCon Keyboard Bindings
|
||||||
"left_joycon": {
|
"left_joycon": {
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Ryujinx
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default configuration instance
|
/// The default configuration instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Configuration Default { get; private set; }
|
public static Configuration Instance { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dumps shaders in this local directory
|
/// Dumps shaders in this local directory
|
||||||
|
@ -94,17 +94,17 @@ namespace Ryujinx
|
||||||
public bool EnableFsIntegrityChecks { get; private set; }
|
public bool EnableFsIntegrityChecks { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The primary controller's type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HidControllerType ControllerType { get; private set; }
|
public HidControllerType ControllerType { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Keyboard control bindings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NpadKeyboard KeyboardControls { get; private set; }
|
public NpadKeyboard KeyboardControls { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Controller control bindings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NpadController GamepadControls { get; private set; }
|
public NpadController GamepadControls { get; private set; }
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
using (Stream stream = File.OpenRead(path))
|
using (Stream stream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
Default = JsonSerializer.Deserialize<Configuration>(stream, resolver);
|
Instance = JsonSerializer.Deserialize<Configuration>(stream, resolver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,11 +131,14 @@ namespace Ryujinx
|
||||||
/// <param name="path">The path to the JSON configuration file</param>
|
/// <param name="path">The path to the JSON configuration file</param>
|
||||||
public static async Task LoadAsync(string path)
|
public static async Task LoadAsync(string path)
|
||||||
{
|
{
|
||||||
var resolver = CompositeResolver.Create(StandardResolver.AllowPrivateSnakeCase);
|
var resolver = CompositeResolver.Create(
|
||||||
|
new[] { new ConfigurationEnumFormatter<Key>() },
|
||||||
|
new[] { StandardResolver.AllowPrivateSnakeCase }
|
||||||
|
);
|
||||||
|
|
||||||
using (Stream stream = File.OpenRead(path))
|
using (Stream stream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
Default = await JsonSerializer.DeserializeAsync<Configuration>(stream, resolver);
|
Instance = await JsonSerializer.DeserializeAsync<Configuration>(stream, resolver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,12 +148,12 @@ namespace Ryujinx
|
||||||
/// <param name="device">The instance to configure</param>
|
/// <param name="device">The instance to configure</param>
|
||||||
public static void Configure(Switch device)
|
public static void Configure(Switch device)
|
||||||
{
|
{
|
||||||
if (Default == null)
|
if (Instance == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Configuration has not been loaded yet.");
|
throw new InvalidOperationException("Configuration has not been loaded yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsConfig.ShadersDumpPath = Default.GraphicsShadersDumpPath;
|
GraphicsConfig.ShadersDumpPath = Instance.GraphicsShadersDumpPath;
|
||||||
|
|
||||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||||
new ConsoleLogTarget(),
|
new ConsoleLogTarget(),
|
||||||
|
@ -158,7 +161,7 @@ namespace Ryujinx
|
||||||
AsyncLogTargetOverflowAction.Block
|
AsyncLogTargetOverflowAction.Block
|
||||||
));
|
));
|
||||||
|
|
||||||
if (Default.EnableFileLog)
|
if (Instance.EnableFileLog)
|
||||||
{
|
{
|
||||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||||
new FileLogTarget("Ryujinx.log"),
|
new FileLogTarget("Ryujinx.log"),
|
||||||
|
@ -167,49 +170,49 @@ namespace Ryujinx
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.SetEnable(LogLevel.Debug, Default.LoggingEnableDebug);
|
Logger.SetEnable(LogLevel.Debug, Instance.LoggingEnableDebug);
|
||||||
Logger.SetEnable(LogLevel.Stub, Default.LoggingEnableStub);
|
Logger.SetEnable(LogLevel.Stub, Instance.LoggingEnableStub);
|
||||||
Logger.SetEnable(LogLevel.Info, Default.LoggingEnableInfo);
|
Logger.SetEnable(LogLevel.Info, Instance.LoggingEnableInfo);
|
||||||
Logger.SetEnable(LogLevel.Warning, Default.LoggingEnableWarn);
|
Logger.SetEnable(LogLevel.Warning, Instance.LoggingEnableWarn);
|
||||||
Logger.SetEnable(LogLevel.Error, Default.LoggingEnableError);
|
Logger.SetEnable(LogLevel.Error, Instance.LoggingEnableError);
|
||||||
|
|
||||||
if (Default.LoggingFilteredClasses.Length > 0)
|
if (Instance.LoggingFilteredClasses.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (var logClass in EnumExtensions.GetValues<LogClass>())
|
foreach (var logClass in EnumExtensions.GetValues<LogClass>())
|
||||||
{
|
{
|
||||||
Logger.SetEnable(logClass, false);
|
Logger.SetEnable(logClass, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var logClass in Default.LoggingFilteredClasses)
|
foreach (var logClass in Instance.LoggingFilteredClasses)
|
||||||
{
|
{
|
||||||
Logger.SetEnable(logClass, true);
|
Logger.SetEnable(logClass, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
device.EnableDeviceVsync = Default.EnableVsync;
|
device.EnableDeviceVsync = Instance.EnableVsync;
|
||||||
|
|
||||||
device.System.State.DockedMode = Default.DockedMode;
|
device.System.State.DockedMode = Instance.DockedMode;
|
||||||
|
|
||||||
device.System.State.SetLanguage(Default.SystemLanguage);
|
device.System.State.SetLanguage(Instance.SystemLanguage);
|
||||||
|
|
||||||
if (Default.EnableMultiCoreScheduling)
|
if (Instance.EnableMultiCoreScheduling)
|
||||||
{
|
{
|
||||||
device.System.EnableMultiCoreScheduling();
|
device.System.EnableMultiCoreScheduling();
|
||||||
}
|
}
|
||||||
|
|
||||||
device.System.FsIntegrityCheckLevel = Default.EnableFsIntegrityChecks
|
device.System.FsIntegrityCheckLevel = Instance.EnableFsIntegrityChecks
|
||||||
? IntegrityCheckLevel.ErrorOnInvalid
|
? IntegrityCheckLevel.ErrorOnInvalid
|
||||||
: IntegrityCheckLevel.None;
|
: IntegrityCheckLevel.None;
|
||||||
|
|
||||||
if(Default.GamepadControls.Enabled)
|
if(Instance.GamepadControls.Enabled)
|
||||||
{
|
{
|
||||||
if (GamePad.GetName(Default.GamepadControls.Index) == "Unmapped Controller")
|
if (GamePad.GetName(Instance.GamepadControls.Index) == "Unmapped Controller")
|
||||||
{
|
{
|
||||||
Default.GamepadControls.SetEnabled(false);
|
Instance.GamepadControls.SetEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
device.Hid.InitilizePrimaryController(Default.ControllerType);
|
device.Hid.InitilizePrimaryController(Instance.ControllerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ConfigurationEnumFormatter<T> : IJsonFormatter<T>
|
private class ConfigurationEnumFormatter<T> : IJsonFormatter<T>
|
||||||
|
|
|
@ -142,24 +142,24 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
KeyboardState keyboard = _keyboard.Value;
|
KeyboardState keyboard = _keyboard.Value;
|
||||||
|
|
||||||
currentButton = Configuration.Default.KeyboardControls.GetButtons(keyboard);
|
currentButton = Configuration.Instance.KeyboardControls.GetButtons(keyboard);
|
||||||
|
|
||||||
(leftJoystickDx, leftJoystickDy) = Configuration.Default.KeyboardControls.GetLeftStick(keyboard);
|
(leftJoystickDx, leftJoystickDy) = Configuration.Instance.KeyboardControls.GetLeftStick(keyboard);
|
||||||
|
|
||||||
(rightJoystickDx, rightJoystickDy) = Configuration.Default.KeyboardControls.GetRightStick(keyboard);
|
(rightJoystickDx, rightJoystickDy) = Configuration.Instance.KeyboardControls.GetRightStick(keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentButton |= Configuration.Default.GamepadControls.GetButtons();
|
currentButton |= Configuration.Instance.GamepadControls.GetButtons();
|
||||||
|
|
||||||
//Keyboard has priority stick-wise
|
//Keyboard has priority stick-wise
|
||||||
if (leftJoystickDx == 0 && leftJoystickDy == 0)
|
if (leftJoystickDx == 0 && leftJoystickDy == 0)
|
||||||
{
|
{
|
||||||
(leftJoystickDx, leftJoystickDy) = Configuration.Default.GamepadControls.GetLeftStick();
|
(leftJoystickDx, leftJoystickDy) = Configuration.Instance.GamepadControls.GetLeftStick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rightJoystickDx == 0 && rightJoystickDy == 0)
|
if (rightJoystickDx == 0 && rightJoystickDy == 0)
|
||||||
{
|
{
|
||||||
(rightJoystickDx, rightJoystickDy) = Configuration.Default.GamepadControls.GetRightStick();
|
(rightJoystickDx, rightJoystickDy) = Configuration.Instance.GamepadControls.GetRightStick();
|
||||||
}
|
}
|
||||||
|
|
||||||
leftJoystick = new HidJoystickPosition
|
leftJoystick = new HidJoystickPosition
|
||||||
|
|
|
@ -10,23 +10,23 @@ namespace Ryujinx.UI.Input
|
||||||
{
|
{
|
||||||
Invalid,
|
Invalid,
|
||||||
LStick,
|
LStick,
|
||||||
DPadUp,
|
|
||||||
DPadDown,
|
|
||||||
DPadLeft,
|
|
||||||
DPadRight,
|
|
||||||
Back,
|
|
||||||
LShoulder,
|
|
||||||
RStick,
|
RStick,
|
||||||
A,
|
LShoulder,
|
||||||
B,
|
|
||||||
X,
|
|
||||||
Y,
|
|
||||||
Start,
|
|
||||||
RShoulder,
|
RShoulder,
|
||||||
LTrigger,
|
LTrigger,
|
||||||
RTrigger,
|
RTrigger,
|
||||||
LJoystick,
|
LJoystick,
|
||||||
RJoystick
|
RJoystick,
|
||||||
|
DPadUp,
|
||||||
|
DPadDown,
|
||||||
|
DPadLeft,
|
||||||
|
DPadRight,
|
||||||
|
Start,
|
||||||
|
Back,
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
X,
|
||||||
|
Y
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct NpadControllerLeft
|
public struct NpadControllerLeft
|
||||||
|
@ -60,17 +60,17 @@ namespace Ryujinx.UI.Input
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables or disables controller support
|
/// Enables or disables controller support
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Enabled { get; private set; }
|
public bool Enabled { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controller Device Index
|
/// Controller Device Index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Index { get; private set; }
|
public int Index { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controller Analog Stick Deadzone
|
/// Controller Analog Stick Deadzone
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Deadzone { get; private set; }
|
public float Deadzone { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controller Trigger Threshold
|
/// Controller Trigger Threshold
|
||||||
|
@ -80,7 +80,7 @@ namespace Ryujinx.UI.Input
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Left JoyCon Controller Bindings
|
/// Left JoyCon Controller Bindings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NpadControllerLeft LeftJoycon { get; private set; }
|
public NpadControllerLeft LeftJoycon { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Right JoyCon Controller Bindings
|
/// Right JoyCon Controller Bindings
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue