Logger and Configuration Refactoring (#573)
* Logging: Refactor log targets into Ryujinx.Common * Logger: Implement JSON Log Target * Logger: Optimize Console/File logging targets Implement a simple ObjectPool to pool up StringBuilders to avoid causing excessive GCing of gen1/2 items when large amounts of log entries are being generated. We can also pre-determine the async overflow action at initialization time, allowing for an easy optimization in the message enqueue function, avoiding a number of comparisons. * Logger: Implement LogFormatters * Config: Refactor configuration file and loading * Config: Rename to .jsonc to avoid highlighting issues in VSC and GitHub * Resolve style nits * Config: Resolve incorrect default key binding * Config: Also update key binding default in schema * Tidy up namespace imports * Config: Update CONFIG.md to reflect new Config file
This commit is contained in:
parent
a694420d11
commit
d306115750
31 changed files with 1844 additions and 691 deletions
|
@ -5,70 +5,69 @@ namespace Ryujinx.UI.Input
|
|||
{
|
||||
public struct NpadKeyboardLeft
|
||||
{
|
||||
public int StickUp;
|
||||
public int StickDown;
|
||||
public int StickLeft;
|
||||
public int StickRight;
|
||||
public int StickButton;
|
||||
public int DPadUp;
|
||||
public int DPadDown;
|
||||
public int DPadLeft;
|
||||
public int DPadRight;
|
||||
public int ButtonMinus;
|
||||
public int ButtonL;
|
||||
public int ButtonZl;
|
||||
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;
|
||||
}
|
||||
|
||||
public struct NpadKeyboardRight
|
||||
{
|
||||
public int StickUp;
|
||||
public int StickDown;
|
||||
public int StickLeft;
|
||||
public int StickRight;
|
||||
public int StickButton;
|
||||
public int ButtonA;
|
||||
public int ButtonB;
|
||||
public int ButtonX;
|
||||
public int ButtonY;
|
||||
public int ButtonPlus;
|
||||
public int ButtonR;
|
||||
public int ButtonZr;
|
||||
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;
|
||||
}
|
||||
|
||||
public class NpadKeyboard
|
||||
{
|
||||
public NpadKeyboardLeft Left;
|
||||
public NpadKeyboardRight Right;
|
||||
/// <summary>
|
||||
/// Left JoyCon Keyboard Bindings
|
||||
/// </summary>
|
||||
public NpadKeyboardLeft LeftJoycon { get; private set; }
|
||||
|
||||
public NpadKeyboard(
|
||||
NpadKeyboardLeft left,
|
||||
NpadKeyboardRight right)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
}
|
||||
/// <summary>
|
||||
/// Right JoyCon Keyboard Bindings
|
||||
/// </summary>
|
||||
public NpadKeyboardRight RightJoycon { get; private set; }
|
||||
|
||||
public HidControllerButtons GetButtons(KeyboardState keyboard)
|
||||
{
|
||||
HidControllerButtons buttons = 0;
|
||||
|
||||
if (keyboard[(Key)Left.StickButton]) buttons |= HidControllerButtons.StickLeft;
|
||||
if (keyboard[(Key)Left.DPadUp]) buttons |= HidControllerButtons.DpadUp;
|
||||
if (keyboard[(Key)Left.DPadDown]) buttons |= HidControllerButtons.DpadDown;
|
||||
if (keyboard[(Key)Left.DPadLeft]) buttons |= HidControllerButtons.DpadLeft;
|
||||
if (keyboard[(Key)Left.DPadRight]) buttons |= HidControllerButtons.DPadRight;
|
||||
if (keyboard[(Key)Left.ButtonMinus]) buttons |= HidControllerButtons.Minus;
|
||||
if (keyboard[(Key)Left.ButtonL]) buttons |= HidControllerButtons.L;
|
||||
if (keyboard[(Key)Left.ButtonZl]) buttons |= HidControllerButtons.Zl;
|
||||
if (keyboard[(Key)LeftJoycon.StickButton]) buttons |= HidControllerButtons.StickLeft;
|
||||
if (keyboard[(Key)LeftJoycon.DPadUp]) buttons |= HidControllerButtons.DpadUp;
|
||||
if (keyboard[(Key)LeftJoycon.DPadDown]) buttons |= HidControllerButtons.DpadDown;
|
||||
if (keyboard[(Key)LeftJoycon.DPadLeft]) buttons |= HidControllerButtons.DpadLeft;
|
||||
if (keyboard[(Key)LeftJoycon.DPadRight]) buttons |= HidControllerButtons.DPadRight;
|
||||
if (keyboard[(Key)LeftJoycon.ButtonMinus]) buttons |= HidControllerButtons.Minus;
|
||||
if (keyboard[(Key)LeftJoycon.ButtonL]) buttons |= HidControllerButtons.L;
|
||||
if (keyboard[(Key)LeftJoycon.ButtonZl]) buttons |= HidControllerButtons.Zl;
|
||||
|
||||
if (keyboard[(Key)Right.StickButton]) buttons |= HidControllerButtons.StickRight;
|
||||
if (keyboard[(Key)Right.ButtonA]) buttons |= HidControllerButtons.A;
|
||||
if (keyboard[(Key)Right.ButtonB]) buttons |= HidControllerButtons.B;
|
||||
if (keyboard[(Key)Right.ButtonX]) buttons |= HidControllerButtons.X;
|
||||
if (keyboard[(Key)Right.ButtonY]) buttons |= HidControllerButtons.Y;
|
||||
if (keyboard[(Key)Right.ButtonPlus]) buttons |= HidControllerButtons.Plus;
|
||||
if (keyboard[(Key)Right.ButtonR]) buttons |= HidControllerButtons.R;
|
||||
if (keyboard[(Key)Right.ButtonZr]) buttons |= HidControllerButtons.Zr;
|
||||
if (keyboard[(Key)RightJoycon.StickButton]) buttons |= HidControllerButtons.StickRight;
|
||||
if (keyboard[(Key)RightJoycon.ButtonA]) buttons |= HidControllerButtons.A;
|
||||
if (keyboard[(Key)RightJoycon.ButtonB]) buttons |= HidControllerButtons.B;
|
||||
if (keyboard[(Key)RightJoycon.ButtonX]) buttons |= HidControllerButtons.X;
|
||||
if (keyboard[(Key)RightJoycon.ButtonY]) buttons |= HidControllerButtons.Y;
|
||||
if (keyboard[(Key)RightJoycon.ButtonPlus]) buttons |= HidControllerButtons.Plus;
|
||||
if (keyboard[(Key)RightJoycon.ButtonR]) buttons |= HidControllerButtons.R;
|
||||
if (keyboard[(Key)RightJoycon.ButtonZr]) buttons |= HidControllerButtons.Zr;
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
@ -78,10 +77,10 @@ namespace Ryujinx.UI.Input
|
|||
short dx = 0;
|
||||
short dy = 0;
|
||||
|
||||
if (keyboard[(Key)Left.StickUp]) dy = short.MaxValue;
|
||||
if (keyboard[(Key)Left.StickDown]) dy = -short.MaxValue;
|
||||
if (keyboard[(Key)Left.StickLeft]) dx = -short.MaxValue;
|
||||
if (keyboard[(Key)Left.StickRight]) dx = short.MaxValue;
|
||||
if (keyboard[(Key)LeftJoycon.StickUp]) dy = short.MaxValue;
|
||||
if (keyboard[(Key)LeftJoycon.StickDown]) dy = -short.MaxValue;
|
||||
if (keyboard[(Key)LeftJoycon.StickLeft]) dx = -short.MaxValue;
|
||||
if (keyboard[(Key)LeftJoycon.StickRight]) dx = short.MaxValue;
|
||||
|
||||
return (dx, dy);
|
||||
}
|
||||
|
@ -91,10 +90,10 @@ namespace Ryujinx.UI.Input
|
|||
short dx = 0;
|
||||
short dy = 0;
|
||||
|
||||
if (keyboard[(Key)Right.StickUp]) dy = short.MaxValue;
|
||||
if (keyboard[(Key)Right.StickDown]) dy = -short.MaxValue;
|
||||
if (keyboard[(Key)Right.StickLeft]) dx = -short.MaxValue;
|
||||
if (keyboard[(Key)Right.StickRight]) dx = short.MaxValue;
|
||||
if (keyboard[(Key)RightJoycon.StickUp]) dy = short.MaxValue;
|
||||
if (keyboard[(Key)RightJoycon.StickDown]) dy = -short.MaxValue;
|
||||
if (keyboard[(Key)RightJoycon.StickLeft]) dx = -short.MaxValue;
|
||||
if (keyboard[(Key)RightJoycon.StickRight]) dx = short.MaxValue;
|
||||
|
||||
return (dx, dy);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue