Compare commits
5 Commits
Canary-1.2
...
9b2da5901a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b2da5901a | ||
|
|
1d88771d1b | ||
|
|
4e8157688e | ||
|
|
5085af0050 | ||
|
|
f73ffd1fd0 |
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.Common.Configuration.Hid
|
namespace Ryujinx.Common.Configuration.Hid
|
||||||
{
|
{
|
||||||
public class KeyboardHotkeys
|
public class KeyboardHotkeys
|
||||||
@@ -13,5 +15,6 @@ namespace Ryujinx.Common.Configuration.Hid
|
|||||||
public Key VolumeDown { get; set; }
|
public Key VolumeDown { get; set; }
|
||||||
public Key CustomVSyncIntervalIncrement { get; set; }
|
public Key CustomVSyncIntervalIncrement { get; set; }
|
||||||
public Key CustomVSyncIntervalDecrement { get; set; }
|
public Key CustomVSyncIntervalDecrement { get; set; }
|
||||||
|
public List<Key> CycleControllers { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using MsgPack;
|
using MsgPack;
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
|
using Ryujinx.Horizon.Prepo.Types;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -8,7 +9,7 @@ namespace Ryujinx.Horizon
|
|||||||
{
|
{
|
||||||
public static class HorizonStatic
|
public static class HorizonStatic
|
||||||
{
|
{
|
||||||
internal static void HandlePlayReport(MessagePackObject report) =>
|
internal static void HandlePlayReport(PlayReport report) =>
|
||||||
new Thread(() => PlayReport?.Invoke(report))
|
new Thread(() => PlayReport?.Invoke(report))
|
||||||
{
|
{
|
||||||
Name = "HLE.PlayReportEvent",
|
Name = "HLE.PlayReportEvent",
|
||||||
@@ -16,7 +17,7 @@ namespace Ryujinx.Horizon
|
|||||||
Priority = ThreadPriority.AboveNormal
|
Priority = ThreadPriority.AboveNormal
|
||||||
}.Start();
|
}.Start();
|
||||||
|
|
||||||
public static event Action<MessagePackObject> PlayReport;
|
public static event Action<PlayReport> PlayReport;
|
||||||
|
|
||||||
[field: ThreadStatic]
|
[field: ThreadStatic]
|
||||||
public static HorizonOptions Options { get; private set; }
|
public static HorizonOptions Options { get; private set; }
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Gommon;
|
|
||||||
using MsgPack;
|
using MsgPack;
|
||||||
using MsgPack.Serialization;
|
using MsgPack.Serialization;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
@@ -12,19 +11,12 @@ using Ryujinx.Horizon.Sdk.Sf;
|
|||||||
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
using ApplicationId = Ryujinx.Horizon.Sdk.Ncm.ApplicationId;
|
using ApplicationId = Ryujinx.Horizon.Sdk.Ncm.ApplicationId;
|
||||||
|
|
||||||
namespace Ryujinx.Horizon.Prepo.Ipc
|
namespace Ryujinx.Horizon.Prepo.Ipc
|
||||||
{
|
{
|
||||||
partial class PrepoService : IPrepoService
|
partial class PrepoService : IPrepoService
|
||||||
{
|
{
|
||||||
enum PlayReportKind
|
|
||||||
{
|
|
||||||
Normal,
|
|
||||||
System,
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly ArpApi _arp;
|
private readonly ArpApi _arp;
|
||||||
private readonly PrepoServicePermissionLevel _permissionLevel;
|
private readonly PrepoServicePermissionLevel _permissionLevel;
|
||||||
private ulong _systemSessionId;
|
private ulong _systemSessionId;
|
||||||
@@ -196,10 +188,17 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
|||||||
{
|
{
|
||||||
return PrepoResult.InvalidBufferSize;
|
return PrepoResult.InvalidBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder builder = new();
|
StringBuilder builder = new();
|
||||||
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(reportBuffer.ToArray());
|
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(reportBuffer.ToArray());
|
||||||
|
|
||||||
|
PlayReport playReport = new()
|
||||||
|
{
|
||||||
|
Kind = playReportKind,
|
||||||
|
Room = gameRoom,
|
||||||
|
ReportData = deserializedReport
|
||||||
|
};
|
||||||
|
|
||||||
builder.AppendLine();
|
builder.AppendLine();
|
||||||
builder.AppendLine("PlayReport log:");
|
builder.AppendLine("PlayReport log:");
|
||||||
builder.AppendLine($" Kind: {playReportKind}");
|
builder.AppendLine($" Kind: {playReportKind}");
|
||||||
@@ -209,10 +208,12 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
|||||||
if (pid != 0)
|
if (pid != 0)
|
||||||
{
|
{
|
||||||
builder.AppendLine($" Pid: {pid}");
|
builder.AppendLine($" Pid: {pid}");
|
||||||
|
playReport.Pid = pid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
builder.AppendLine($" ApplicationId: {applicationId}");
|
builder.AppendLine($" ApplicationId: {applicationId}");
|
||||||
|
playReport.AppId = applicationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result result = _arp.GetApplicationInstanceId(out ulong applicationInstanceId, pid);
|
Result result = _arp.GetApplicationInstanceId(out ulong applicationInstanceId, pid);
|
||||||
@@ -223,17 +224,20 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
|||||||
|
|
||||||
_arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty applicationLaunchProperty, applicationInstanceId).AbortOnFailure();
|
_arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty applicationLaunchProperty, applicationInstanceId).AbortOnFailure();
|
||||||
|
|
||||||
|
playReport.Version = applicationLaunchProperty.Version;
|
||||||
|
|
||||||
builder.AppendLine($" ApplicationVersion: {applicationLaunchProperty.Version}");
|
builder.AppendLine($" ApplicationVersion: {applicationLaunchProperty.Version}");
|
||||||
|
|
||||||
if (!userId.IsNull)
|
if (!userId.IsNull)
|
||||||
{
|
{
|
||||||
builder.AppendLine($" UserId: {userId}");
|
builder.AppendLine($" UserId: {userId}");
|
||||||
|
playReport.UserId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.AppendLine($" Room: {gameRoom}");
|
builder.AppendLine($" Room: {gameRoom}");
|
||||||
builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}");
|
builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}");
|
||||||
|
|
||||||
HorizonStatic.HandlePlayReport(deserializedReport);
|
HorizonStatic.HandlePlayReport(playReport);
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString());
|
Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString());
|
||||||
|
|
||||||
|
|||||||
24
src/Ryujinx.Horizon/Prepo/Types/PlayReport.cs
Normal file
24
src/Ryujinx.Horizon/Prepo/Types/PlayReport.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using MsgPack;
|
||||||
|
using Ryujinx.Horizon.Sdk.Account;
|
||||||
|
using Ryujinx.Horizon.Sdk.Ncm;
|
||||||
|
|
||||||
|
namespace Ryujinx.Horizon.Prepo.Types
|
||||||
|
{
|
||||||
|
public struct PlayReport
|
||||||
|
{
|
||||||
|
public PlayReportKind Kind { get; init; }
|
||||||
|
public string Room { get; init; }
|
||||||
|
public MessagePackObject ReportData { get; init; }
|
||||||
|
|
||||||
|
public ApplicationId? AppId;
|
||||||
|
public ulong? Pid;
|
||||||
|
public uint Version;
|
||||||
|
public Uid? UserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PlayReportKind
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
System,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,7 @@ using Ryujinx.HLE;
|
|||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
@@ -49,6 +50,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -1308,6 +1310,18 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
_viewModel.Volume = Device.GetVolume();
|
_viewModel.Volume = Device.GetVolume();
|
||||||
break;
|
break;
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer1:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer2:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer3:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer4:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer5:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer6:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer7:
|
||||||
|
case KeyboardHotkeyState.CycleControllersPlayer8:
|
||||||
|
var player = currentHotkeyState - KeyboardHotkeyState.CycleControllersPlayer1;
|
||||||
|
var ivm = new UI.ViewModels.Input.InputViewModel();
|
||||||
|
Dispatcher.UIThread.Invoke(() => ivm.CyclePlayerDevice(player));
|
||||||
|
break;
|
||||||
case KeyboardHotkeyState.None:
|
case KeyboardHotkeyState.None:
|
||||||
(_keyboardInterface as AvaloniaKeyboard).Clear();
|
(_keyboardInterface as AvaloniaKeyboard).Clear();
|
||||||
break;
|
break;
|
||||||
@@ -1390,6 +1404,15 @@ namespace Ryujinx.Ava
|
|||||||
state = KeyboardHotkeyState.CustomVSyncIntervalDecrement;
|
state = KeyboardHotkeyState.CustomVSyncIntervalDecrement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var cycle in ConfigurationState.Instance.Hid.Hotkeys.Value.CycleControllers?.Select((value, index) => (value, index)) ?? [])
|
||||||
|
{
|
||||||
|
if (_keyboardInterface.IsPressed((Key)cycle.value))
|
||||||
|
{
|
||||||
|
state = KeyboardHotkeyState.CycleControllersPlayer1 + cycle.index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5672,6 +5672,31 @@
|
|||||||
"zh_TW": "啟用警告日誌"
|
"zh_TW": "啟用警告日誌"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ID": "SettingsTabHotkeysCycleControllers",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Cycle Controllers",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ID": "SettingsTabLoggingEnableErrorLogs",
|
"ID": "SettingsTabLoggingEnableErrorLogs",
|
||||||
"Translations": {
|
"Translations": {
|
||||||
@@ -23696,6 +23721,56 @@
|
|||||||
"zh_CN": "选择一个要解压的 DLC",
|
"zh_CN": "选择一个要解压的 DLC",
|
||||||
"zh_TW": ""
|
"zh_TW": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "GameInfoRpcImage",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Rich Presence Image",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": "GameInfoRpcDynamic",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Dynamic Rich Presence",
|
||||||
|
"es_ES": "",
|
||||||
|
"fr_FR": "",
|
||||||
|
"he_IL": "",
|
||||||
|
"it_IT": "",
|
||||||
|
"ja_JP": "",
|
||||||
|
"ko_KR": "",
|
||||||
|
"no_NO": "",
|
||||||
|
"pl_PL": "",
|
||||||
|
"pt_BR": "",
|
||||||
|
"ru_RU": "",
|
||||||
|
"sv_SE": "",
|
||||||
|
"th_TH": "",
|
||||||
|
"tr_TR": "",
|
||||||
|
"uk_UA": "",
|
||||||
|
"zh_CN": "",
|
||||||
|
"zh_TW": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -14,5 +14,13 @@ namespace Ryujinx.Ava.Common
|
|||||||
VolumeDown,
|
VolumeDown,
|
||||||
CustomVSyncIntervalIncrement,
|
CustomVSyncIntervalIncrement,
|
||||||
CustomVSyncIntervalDecrement,
|
CustomVSyncIntervalDecrement,
|
||||||
|
CycleControllersPlayer1,
|
||||||
|
CycleControllersPlayer2,
|
||||||
|
CycleControllersPlayer3,
|
||||||
|
CycleControllersPlayer4,
|
||||||
|
CycleControllersPlayer5,
|
||||||
|
CycleControllersPlayer6,
|
||||||
|
CycleControllersPlayer7,
|
||||||
|
CycleControllersPlayer8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ using Ryujinx.Common.Logging;
|
|||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.Loaders.Processes;
|
using Ryujinx.HLE.Loaders.Processes;
|
||||||
using Ryujinx.Horizon;
|
using Ryujinx.Horizon;
|
||||||
|
using Ryujinx.Horizon.Prepo.Types;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Ryujinx.Ava
|
namespace Ryujinx.Ava
|
||||||
@@ -37,6 +39,9 @@ namespace Ryujinx.Ava
|
|||||||
private static RichPresence _discordPresencePlaying;
|
private static RichPresence _discordPresencePlaying;
|
||||||
private static ApplicationMetadata _currentApp;
|
private static ApplicationMetadata _currentApp;
|
||||||
|
|
||||||
|
public static bool HasAssetImage(string titleId) => TitleIDs.DiscordGameAssetKeys.ContainsIgnoreCase(titleId);
|
||||||
|
public static bool HasAnalyzer(string titleId) => PlayReports.Analyzer.TitleIds.ContainsIgnoreCase(titleId);
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
_discordPresenceMain = new RichPresence
|
_discordPresenceMain = new RichPresence
|
||||||
@@ -120,7 +125,7 @@ namespace Ryujinx.Ava
|
|||||||
_currentApp = null;
|
_currentApp = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandlePlayReport(MessagePackObject playReport)
|
private static void HandlePlayReport(PlayReport playReport)
|
||||||
{
|
{
|
||||||
if (_discordClient is null) return;
|
if (_discordClient is null) return;
|
||||||
if (!TitleIDs.CurrentApplication.Value.HasValue) return;
|
if (!TitleIDs.CurrentApplication.Value.HasValue) return;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
xmlns:ext="using:Ryujinx.Ava.Common.Markup"
|
xmlns:ext="using:Ryujinx.Ava.Common.Markup"
|
||||||
xmlns:viewModels="using:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModels="using:Ryujinx.Ava.UI.ViewModels"
|
||||||
|
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Ryujinx.Ava.UI.Controls.ApplicationDataView"
|
x:Class="Ryujinx.Ava.UI.Controls.ApplicationDataView"
|
||||||
@@ -85,6 +86,49 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Separator Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" />
|
<Separator Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" />
|
||||||
|
<StackPanel Orientation="Vertical" Spacing="5">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||||
|
<ui:SymbolIcon Foreground="ForestGreen" Symbol="Checkmark" IsVisible="{Binding AppData.HasRichPresenceAsset}"/>
|
||||||
|
<TextBlock
|
||||||
|
Foreground="ForestGreen"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsVisible="{Binding AppData.HasRichPresenceAsset}"
|
||||||
|
Text="{ext:Locale GameInfoRpcImage}"
|
||||||
|
TextAlignment="Start"
|
||||||
|
TextWrapping="Wrap" >
|
||||||
|
</TextBlock>
|
||||||
|
<ui:SymbolIcon Foreground="Red" Symbol="Cancel" IsVisible="{Binding !AppData.HasRichPresenceAsset}"/>
|
||||||
|
<TextBlock
|
||||||
|
Foreground="Red"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsVisible="{Binding !AppData.HasRichPresenceAsset}"
|
||||||
|
Text="{ext:Locale GameInfoRpcImage}"
|
||||||
|
TextAlignment="Start"
|
||||||
|
TextWrapping="Wrap" >
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||||
|
<ui:SymbolIcon Foreground="ForestGreen" Symbol="Checkmark" IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"/>
|
||||||
|
<TextBlock
|
||||||
|
Foreground="ForestGreen"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"
|
||||||
|
Text="{ext:Locale GameInfoRpcDynamic}"
|
||||||
|
TextAlignment="Start"
|
||||||
|
TextWrapping="Wrap" >
|
||||||
|
</TextBlock>
|
||||||
|
<ui:SymbolIcon Foreground="Red" Symbol="Cancel" IsVisible="{Binding !AppData.HasDynamicRichPresenceSupport}"/>
|
||||||
|
<TextBlock
|
||||||
|
Foreground="Red"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsVisible="{Binding !AppData.HasDynamicRichPresenceSupport}"
|
||||||
|
Text="{ext:Locale GameInfoRpcDynamic}"
|
||||||
|
TextAlignment="Start"
|
||||||
|
TextWrapping="Wrap" >
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<Separator Margin="0, 10, 0, 10" Height="1" BorderBrush="Gray" Background="Gray" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
IsVisible="{Binding AppData.HasLdnGames}"
|
IsVisible="{Binding AppData.HasLdnGames}"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
LocaleKeys.CompatibilityListNothing or
|
LocaleKeys.CompatibilityListNothing or
|
||||||
LocaleKeys.CompatibilityListBoots or
|
LocaleKeys.CompatibilityListBoots or
|
||||||
LocaleKeys.CompatibilityListMenus => Brushes.Red,
|
LocaleKeys.CompatibilityListMenus => Brushes.Red,
|
||||||
LocaleKeys.CompatibilityListIngame => Brushes.Yellow,
|
LocaleKeys.CompatibilityListIngame => Brushes.DarkOrange,
|
||||||
_ => Brushes.ForestGreen
|
_ => Brushes.ForestGreen
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using DynamicData;
|
||||||
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Models.Input
|
namespace Ryujinx.Ava.UI.Models.Input
|
||||||
{
|
{
|
||||||
@@ -28,8 +33,15 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||||||
|
|
||||||
[ObservableProperty] private Key _customVSyncIntervalDecrement;
|
[ObservableProperty] private Key _customVSyncIntervalDecrement;
|
||||||
|
|
||||||
|
public ObservableCollection<CycleController> CycleControllers { get; set; } = new ObservableCollection<CycleController>();
|
||||||
|
public ICommand AddCycleController { get; set; }
|
||||||
|
public ICommand RemoveCycleController { get; set; }
|
||||||
|
public bool CanRemoveCycleController => CycleControllers.Count > 0 && CycleControllers.Count < 8;
|
||||||
|
|
||||||
public HotkeyConfig(KeyboardHotkeys config)
|
public HotkeyConfig(KeyboardHotkeys config)
|
||||||
{
|
{
|
||||||
|
AddCycleController = MiniCommand.Create(() => CycleControllers.Add(new CycleController(CycleControllers.Count + 1, Key.Unbound)));
|
||||||
|
RemoveCycleController = MiniCommand.Create(() => CycleControllers.Remove(CycleControllers.Last()));
|
||||||
if (config == null)
|
if (config == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -44,6 +56,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||||||
VolumeDown = config.VolumeDown;
|
VolumeDown = config.VolumeDown;
|
||||||
CustomVSyncIntervalIncrement = config.CustomVSyncIntervalIncrement;
|
CustomVSyncIntervalIncrement = config.CustomVSyncIntervalIncrement;
|
||||||
CustomVSyncIntervalDecrement = config.CustomVSyncIntervalDecrement;
|
CustomVSyncIntervalDecrement = config.CustomVSyncIntervalDecrement;
|
||||||
|
CycleControllers.AddRange((config.CycleControllers ?? []).Select((x, i) => new CycleController(i + 1, x)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardHotkeys GetConfig() =>
|
public KeyboardHotkeys GetConfig() =>
|
||||||
@@ -60,6 +73,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||||||
VolumeDown = VolumeDown,
|
VolumeDown = VolumeDown,
|
||||||
CustomVSyncIntervalIncrement = CustomVSyncIntervalIncrement,
|
CustomVSyncIntervalIncrement = CustomVSyncIntervalIncrement,
|
||||||
CustomVSyncIntervalDecrement = CustomVSyncIntervalDecrement,
|
CustomVSyncIntervalDecrement = CustomVSyncIntervalDecrement,
|
||||||
|
CycleControllers = CycleControllers.Select(x => x.Hotkey).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
src/Ryujinx/UI/ViewModels/CycleController.cs
Normal file
48
src/Ryujinx/UI/ViewModels/CycleController.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using Ryujinx.Ava.Common.Locale;
|
||||||
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
{
|
||||||
|
public class CycleController : BaseModel
|
||||||
|
{
|
||||||
|
private string _player;
|
||||||
|
private Key _hotkey;
|
||||||
|
|
||||||
|
public string Player
|
||||||
|
{
|
||||||
|
get => _player;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_player = value;
|
||||||
|
OnPropertyChanged(nameof(Player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Key Hotkey
|
||||||
|
{
|
||||||
|
get => _hotkey;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_hotkey = value;
|
||||||
|
OnPropertyChanged(nameof(Hotkey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CycleController(int v, Key x)
|
||||||
|
{
|
||||||
|
Player = v switch
|
||||||
|
{
|
||||||
|
1 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer1],
|
||||||
|
2 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer2],
|
||||||
|
3 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer3],
|
||||||
|
4 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer4],
|
||||||
|
5 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer5],
|
||||||
|
6 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer6],
|
||||||
|
7 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer7],
|
||||||
|
8 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer8],
|
||||||
|
_ => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer] + " " + v
|
||||||
|
};
|
||||||
|
Hotkey = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -897,5 +897,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
|
|
||||||
AvaloniaKeyboardDriver.Dispose();
|
AvaloniaKeyboardDriver.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CyclePlayerDevice(int player)
|
||||||
|
{
|
||||||
|
LoadDevices();
|
||||||
|
PlayerId = (PlayerIndex)player;
|
||||||
|
Device = (Device + 1) % Devices.Count;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsHotkeysView"
|
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsHotkeysView"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@@ -15,17 +15,18 @@
|
|||||||
<viewModels:SettingsViewModel />
|
<viewModels:SettingsViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<UserControl.Styles>
|
<UserControl.Styles>
|
||||||
<Style Selector="StackPanel > StackPanel">
|
<Style Selector="StackPanel StackPanel">
|
||||||
<Setter Property="Margin" Value="10, 0, 0, 0" />
|
<Setter Property="Margin" Value="10, 0, 0, 0" />
|
||||||
<Setter Property="Orientation" Value="Horizontal" />
|
<Setter Property="Orientation" Value="Horizontal" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="StackPanel > StackPanel > TextBlock">
|
<Style Selector="StackPanel StackPanel > TextBlock">
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="Width" Value="230" />
|
<Setter Property="Width" Value="230" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="ToggleButton">
|
<Style Selector="ToggleButton, Button">
|
||||||
<Setter Property="Width" Value="90" />
|
<Setter Property="Width" Value="90" />
|
||||||
<Setter Property="Height" Value="27" />
|
<Setter Property="Height" Value="27" />
|
||||||
|
<Setter Property="Padding" Value="0,5,0,5" /> <!-- Added vertical padding -->
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="ToggleButton > TextBlock">
|
<Style Selector="ToggleButton > TextBlock">
|
||||||
<Setter Property="TextAlignment" Value="Center" />
|
<Setter Property="TextAlignment" Value="Center" />
|
||||||
@@ -39,79 +40,123 @@
|
|||||||
VerticalScrollBarVisibility="Auto">
|
VerticalScrollBarVisibility="Auto">
|
||||||
<Border Classes="settings">
|
<Border Classes="settings">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Name="SettingButtons"
|
|
||||||
Margin="10"
|
Margin="10"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
Orientation="Vertical"
|
Orientation="Vertical"
|
||||||
Spacing="10">
|
Spacing="10"
|
||||||
|
Name="SettingButtons">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Classes="h1"
|
Classes="h1"
|
||||||
Text="{ext:Locale SettingsTabHotkeysHotkeys}" />
|
Text="{ext:Locale SettingsTabHotkeysHotkeys}" />
|
||||||
<StackPanel>
|
<StackPanel
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysToggleVSyncModeHotkey}" />
|
Margin="10,0,0,0"
|
||||||
<ToggleButton Name="ToggleVSyncMode">
|
Spacing="10"
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.ToggleVSyncMode, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
Orientation="Vertical">
|
||||||
</ToggleButton>
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysToggleVSyncModeHotkey}" />
|
||||||
|
<ToggleButton Name="ToggleVSyncMode">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.ToggleVSyncMode, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysScreenshotHotkey}" />
|
||||||
|
<ToggleButton Name="Screenshot">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.Screenshot, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysShowUiHotkey}" />
|
||||||
|
<ToggleButton Name="ShowUI">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.ShowUI, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysPauseHotkey}" />
|
||||||
|
<ToggleButton Name="Pause">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.Pause, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysToggleMuteHotkey}" />
|
||||||
|
<ToggleButton Name="ToggleMute">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.ToggleMute, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysResScaleUpHotkey}" />
|
||||||
|
<ToggleButton Name="ResScaleUp">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.ResScaleUp, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysResScaleDownHotkey}" />
|
||||||
|
<ToggleButton Name="ResScaleDown">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.ResScaleDown, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysVolumeUpHotkey}" />
|
||||||
|
<ToggleButton Name="VolumeUp">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.VolumeUp, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysVolumeDownHotkey}" />
|
||||||
|
<ToggleButton Name="VolumeDown">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.VolumeDown, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysIncrementCustomVSyncIntervalHotkey}" />
|
||||||
|
<ToggleButton Name="CustomVSyncIntervalIncrement">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.CustomVSyncIntervalIncrement, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{ext:Locale SettingsTabHotkeysDecrementCustomVSyncIntervalHotkey}" />
|
||||||
|
<ToggleButton Name="CustomVSyncIntervalDecrement">
|
||||||
|
<TextBlock Text="{Binding KeyboardHotkey.CustomVSyncIntervalDecrement, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<Separator Height="1" />
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysScreenshotHotkey}" />
|
<StackPanel Margin="0">
|
||||||
<ToggleButton Name="Screenshot">
|
<TextBlock
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.Screenshot, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
Classes="h1"
|
||||||
</ToggleButton>
|
Text="{ext:Locale SettingsTabHotkeysCycleControllers}" />
|
||||||
</StackPanel>
|
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||||
<StackPanel>
|
<Button
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysShowUiHotkey}" />
|
Content="{ext:Locale SettingsTabGeneralAdd}"
|
||||||
<ToggleButton Name="ShowUI">
|
Margin="10,0,0,0"
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.ShowUI, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
Command="{Binding KeyboardHotkey.AddCycleController}" />
|
||||||
</ToggleButton>
|
<Button
|
||||||
</StackPanel>
|
Content="{ext:Locale SettingsTabGeneralRemove}"
|
||||||
<StackPanel>
|
IsEnabled="{Binding KeyboardHotkey.CanRemoveCycleController}"
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysPauseHotkey}" />
|
Command="{Binding KeyboardHotkey.RemoveCycleController}" />
|
||||||
<ToggleButton Name="Pause">
|
</StackPanel>
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.Pause, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysToggleMuteHotkey}" />
|
|
||||||
<ToggleButton Name="ToggleMute">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.ToggleMute, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysResScaleUpHotkey}" />
|
|
||||||
<ToggleButton Name="ResScaleUp">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.ResScaleUp, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysResScaleDownHotkey}" />
|
|
||||||
<ToggleButton Name="ResScaleDown">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.ResScaleDown, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysVolumeUpHotkey}" />
|
|
||||||
<ToggleButton Name="VolumeUp">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.VolumeUp, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysVolumeDownHotkey}" />
|
|
||||||
<ToggleButton Name="VolumeDown">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.VolumeDown, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysIncrementCustomVSyncIntervalHotkey}" />
|
|
||||||
<ToggleButton Name="CustomVSyncIntervalIncrement">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.CustomVSyncIntervalIncrement, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
|
||||||
<TextBlock Text="{ext:Locale SettingsTabHotkeysDecrementCustomVSyncIntervalHotkey}" />
|
|
||||||
<ToggleButton Name="CustomVSyncIntervalDecrement">
|
|
||||||
<TextBlock Text="{Binding KeyboardHotkey.CustomVSyncIntervalDecrement, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
|
||||||
</ToggleButton>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<ItemsControl ItemsSource="{Binding KeyboardHotkey.CycleControllers}"
|
||||||
|
Name="CycleControllers">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Orientation="Vertical"
|
||||||
|
Spacing="10" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{Binding Player}" />
|
||||||
|
<ToggleButton>
|
||||||
|
<TextBlock
|
||||||
|
Text="{Binding Hotkey, Converter={x:Static helpers:KeyValueConverter.Instance}}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ using Avalonia.Controls.Primitives;
|
|||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.LogicalTree;
|
using Avalonia.LogicalTree;
|
||||||
|
using Avalonia.VisualTree;
|
||||||
|
using DynamicData;
|
||||||
using Ryujinx.Ava.Input;
|
using Ryujinx.Ava.Input;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.Assigner;
|
using Ryujinx.Input.Assigner;
|
||||||
|
using System.Linq;
|
||||||
using Button = Ryujinx.Input.Button;
|
using Button = Ryujinx.Input.Button;
|
||||||
using Key = Ryujinx.Common.Configuration.Hid.Key;
|
using Key = Ryujinx.Common.Configuration.Hid.Key;
|
||||||
|
|
||||||
@@ -21,16 +24,21 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||||||
public SettingsHotkeysView()
|
public SettingsHotkeysView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
RegisterEvents();
|
||||||
|
_avaloniaKeyboardDriver = new AvaloniaKeyboardDriver(this);
|
||||||
|
CycleControllers.LayoutUpdated += (_, _1) => RegisterEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegisterEvents()
|
||||||
|
{
|
||||||
foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
|
foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
|
||||||
{
|
{
|
||||||
if (visual is ToggleButton button and not CheckBox)
|
if (visual is ToggleButton button and not CheckBox)
|
||||||
{
|
{
|
||||||
|
button.IsCheckedChanged -= Button_IsCheckedChanged;
|
||||||
button.IsCheckedChanged += Button_IsCheckedChanged;
|
button.IsCheckedChanged += Button_IsCheckedChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_avaloniaKeyboardDriver = new AvaloniaKeyboardDriver(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPointerReleased(PointerReleasedEventArgs e)
|
protected override void OnPointerReleased(PointerReleasedEventArgs e)
|
||||||
@@ -116,6 +124,13 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||||||
case "CustomVSyncIntervalDecrement":
|
case "CustomVSyncIntervalDecrement":
|
||||||
viewModel.KeyboardHotkey.CustomVSyncIntervalDecrement = buttonValue.AsHidType<Key>();
|
viewModel.KeyboardHotkey.CustomVSyncIntervalDecrement = buttonValue.AsHidType<Key>();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
var index = button.FindAncestorOfType<ItemsControl>().GetLogicalDescendants().OfType<ToggleButton>().IndexOf(button);
|
||||||
|
if (index >= 0 && viewModel.KeyboardHotkey.CycleControllers != null)
|
||||||
|
{
|
||||||
|
viewModel.KeyboardHotkey.CycleControllers[index].Hotkey = buttonValue.AsHidType<Key>();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
|||||||
public int GameCount { get; set; }
|
public int GameCount { get; set; }
|
||||||
|
|
||||||
public bool HasLdnGames => PlayerCount != 0 && GameCount != 0;
|
public bool HasLdnGames => PlayerCount != 0 && GameCount != 0;
|
||||||
|
|
||||||
|
public bool HasRichPresenceAsset => DiscordIntegrationModule.HasAssetImage(IdString);
|
||||||
|
public bool HasDynamicRichPresenceSupport => DiscordIntegrationModule.HasAnalyzer(IdString);
|
||||||
|
|
||||||
public TimeSpan TimePlayed { get; set; }
|
public TimeSpan TimePlayed { get; set; }
|
||||||
public DateTime? LastPlayed { get; set; }
|
public DateTime? LastPlayed { get; set; }
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using MsgPack;
|
|||||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -15,6 +16,10 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
{
|
{
|
||||||
private readonly List<GameSpec> _specs = [];
|
private readonly List<GameSpec> _specs = [];
|
||||||
|
|
||||||
|
public string[] TitleIds => Specs.SelectMany(x => x.TitleIds).ToArray();
|
||||||
|
|
||||||
|
public IReadOnlyList<GameSpec> Specs => new ReadOnlyCollection<GameSpec>(_specs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add an analysis spec matching a specific game by title ID, with the provided spec configuration.
|
/// Add an analysis spec matching a specific game by title ID, with the provided spec configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -80,7 +85,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs the configured <see cref="GameSpec.FormatterSpec"/> for the specified game title ID.
|
/// Runs the configured <see cref="FormatterSpec"/> for the specified game title ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="runningGameId">The game currently running.</param>
|
/// <param name="runningGameId">The game currently running.</param>
|
||||||
/// <param name="appMeta">The Application metadata information, including localized game name and play time information.</param>
|
/// <param name="appMeta">The Application metadata information, including localized game name and play time information.</param>
|
||||||
@@ -89,10 +94,10 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
public FormattedValue Format(
|
public FormattedValue Format(
|
||||||
string runningGameId,
|
string runningGameId,
|
||||||
ApplicationMetadata appMeta,
|
ApplicationMetadata appMeta,
|
||||||
MessagePackObject playReport
|
Horizon.Prepo.Types.PlayReport playReport
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!playReport.IsDictionary)
|
if (!playReport.ReportData.IsDictionary)
|
||||||
return FormattedValue.Unhandled;
|
return FormattedValue.Unhandled;
|
||||||
|
|
||||||
if (!_specs.TryGetFirst(s => runningGameId.EqualsAnyIgnoreCase(s.TitleIds), out GameSpec spec))
|
if (!_specs.TryGetFirst(s => runningGameId.EqualsAnyIgnoreCase(s.TitleIds), out GameSpec spec))
|
||||||
@@ -100,10 +105,14 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
|
|
||||||
foreach (FormatterSpec formatSpec in spec.SimpleValueFormatters.OrderBy(x => x.Priority))
|
foreach (FormatterSpec formatSpec in spec.SimpleValueFormatters.OrderBy(x => x.Priority))
|
||||||
{
|
{
|
||||||
if (!playReport.AsDictionary().TryGetValue(formatSpec.ReportKey, out MessagePackObject valuePackObject))
|
if (!playReport.ReportData.AsDictionary().TryGetValue(formatSpec.ReportKey, out MessagePackObject valuePackObject))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return formatSpec.Formatter(new Value { Application = appMeta, PackedValue = valuePackObject });
|
return formatSpec.Formatter(new SingleValue(valuePackObject)
|
||||||
|
{
|
||||||
|
Application = appMeta,
|
||||||
|
PlayReport = playReport
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (MultiFormatterSpec formatSpec in spec.MultiValueFormatters.OrderBy(x => x.Priority))
|
foreach (MultiFormatterSpec formatSpec in spec.MultiValueFormatters.OrderBy(x => x.Priority))
|
||||||
@@ -111,7 +120,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
List<MessagePackObject> packedObjects = [];
|
List<MessagePackObject> packedObjects = [];
|
||||||
foreach (var reportKey in formatSpec.ReportKeys)
|
foreach (var reportKey in formatSpec.ReportKeys)
|
||||||
{
|
{
|
||||||
if (!playReport.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
|
if (!playReport.ReportData.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
packedObjects.Add(valuePackObject);
|
packedObjects.Add(valuePackObject);
|
||||||
@@ -120,23 +129,30 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
if (packedObjects.Count != formatSpec.ReportKeys.Length)
|
if (packedObjects.Count != formatSpec.ReportKeys.Length)
|
||||||
return FormattedValue.Unhandled;
|
return FormattedValue.Unhandled;
|
||||||
|
|
||||||
return formatSpec.Formatter(packedObjects
|
return formatSpec.Formatter(new MultiValue(packedObjects)
|
||||||
.Select(packObject => new Value { Application = appMeta, PackedValue = packObject })
|
{
|
||||||
.ToArray());
|
Application = appMeta,
|
||||||
|
PlayReport = playReport
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (SparseMultiFormatterSpec formatSpec in spec.SparseMultiValueFormatters.OrderBy(x => x.Priority))
|
foreach (SparseMultiFormatterSpec formatSpec in spec.SparseMultiValueFormatters.OrderBy(x => x.Priority))
|
||||||
{
|
{
|
||||||
Dictionary<string, Value> packedObjects = [];
|
Dictionary<string, MessagePackObject> packedObjects = [];
|
||||||
foreach (var reportKey in formatSpec.ReportKeys)
|
foreach (var reportKey in formatSpec.ReportKeys)
|
||||||
{
|
{
|
||||||
if (!playReport.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
|
if (!playReport.ReportData.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
packedObjects.Add(reportKey, new Value { Application = appMeta, PackedValue = valuePackObject });
|
packedObjects.Add(reportKey, valuePackObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatSpec.Formatter(packedObjects);
|
return formatSpec.Formatter(
|
||||||
|
new SparseMultiValue(packedObjects)
|
||||||
|
{
|
||||||
|
Application = appMeta,
|
||||||
|
PlayReport = playReport
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return FormattedValue.Unhandled;
|
return FormattedValue.Unhandled;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
namespace Ryujinx.Ava.Utilities.PlayReport
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.PlayReport
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delegate type that powers single value formatters.<br/>
|
/// The delegate type that powers single value formatters.<br/>
|
||||||
@@ -12,7 +10,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
/// <br/>
|
/// <br/>
|
||||||
/// OR a signal to reset the value that the caller is using the <see cref="Analyzer"/> for.
|
/// OR a signal to reset the value that the caller is using the <see cref="Analyzer"/> for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate FormattedValue ValueFormatter(Value value);
|
public delegate FormattedValue ValueFormatter(SingleValue value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delegate type that powers multiple value formatters.<br/>
|
/// The delegate type that powers multiple value formatters.<br/>
|
||||||
@@ -24,7 +22,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
/// <br/>
|
/// <br/>
|
||||||
/// OR a signal to reset the value that the caller is using the <see cref="Analyzer"/> for.
|
/// OR a signal to reset the value that the caller is using the <see cref="Analyzer"/> for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate FormattedValue MultiValueFormatter(Value[] value);
|
public delegate FormattedValue MultiValueFormatter(MultiValue value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delegate type that powers multiple value formatters.
|
/// The delegate type that powers multiple value formatters.
|
||||||
@@ -38,5 +36,5 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
/// <br/>
|
/// <br/>
|
||||||
/// OR a signal to reset the value that the caller is using the <see cref="Analyzer"/> for.
|
/// OR a signal to reset the value that the caller is using the <see cref="Analyzer"/> for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate FormattedValue SparseMultiValueFormatter(Dictionary<string, Value> values);
|
public delegate FormattedValue SparseMultiValueFormatter(SparseMultiValue value);
|
||||||
}
|
}
|
||||||
|
|||||||
87
src/Ryujinx/Utilities/PlayReport/MatchedValues.cs
Normal file
87
src/Ryujinx/Utilities/PlayReport/MatchedValues.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
using MsgPack;
|
||||||
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.Utilities.PlayReport
|
||||||
|
{
|
||||||
|
public abstract class MatchedValue<T>
|
||||||
|
{
|
||||||
|
public MatchedValue(T matched)
|
||||||
|
{
|
||||||
|
Matched = matched;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The currently running application's <see cref="ApplicationMetadata"/>.
|
||||||
|
/// </summary>
|
||||||
|
public ApplicationMetadata Application { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entire play report.
|
||||||
|
/// </summary>
|
||||||
|
public Horizon.Prepo.Types.PlayReport PlayReport { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The matched value from the Play Report.
|
||||||
|
/// </summary>
|
||||||
|
public T Matched { get; init; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The input data to a <see cref="ValueFormatter"/>,
|
||||||
|
/// containing the currently running application's <see cref="ApplicationMetadata"/>,
|
||||||
|
/// and the matched <see cref="MessagePackObject"/> from the Play Report.
|
||||||
|
/// </summary>
|
||||||
|
public class SingleValue : MatchedValue<Value>
|
||||||
|
{
|
||||||
|
public SingleValue(Value matched) : base(matched)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator SingleValue(MessagePackObject mpo) => new(mpo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The input data to a <see cref="MultiValueFormatter"/>,
|
||||||
|
/// containing the currently running application's <see cref="ApplicationMetadata"/>,
|
||||||
|
/// and the matched <see cref="MessagePackObject"/>s from the Play Report.
|
||||||
|
/// </summary>
|
||||||
|
public class MultiValue : MatchedValue<Value[]>
|
||||||
|
{
|
||||||
|
public MultiValue(Value[] matched) : base(matched)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiValue(IEnumerable<MessagePackObject> matched) : base(Value.ConvertPackedObjects(matched))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator MultiValue(List<MessagePackObject> matched)
|
||||||
|
=> new(matched.Select(x => new Value(x)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The input data to a <see cref="SparseMultiValueFormatter"/>,
|
||||||
|
/// containing the currently running application's <see cref="ApplicationMetadata"/>,
|
||||||
|
/// and the matched <see cref="MessagePackObject"/>s from the Play Report.
|
||||||
|
/// </summary>
|
||||||
|
public class SparseMultiValue : MatchedValue<Dictionary<string, Value>>
|
||||||
|
{
|
||||||
|
public SparseMultiValue(Dictionary<string, Value> matched) : base(matched)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public SparseMultiValue(Dictionary<string, MessagePackObject> matched) : base(Value.ConvertPackedObjectMap(matched))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator SparseMultiValue(Dictionary<string, MessagePackObject> matched)
|
||||||
|
=> new(matched
|
||||||
|
.ToDictionary(
|
||||||
|
x => x.Key,
|
||||||
|
x => new Value(x.Value)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,28 +39,28 @@
|
|||||||
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
||||||
);
|
);
|
||||||
|
|
||||||
private static FormattedValue BreathOfTheWild_MasterMode(Value value)
|
private static FormattedValue BreathOfTheWild_MasterMode(SingleValue value)
|
||||||
=> value.BoxedValue is 1 ? "Playing Master Mode" : FormattedValue.ForceReset;
|
=> value.Matched.BoxedValue is 1 ? "Playing Master Mode" : FormattedValue.ForceReset;
|
||||||
|
|
||||||
private static FormattedValue TearsOfTheKingdom_CurrentField(Value value) =>
|
private static FormattedValue TearsOfTheKingdom_CurrentField(SingleValue value) =>
|
||||||
value.DoubleValue switch
|
value.Matched.DoubleValue switch
|
||||||
{
|
{
|
||||||
> 800d => "Exploring the Sky Islands",
|
> 800d => "Exploring the Sky Islands",
|
||||||
< -201d => "Exploring the Depths",
|
< -201d => "Exploring the Depths",
|
||||||
_ => "Roaming Hyrule"
|
_ => "Roaming Hyrule"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static FormattedValue SuperMarioOdyssey_AssistMode(Value value)
|
private static FormattedValue SuperMarioOdyssey_AssistMode(SingleValue value)
|
||||||
=> value.BoxedValue is 1 ? "Playing in Assist Mode" : "Playing in Regular Mode";
|
=> value.Matched.BoxedValue is 1 ? "Playing in Assist Mode" : "Playing in Regular Mode";
|
||||||
|
|
||||||
private static FormattedValue SuperMarioOdysseyChina_AssistMode(Value value)
|
private static FormattedValue SuperMarioOdysseyChina_AssistMode(SingleValue value)
|
||||||
=> value.BoxedValue is 1 ? "Playing in 帮助模式" : "Playing in 普通模式";
|
=> value.Matched.BoxedValue is 1 ? "Playing in 帮助模式" : "Playing in 普通模式";
|
||||||
|
|
||||||
private static FormattedValue SuperMario3DWorldOrBowsersFury(Value value)
|
private static FormattedValue SuperMario3DWorldOrBowsersFury(SingleValue value)
|
||||||
=> value.BoxedValue is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury";
|
=> value.Matched.BoxedValue is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury";
|
||||||
|
|
||||||
private static FormattedValue MarioKart8Deluxe_Mode(Value value)
|
private static FormattedValue MarioKart8Deluxe_Mode(SingleValue value)
|
||||||
=> value.StringValue switch
|
=> value.Matched.StringValue switch
|
||||||
{
|
{
|
||||||
// Single Player
|
// Single Player
|
||||||
"Single" => "Single Player",
|
"Single" => "Single Player",
|
||||||
@@ -87,11 +87,11 @@
|
|||||||
_ => FormattedValue.ForceReset
|
_ => FormattedValue.ForceReset
|
||||||
};
|
};
|
||||||
|
|
||||||
private static FormattedValue PokemonSVUnionCircle(Value value)
|
private static FormattedValue PokemonSVUnionCircle(SingleValue value)
|
||||||
=> value.BoxedValue is 0 ? "Playing Alone" : "Playing in a group";
|
=> value.Matched.BoxedValue is 0 ? "Playing Alone" : "Playing in a group";
|
||||||
|
|
||||||
private static FormattedValue PokemonSVArea(Value value)
|
private static FormattedValue PokemonSVArea(SingleValue value)
|
||||||
=> value.StringValue switch
|
=> value.Matched.StringValue switch
|
||||||
{
|
{
|
||||||
// Base Game Locations
|
// Base Game Locations
|
||||||
"a_w01" => "South Area One",
|
"a_w01" => "South Area One",
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using MsgPack;
|
using MsgPack;
|
||||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.PlayReport
|
namespace Ryujinx.Ava.Utilities.PlayReport
|
||||||
{
|
{
|
||||||
@@ -9,12 +11,12 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
/// containing the currently running application's <see cref="ApplicationMetadata"/>,
|
/// containing the currently running application's <see cref="ApplicationMetadata"/>,
|
||||||
/// and the matched <see cref="MessagePackObject"/> from the Play Report.
|
/// and the matched <see cref="MessagePackObject"/> from the Play Report.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Value
|
public readonly struct Value
|
||||||
{
|
{
|
||||||
/// <summary>
|
public Value(MessagePackObject packedValue)
|
||||||
/// The currently running application's <see cref="ApplicationMetadata"/>.
|
{
|
||||||
/// </summary>
|
PackedValue = packedValue;
|
||||||
public ApplicationMetadata Application { get; init; }
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The matched value from the Play Report.
|
/// The matched value from the Play Report.
|
||||||
@@ -37,6 +39,17 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
: boxed.ToString();
|
: boxed.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static implicit operator Value(MessagePackObject matched) => new(matched);
|
||||||
|
|
||||||
|
public static Value[] ConvertPackedObjects(IEnumerable<MessagePackObject> packObjects)
|
||||||
|
=> packObjects.Select(packObject => new Value(packObject)).ToArray();
|
||||||
|
|
||||||
|
public static Dictionary<string, Value> ConvertPackedObjectMap(Dictionary<string, MessagePackObject> packObjects)
|
||||||
|
=> packObjects.ToDictionary(
|
||||||
|
x => x.Key,
|
||||||
|
x => new Value(x.Value)
|
||||||
|
);
|
||||||
|
|
||||||
#region AsX accessors
|
#region AsX accessors
|
||||||
|
|
||||||
public bool BooleanValue => PackedValue.AsBoolean();
|
public bool BooleanValue => PackedValue.AsBoolean();
|
||||||
|
|||||||
Reference in New Issue
Block a user