misc: Move configuration management to the Ryujinx project (#2269)

* Decouple configuration from Ryujinx.HLE and Ryujinx.Input

* Move Configuration to the Ryujinx project
This commit is contained in:
Mary 2021-05-16 17:12:14 +02:00 committed by GitHub
parent f48828351c
commit bec67dbef7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 387 additions and 215 deletions

View file

@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
switch (kind)
{
case LaunchParameterKind.UserChannel:
storageData = context.Device.UserChannelPersistence.Pop();
storageData = context.Device.Configuration.UserChannelPersistence.Pop();
break;
case LaunchParameterKind.PreselectedUser:
// Only the first 0x18 bytes of the Data seems to be actually used.
@ -453,7 +453,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
// ClearUserChannel()
public ResultCode ClearUserChannel(ServiceCtx context)
{
context.Device.UserChannelPersistence.Clear();
context.Device.Configuration.UserChannelPersistence.Clear();
return ResultCode.Success;
}
@ -464,7 +464,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
{
AppletAE.IStorage data = GetObject<AppletAE.IStorage>(context, 0);
context.Device.UserChannelPersistence.Push(data.Data);
context.Device.Configuration.UserChannelPersistence.Push(data.Data);
return ResultCode.Success;
}
@ -473,7 +473,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
// GetPreviousProgramIndex() -> s32 program_index
public ResultCode GetPreviousProgramIndex(ServiceCtx context)
{
int previousProgramIndex = context.Device.UserChannelPersistence.PreviousIndex;
int previousProgramIndex = context.Device.Configuration.UserChannelPersistence.PreviousIndex;
context.ResponseData.Write(previousProgramIndex);

View file

@ -396,7 +396,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
// We do a mitm here to find if the request is for an AOC.
// This is because AOC can be distributed over multiple containers in the emulator.
if (context.Device.System.ContentManager.GetAocDataStorage((ulong)titleId, out LibHac.Fs.IStorage aocStorage))
if (context.Device.System.ContentManager.GetAocDataStorage((ulong)titleId, out LibHac.Fs.IStorage aocStorage, context.Device.Configuration.FsIntegrityCheckLevel))
{
Logger.Info?.Print(LogClass.Loader, $"Opened AddOnContent Data TitleID={titleId:X16}");

View file

@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
Npads = new NpadDevices(_device, true);
}
internal void RefreshInputConfig(List<InputConfig> inputConfig)
public void RefreshInputConfig(List<InputConfig> inputConfig)
{
ControllerConfig[] npadConfig = new ControllerConfig[inputConfig.Count];
@ -78,11 +78,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid
_device.Hid.Npads.Configure(npadConfig);
}
internal void RefreshInputConfigEvent(object _, ReactiveEventArgs<List<InputConfig>> args)
{
RefreshInputConfig(args.NewValue);
}
public ControllerKeys UpdateStickButtons(JoystickPosition leftStick, JoystickPosition rightStick)
{
const int stickButtonThreshold = short.MaxValue / 2;

View file

@ -109,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Services
bool serviceExists = service.HipcCommands.TryGetValue(commandId, out MethodInfo processRequest);
if (ServiceConfiguration.IgnoreMissingServices || serviceExists)
if (context.Device.Configuration.IgnoreMissingServices || serviceExists)
{
ResultCode result = ResultCode.Success;
@ -163,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services
bool serviceExists = TipcCommands.TryGetValue(commandId, out MethodInfo processRequest);
if (ServiceConfiguration.IgnoreMissingServices || serviceExists)
if (context.Device.Configuration.IgnoreMissingServices || serviceExists)
{
ResultCode result = ResultCode.Success;

View file

@ -1,7 +0,0 @@
namespace Ryujinx.HLE.HOS.Services
{
public static class ServiceConfiguration
{
public static bool IgnoreMissingServices { get; set; }
}
}

View file

@ -98,7 +98,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm
}
else
{
if (ServiceConfiguration.IgnoreMissingServices)
if (context.Device.Configuration.IgnoreMissingServices)
{
Logger.Warning?.Print(LogClass.Service, $"Missing service {name} ignored");
}

View file

@ -1,6 +1,5 @@
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Configuration;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu;
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap;
@ -351,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
bool flipX = item.Transform.HasFlag(NativeWindowTransform.FlipX);
bool flipY = item.Transform.HasFlag(NativeWindowTransform.FlipY);
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
AspectRatio aspectRatio = _device.Configuration.AspectRatio;
bool isStretched = aspectRatio == AspectRatio.Stretched;
ImageCrop crop = new ImageCrop(

View file

@ -5,7 +5,6 @@ using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils;
using Ryujinx.Common.Logging;
using Ryujinx.Configuration;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
@ -47,10 +46,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
InitializeLocationNameCache();
}
public string SanityCheckDeviceLocationName()
public string SanityCheckDeviceLocationName(string locationName)
{
string locationName = ConfigurationState.Instance.System.TimeZone;
if (IsLocationNameValid(locationName))
{
return locationName;
@ -58,8 +55,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
Logger.Warning?.Print(LogClass.ServiceTime, $"Invalid device TimeZone {locationName}, switching back to UTC");
ConfigurationState.Instance.System.TimeZone.Value = "UTC";
return "UTC";
}
@ -69,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
SteadyClockTimePoint timeZoneUpdatedTimePoint = timeManager.StandardSteadyClock.GetCurrentTimePoint(null);
string deviceLocationName = SanityCheckDeviceLocationName();
string deviceLocationName = SanityCheckDeviceLocationName(device.Configuration.TimeZone);
ResultCode result = GetTimeZoneBinary(deviceLocationName, out Stream timeZoneBinaryStream, out LocalStorage ncaFile);