mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-12-22 03:46:39 +01:00
misc: Code cleanups.
This commit is contained in:
parent
a2cd3c2799
commit
7618ef134d
13 changed files with 45 additions and 113 deletions
|
@ -85,7 +85,9 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
}
|
||||
|
||||
// TODO: LibHac npdm currently doesn't support version field.
|
||||
string version = ProgramId > 0x0100000000007FFF ? DisplayVersion : device.System.ContentManager.GetCurrentFirmwareVersion()?.VersionString ?? "?";
|
||||
string version = ProgramId > 0x0100000000007FFF
|
||||
? DisplayVersion
|
||||
: device.System.ContentManager.GetCurrentFirmwareVersion()?.VersionString ?? "?";
|
||||
|
||||
Logger.Info?.Print(LogClass.Loader, $"Application Loaded: {Name} v{version} [{ProgramIdText}] [{(Is64Bit ? "64-bit" : "32-bit")}]");
|
||||
|
||||
|
|
|
@ -119,12 +119,10 @@ namespace Ryujinx.Headless.SDL2
|
|||
}
|
||||
}
|
||||
|
||||
IGamepad gamepad;
|
||||
IGamepad gamepad = _inputManager.KeyboardDriver.GetGamepad(inputId);
|
||||
|
||||
bool isKeyboard = true;
|
||||
|
||||
gamepad = _inputManager.KeyboardDriver.GetGamepad(inputId);
|
||||
|
||||
if (gamepad == null)
|
||||
{
|
||||
gamepad = _inputManager.GamepadDriver.GetGamepad(inputId);
|
||||
|
|
|
@ -325,12 +325,12 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
public ReactiveObject<bool> EnableDockedMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables profiled translation cache persistency
|
||||
/// Enables or disables persistent profiled translation cache
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnablePtc { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables low-power profiled translation cache persistency loading
|
||||
/// Enables or disables low-power persistent profiled translation cache loading
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableLowPowerPtc { get; private set; }
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Ryujinx.UI.Common
|
|||
{
|
||||
Assets = new Assets
|
||||
{
|
||||
LargeImageKey = _discordGameAssetKeys.Contains(procRes.ProgramIdText.ToLower()) ? procRes.ProgramIdText : "game",
|
||||
LargeImageKey = _discordGameAssetKeys.Contains(procRes.ProgramIdText) ? procRes.ProgramIdText : "game",
|
||||
LargeImageText = TruncateToByteLength($"{appMeta.Title} | {procRes.DisplayVersion}"),
|
||||
SmallImageKey = "ryujinx",
|
||||
SmallImageText = TruncateToByteLength(_description)
|
||||
|
@ -121,8 +121,8 @@ namespace Ryujinx.UI.Common
|
|||
}
|
||||
|
||||
private static readonly string[] _discordGameAssetKeys =
|
||||
[
|
||||
"01002da013484000", // The Legend of Zelda: Skyward Sword HD
|
||||
[
|
||||
"01002da013484000", // The Legend of Zelda: Skyward Sword HD
|
||||
"01007ef00011e000", // The Legend of Zelda: Breath of the Wild
|
||||
"0100f2c0115b6000", // The Legend of Zelda: Tears of the Kingdom
|
||||
"01008cf01baac000", // The Legend of Zelda: Echoes of Wisdom
|
||||
|
@ -131,9 +131,15 @@ namespace Ryujinx.UI.Common
|
|||
"0100000000010000", // SUPER MARIO ODYSSEY
|
||||
"010015100b514000", // Super Mario Bros. Wonder
|
||||
"0100152000022000", // Mario Kart 8 Deluxe
|
||||
"01006fe013472000", // Mario Party Superstars
|
||||
"0100965017338000", // Super Mario Party Jamboree
|
||||
"010049900f546000", // Super Mario 3D All-Stars
|
||||
"010028600ebda000", // Super Mario 3D World + Bowser's Fury
|
||||
"0100ecd018ebe000", // Paper Mario: The Thousand-Year Door
|
||||
"010019401051c000", // Mario Strikers League
|
||||
"0100ea80032ea000", // Super Mario Bros. U Deluxe
|
||||
"0100bc0018138000", // Super Mario RPG
|
||||
"0100bde00862a000", // Mario Tennis Aces
|
||||
|
||||
"010048701995e000", // Luigi's Mansion 2 HD
|
||||
"0100dca0064a6000", // Luigi's Mansion 3
|
||||
|
@ -148,15 +154,22 @@ namespace Ryujinx.UI.Common
|
|||
"0100d680194b2000", // Pikmin 2
|
||||
"0100f4c009322000", // Pikmin 3 Deluxe
|
||||
"0100b7c00933a000", // Pikmin 4
|
||||
|
||||
"01004ad014bf0000", // Sonic Frontiers
|
||||
|
||||
"01004d300c5ae000", // Kirby and the Forgotten Land
|
||||
"01006b601380e000", // Kirby's Return to Dreamland Deluxe
|
||||
"01007e3006dda000", // Kirby Star Allies
|
||||
|
||||
"0100c2500fc20000", // Splatoon 3
|
||||
"0100ba0018500000", // Splatoon 3: Splatfest World Premiere
|
||||
"01000a10041ea000", // The Elder Scrolls V: Skyrim
|
||||
"01007820196a6000", // Red Dead Redemption
|
||||
"01008c8012920000", // Dying Light Platinum Edition
|
||||
"0100744001588000", // Cars 3: Driven to Win
|
||||
"0100c1f0051b6000", // Donkey Kong Country: Tropical Freeze
|
||||
"01002b00111a2000", // Hyrule Warriors: Age of Calamity
|
||||
"01006f8002326000", // Animal Crossing: New Horizons
|
||||
"01004d300c5ae000", // Kirby and the Forgotten Land
|
||||
"0100853015e86000", // No Man's Sky
|
||||
"01008d100d43e000", // Saints Row IV
|
||||
"0100de600beee000", // Saints Row: The Third - The Full Package
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Ryujinx.Ava.Common
|
|||
Logger.Warning?.Print(LogClass.Application, "No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
|
||||
}
|
||||
|
||||
Uid user = new((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low);
|
||||
Uid user = _accountManager.LastOpenedUser.UserId.ToLibHacUid();
|
||||
|
||||
result = _horizonClient.Fs.EnsureApplicationSaveData(out _, new ApplicationId(titleId), in control, in user);
|
||||
if (result.IsFailure())
|
||||
|
|
|
@ -37,14 +37,9 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
|
||||
public ControllerAppletDialog(MainWindow mainWindow, ControllerAppletUIArgs args)
|
||||
{
|
||||
if (args.PlayerCountMin == args.PlayerCountMax)
|
||||
{
|
||||
PlayerCount = args.PlayerCountMin.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerCount = $"{args.PlayerCountMin} - {args.PlayerCountMax}";
|
||||
}
|
||||
PlayerCount = args.PlayerCountMin == args.PlayerCountMax
|
||||
? args.PlayerCountMin.ToString()
|
||||
: $"{args.PlayerCountMin} - {args.PlayerCountMax}";
|
||||
|
||||
SupportsProController = (args.SupportedStyles & ControllerType.ProController) != 0;
|
||||
SupportsLeftJoycon = (args.SupportedStyles & ControllerType.JoyconLeft) != 0;
|
||||
|
|
|
@ -13,19 +13,19 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
switch (value)
|
||||
{
|
||||
return null;
|
||||
case null:
|
||||
return null;
|
||||
case byte[] buffer when targetType == typeof(IImage):
|
||||
{
|
||||
MemoryStream mem = new(buffer);
|
||||
|
||||
return new Bitmap(mem);
|
||||
}
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
if (value is byte[] buffer && targetType == typeof(IImage))
|
||||
{
|
||||
MemoryStream mem = new(buffer);
|
||||
|
||||
return new Bitmap(mem);
|
||||
}
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
|
|
@ -41,11 +41,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
if (_isWaitingForInput)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
Cancel();
|
||||
});
|
||||
|
||||
Dispatcher.UIThread.Post(() => Cancel());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,22 +22,11 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
_key = key;
|
||||
}
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_glyphs.TryGetValue(Enum.Parse<Glyph>(key), out var val))
|
||||
{
|
||||
return val;
|
||||
}
|
||||
public string this[string key] =>
|
||||
_glyphs.TryGetValue(Enum.Parse<Glyph>(key), out var val)
|
||||
? val
|
||||
: string.Empty;
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return this[_key];
|
||||
}
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) => this[_key];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.UI.Common.Helper;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// This <see cref="IValueConverter"/> makes sure that the string "Never" that's returned by <see cref="ValueFormatUtils.FormatDateTime"/> is properly localized in the Avalonia UI.
|
||||
/// After the Avalonia UI has been made the default and the GTK UI is removed, <see cref="ValueFormatUtils"/> should be updated to directly return a localized string.
|
||||
/// </summary>
|
||||
// TODO: localize ValueFormatUtils.FormateDateTime
|
||||
internal class LocalizedNeverConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
private static readonly LocalizedNeverConverter _instance = new();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not string valStr)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (valStr == "Never")
|
||||
{
|
||||
return LocaleManager.Instance[LocaleKeys.Never];
|
||||
}
|
||||
|
||||
return valStr;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Models
|
||||
{
|
||||
internal class StatusInitEventArgs : EventArgs
|
||||
{
|
||||
public string GpuBackend { get; }
|
||||
public string GpuName { get; }
|
||||
|
||||
public StatusInitEventArgs(string gpuBackend, string gpuName)
|
||||
{
|
||||
GpuBackend = gpuBackend;
|
||||
GpuName = gpuName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
private PlayerIndex _playerId;
|
||||
private int _controller;
|
||||
private readonly int _controllerNumber;
|
||||
private string _controllerImage;
|
||||
private int _device;
|
||||
private object _configViewModel;
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
var value = GetColorValue(color);
|
||||
|
||||
// If the color is rarely used on the image,
|
||||
// then chances are that theres a better candidate, even if the saturation value
|
||||
// then chances are that there's a better candidate, even if the saturation value
|
||||
// is high. By multiplying the saturation value with a weight, we can lower
|
||||
// it if the color is almost never used (hit count is low).
|
||||
var satWeighted = quantSat;
|
||||
|
|
Loading…
Reference in a new issue