Replace 'Expand DRAM' option with dropdown menu (#32)

Allows to use mods that require a larger memory pool to allocate from.
This commit is contained in:
Keaton
2024-10-21 23:16:41 -05:00
committed by GitHub
parent 0f3c7f920b
commit f76a97c976
54 changed files with 416 additions and 118 deletions

View File

@@ -3,6 +3,7 @@ using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Configuration.Multiplayer;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Utilities;
using Ryujinx.HLE;
using Ryujinx.UI.Common.Configuration.System;
using Ryujinx.UI.Common.Configuration.UI;
using System.Collections.Generic;
@@ -15,7 +16,7 @@ namespace Ryujinx.UI.Common.Configuration
/// <summary>
/// The current version of the file format
/// </summary>
public const int CurrentVersion = 53;
public const int CurrentVersion = 54;
/// <summary>
/// Version of the configuration file format
@@ -245,7 +246,7 @@ namespace Ryujinx.UI.Common.Configuration
/// <summary>
/// Expands the RAM amount on the emulated system from 4GiB to 8GiB
/// </summary>
public bool ExpandRam { get; set; }
public MemoryConfiguration DramSize { get; set; }
/// <summary>
/// Enable or disable ignoring missing services

View File

@@ -7,6 +7,7 @@ using Ryujinx.Common.Configuration.Hid.Keyboard;
using Ryujinx.Common.Configuration.Multiplayer;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Vulkan;
using Ryujinx.HLE;
using Ryujinx.UI.Common.Configuration.System;
using Ryujinx.UI.Common.Configuration.UI;
using Ryujinx.UI.Common.Helper;
@@ -366,7 +367,7 @@ namespace Ryujinx.UI.Common.Configuration
/// <summary>
/// Defines the amount of RAM available on the emulated system, and how it is distributed
/// </summary>
public ReactiveObject<bool> ExpandRam { get; private set; }
public ReactiveObject<MemoryConfiguration> DramSize { get; private set; }
/// <summary>
/// Enable or disable ignoring missing services
@@ -400,8 +401,8 @@ namespace Ryujinx.UI.Common.Configuration
AudioBackend.Event += static (sender, e) => LogValueChange(e, nameof(AudioBackend));
MemoryManagerMode = new ReactiveObject<MemoryManagerMode>();
MemoryManagerMode.Event += static (sender, e) => LogValueChange(e, nameof(MemoryManagerMode));
ExpandRam = new ReactiveObject<bool>();
ExpandRam.Event += static (sender, e) => LogValueChange(e, nameof(ExpandRam));
DramSize = new ReactiveObject<MemoryConfiguration>();
DramSize.Event += static (sender, e) => LogValueChange(e, nameof(DramSize));
IgnoreMissingServices = new ReactiveObject<bool>();
IgnoreMissingServices.Event += static (sender, e) => LogValueChange(e, nameof(IgnoreMissingServices));
AudioVolume = new ReactiveObject<float>();
@@ -721,7 +722,7 @@ namespace Ryujinx.UI.Common.Configuration
AudioBackend = System.AudioBackend,
AudioVolume = System.AudioVolume,
MemoryManagerMode = System.MemoryManagerMode,
ExpandRam = System.ExpandRam,
DramSize = System.DramSize,
IgnoreMissingServices = System.IgnoreMissingServices,
UseHypervisor = System.UseHypervisor,
GuiColumns = new GuiColumns
@@ -834,7 +835,7 @@ namespace Ryujinx.UI.Common.Configuration
System.AudioBackend.Value = AudioBackend.SDL2;
System.AudioVolume.Value = 1;
System.MemoryManagerMode.Value = MemoryManagerMode.HostMappedUnsafe;
System.ExpandRam.Value = false;
System.DramSize.Value = MemoryConfiguration.MemoryConfiguration4GiB;
System.IgnoreMissingServices.Value = false;
System.UseHypervisor.Value = true;
Multiplayer.LanInterfaceId.Value = "0";
@@ -1513,6 +1514,15 @@ namespace Ryujinx.UI.Common.Configuration
configurationFileUpdated = true;
}
if (configurationFileFormat.Version < 54)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 54.");
configurationFileFormat.DramSize = MemoryConfiguration.MemoryConfiguration4GiB;
configurationFileUpdated = true;
}
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
@@ -1559,7 +1569,7 @@ namespace Ryujinx.UI.Common.Configuration
System.AudioBackend.Value = configurationFileFormat.AudioBackend;
System.AudioVolume.Value = configurationFileFormat.AudioVolume;
System.MemoryManagerMode.Value = configurationFileFormat.MemoryManagerMode;
System.ExpandRam.Value = configurationFileFormat.ExpandRam;
System.DramSize.Value = configurationFileFormat.DramSize;
System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices;
System.UseHypervisor.Value = configurationFileFormat.UseHypervisor;
UI.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn;

View File

@@ -14,8 +14,8 @@ namespace Ryujinx.UI.Common
public static class DiscordIntegrationModule
{
public static Timestamps StartedAt { get; set; }
private static readonly string _description = ReleaseInformation.IsValid
private static readonly string _description = ReleaseInformation.IsValid
? $"v{ReleaseInformation.Version} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}@{ReleaseInformation.BuildGitHash}"
: "dev build";
@@ -80,7 +80,7 @@ namespace Ryujinx.UI.Common
},
Details = TruncateToByteLength($"Playing {appMeta.Title}"),
State = appMeta.LastPlayed.HasValue && appMeta.TimePlayed.TotalSeconds > 5
? $"Total play time: {appMeta.TimePlayed.Humanize(2, false)}"
? $"Total play time: {appMeta.TimePlayed.Humanize(2, false)}"
: "Never played",
Timestamps = Timestamps.Now
});
@@ -120,7 +120,7 @@ namespace Ryujinx.UI.Common
_discordClient?.Dispose();
}
private static readonly string[] _discordGameAssetKeys =
private static readonly string[] _discordGameAssetKeys =
[
"01002da013484000", // The Legend of Zelda: Skyward Sword HD
"01007ef00011e000", // The Legend of Zelda: Breath of the Wild

View File

@@ -98,7 +98,6 @@ namespace Ryujinx.UI.Common.Helper
if (baseApplicationExtension is not (".nro" or ".nso"))
return IsFirmwareValid(contentManager, out error);
error = UserError.Success;
}
error = UserError.ApplicationNotFound;

View File

@@ -9,7 +9,7 @@ namespace Ryujinx.UI.Common.Helper
{
if (activeProcess == null)
return string.Empty;
string titleNameSection = string.IsNullOrWhiteSpace(activeProcess.Name) ? string.Empty : $" {activeProcess.Name}";
string titleVersionSection = string.IsNullOrWhiteSpace(activeProcess.DisplayVersion) ? string.Empty : $" v{activeProcess.DisplayVersion}";
string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";

View File

@@ -87,7 +87,8 @@ namespace Ryujinx.UI.Common.Helper
foreach (string path in titleUpdateMetadata.Paths)
{
if (!File.Exists(path)) continue;
if (!File.Exists(path))
continue;
try
{
@@ -104,7 +105,7 @@ namespace Ryujinx.UI.Common.Helper
if (controlNca is null || patchNca is null)
continue;
ApplicationControlProperty controlData = new();
using UniqueRef<IFile> nacpFile = new();
@@ -144,7 +145,7 @@ namespace Ryujinx.UI.Common.Helper
return result;
}
private static string PathToGameUpdatesJson(ulong applicationIdBase)
private static string PathToGameUpdatesJson(ulong applicationIdBase)
=> Path.Combine(AppDataManager.GamesDirPath, applicationIdBase.ToString("x16"), "updates.json");
}
}

View File

@@ -34,10 +34,10 @@ namespace Ryujinx.UI.Common.SystemInfo
{
if (OperatingSystem.IsWindows())
return new WindowsSystemInfo();
if (OperatingSystem.IsLinux())
return new LinuxSystemInfo();
if (OperatingSystem.IsMacOS())
return new MacOSSystemInfo();