Compare commits
4 Commits
Canary-1.2
...
Canary-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c82d98ec4 | ||
|
|
4aae82bad1 | ||
|
|
299be822c4 | ||
|
|
b17e4f79fb |
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -848,18 +849,15 @@ namespace ARMeilleure.Translation.PTC
|
||||
}
|
||||
}
|
||||
|
||||
List<Thread> threads = new();
|
||||
|
||||
for (int i = 0; i < degreeOfParallelism; i++)
|
||||
{
|
||||
Thread thread = new(TranslateFuncs)
|
||||
List<Thread> threads = Enumerable.Range(0, degreeOfParallelism)
|
||||
.Select(idx =>
|
||||
new Thread(TranslateFuncs)
|
||||
{
|
||||
IsBackground = true,
|
||||
Name = "Ptc.TranslateThread." + i
|
||||
};
|
||||
|
||||
threads.Add(thread);
|
||||
Name = "Ptc.TranslateThread." + idx
|
||||
}
|
||||
).ToList();
|
||||
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace Ryujinx.Common.Logging.Targets
|
||||
string ILogTarget.Name { get => _target.Name; }
|
||||
|
||||
public AsyncLogTargetWrapper(ILogTarget target)
|
||||
: this(target, -1, AsyncLogTargetOverflowAction.Block)
|
||||
: this(target, -1)
|
||||
{ }
|
||||
|
||||
public AsyncLogTargetWrapper(ILogTarget target, int queueLimit, AsyncLogTargetOverflowAction overflowAction)
|
||||
public AsyncLogTargetWrapper(ILogTarget target, int queueLimit = -1, AsyncLogTargetOverflowAction overflowAction = AsyncLogTargetOverflowAction.Block)
|
||||
{
|
||||
_target = target;
|
||||
_messageQueue = new BlockingCollection<LogEventArgs>(queueLimit);
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager
|
||||
public uint FileVersion { get; set; }
|
||||
public byte[] TagUuid { get; set; }
|
||||
public string AmiiboId { get; set; }
|
||||
public string NickName { get; set; }
|
||||
public DateTime FirstWriteDate { get; set; }
|
||||
public DateTime LastWriteDate { get; set; }
|
||||
public ushort WriteCounter { get; set; }
|
||||
|
||||
@@ -64,16 +64,17 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
||||
};
|
||||
}
|
||||
|
||||
public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string nickname)
|
||||
public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string userName)
|
||||
{
|
||||
VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);
|
||||
|
||||
string nickname = amiiboFile.NickName ?? "Ryujinx";
|
||||
UtilityImpl utilityImpl = new(tickSource);
|
||||
CharInfo charInfo = new();
|
||||
|
||||
charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));
|
||||
|
||||
charInfo.Nickname = Nickname.FromString(nickname);
|
||||
// This is the player's name
|
||||
charInfo.Nickname = Nickname.FromString(userName);
|
||||
|
||||
RegisterInfo registerInfo = new()
|
||||
{
|
||||
@@ -85,7 +86,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
||||
Reserved1 = new Array64<byte>(),
|
||||
Reserved2 = new Array58<byte>(),
|
||||
};
|
||||
"Ryujinx"u8.CopyTo(registerInfo.Nickname.AsSpan());
|
||||
// This is the amiibo's name
|
||||
byte[] nicknameBytes = System.Text.Encoding.UTF8.GetBytes(nickname);
|
||||
nicknameBytes.CopyTo(registerInfo.Nickname.AsSpan());
|
||||
|
||||
return registerInfo;
|
||||
}
|
||||
|
||||
@@ -117,8 +117,9 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursorMode hideCursorMode)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode)
|
||||
HideCursorMode hideCursorMode,
|
||||
bool ignoreControllerApplet)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode, ignoreControllerApplet)
|
||||
{
|
||||
_glLogLevel = glLogLevel;
|
||||
}
|
||||
|
||||
@@ -226,6 +226,9 @@ namespace Ryujinx.Headless.SDL2
|
||||
[Option("ignore-missing-services", Required = false, Default = false, HelpText = "Enable ignoring missing services.")]
|
||||
public bool IgnoreMissingServices { get; set; }
|
||||
|
||||
[Option("ignore-controller-applet", Required = false, Default = false, HelpText = "Enable ignoring the controller applet when your game loses connection to your controller.")]
|
||||
public bool IgnoreControllerApplet { get; set; }
|
||||
|
||||
// Values
|
||||
|
||||
[Value(0, MetaName = "input", HelpText = "Input to load.", Required = true)]
|
||||
|
||||
@@ -444,8 +444,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||
new FileLogTarget("file", logFile),
|
||||
1000,
|
||||
AsyncLogTargetOverflowAction.Block
|
||||
1000
|
||||
));
|
||||
}
|
||||
else
|
||||
@@ -506,8 +505,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
private static WindowBase CreateWindow(Options options)
|
||||
{
|
||||
return options.GraphicsBackend == GraphicsBackend.Vulkan
|
||||
? new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode)
|
||||
: new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode);
|
||||
? new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode, options.IgnoreControllerApplet)
|
||||
: new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode, options.IgnoreControllerApplet);
|
||||
}
|
||||
|
||||
private static IRenderer CreateRenderer(Options options, WindowBase window)
|
||||
|
||||
@@ -17,8 +17,9 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursorMode hideCursorMode)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode)
|
||||
HideCursorMode hideCursorMode,
|
||||
bool ignoreControllerApplet)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode, ignoreControllerApplet)
|
||||
{
|
||||
_glLogLevel = glLogLevel;
|
||||
}
|
||||
|
||||
@@ -86,13 +86,15 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
private readonly AspectRatio _aspectRatio;
|
||||
private readonly bool _enableMouse;
|
||||
private readonly bool _ignoreControllerApplet;
|
||||
|
||||
public WindowBase(
|
||||
InputManager inputManager,
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursorMode hideCursorMode)
|
||||
HideCursorMode hideCursorMode,
|
||||
bool ignoreControllerApplet)
|
||||
{
|
||||
MouseDriver = new SDL2MouseDriver(hideCursorMode);
|
||||
_inputManager = inputManager;
|
||||
@@ -108,6 +110,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
_gpuDoneEvent = new ManualResetEvent(false);
|
||||
_aspectRatio = aspectRatio;
|
||||
_enableMouse = enableMouse;
|
||||
_ignoreControllerApplet = ignoreControllerApplet;
|
||||
HostUITheme = new HeadlessHostUiTheme();
|
||||
|
||||
SDL2Driver.Instance.Initialize();
|
||||
@@ -484,6 +487,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public bool DisplayMessageDialog(ControllerAppletUIArgs args)
|
||||
{
|
||||
if (_ignoreControllerApplet) return false;
|
||||
|
||||
string playerCount = args.PlayerCountMin == args.PlayerCountMax ? $"exactly {args.PlayerCountMin}" : $"{args.PlayerCountMin}-{args.PlayerCountMax}";
|
||||
|
||||
string message = $"Application requests {playerCount} {"player".ToQuantity(args.PlayerCountMin + args.PlayerCountMax, ShowQuantityAs.None)} with:\n\n"
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"AvatarSetBackgroundColor": "Set Background Color",
|
||||
"AvatarClose": "Close",
|
||||
"ControllerSettingsLoadProfileToolTip": "Load Profile",
|
||||
"ControllerSettingsViewProfileToolTip": "View Profile",
|
||||
"ControllerSettingsAddProfileToolTip": "Add Profile",
|
||||
"ControllerSettingsRemoveProfileToolTip": "Remove Profile",
|
||||
"ControllerSettingsSaveProfileToolTip": "Save Profile",
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Ryujinx.Ava
|
||||
{
|
||||
internal partial class Program
|
||||
{
|
||||
//
|
||||
public static double WindowScaleFactor { get; set; }
|
||||
public static double DesktopScaleFactor { get; set; } = 1.0;
|
||||
public static string Version { get; private set; }
|
||||
|
||||
@@ -226,6 +226,24 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
(int)Symbol.Help,
|
||||
primaryButtonResult);
|
||||
|
||||
internal static async Task<UserResult> CreateConfirmationDialogExtended(
|
||||
string primaryText,
|
||||
string secondaryText,
|
||||
string acceptButtonText,
|
||||
string noacceptButtonText,
|
||||
string cancelButtonText,
|
||||
string title,
|
||||
UserResult primaryButtonResult = UserResult.Yes)
|
||||
=> await ShowTextDialog(
|
||||
string.IsNullOrWhiteSpace(title) ? LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle] : title,
|
||||
primaryText,
|
||||
secondaryText,
|
||||
acceptButtonText,
|
||||
noacceptButtonText,
|
||||
cancelButtonText,
|
||||
(int)Symbol.Help,
|
||||
primaryButtonResult);
|
||||
|
||||
internal static async Task<UserResult> CreateLocalizedConfirmationDialog(string primaryText, string secondaryText)
|
||||
=> await CreateConfirmationDialog(
|
||||
primaryText,
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
private readonly MainWindow _mainWindow;
|
||||
|
||||
private PlayerIndex _playerId;
|
||||
private PlayerIndex _playerIdChoose;
|
||||
private int _controller;
|
||||
private string _controllerImage;
|
||||
private int _device;
|
||||
@@ -83,6 +84,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerIndex PlayerIdChoose
|
||||
{
|
||||
get => _playerIdChoose;
|
||||
set { }
|
||||
}
|
||||
|
||||
public PlayerIndex PlayerId
|
||||
{
|
||||
get => _playerId;
|
||||
@@ -90,6 +97,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
{
|
||||
if (IsModified)
|
||||
{
|
||||
|
||||
_playerIdChoose = value;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +108,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
if (!Enum.IsDefined(typeof(PlayerIndex), _playerId))
|
||||
{
|
||||
_playerId = PlayerIndex.Player1;
|
||||
|
||||
}
|
||||
_isLoaded = false;
|
||||
|
||||
LoadConfiguration();
|
||||
LoadDevice();
|
||||
|
||||
@@ -4,11 +4,14 @@ using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.LogicalTree;
|
||||
using DiscordRPC;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.ViewModels.Input;
|
||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Input;
|
||||
using Ryujinx.Input.Assigner;
|
||||
using System;
|
||||
using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Views.Input
|
||||
@@ -27,6 +30,16 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
{
|
||||
button.IsCheckedChanged += Button_IsCheckedChanged;
|
||||
}
|
||||
|
||||
if (visual is CheckBox check)
|
||||
{
|
||||
check.IsCheckedChanged += CheckBox_IsCheckedChanged;
|
||||
}
|
||||
|
||||
if (visual is Slider slider)
|
||||
{
|
||||
slider.PropertyChanged += Slider_IsCheckedChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +53,48 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
}
|
||||
}
|
||||
|
||||
private float _changeSlider = -1.0f;
|
||||
|
||||
private void Slider_IsCheckedChanged(object sender, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
if (sender is Slider check)
|
||||
{
|
||||
if ((bool)check.IsPointerOver && _changeSlider == -1.0f)
|
||||
{
|
||||
_changeSlider = (float)check.Value;
|
||||
|
||||
}
|
||||
else if (!(bool)check.IsPointerOver)
|
||||
{
|
||||
_changeSlider = -1.0f;
|
||||
}
|
||||
|
||||
if (_changeSlider != -1.0f && _changeSlider != (float)check.Value)
|
||||
{
|
||||
|
||||
var viewModel = (DataContext as ControllerInputViewModel);
|
||||
viewModel.ParentModel.IsModified = true;
|
||||
_changeSlider = (float)check.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckBox_IsCheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is CheckBox check)
|
||||
{
|
||||
if ((bool)check.IsPointerOver)
|
||||
{
|
||||
|
||||
var viewModel = (DataContext as ControllerInputViewModel);
|
||||
viewModel.ParentModel.IsModified = true;
|
||||
_currentAssigner?.Cancel();
|
||||
_currentAssigner = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ToggleButton button )
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
ToolTip.Tip="{ext:Locale ControllerSettingsLoadProfileToolTip}"
|
||||
Command="{Binding LoadProfile}">
|
||||
<ui:SymbolIcon
|
||||
Symbol="Upload"
|
||||
Symbol="View"
|
||||
FontSize="15"
|
||||
Height="20" />
|
||||
</Button>
|
||||
|
||||
@@ -25,17 +25,27 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
|
||||
private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (PlayerIndexBox != null)
|
||||
{
|
||||
if (PlayerIndexBox.SelectedIndex != (int)ViewModel.PlayerId)
|
||||
{
|
||||
PlayerIndexBox.SelectedIndex = (int)ViewModel.PlayerId;
|
||||
}
|
||||
}
|
||||
|
||||
if (ViewModel.IsModified && !_dialogOpen)
|
||||
{
|
||||
_dialogOpen = true;
|
||||
|
||||
var result = await ContentDialogHelper.CreateConfirmationDialog(
|
||||
var result = await ContentDialogHelper.CreateConfirmationDialogExtended(
|
||||
LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
|
||||
LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
||||
LocaleManager.Instance[LocaleKeys.Cancel],
|
||||
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
|
||||
|
||||
|
||||
if (result == UserResult.Yes)
|
||||
{
|
||||
ViewModel.Save();
|
||||
@@ -43,16 +53,32 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
|
||||
_dialogOpen = false;
|
||||
|
||||
if (result == UserResult.Cancel)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ViewModel.IsModified = false;
|
||||
|
||||
if (result != UserResult.Cancel)
|
||||
{
|
||||
ViewModel.PlayerId = ViewModel.PlayerIdChoose;
|
||||
}
|
||||
|
||||
if (result == UserResult.Cancel)
|
||||
{
|
||||
if (e.AddedItems.Count > 0)
|
||||
{
|
||||
ViewModel.IsModified = true;
|
||||
var player = (PlayerModel)e.AddedItems[0];
|
||||
ViewModel.PlayerId = player.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ViewModel.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user