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)
|
||||
{
|
||||
_target = target;
|
||||
_messageQueue = new BlockingCollection<LogEventArgs>(queueLimit);
|
||||
_target = target;
|
||||
_messageQueue = new BlockingCollection<LogEventArgs>(queueLimit);
|
||||
_overflowTimeout = overflowAction == AsyncLogTargetOverflowAction.Block ? -1 : 0;
|
||||
|
||||
_messageThread = new Thread(() => {
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Common.Logging
|
|||
|
||||
public JsonLogTarget(Stream stream, bool leaveOpen)
|
||||
{
|
||||
_stream = stream;
|
||||
_stream = stream;
|
||||
_leaveOpen = leaveOpen;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace Ryujinx.Common
|
|||
|
||||
public ObjectPool(Func<T> factory, int size)
|
||||
{
|
||||
_items = new T[size - 1];
|
||||
_factory = factory;
|
||||
_items = new T[size - 1];
|
||||
}
|
||||
|
||||
public T Allocate()
|
||||
|
@ -69,7 +69,6 @@ namespace Ryujinx.Common
|
|||
if (items[i] == null)
|
||||
{
|
||||
items[i] = obj;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ namespace Ryujinx.Common
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"$schema": "./_schema.json",
|
||||
|
||||
// Dump shaders in local directory (e.g. `C:\ShaderDumps`)
|
||||
"graphics_shaders_dump_path": "WowHello",
|
||||
"graphics_shaders_dump_path": "",
|
||||
|
||||
// Enable print debug logs
|
||||
"logging_enable_debug": false,
|
||||
|
@ -19,7 +19,7 @@
|
|||
// Enable print error logs
|
||||
"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": [ ],
|
||||
|
||||
// Enable file logging
|
||||
|
@ -41,12 +41,12 @@
|
|||
// Enable integrity checks on Switch content files
|
||||
"enable_fs_integrity_checks": true,
|
||||
|
||||
// The primary controller's type.
|
||||
// The primary controller's type
|
||||
// Supported Values: Handheld, ProController, NpadPair, NpadLeft, NpadRight
|
||||
"controller_type": "Handheld",
|
||||
|
||||
// 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": {
|
||||
// Left JoyCon Keyboard Bindings
|
||||
"left_joycon": {
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Ryujinx
|
|||
/// <summary>
|
||||
/// The default configuration instance
|
||||
/// </summary>
|
||||
public static Configuration Default { get; private set; }
|
||||
public static Configuration Instance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dumps shaders in this local directory
|
||||
|
@ -94,17 +94,17 @@ namespace Ryujinx
|
|||
public bool EnableFsIntegrityChecks { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The primary controller's type
|
||||
/// </summary>
|
||||
public HidControllerType ControllerType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Keyboard control bindings
|
||||
/// </summary>
|
||||
public NpadKeyboard KeyboardControls { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Controller control bindings
|
||||
/// </summary>
|
||||
public NpadController GamepadControls { get; private set; }
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace Ryujinx
|
|||
|
||||
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>
|
||||
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))
|
||||
{
|
||||
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>
|
||||
public static void Configure(Switch device)
|
||||
{
|
||||
if (Default == null)
|
||||
if (Instance == null)
|
||||
{
|
||||
throw new InvalidOperationException("Configuration has not been loaded yet.");
|
||||
}
|
||||
|
||||
GraphicsConfig.ShadersDumpPath = Default.GraphicsShadersDumpPath;
|
||||
GraphicsConfig.ShadersDumpPath = Instance.GraphicsShadersDumpPath;
|
||||
|
||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||
new ConsoleLogTarget(),
|
||||
|
@ -158,7 +161,7 @@ namespace Ryujinx
|
|||
AsyncLogTargetOverflowAction.Block
|
||||
));
|
||||
|
||||
if (Default.EnableFileLog)
|
||||
if (Instance.EnableFileLog)
|
||||
{
|
||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||
new FileLogTarget("Ryujinx.log"),
|
||||
|
@ -167,49 +170,49 @@ namespace Ryujinx
|
|||
));
|
||||
}
|
||||
|
||||
Logger.SetEnable(LogLevel.Debug, Default.LoggingEnableDebug);
|
||||
Logger.SetEnable(LogLevel.Stub, Default.LoggingEnableStub);
|
||||
Logger.SetEnable(LogLevel.Info, Default.LoggingEnableInfo);
|
||||
Logger.SetEnable(LogLevel.Warning, Default.LoggingEnableWarn);
|
||||
Logger.SetEnable(LogLevel.Error, Default.LoggingEnableError);
|
||||
Logger.SetEnable(LogLevel.Debug, Instance.LoggingEnableDebug);
|
||||
Logger.SetEnable(LogLevel.Stub, Instance.LoggingEnableStub);
|
||||
Logger.SetEnable(LogLevel.Info, Instance.LoggingEnableInfo);
|
||||
Logger.SetEnable(LogLevel.Warning, Instance.LoggingEnableWarn);
|
||||
Logger.SetEnable(LogLevel.Error, Instance.LoggingEnableError);
|
||||
|
||||
if (Default.LoggingFilteredClasses.Length > 0)
|
||||
if (Instance.LoggingFilteredClasses.Length > 0)
|
||||
{
|
||||
foreach (var logClass in EnumExtensions.GetValues<LogClass>())
|
||||
{
|
||||
Logger.SetEnable(logClass, false);
|
||||
}
|
||||
|
||||
foreach (var logClass in Default.LoggingFilteredClasses)
|
||||
foreach (var logClass in Instance.LoggingFilteredClasses)
|
||||
{
|
||||
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.FsIntegrityCheckLevel = Default.EnableFsIntegrityChecks
|
||||
device.System.FsIntegrityCheckLevel = Instance.EnableFsIntegrityChecks
|
||||
? IntegrityCheckLevel.ErrorOnInvalid
|
||||
: 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>
|
||||
|
|
|
@ -142,24 +142,24 @@ namespace Ryujinx
|
|||
{
|
||||
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
|
||||
if (leftJoystickDx == 0 && leftJoystickDy == 0)
|
||||
{
|
||||
(leftJoystickDx, leftJoystickDy) = Configuration.Default.GamepadControls.GetLeftStick();
|
||||
(leftJoystickDx, leftJoystickDy) = Configuration.Instance.GamepadControls.GetLeftStick();
|
||||
}
|
||||
|
||||
if (rightJoystickDx == 0 && rightJoystickDy == 0)
|
||||
{
|
||||
(rightJoystickDx, rightJoystickDy) = Configuration.Default.GamepadControls.GetRightStick();
|
||||
(rightJoystickDx, rightJoystickDy) = Configuration.Instance.GamepadControls.GetRightStick();
|
||||
}
|
||||
|
||||
leftJoystick = new HidJoystickPosition
|
||||
|
|
|
@ -10,23 +10,23 @@ namespace Ryujinx.UI.Input
|
|||
{
|
||||
Invalid,
|
||||
LStick,
|
||||
DPadUp,
|
||||
DPadDown,
|
||||
DPadLeft,
|
||||
DPadRight,
|
||||
Back,
|
||||
LShoulder,
|
||||
RStick,
|
||||
A,
|
||||
B,
|
||||
X,
|
||||
Y,
|
||||
Start,
|
||||
LShoulder,
|
||||
RShoulder,
|
||||
LTrigger,
|
||||
RTrigger,
|
||||
LJoystick,
|
||||
RJoystick
|
||||
RJoystick,
|
||||
DPadUp,
|
||||
DPadDown,
|
||||
DPadLeft,
|
||||
DPadRight,
|
||||
Start,
|
||||
Back,
|
||||
A,
|
||||
B,
|
||||
X,
|
||||
Y
|
||||
}
|
||||
|
||||
public struct NpadControllerLeft
|
||||
|
@ -60,17 +60,17 @@ namespace Ryujinx.UI.Input
|
|||
/// <summary>
|
||||
/// Enables or disables controller support
|
||||
/// </summary>
|
||||
public bool Enabled { get; private set; }
|
||||
public bool Enabled { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controller Device Index
|
||||
/// </summary>
|
||||
public int Index { get; private set; }
|
||||
public int Index { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controller Analog Stick Deadzone
|
||||
/// </summary>
|
||||
public float Deadzone { get; private set; }
|
||||
public float Deadzone { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controller Trigger Threshold
|
||||
|
@ -80,7 +80,7 @@ namespace Ryujinx.UI.Input
|
|||
/// <summary>
|
||||
/// Left JoyCon Controller Bindings
|
||||
/// </summary>
|
||||
public NpadControllerLeft LeftJoycon { get; private set; }
|
||||
public NpadControllerLeft LeftJoycon { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Right JoyCon Controller Bindings
|
||||
|
|
Loading…
Add table
Reference in a new issue