Compare commits
5 Commits
Canary-1.2
...
f4ea7b3420
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4ea7b3420 | ||
|
|
b1f61e5143 | ||
|
|
0d7d0e8092 | ||
|
|
aa2178dbe5 | ||
|
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -1309,6 +1311,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;
|
||||||
@@ -1391,6 +1405,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -447,6 +447,31 @@
|
|||||||
"zh_TW": "開啟 Ryujinx 資料夾"
|
"zh_TW": "開啟 Ryujinx 資料夾"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ID": "MenuBarFileOpenScreenshotsFolder",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Open Screenshots Folder",
|
||||||
|
"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": "MenuBarFileOpenLogsFolder",
|
"ID": "MenuBarFileOpenLogsFolder",
|
||||||
"Translations": {
|
"Translations": {
|
||||||
@@ -5922,6 +5947,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": {
|
||||||
@@ -17197,6 +17247,31 @@
|
|||||||
"zh_TW": "開啟 Ryujinx 檔案系統資料夾"
|
"zh_TW": "開啟 Ryujinx 檔案系統資料夾"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ID": "OpenScreenshotFolderTooltip",
|
||||||
|
"Translations": {
|
||||||
|
"ar_SA": "",
|
||||||
|
"de_DE": "",
|
||||||
|
"el_GR": "",
|
||||||
|
"en_US": "Open Ryujinx screenshots folder",
|
||||||
|
"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": "OpenRyujinxLogsTooltip",
|
"ID": "OpenRyujinxLogsTooltip",
|
||||||
"Translations": {
|
"Translations": {
|
||||||
|
|||||||
@@ -14,5 +14,13 @@ namespace Ryujinx.Ava.Common
|
|||||||
VolumeDown,
|
VolumeDown,
|
||||||
CustomVSyncIntervalIncrement,
|
CustomVSyncIntervalIncrement,
|
||||||
CustomVSyncIntervalDecrement,
|
CustomVSyncIntervalDecrement,
|
||||||
|
CycleControllersPlayer1,
|
||||||
|
CycleControllersPlayer2,
|
||||||
|
CycleControllersPlayer3,
|
||||||
|
CycleControllersPlayer4,
|
||||||
|
CycleControllersPlayer5,
|
||||||
|
CycleControllersPlayer6,
|
||||||
|
CycleControllersPlayer7,
|
||||||
|
CycleControllersPlayer8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,17 +119,23 @@
|
|||||||
TextWrapping="Wrap" >
|
TextWrapping="Wrap" >
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
<StackPanel Orientation="Horizontal" Spacing="5" ToolTip.Tip="{Binding DynamicRichPresenceDescription}">
|
||||||
<ui:SymbolIcon Foreground="ForestGreen" Symbol="Checkmark" IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"/>
|
<ui:SymbolIcon
|
||||||
|
Foreground="ForestGreen"
|
||||||
|
Symbol="Checkmark"
|
||||||
|
IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="ForestGreen"
|
Foreground="ForestGreen"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"
|
IsVisible="{Binding AppData.HasDynamicRichPresenceSupport}"
|
||||||
Text="{ext:Locale GameInfoRpcDynamic}"
|
Text="{ext:Locale GameInfoRpcDynamic}"
|
||||||
TextAlignment="Start"
|
TextAlignment="Start"
|
||||||
TextWrapping="Wrap" >
|
TextWrapping="Wrap">
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<ui:SymbolIcon Foreground="Red" Symbol="Cancel" IsVisible="{Binding !AppData.HasDynamicRichPresenceSupport}"/>
|
<ui:SymbolIcon
|
||||||
|
Foreground="Red"
|
||||||
|
Symbol="Cancel"
|
||||||
|
IsVisible="{Binding !AppData.HasDynamicRichPresenceSupport}"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
|
|||||||
@@ -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()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Gommon;
|
using Gommon;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
|
using Ryujinx.Ava.Utilities.PlayReport;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.ViewModels
|
namespace Ryujinx.Ava.UI.ViewModels
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
public ApplicationDataViewModel(ApplicationData appData) => AppData = appData;
|
public ApplicationDataViewModel(ApplicationData appData) => AppData = appData;
|
||||||
|
|
||||||
|
public string DynamicRichPresenceDescription =>
|
||||||
|
AppData.HasDynamicRichPresenceSupport
|
||||||
|
? AppData.RichPresenceSpec.Value.Description
|
||||||
|
: GameSpec.DefaultDescription;
|
||||||
|
|
||||||
public string FormattedVersion => LocaleManager.Instance[LocaleKeys.GameListHeaderVersion].Format(AppData.Version);
|
public string FormattedVersion => LocaleManager.Instance[LocaleKeys.GameListHeaderVersion].Format(AppData.Version);
|
||||||
public string FormattedDeveloper => LocaleManager.Instance[LocaleKeys.GameListHeaderDeveloper].Format(AppData.Developer);
|
public string FormattedDeveloper => LocaleManager.Instance[LocaleKeys.GameListHeaderDeveloper].Format(AppData.Developer);
|
||||||
public string FormattedFileExtension => LocaleManager.Instance[LocaleKeys.GameListHeaderFileExtension].Format(AppData.FileExtension);
|
public string FormattedFileExtension => LocaleManager.Instance[LocaleKeys.GameListHeaderFileExtension].Format(AppData.FileExtension);
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1347,6 +1347,25 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
OpenHelper.OpenFolder(AppDataManager.BaseDirPath);
|
OpenHelper.OpenFolder(AppDataManager.BaseDirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OpenScreenshotsFolder()
|
||||||
|
{
|
||||||
|
string screenshotsDir = Path.Combine(AppDataManager.BaseDirPath, "screenshots");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(screenshotsDir))
|
||||||
|
Directory.CreateDirectory(screenshotsDir);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Application, $"Failed to create directory at path {screenshotsDir}. Error : {ex.GetType().Name}", "Screenshot");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenHelper.OpenFolder(screenshotsDir);
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenLogsFolder()
|
public void OpenLogsFolder()
|
||||||
{
|
{
|
||||||
string logPath = AppDataManager.GetOrCreateLogsDir();
|
string logPath = AppDataManager.GetOrCreateLogsDir();
|
||||||
|
|||||||
@@ -66,6 +66,10 @@
|
|||||||
Command="{Binding OpenRyujinxFolder}"
|
Command="{Binding OpenRyujinxFolder}"
|
||||||
Header="{ext:Locale MenuBarFileOpenEmuFolder}"
|
Header="{ext:Locale MenuBarFileOpenEmuFolder}"
|
||||||
ToolTip.Tip="{ext:Locale OpenRyujinxFolderTooltip}" />
|
ToolTip.Tip="{ext:Locale OpenRyujinxFolderTooltip}" />
|
||||||
|
<MenuItem
|
||||||
|
Command="{Binding OpenScreenshotsFolder}"
|
||||||
|
Header="{ext:Locale MenuBarFileOpenScreenshotsFolder}"
|
||||||
|
ToolTip.Tip="{ext:Locale OpenScreenshotFolderTooltip}"/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding OpenLogsFolder}"
|
Command="{Binding OpenLogsFolder}"
|
||||||
Header="{ext:Locale MenuBarFileOpenLogsFolder}"
|
Header="{ext:Locale MenuBarFileOpenLogsFolder}"
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using LibHac.Tools.FsSystem;
|
|||||||
using LibHac.Tools.FsSystem.NcaUtils;
|
using LibHac.Tools.FsSystem.NcaUtils;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Utilities.Compat;
|
using Ryujinx.Ava.Utilities.Compat;
|
||||||
|
using Ryujinx.Ava.Utilities.PlayReport;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.Loaders.Processes.Extensions;
|
using Ryujinx.HLE.Loaders.Processes.Extensions;
|
||||||
@@ -35,9 +36,14 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
|||||||
{
|
{
|
||||||
_id = value;
|
_id = value;
|
||||||
|
|
||||||
Compatibility = CompatibilityCsv.Find(Id);
|
Compatibility = CompatibilityCsv.Find(value);
|
||||||
|
RichPresenceSpec = PlayReports.Analyzer.TryGetSpec(IdString, out GameSpec gameSpec)
|
||||||
|
? gameSpec
|
||||||
|
: default(Optional<GameSpec>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Optional<GameSpec> RichPresenceSpec { get; set; }
|
||||||
|
|
||||||
public string Developer { get; set; } = "Unknown";
|
public string Developer { get; set; } = "Unknown";
|
||||||
public string Version { get; set; } = "0";
|
public string Version { get; set; } = "0";
|
||||||
public int PlayerCount { get; set; }
|
public int PlayerCount { get; set; }
|
||||||
@@ -46,7 +52,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
|||||||
public bool HasLdnGames => PlayerCount != 0 && GameCount != 0;
|
public bool HasLdnGames => PlayerCount != 0 && GameCount != 0;
|
||||||
|
|
||||||
public bool HasRichPresenceAsset => DiscordIntegrationModule.HasAssetImage(IdString);
|
public bool HasRichPresenceAsset => DiscordIntegrationModule.HasAssetImage(IdString);
|
||||||
public bool HasDynamicRichPresenceSupport => DiscordIntegrationModule.HasAnalyzer(IdString);
|
public bool HasDynamicRichPresenceSupport => RichPresenceSpec.HasValue;
|
||||||
|
|
||||||
public TimeSpan TimePlayed { get; set; }
|
public TimeSpan TimePlayed { get; set; }
|
||||||
public DateTime? LastPlayed { get; set; }
|
public DateTime? LastPlayed { get; set; }
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
|
|
||||||
public IReadOnlyList<GameSpec> Specs => new ReadOnlyCollection<GameSpec>(_specs);
|
public IReadOnlyList<GameSpec> Specs => new ReadOnlyCollection<GameSpec>(_specs);
|
||||||
|
|
||||||
|
public GameSpec GetSpec(string titleId) => _specs.First(x => x.TitleIds.ContainsIgnoreCase(titleId));
|
||||||
|
|
||||||
|
public bool TryGetSpec(string titleId, out GameSpec gameSpec)
|
||||||
|
=> (gameSpec = _specs.FirstOrDefault(x => x.TitleIds.ContainsIgnoreCase(titleId))) != null;
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -128,13 +133,13 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
{
|
{
|
||||||
if (!playReport.ReportData.IsDictionary)
|
if (!playReport.ReportData.IsDictionary)
|
||||||
return FormattedValue.Unhandled;
|
return FormattedValue.Unhandled;
|
||||||
|
|
||||||
if (!_specs.TryGetFirst(s => runningGameId.EqualsAnyIgnoreCase(s.TitleIds), out GameSpec spec))
|
if (!TryGetSpec(runningGameId, out GameSpec spec))
|
||||||
return FormattedValue.Unhandled;
|
return FormattedValue.Unhandled;
|
||||||
|
|
||||||
foreach (FormatterSpecBase formatSpec in spec.ValueFormatters.OrderBy(x => x.Priority))
|
foreach (FormatterSpecBase formatSpec in spec.ValueFormatters.OrderBy(x => x.Priority))
|
||||||
{
|
{
|
||||||
if (!formatSpec.Format(appMeta, playReport, out FormattedValue value))
|
if (!formatSpec.TryFormat(appMeta, playReport, out FormattedValue value))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -9,72 +9,89 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
// init lazy value
|
// init lazy value
|
||||||
_ = Analyzer;
|
_ = Analyzer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Analyzer Analyzer => _analyzerLazy.Value;
|
public static Analyzer Analyzer => _analyzerLazy.Value;
|
||||||
|
|
||||||
private static readonly Lazy<Analyzer> _analyzerLazy = new(() =>
|
private static readonly Lazy<Analyzer> _analyzerLazy = new(() => new Analyzer()
|
||||||
new Analyzer()
|
.AddSpec(
|
||||||
.AddSpec(
|
"01007ef00011e000",
|
||||||
"01007ef00011e000",
|
spec => spec
|
||||||
spec => spec
|
.WithDescription("based on being in Master Mode.")
|
||||||
.AddValueFormatter("IsHardMode", BreathOfTheWild_MasterMode)
|
.AddValueFormatter("IsHardMode", BreathOfTheWild_MasterMode)
|
||||||
// reset to normal status when switching between normal & master mode in title screen
|
// reset to normal status when switching between normal & master mode in title screen
|
||||||
.AddValueFormatter("AoCVer", FormattedValue.SingleAlwaysResets)
|
.AddValueFormatter("AoCVer", FormattedValue.SingleAlwaysResets)
|
||||||
)
|
)
|
||||||
.AddSpec(
|
.AddSpec(
|
||||||
"0100f2c0115b6000",
|
"0100f2c0115b6000",
|
||||||
spec => spec
|
spec => spec
|
||||||
.AddValueFormatter("PlayerPosY", TearsOfTheKingdom_CurrentField))
|
.WithDescription("based on where you are in Hyrule (Depths, Surface, Sky).")
|
||||||
.AddSpec(
|
.AddValueFormatter("PlayerPosY", TearsOfTheKingdom_CurrentField))
|
||||||
"0100000000010000",
|
.AddSpec(
|
||||||
spec =>
|
"01002da013484000",
|
||||||
spec.AddValueFormatter("is_kids_mode", SuperMarioOdyssey_AssistMode)
|
spec => spec
|
||||||
)
|
.WithDescription("based on how many Rupees you have.")
|
||||||
.AddSpec(
|
.AddValueFormatter("rupees", SkywardSwordHD_Rupees))
|
||||||
"010075000ecbe000",
|
.AddSpec(
|
||||||
spec =>
|
"0100000000010000",
|
||||||
spec.AddValueFormatter("is_kids_mode", SuperMarioOdysseyChina_AssistMode)
|
spec => spec
|
||||||
)
|
.WithDescription("based on if you're playing with Assist Mode.")
|
||||||
.AddSpec(
|
.AddValueFormatter("is_kids_mode", SuperMarioOdyssey_AssistMode)
|
||||||
"010028600ebda000",
|
)
|
||||||
spec => spec.AddValueFormatter("mode", SuperMario3DWorldOrBowsersFury)
|
.AddSpec(
|
||||||
)
|
"010075000ecbe000",
|
||||||
.AddSpec( // Global & China IDs
|
spec => spec
|
||||||
["0100152000022000", "010075100e8ec000"],
|
.WithDescription("based on if you're playing with Assist Mode.")
|
||||||
spec => spec.AddValueFormatter("To", MarioKart8Deluxe_Mode)
|
.AddValueFormatter("is_kids_mode", SuperMarioOdysseyChina_AssistMode)
|
||||||
)
|
)
|
||||||
.AddSpec(
|
.AddSpec(
|
||||||
["0100a3d008c5c000", "01008f6008c5e000"],
|
"010028600ebda000",
|
||||||
spec => spec
|
spec => spec
|
||||||
.AddValueFormatter("area_no", PokemonSVArea)
|
.WithDescription("based on being in either Super Mario 3D World or Bowser's Fury.")
|
||||||
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
.AddValueFormatter("mode", SuperMario3DWorldOrBowsersFury)
|
||||||
)
|
)
|
||||||
.AddSpec(
|
.AddSpec( // Global & China IDs
|
||||||
"01006a800016e000",
|
["0100152000022000", "010075100e8ec000"],
|
||||||
spec => spec
|
spec => spec
|
||||||
.AddSparseMultiValueFormatter(
|
.WithDescription(
|
||||||
[
|
"based on what modes you're selecting in the menu & whether or not you're in a race.")
|
||||||
// Metadata to figure out what PlayReport we have.
|
.AddValueFormatter("To", MarioKart8Deluxe_Mode)
|
||||||
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count",
|
)
|
||||||
"adv_slot",
|
.AddSpec(
|
||||||
// List of Fighters
|
["0100a3d008c5c000", "01008f6008c5e000"],
|
||||||
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter",
|
spec => spec
|
||||||
"player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
.WithDescription("based on what area of Paldea you're exploring.")
|
||||||
// List of rankings/placements
|
.AddValueFormatter("area_no", PokemonSVArea)
|
||||||
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank",
|
.AddValueFormatter("team_circle", PokemonSVUnionCircle)
|
||||||
"player_6_rank", "player_7_rank", "player_8_rank"
|
)
|
||||||
],
|
.AddSpec(
|
||||||
SuperSmashBrosUltimate_Mode
|
"01006a800016e000",
|
||||||
)
|
spec => spec
|
||||||
)
|
.WithDescription("based on what mode you're playing, who won, and what characters were present.")
|
||||||
.AddSpec(
|
.AddSparseMultiValueFormatter(
|
||||||
[
|
[
|
||||||
"0100c9a00ece6000", "01008d300c50c000", "0100d870045b6000",
|
// Metadata to figure out what PlayReport we have.
|
||||||
"010012f017576000", "0100c62011050000", "0100b3c014bda000"
|
"match_mode", "match_submode", "anniversary", "fighter", "reason", "challenge_count",
|
||||||
],
|
"adv_slot",
|
||||||
spec => spec.AddValueFormatter("launch_title_id", NsoEmulator_LaunchedGame)
|
// List of Fighters
|
||||||
)
|
"player_1_fighter", "player_2_fighter", "player_3_fighter", "player_4_fighter",
|
||||||
.AddSpec("01002da013484000", spec => spec.AddValueFormatter("rupees", SkywardSwordHD_Rupees))
|
"player_5_fighter", "player_6_fighter", "player_7_fighter", "player_8_fighter",
|
||||||
|
// List of rankings/placements
|
||||||
|
"player_1_rank", "player_2_rank", "player_3_rank", "player_4_rank", "player_5_rank",
|
||||||
|
"player_6_rank", "player_7_rank", "player_8_rank"
|
||||||
|
],
|
||||||
|
SuperSmashBrosUltimate_Mode
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.AddSpec(
|
||||||
|
[
|
||||||
|
"0100c9a00ece6000", "01008d300c50c000", "0100d870045b6000",
|
||||||
|
"010012f017576000", "0100c62011050000", "0100b3c014bda000"
|
||||||
|
],
|
||||||
|
spec => spec
|
||||||
|
.WithDescription(
|
||||||
|
"based on what game you first launch.\n\nNSO emulators do not print any Play Report information past the first game launch so it's all we got.")
|
||||||
|
.AddValueFormatter("launch_title_id", NsoEmulator_LaunchedGame)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
private static string Playing(string game) => $"Playing {game}";
|
private static string Playing(string game) => $"Playing {game}";
|
||||||
|
|||||||
@@ -23,6 +23,20 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
|
|
||||||
public required string[] TitleIds { get; init; }
|
public required string[] TitleIds { get; init; }
|
||||||
|
|
||||||
|
public const string DefaultDescription = "Formats the details on your Discord presence based on logged data from the game.";
|
||||||
|
|
||||||
|
private string _valueDescription;
|
||||||
|
|
||||||
|
public string Description => _valueDescription ?? DefaultDescription;
|
||||||
|
|
||||||
|
public GameSpec WithDescription(string description)
|
||||||
|
{
|
||||||
|
_valueDescription = description != null
|
||||||
|
? $"Formats the details on your Discord presence {description}"
|
||||||
|
: null;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<FormatterSpecBase> ValueFormatters { get; } = [];
|
public List<FormatterSpecBase> ValueFormatters { get; } = [];
|
||||||
|
|
||||||
|
|
||||||
@@ -197,7 +211,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
|
|||||||
public string[] ReportKeys { get; init; }
|
public string[] ReportKeys { get; init; }
|
||||||
public Delegate Formatter { get; init; }
|
public Delegate Formatter { get; init; }
|
||||||
|
|
||||||
public bool Format(ApplicationMetadata appMeta, Horizon.Prepo.Types.PlayReport playReport,
|
public bool TryFormat(ApplicationMetadata appMeta, Horizon.Prepo.Types.PlayReport playReport,
|
||||||
out FormattedValue formattedValue)
|
out FormattedValue formattedValue)
|
||||||
{
|
{
|
||||||
formattedValue = default;
|
formattedValue = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user