Generate a default configuration if version mismatch or not found
Also remove JoystickY as it's not used in configuration or in any codepath. This also regenerate the Config.json as some fields were missing.
This commit is contained in:
parent
72fa78ec8d
commit
a41f11f79e
6 changed files with 229 additions and 111 deletions
|
@ -334,12 +334,123 @@ namespace Ryujinx.Configuration
|
|||
return configurationFile;
|
||||
}
|
||||
|
||||
public void LoadDefault()
|
||||
{
|
||||
Graphics.ShadersDumpPath.Value = "";
|
||||
Logger.EnableDebug.Value = false;
|
||||
Logger.EnableStub.Value = true;
|
||||
Logger.EnableInfo.Value = true;
|
||||
Logger.EnableWarn.Value = true;
|
||||
Logger.EnableError.Value = true;
|
||||
Logger.EnableGuest.Value = true;
|
||||
Logger.EnableFsAccessLog.Value = false;
|
||||
Logger.FilteredClasses.Value = new LogClass[] { };
|
||||
Logger.EnableFileLog.Value = true;
|
||||
System.Language.Value = Language.AmericanEnglish;
|
||||
System.EnableDockedMode.Value = false;
|
||||
EnableDiscordIntegration.Value = true;
|
||||
Graphics.EnableVsync.Value = true;
|
||||
System.EnableMulticoreScheduling.Value = true;
|
||||
System.EnableFsIntegrityChecks.Value = true;
|
||||
System.FsGlobalAccessLogMode.Value = 0;
|
||||
System.IgnoreMissingServices.Value = false;
|
||||
Hid.ControllerType.Value = ControllerType.Handheld;
|
||||
Ui.GuiColumns.FavColumn.Value = true;
|
||||
Ui.GuiColumns.IconColumn.Value = true;
|
||||
Ui.GuiColumns.AppColumn.Value = true;
|
||||
Ui.GuiColumns.DevColumn.Value = true;
|
||||
Ui.GuiColumns.VersionColumn.Value = true;
|
||||
Ui.GuiColumns.TimePlayedColumn.Value = true;
|
||||
Ui.GuiColumns.LastPlayedColumn.Value = true;
|
||||
Ui.GuiColumns.FileExtColumn.Value = true;
|
||||
Ui.GuiColumns.FileSizeColumn.Value = true;
|
||||
Ui.GuiColumns.PathColumn.Value = true;
|
||||
Ui.GameDirs.Value = new List<string>();
|
||||
Ui.EnableCustomTheme.Value = false;
|
||||
Ui.CustomThemePath.Value = "";
|
||||
Hid.EnableKeyboard.Value = false;
|
||||
|
||||
Hid.KeyboardControls.Value = new NpadKeyboard
|
||||
{
|
||||
LeftJoycon = new NpadKeyboardLeft
|
||||
{
|
||||
StickUp = Key.W,
|
||||
StickDown = Key.S,
|
||||
StickLeft = Key.A,
|
||||
StickRight = Key.D,
|
||||
StickButton = Key.F,
|
||||
DPadUp = Key.Up,
|
||||
DPadDown = Key.Down,
|
||||
DPadLeft = Key.Left,
|
||||
DPadRight = Key.Right,
|
||||
ButtonMinus = Key.Minus,
|
||||
ButtonL = Key.E,
|
||||
ButtonZl = Key.Q,
|
||||
},
|
||||
RightJoycon = new NpadKeyboardRight
|
||||
{
|
||||
StickUp = Key.I,
|
||||
StickDown = Key.K,
|
||||
StickLeft = Key.J,
|
||||
StickRight = Key.L,
|
||||
StickButton = Key.H,
|
||||
ButtonA = Key.Z,
|
||||
ButtonB = Key.X,
|
||||
ButtonX = Key.C,
|
||||
ButtonY = Key.V,
|
||||
ButtonPlus = Key.Plus,
|
||||
ButtonR = Key.U,
|
||||
ButtonZr = Key.O,
|
||||
},
|
||||
Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVsync = Key.Tab
|
||||
}
|
||||
};
|
||||
|
||||
Hid.JoystickControls.Value = new NpadController
|
||||
{
|
||||
Enabled = true,
|
||||
Index = 0,
|
||||
Deadzone = 0.05f,
|
||||
TriggerThreshold = 0.5f,
|
||||
LeftJoycon = new NpadControllerLeft
|
||||
{
|
||||
Stick = ControllerInputId.Axis0,
|
||||
StickButton = ControllerInputId.Button8,
|
||||
DPadUp = ControllerInputId.Hat0Up,
|
||||
DPadDown = ControllerInputId.Hat0Down,
|
||||
DPadLeft = ControllerInputId.Hat0Left,
|
||||
DPadRight = ControllerInputId.Hat0Right,
|
||||
ButtonMinus = ControllerInputId.Button6,
|
||||
ButtonL = ControllerInputId.Button4,
|
||||
ButtonZl = ControllerInputId.Axis2,
|
||||
|
||||
},
|
||||
RightJoycon = new NpadControllerRight
|
||||
{
|
||||
Stick = ControllerInputId.Axis3,
|
||||
StickButton = ControllerInputId.Button9,
|
||||
ButtonA = ControllerInputId.Button1,
|
||||
ButtonB = ControllerInputId.Button0,
|
||||
ButtonX = ControllerInputId.Button3,
|
||||
ButtonY = ControllerInputId.Button2,
|
||||
ButtonPlus = ControllerInputId.Button7,
|
||||
ButtonR = ControllerInputId.Button5,
|
||||
ButtonZr = ControllerInputId.Axis5,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void Load(ConfigurationFileFormat configurationFileFormat)
|
||||
{
|
||||
if (configurationFileFormat.Version != 1 && configurationFileFormat.Version != 0)
|
||||
{
|
||||
// TODO: load default configuration
|
||||
throw new NotSupportedException($"Unsupported configuration version {configurationFileFormat.Version}");
|
||||
Common.Logging.Logger.PrintWarning(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default!");
|
||||
|
||||
LoadDefault();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
|
||||
|
|
|
@ -5,31 +5,31 @@
|
|||
/// <summary>
|
||||
/// Enables or disables controller support
|
||||
/// </summary>
|
||||
public bool Enabled { get; private set; }
|
||||
public bool Enabled;
|
||||
|
||||
/// <summary>
|
||||
/// Controller Device Index
|
||||
/// </summary>
|
||||
public int Index { get; private set; }
|
||||
public int Index;
|
||||
|
||||
/// <summary>
|
||||
/// Controller Analog Stick Deadzone
|
||||
/// </summary>
|
||||
public float Deadzone { get; private set; }
|
||||
public float Deadzone;
|
||||
|
||||
/// <summary>
|
||||
/// Controller Trigger Threshold
|
||||
/// </summary>
|
||||
public float TriggerThreshold { get; private set; }
|
||||
public float TriggerThreshold;
|
||||
|
||||
/// <summary>
|
||||
/// Left JoyCon Controller Bindings
|
||||
/// </summary>
|
||||
public NpadControllerLeft LeftJoycon { get; private set; }
|
||||
public NpadControllerLeft LeftJoycon;
|
||||
|
||||
/// <summary>
|
||||
/// Right JoyCon Controller Bindings
|
||||
/// </summary>
|
||||
public NpadControllerRight RightJoycon { get; private set; }
|
||||
public NpadControllerRight RightJoycon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
public struct NpadControllerRight
|
||||
{
|
||||
public ControllerInputId Stick;
|
||||
public ControllerInputId StickY;
|
||||
public ControllerInputId StickButton;
|
||||
public ControllerInputId ButtonA;
|
||||
public ControllerInputId ButtonB;
|
||||
|
|
|
@ -5,16 +5,16 @@ namespace Ryujinx.UI.Input
|
|||
/// <summary>
|
||||
/// Left JoyCon Keyboard Bindings
|
||||
/// </summary>
|
||||
public Configuration.Hid.NpadKeyboardLeft LeftJoycon { get; set; }
|
||||
public Configuration.Hid.NpadKeyboardLeft LeftJoycon;
|
||||
|
||||
/// <summary>
|
||||
/// Right JoyCon Keyboard Bindings
|
||||
/// </summary>
|
||||
public Configuration.Hid.NpadKeyboardRight RightJoycon { get; set; }
|
||||
public Configuration.Hid.NpadKeyboardRight RightJoycon;
|
||||
|
||||
/// <summary>
|
||||
/// Hotkey Keyboard Bindings
|
||||
/// </summary>
|
||||
public Configuration.Hid.KeyboardHotkeys Hotkeys { get; private set; }
|
||||
public Configuration.Hid.KeyboardHotkeys Hotkeys;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,102 +1,99 @@
|
|||
{
|
||||
"graphics_shaders_dump_path": "",
|
||||
"logging_enable_debug": false,
|
||||
"logging_enable_stub": true,
|
||||
"logging_enable_info": true,
|
||||
"logging_enable_warn": true,
|
||||
"logging_enable_error": true,
|
||||
"logging_enable_guest": true,
|
||||
"logging_enable_fs_access_log": false,
|
||||
"logging_filtered_classes": [
|
||||
|
||||
],
|
||||
"enable_file_log": true,
|
||||
"system_language": "AmericanEnglish",
|
||||
"docked_mode": false,
|
||||
"enable_discord_integration": true,
|
||||
"enable_vsync": true,
|
||||
"enable_multicore_scheduling": true,
|
||||
"enable_fs_integrity_checks": true,
|
||||
"fs_global_access_log_mode": 0,
|
||||
"ignore_missing_services": false,
|
||||
"controller_type": "Handheld",
|
||||
"gui_columns": {
|
||||
"fav_column": true,
|
||||
"icon_column": true,
|
||||
"app_column": true,
|
||||
"dev_column": true,
|
||||
"version_column": true,
|
||||
"time_played_column": true,
|
||||
"last_played_column": true,
|
||||
"file_ext_column": true,
|
||||
"file_size_column": true,
|
||||
"path_column": true
|
||||
"version": 1,
|
||||
"graphics_shaders_dump_path": "",
|
||||
"logging_enable_debug": false,
|
||||
"logging_enable_stub": true,
|
||||
"logging_enable_info": true,
|
||||
"logging_enable_warn": true,
|
||||
"logging_enable_error": true,
|
||||
"logging_enable_guest": true,
|
||||
"logging_enable_fs_access_log": false,
|
||||
"logging_filtered_classes": [],
|
||||
"enable_file_log": true,
|
||||
"system_language": "AmericanEnglish",
|
||||
"docked_mode": false,
|
||||
"enable_discord_integration": true,
|
||||
"enable_vsync": true,
|
||||
"enable_multicore_scheduling": true,
|
||||
"enable_fs_integrity_checks": true,
|
||||
"fs_global_access_log_mode": 0,
|
||||
"ignore_missing_services": false,
|
||||
"controller_type": "Handheld",
|
||||
"gui_columns": {
|
||||
"fav_column": true,
|
||||
"icon_column": true,
|
||||
"app_column": true,
|
||||
"dev_column": true,
|
||||
"version_column": true,
|
||||
"time_played_column": true,
|
||||
"last_played_column": true,
|
||||
"file_ext_column": true,
|
||||
"file_size_column": true,
|
||||
"path_column": true
|
||||
},
|
||||
"game_dirs": [],
|
||||
"enable_custom_theme": false,
|
||||
"custom_theme_path": "",
|
||||
"enable_keyboard": false,
|
||||
"keyboard_controls": {
|
||||
"left_joycon": {
|
||||
"stick_up": "W",
|
||||
"stick_down": "S",
|
||||
"stick_left": "A",
|
||||
"stick_right": "D",
|
||||
"stick_button": "F",
|
||||
"dpad_up": "Up",
|
||||
"dpad_down": "Down",
|
||||
"dpad_left": "Left",
|
||||
"dpad_right": "Right",
|
||||
"button_minus": "Minus",
|
||||
"button_l": "E",
|
||||
"button_zl": "Q"
|
||||
},
|
||||
"game_dirs": [
|
||||
|
||||
],
|
||||
"enable_custom_theme": false,
|
||||
"custom_theme_path": "",
|
||||
"enable_keyboard": false,
|
||||
"keyboard_controls": {
|
||||
"left_joycon": {
|
||||
"stick_up": "W",
|
||||
"stick_down": "S",
|
||||
"stick_left": "A",
|
||||
"stick_right": "D",
|
||||
"stick_button": "F",
|
||||
"dpad_up": "Up",
|
||||
"dpad_down": "Down",
|
||||
"dpad_left": "Left",
|
||||
"dpad_right": "Right",
|
||||
"button_minus": "Minus",
|
||||
"button_l": "E",
|
||||
"button_zl": "Q"
|
||||
},
|
||||
"right_joycon": {
|
||||
"stick_up": "I",
|
||||
"stick_down": "K",
|
||||
"stick_left": "J",
|
||||
"stick_right": "L",
|
||||
"stick_button": "H",
|
||||
"button_a": "Z",
|
||||
"button_b": "X",
|
||||
"button_x": "C",
|
||||
"button_y": "V",
|
||||
"button_plus": "Plus",
|
||||
"button_r": "U",
|
||||
"button_zr": "O"
|
||||
},
|
||||
"hotkeys": {
|
||||
"toggle_vsync": "Tab"
|
||||
}
|
||||
"right_joycon": {
|
||||
"stick_up": "I",
|
||||
"stick_down": "K",
|
||||
"stick_left": "J",
|
||||
"stick_right": "L",
|
||||
"stick_button": "H",
|
||||
"button_a": "Z",
|
||||
"button_b": "X",
|
||||
"button_x": "C",
|
||||
"button_y": "V",
|
||||
"button_plus": "Plus",
|
||||
"button_r": "U",
|
||||
"button_zr": "O"
|
||||
},
|
||||
"joystick_controls": {
|
||||
"enabled": true,
|
||||
"index": 0,
|
||||
"deadzone": 0.05,
|
||||
"trigger_threshold": 0.5,
|
||||
"left_joycon": {
|
||||
"stick": "Axis0",
|
||||
"stick_button": "Button8",
|
||||
"button_minus": "Button6",
|
||||
"button_l": "Button4",
|
||||
"button_zl": "Axis2",
|
||||
"dpad_up": "Hat0Up",
|
||||
"dpad_down": "Hat0Down",
|
||||
"dpad_left": "Hat0Left",
|
||||
"dpad_right": "Hat0Right"
|
||||
},
|
||||
"right_joycon": {
|
||||
"stick": "Axis3",
|
||||
"stick_button": "Button9",
|
||||
"button_a": "Button1",
|
||||
"button_b": "Button0",
|
||||
"button_x": "Button3",
|
||||
"button_y": "Button2",
|
||||
"button_plus": "Button7",
|
||||
"button_r": "Button5",
|
||||
"button_zr": "Axis5"
|
||||
}
|
||||
"hotkeys": {
|
||||
"toggle_vsync": "Tab"
|
||||
}
|
||||
},
|
||||
"joystick_controls": {
|
||||
"enabled": true,
|
||||
"index": 0,
|
||||
"deadzone": 0.05,
|
||||
"trigger_threshold": 0.5,
|
||||
"left_joycon": {
|
||||
"stick": "Axis0",
|
||||
"stick_button": "Button8",
|
||||
"button_minus": "Button6",
|
||||
"button_l": "Button4",
|
||||
"button_zl": "Axis2",
|
||||
"dpad_up": "Hat0Up",
|
||||
"dpad_down": "Hat0Down",
|
||||
"dpad_left": "Hat0Left",
|
||||
"dpad_right": "Hat0Right"
|
||||
},
|
||||
"right_joycon": {
|
||||
"stick": "Axis3",
|
||||
"stick_button": "Button9",
|
||||
"button_a": "Button1",
|
||||
"button_b": "Button0",
|
||||
"button_x": "Button3",
|
||||
"button_y": "Button2",
|
||||
"button_plus": "Button7",
|
||||
"button_r": "Button5",
|
||||
"button_zr": "Axis5"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,9 +28,20 @@ namespace Ryujinx
|
|||
// Initialize Discord integration
|
||||
DiscordIntegrationModule.Initialize();
|
||||
|
||||
string configurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json");
|
||||
|
||||
// Now load the configuration as the other subsystem are now registered
|
||||
ConfigurationFileFormat configurationFileFormat = ConfigurationFileFormat.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Load(configurationFileFormat);
|
||||
if (File.Exists(configurationPath))
|
||||
{
|
||||
ConfigurationFileFormat configurationFileFormat = ConfigurationFileFormat.Load(configurationPath);
|
||||
ConfigurationState.Instance.Load(configurationFileFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No configuration, we load the default values.
|
||||
ConfigurationState.Instance.LoadDefault();
|
||||
}
|
||||
|
||||
|
||||
Profile.Initialize();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue