This reverts commit 4ce4299ca2
.
This commit is contained in:
parent
4ce4299ca2
commit
ba95ee54ab
73 changed files with 608 additions and 886 deletions
|
@ -1,9 +1,5 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration
|
||||
namespace Ryujinx.Ui.Common.Configuration
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<AudioBackend>))]
|
||||
public enum AudioBackend
|
||||
{
|
||||
Dummy,
|
||||
|
|
|
@ -5,7 +5,7 @@ using Ryujinx.Common.Utilities;
|
|||
using Ryujinx.Ui.Common.Configuration.System;
|
||||
using Ryujinx.Ui.Common.Configuration.Ui;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.IO;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration
|
||||
{
|
||||
|
@ -321,14 +321,14 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
/// </summary>
|
||||
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
||||
/// TODO: Remove this when those older versions aren't in use anymore.
|
||||
public List<JsonObject> KeyboardConfig { get; set; }
|
||||
public List<object> KeyboardConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Legacy controller control bindings
|
||||
/// </summary>
|
||||
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
||||
/// TODO: Remove this when those older versions aren't in use anymore.
|
||||
public List<JsonObject> ControllerConfig { get; set; }
|
||||
public List<object> ControllerConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Input configurations
|
||||
|
@ -354,12 +354,11 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
/// Loads a configuration file from disk
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the JSON configuration file</param>
|
||||
/// <param name="configurationFileFormat">Parsed configuration file</param>
|
||||
public static bool TryLoad(string path, out ConfigurationFileFormat configurationFileFormat)
|
||||
{
|
||||
try
|
||||
{
|
||||
configurationFileFormat = JsonHelper.DeserializeFromFile(path, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||
configurationFileFormat = JsonHelper.DeserializeFromFile<ConfigurationFileFormat>(path);
|
||||
|
||||
return configurationFileFormat.Version != 0;
|
||||
}
|
||||
|
@ -377,7 +376,8 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
/// <param name="path">The path to the JSON configuration file</param>
|
||||
public void SaveConfig(string path)
|
||||
{
|
||||
JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||
using FileStream fileStream = File.Create(path, 4096, FileOptions.WriteThrough);
|
||||
JsonHelper.Serialize(fileStream, this, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration
|
||||
{
|
||||
internal static class ConfigurationFileFormatSettings
|
||||
{
|
||||
public static readonly ConfigurationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration
|
||||
{
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ConfigurationFileFormat))]
|
||||
internal partial class ConfigurationJsonSerializerContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ using Ryujinx.Ui.Common.Configuration.Ui;
|
|||
using Ryujinx.Ui.Common.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration
|
||||
{
|
||||
|
@ -632,8 +631,8 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
EnableKeyboard = Hid.EnableKeyboard,
|
||||
EnableMouse = Hid.EnableMouse,
|
||||
Hotkeys = Hid.Hotkeys,
|
||||
KeyboardConfig = new List<JsonObject>(),
|
||||
ControllerConfig = new List<JsonObject>(),
|
||||
KeyboardConfig = new List<object>(),
|
||||
ControllerConfig = new List<object>(),
|
||||
InputConfig = Hid.InputConfig,
|
||||
GraphicsBackend = Graphics.GraphicsBackend,
|
||||
PreferredGpu = Graphics.PreferredGpu
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration.System
|
||||
namespace Ryujinx.Ui.Common.Configuration.System
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<Language>))]
|
||||
public enum Language
|
||||
{
|
||||
Japanese,
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ui.Common.Configuration.System
|
||||
namespace Ryujinx.Ui.Common.Configuration.System
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<Region>))]
|
||||
public enum Region
|
||||
{
|
||||
Japan,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue