Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bf713a80d6 | |||
| b38b5a1e70 | |||
| 2d7700949c | |||
| ea2287af03 | |||
| 37af8c70aa | |||
| 50cee3fd19 | |||
| a46aacf2e2 | |||
| ad9d6588e8 | |||
| 38ef65aae0 | |||
| 9f94aa1c79 | |||
| 2c9a26c11c | |||
| a4a15a4c80 | |||
| cc3b95eee1 | |||
| 2ab806f759 |
@@ -2483,7 +2483,7 @@
|
|||||||
0100A5200C2E0000,"Safety First!",,playable,2021-01-06 09:05:23
|
0100A5200C2E0000,"Safety First!",,playable,2021-01-06 09:05:23
|
||||||
0100A51013530000,"SaGa Frontier Remastered",nvdec,playable,2022-11-03 13:54:56
|
0100A51013530000,"SaGa Frontier Remastered",nvdec,playable,2022-11-03 13:54:56
|
||||||
010003A00D0B4000,"SaGa SCARLET GRACE: AMBITIONS™",,playable,2022-10-06 13:20:31
|
010003A00D0B4000,"SaGa SCARLET GRACE: AMBITIONS™",,playable,2022-10-06 13:20:31
|
||||||
01008D100D43E000,"Saints Row IV®: Re-Elected™",ldn-untested;LAN,playable,2023-12-04 18:33:37
|
01008D100D43E000,"Saints Row IV®: Re-Elected™",ldn-untested;LAN;deadlock,ingame,2025-02-02 16:57:53
|
||||||
0100DE600BEEE000,"SAINTS ROW®: THE THIRD™ - THE FULL PACKAGE",slow;LAN,playable,2023-08-24 02:40:58
|
0100DE600BEEE000,"SAINTS ROW®: THE THIRD™ - THE FULL PACKAGE",slow;LAN,playable,2023-08-24 02:40:58
|
||||||
01007F000EB36000,"Sakai and...",nvdec,playable,2022-12-15 13:53:19
|
01007F000EB36000,"Sakai and...",nvdec,playable,2022-12-15 13:53:19
|
||||||
0100B1400E8FE000,"Sakuna: Of Rice and Ruin",,playable,2023-07-24 13:47:13
|
0100B1400E8FE000,"Sakuna: Of Rice and Ruin",,playable,2023-07-24 13:47:13
|
||||||
|
|||||||
|
@@ -0,0 +1,118 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Ryujinx.Common.Helper
|
||||||
|
{
|
||||||
|
public static partial class Patterns
|
||||||
|
{
|
||||||
|
#region Accessors
|
||||||
|
|
||||||
|
public static readonly Regex Numeric = NumericRegex();
|
||||||
|
|
||||||
|
public static readonly Regex AmdGcn = AmdGcnRegex();
|
||||||
|
public static readonly Regex NvidiaConsumerClass = NvidiaConsumerClassRegex();
|
||||||
|
|
||||||
|
public static readonly Regex DomainLp1Ns = DomainLp1NsRegex();
|
||||||
|
public static readonly Regex DomainLp1Lp1Npln = DomainLp1Lp1NplnRegex();
|
||||||
|
public static readonly Regex DomainLp1Znc = DomainLp1ZncRegex();
|
||||||
|
public static readonly Regex DomainSbApi = DomainSbApiRegex();
|
||||||
|
public static readonly Regex DomainSbAccounts = DomainSbAccountsRegex();
|
||||||
|
public static readonly Regex DomainAccounts = DomainAccountsRegex();
|
||||||
|
|
||||||
|
public static readonly Regex Module = ModuleRegex();
|
||||||
|
public static readonly Regex FsSdk = FsSdkRegex();
|
||||||
|
public static readonly Regex SdkMw = SdkMwRegex();
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
public static readonly Regex CJK = CJKRegex();
|
||||||
|
|
||||||
|
public static readonly Regex LdnPassphrase = LdnPassphraseRegex();
|
||||||
|
|
||||||
|
public static readonly Regex CleanText = CleanTextRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Generated pattern stubs
|
||||||
|
|
||||||
|
#region Numeric validation
|
||||||
|
|
||||||
|
[GeneratedRegex("[0-9]|.")]
|
||||||
|
internal static partial Regex NumericRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GPU names
|
||||||
|
|
||||||
|
[GeneratedRegex(
|
||||||
|
"Radeon (((HD|R(5|7|9|X)) )?((M?[2-6]\\d{2}(\\D|$))|([7-8]\\d{3}(\\D|$))|Fury|Nano))|(Pro Duo)")]
|
||||||
|
internal static partial Regex AmdGcnRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex("NVIDIA GeForce (R|G)?TX? (\\d{3}\\d?)M?")]
|
||||||
|
internal static partial Regex NvidiaConsumerClassRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DNS blocking
|
||||||
|
|
||||||
|
public static readonly Regex[] BlockedHosts =
|
||||||
|
[
|
||||||
|
DomainLp1Ns,
|
||||||
|
DomainLp1Lp1Npln,
|
||||||
|
DomainLp1Znc,
|
||||||
|
DomainSbApi,
|
||||||
|
DomainSbAccounts,
|
||||||
|
DomainAccounts
|
||||||
|
];
|
||||||
|
|
||||||
|
const RegexOptions DnsRegexOpts =
|
||||||
|
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^(.*)\-lp1\.(n|s)\.n\.srv\.nintendo\.net$", DnsRegexOpts)]
|
||||||
|
internal static partial Regex DomainLp1NsRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^(.*)\-lp1\.lp1\.t\.npln\.srv\.nintendo\.net$", DnsRegexOpts)]
|
||||||
|
internal static partial Regex DomainLp1Lp1NplnRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^(.*)\-lp1\.(znc|p)\.srv\.nintendo\.net$", DnsRegexOpts)]
|
||||||
|
internal static partial Regex DomainLp1ZncRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^(.*)\-sb\-api\.accounts\.nintendo\.com$", DnsRegexOpts)]
|
||||||
|
internal static partial Regex DomainSbApiRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^(.*)\-sb\.accounts\.nintendo\.com$", DnsRegexOpts)]
|
||||||
|
internal static partial Regex DomainSbAccountsRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^accounts\.nintendo\.com$", DnsRegexOpts)]
|
||||||
|
internal static partial Regex DomainAccountsRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Executable information
|
||||||
|
|
||||||
|
[GeneratedRegex(@"[a-z]:[\\/][ -~]{5,}\.nss", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)]
|
||||||
|
internal static partial Regex ModuleRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"sdk_version: ([0-9.]*)")]
|
||||||
|
internal static partial Regex FsSdkRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"SDK MW[ -~]*")]
|
||||||
|
internal static partial Regex SdkMwRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region CJK
|
||||||
|
|
||||||
|
[GeneratedRegex(
|
||||||
|
"\\p{IsHangulJamo}|\\p{IsCJKRadicalsSupplement}|\\p{IsCJKSymbolsandPunctuation}|\\p{IsEnclosedCJKLettersandMonths}|\\p{IsCJKCompatibility}|\\p{IsCJKUnifiedIdeographsExtensionA}|\\p{IsCJKUnifiedIdeographs}|\\p{IsHangulSyllables}|\\p{IsCJKCompatibilityForms}")]
|
||||||
|
private static partial Regex CJKRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[GeneratedRegex("Ryujinx-[0-9a-f]{8}")]
|
||||||
|
private static partial Regex LdnPassphraseRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"[^\u0000\u0009\u000A\u000D\u0020-\uFFFF]..")]
|
||||||
|
private static partial Regex CleanTextRegex();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
using Gommon;
|
||||||
|
using MsgPack;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Ryujinx.Common.Helper
|
||||||
|
{
|
||||||
|
public class PlayReportAnalyzer
|
||||||
|
{
|
||||||
|
private readonly List<PlayReportGameSpec> _specs = [];
|
||||||
|
|
||||||
|
public PlayReportAnalyzer AddSpec(string titleId, Func<PlayReportGameSpec, PlayReportGameSpec> transform)
|
||||||
|
{
|
||||||
|
_specs.Add(transform(new PlayReportGameSpec { TitleIdStr = titleId }));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayReportAnalyzer AddSpec(string titleId, Action<PlayReportGameSpec> transform)
|
||||||
|
{
|
||||||
|
_specs.Add(new PlayReportGameSpec { TitleIdStr = titleId }.Apply(transform));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<string> Run(string runningGameId, MessagePackObject playReport)
|
||||||
|
{
|
||||||
|
if (!playReport.IsDictionary)
|
||||||
|
return Optional<string>.None;
|
||||||
|
|
||||||
|
if (!_specs.TryGetFirst(s => s.TitleIdStr.EqualsIgnoreCase(runningGameId), out PlayReportGameSpec spec))
|
||||||
|
return Optional<string>.None;
|
||||||
|
|
||||||
|
foreach (PlayReportValueFormatterSpec formatSpec in spec.Analyses.OrderBy(x => x.Priority))
|
||||||
|
{
|
||||||
|
if (!playReport.AsDictionary().TryGetValue(formatSpec.ReportKey, out MessagePackObject valuePackObject))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return formatSpec.ValueFormatter(valuePackObject.ToObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Optional<string>.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PlayReportGameSpec
|
||||||
|
{
|
||||||
|
public required string TitleIdStr { get; init; }
|
||||||
|
public List<PlayReportValueFormatterSpec> Analyses { get; } = [];
|
||||||
|
|
||||||
|
public PlayReportGameSpec AddValueFormatter(string reportKey, Func<object, string> valueFormatter)
|
||||||
|
{
|
||||||
|
Analyses.Add(new PlayReportValueFormatterSpec
|
||||||
|
{
|
||||||
|
Priority = Analyses.Count,
|
||||||
|
ReportKey = reportKey,
|
||||||
|
ValueFormatter = valueFormatter
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayReportGameSpec AddValueFormatter(int priority, string reportKey, Func<object, string> valueFormatter)
|
||||||
|
{
|
||||||
|
Analyses.Add(new PlayReportValueFormatterSpec
|
||||||
|
{
|
||||||
|
Priority = priority,
|
||||||
|
ReportKey = reportKey,
|
||||||
|
ValueFormatter = valueFormatter
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct PlayReportValueFormatterSpec
|
||||||
|
{
|
||||||
|
public required int Priority { get; init; }
|
||||||
|
public required string ReportKey { get; init; }
|
||||||
|
public required Func<object, string> ValueFormatter { get; init; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,14 +10,18 @@ namespace Ryujinx.Common.Helper
|
|||||||
public static bool IsMacOS => OperatingSystem.IsMacOS();
|
public static bool IsMacOS => OperatingSystem.IsMacOS();
|
||||||
public static bool IsWindows => OperatingSystem.IsWindows();
|
public static bool IsWindows => OperatingSystem.IsWindows();
|
||||||
public static bool IsLinux => OperatingSystem.IsLinux();
|
public static bool IsLinux => OperatingSystem.IsLinux();
|
||||||
|
|
||||||
|
public static bool IsArm => RuntimeInformation.OSArchitecture is Architecture.Arm64;
|
||||||
|
|
||||||
|
public static bool IsX64 => RuntimeInformation.OSArchitecture is Architecture.X64;
|
||||||
|
|
||||||
public static bool IsIntelMac => IsMacOS && RuntimeInformation.OSArchitecture is Architecture.X64;
|
public static bool IsIntelMac => IsMacOS && IsX64;
|
||||||
public static bool IsArmMac => IsMacOS && RuntimeInformation.OSArchitecture is Architecture.Arm64;
|
public static bool IsArmMac => IsMacOS && IsArm;
|
||||||
|
|
||||||
public static bool IsX64Windows => IsWindows && (RuntimeInformation.OSArchitecture is Architecture.X64);
|
public static bool IsX64Windows => IsWindows && IsX64;
|
||||||
public static bool IsArmWindows => IsWindows && (RuntimeInformation.OSArchitecture is Architecture.Arm64);
|
public static bool IsArmWindows => IsWindows && IsArm;
|
||||||
|
|
||||||
public static bool IsX64Linux => IsLinux && (RuntimeInformation.OSArchitecture is Architecture.X64);
|
public static bool IsX64Linux => IsLinux && IsX64;
|
||||||
public static bool IsArmLinux => IsLinux && (RuntimeInformation.OSArchitecture is Architecture.Arm64);
|
public static bool IsArmLinux => IsLinux && IsArmMac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
|
|||||||
}
|
}
|
||||||
|
|
||||||
using ManualResetEvent waitEvent = new(false);
|
using ManualResetEvent waitEvent = new(false);
|
||||||
SyncpointWaiterHandle info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set());
|
SyncpointWaiterHandle info = _syncpoints[id].RegisterCallback(threshold, _ => waitEvent.Set());
|
||||||
|
|
||||||
if (info == null)
|
if (info == null)
|
||||||
{
|
{
|
||||||
@@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
|
|||||||
|
|
||||||
bool signaled = waitEvent.WaitOne(timeout);
|
bool signaled = waitEvent.WaitOne(timeout);
|
||||||
|
|
||||||
if (!signaled && info != null)
|
if (!signaled)
|
||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Gpu, $"Wait on syncpoint {id} for threshold {threshold} took more than {timeout.TotalMilliseconds}ms, resuming execution...");
|
Logger.Error?.Print(LogClass.Gpu, $"Wait on syncpoint {id} for threshold {threshold} took more than {timeout.TotalMilliseconds}ms, resuming execution...");
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
static partial class VendorUtils
|
static class VendorUtils
|
||||||
{
|
{
|
||||||
[GeneratedRegex("Radeon (((HD|R(5|7|9|X)) )?((M?[2-6]\\d{2}(\\D|$))|([7-8]\\d{3}(\\D|$))|Fury|Nano))|(Pro Duo)")]
|
|
||||||
public static partial Regex AmdGcnRegex();
|
|
||||||
|
|
||||||
[GeneratedRegex("NVIDIA GeForce (R|G)?TX? (\\d{3}\\d?)M?")]
|
|
||||||
public static partial Regex NvidiaConsumerClassRegex();
|
|
||||||
|
|
||||||
public static Vendor FromId(uint id)
|
public static Vendor FromId(uint id)
|
||||||
{
|
{
|
||||||
return id switch
|
return id switch
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Gommon;
|
using Gommon;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
|
using Ryujinx.Common.Helper;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Shader;
|
using Ryujinx.Graphics.Shader;
|
||||||
@@ -375,11 +376,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
GpuVersion = $"Vulkan v{ParseStandardVulkanVersion(properties.ApiVersion)}, Driver v{ParseDriverVersion(ref properties)}";
|
GpuVersion = $"Vulkan v{ParseStandardVulkanVersion(properties.ApiVersion)}, Driver v{ParseDriverVersion(ref properties)}";
|
||||||
|
|
||||||
IsAmdGcn = !IsMoltenVk && Vendor == Vendor.Amd && VendorUtils.AmdGcnRegex().IsMatch(GpuRenderer);
|
IsAmdGcn = !IsMoltenVk && Vendor == Vendor.Amd && Patterns.AmdGcn.IsMatch(GpuRenderer);
|
||||||
|
|
||||||
if (Vendor == Vendor.Nvidia)
|
if (Vendor == Vendor.Nvidia)
|
||||||
{
|
{
|
||||||
Match match = VendorUtils.NvidiaConsumerClassRegex().Match(GpuRenderer);
|
Match match = Patterns.NvidiaConsumerClass.Match(GpuRenderer);
|
||||||
|
|
||||||
if (match != null && int.TryParse(match.Groups[2].Value, out int gpuNumber))
|
if (match != null && int.TryParse(match.Groups[2].Value, out int gpuNumber))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using LibHac.FsSystem;
|
|||||||
using LibHac.Ncm;
|
using LibHac.Ncm;
|
||||||
using LibHac.Tools.FsSystem;
|
using LibHac.Tools.FsSystem;
|
||||||
using LibHac.Tools.FsSystem.NcaUtils;
|
using LibHac.Tools.FsSystem.NcaUtils;
|
||||||
|
using Ryujinx.Common.Helper;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
@@ -30,9 +31,6 @@ namespace Ryujinx.HLE.HOS.Applets.Error
|
|||||||
|
|
||||||
public event EventHandler AppletStateChanged;
|
public event EventHandler AppletStateChanged;
|
||||||
|
|
||||||
[GeneratedRegex(@"[^\u0000\u0009\u000A\u000D\u0020-\uFFFF]..")]
|
|
||||||
private static partial Regex CleanTextRegex();
|
|
||||||
|
|
||||||
public ErrorApplet(Horizon horizon)
|
public ErrorApplet(Horizon horizon)
|
||||||
{
|
{
|
||||||
_horizon = horizon;
|
_horizon = horizon;
|
||||||
@@ -107,7 +105,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
|
|||||||
|
|
||||||
private static string CleanText(string value)
|
private static string CleanText(string value)
|
||||||
{
|
{
|
||||||
return CleanTextRegex().Replace(value, string.Empty).Replace("\0", string.Empty);
|
return Patterns.CleanText.Replace(value, string.Empty).Replace("\0", string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetMessageText(uint module, uint description, string key)
|
private string GetMessageText(uint module, uint description, string key)
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|
||||||
{
|
|
||||||
public static partial class CJKCharacterValidation
|
|
||||||
{
|
|
||||||
public static bool IsCJK(char value)
|
|
||||||
{
|
|
||||||
Regex regex = CJKRegex();
|
|
||||||
|
|
||||||
return regex.IsMatch(value.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
[GeneratedRegex("\\p{IsHangulJamo}|\\p{IsCJKRadicalsSupplement}|\\p{IsCJKSymbolsandPunctuation}|\\p{IsEnclosedCJKLettersandMonths}|\\p{IsCJKCompatibility}|\\p{IsCJKUnifiedIdeographsExtensionA}|\\p{IsCJKUnifiedIdeographs}|\\p{IsHangulSyllables}|\\p{IsCJKCompatibilityForms}")]
|
|
||||||
private static partial Regex CJKRegex();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Ryujinx.Common.Helper;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
|
{
|
||||||
|
public static class CharacterValidation
|
||||||
|
{
|
||||||
|
public static bool IsNumeric(char value) => Patterns.Numeric.IsMatch(value.ToString());
|
||||||
|
public static bool IsCJK(char value) => Patterns.CJK.IsMatch(value.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|
||||||
{
|
|
||||||
public static partial class NumericCharacterValidation
|
|
||||||
{
|
|
||||||
public static bool IsNumeric(char value)
|
|
||||||
{
|
|
||||||
Regex regex = NumericRegex();
|
|
||||||
|
|
||||||
return regex.IsMatch(value.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
[GeneratedRegex("[0-9]|.")]
|
|
||||||
private static partial Regex NumericRegex();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +1,13 @@
|
|||||||
|
using Ryujinx.Common.Helper;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
|
namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
|
||||||
{
|
{
|
||||||
static partial class DnsBlacklist
|
static class DnsBlacklist
|
||||||
{
|
{
|
||||||
const RegexOptions RegexOpts = RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
|
|
||||||
|
|
||||||
[GeneratedRegex(@"^(.*)\-lp1\.(n|s)\.n\.srv\.nintendo\.net$", RegexOpts)]
|
|
||||||
private static partial Regex BlockedHost1();
|
|
||||||
[GeneratedRegex(@"^(.*)\-lp1\.lp1\.t\.npln\.srv\.nintendo\.net$", RegexOpts)]
|
|
||||||
private static partial Regex BlockedHost2();
|
|
||||||
[GeneratedRegex(@"^(.*)\-lp1\.(znc|p)\.srv\.nintendo\.net$", RegexOpts)]
|
|
||||||
private static partial Regex BlockedHost3();
|
|
||||||
[GeneratedRegex(@"^(.*)\-sb\-api\.accounts\.nintendo\.com$", RegexOpts)]
|
|
||||||
private static partial Regex BlockedHost4();
|
|
||||||
[GeneratedRegex(@"^(.*)\-sb\.accounts\.nintendo\.com$", RegexOpts)]
|
|
||||||
private static partial Regex BlockedHost5();
|
|
||||||
[GeneratedRegex(@"^accounts\.nintendo\.com$", RegexOpts)]
|
|
||||||
private static partial Regex BlockedHost6();
|
|
||||||
|
|
||||||
private static readonly Regex[] _blockedHosts =
|
|
||||||
[
|
|
||||||
BlockedHost1(),
|
|
||||||
BlockedHost2(),
|
|
||||||
BlockedHost3(),
|
|
||||||
BlockedHost4(),
|
|
||||||
BlockedHost5(),
|
|
||||||
BlockedHost6()
|
|
||||||
];
|
|
||||||
|
|
||||||
public static bool IsHostBlocked(string host)
|
public static bool IsHostBlocked(string host)
|
||||||
{
|
{
|
||||||
foreach (Regex regex in _blockedHosts)
|
foreach (Regex regex in Patterns.BlockedHosts)
|
||||||
{
|
{
|
||||||
if (regex.IsMatch(host))
|
if (regex.IsMatch(host))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using LibHac.Common.FixedArrays;
|
|||||||
using LibHac.Fs;
|
using LibHac.Fs;
|
||||||
using LibHac.Loader;
|
using LibHac.Loader;
|
||||||
using LibHac.Tools.FsSystem;
|
using LibHac.Tools.FsSystem;
|
||||||
|
using Ryujinx.Common.Helper;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -29,13 +30,6 @@ namespace Ryujinx.HLE.Loaders.Executables
|
|||||||
public string Name;
|
public string Name;
|
||||||
public Array32<byte> BuildId;
|
public Array32<byte> BuildId;
|
||||||
|
|
||||||
[GeneratedRegex(@"[a-z]:[\\/][ -~]{5,}\.nss", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)]
|
|
||||||
private static partial Regex ModuleRegex();
|
|
||||||
[GeneratedRegex(@"sdk_version: ([0-9.]*)")]
|
|
||||||
private static partial Regex FsSdkRegex();
|
|
||||||
[GeneratedRegex(@"SDK MW[ -~]*")]
|
|
||||||
private static partial Regex SdkMwRegex();
|
|
||||||
|
|
||||||
public NsoExecutable(IStorage inStorage, string name = null)
|
public NsoExecutable(IStorage inStorage, string name = null)
|
||||||
{
|
{
|
||||||
NsoReader reader = new();
|
NsoReader reader = new();
|
||||||
@@ -90,7 +84,7 @@ namespace Ryujinx.HLE.Loaders.Executables
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(modulePath))
|
if (string.IsNullOrEmpty(modulePath))
|
||||||
{
|
{
|
||||||
Match moduleMatch = ModuleRegex().Match(rawTextBuffer);
|
Match moduleMatch = Patterns.Module.Match(rawTextBuffer);
|
||||||
if (moduleMatch.Success)
|
if (moduleMatch.Success)
|
||||||
{
|
{
|
||||||
modulePath = moduleMatch.Value;
|
modulePath = moduleMatch.Value;
|
||||||
@@ -99,13 +93,13 @@ namespace Ryujinx.HLE.Loaders.Executables
|
|||||||
|
|
||||||
stringBuilder.AppendLine($" Module: {modulePath}");
|
stringBuilder.AppendLine($" Module: {modulePath}");
|
||||||
|
|
||||||
Match fsSdkMatch = FsSdkRegex().Match(rawTextBuffer);
|
Match fsSdkMatch = Patterns.FsSdk.Match(rawTextBuffer);
|
||||||
if (fsSdkMatch.Success)
|
if (fsSdkMatch.Success)
|
||||||
{
|
{
|
||||||
stringBuilder.AppendLine($" FS SDK Version: {fsSdkMatch.Value.Replace("sdk_version: ", string.Empty)}");
|
stringBuilder.AppendLine($" FS SDK Version: {fsSdkMatch.Value.Replace("sdk_version: ", string.Empty)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
MatchCollection sdkMwMatches = SdkMwRegex().Matches(rawTextBuffer);
|
MatchCollection sdkMwMatches = Patterns.SdkMw.Matches(rawTextBuffer);
|
||||||
if (sdkMwMatches.Count != 0)
|
if (sdkMwMatches.Count != 0)
|
||||||
{
|
{
|
||||||
string libHeader = " SDK Libraries: ";
|
string libHeader = " SDK Libraries: ";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using MsgPack;
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
@@ -6,6 +7,10 @@ namespace Ryujinx.Horizon
|
|||||||
{
|
{
|
||||||
public static class HorizonStatic
|
public static class HorizonStatic
|
||||||
{
|
{
|
||||||
|
internal static void HandlePlayReport(MessagePackObject report) => PlayReportPrinted?.Invoke(report);
|
||||||
|
|
||||||
|
public static event Action<MessagePackObject> PlayReportPrinted;
|
||||||
|
|
||||||
[ThreadStatic]
|
[ThreadStatic]
|
||||||
private static HorizonOptions _options;
|
private static HorizonOptions _options;
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
|||||||
|
|
||||||
builder.AppendLine($" Room: {gameRoom}");
|
builder.AppendLine($" Room: {gameRoom}");
|
||||||
builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}");
|
builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}");
|
||||||
|
|
||||||
|
HorizonStatic.HandlePlayReport(deserializedReport);
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString());
|
Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString());
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Ryujinx.Common.Logging;
|
|
||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -37,7 +36,6 @@ namespace Ryujinx.Input.SDL2
|
|||||||
SDL2Driver.Instance.Initialize();
|
SDL2Driver.Instance.Initialize();
|
||||||
SDL2Driver.Instance.OnJoyStickConnected += HandleJoyStickConnected;
|
SDL2Driver.Instance.OnJoyStickConnected += HandleJoyStickConnected;
|
||||||
SDL2Driver.Instance.OnJoystickDisconnected += HandleJoyStickDisconnected;
|
SDL2Driver.Instance.OnJoystickDisconnected += HandleJoyStickDisconnected;
|
||||||
SDL2Driver.Instance.OnJoyBatteryUpdated += HandleJoyBatteryUpdated;
|
|
||||||
|
|
||||||
// Add already connected gamepads
|
// Add already connected gamepads
|
||||||
int numJoysticks = SDL_NumJoysticks();
|
int numJoysticks = SDL_NumJoysticks();
|
||||||
@@ -85,30 +83,19 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
private void HandleJoyStickDisconnected(int joystickInstanceId)
|
private void HandleJoyStickDisconnected(int joystickInstanceId)
|
||||||
{
|
{
|
||||||
bool joyConPairDisconnected = false;
|
|
||||||
if (!_gamepadsInstanceIdsMapping.Remove(joystickInstanceId, out string id))
|
if (!_gamepadsInstanceIdsMapping.Remove(joystickInstanceId, out string id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
_gamepadsIds.Remove(id);
|
_gamepadsIds.Remove(id);
|
||||||
if (!SDL2JoyConPair.IsCombinable(_gamepadsIds))
|
|
||||||
{
|
|
||||||
_gamepadsIds.Remove(SDL2JoyConPair.Id);
|
|
||||||
joyConPairDisconnected = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnGamepadDisconnected?.Invoke(id);
|
OnGamepadDisconnected?.Invoke(id);
|
||||||
if (joyConPairDisconnected)
|
|
||||||
{
|
|
||||||
OnGamepadDisconnected?.Invoke(SDL2JoyConPair.Id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleJoyStickConnected(int joystickDeviceId, int joystickInstanceId)
|
private void HandleJoyStickConnected(int joystickDeviceId, int joystickInstanceId)
|
||||||
{
|
{
|
||||||
bool joyConPairConnected = false;
|
|
||||||
if (SDL_IsGameController(joystickDeviceId) == SDL_bool.SDL_TRUE)
|
if (SDL_IsGameController(joystickDeviceId) == SDL_bool.SDL_TRUE)
|
||||||
{
|
{
|
||||||
if (_gamepadsInstanceIdsMapping.ContainsKey(joystickInstanceId))
|
if (_gamepadsInstanceIdsMapping.ContainsKey(joystickInstanceId))
|
||||||
@@ -133,29 +120,13 @@ namespace Ryujinx.Input.SDL2
|
|||||||
_gamepadsIds.Insert(joystickDeviceId, id);
|
_gamepadsIds.Insert(joystickDeviceId, id);
|
||||||
else
|
else
|
||||||
_gamepadsIds.Add(id);
|
_gamepadsIds.Add(id);
|
||||||
if (SDL2JoyConPair.IsCombinable(_gamepadsIds))
|
|
||||||
{
|
|
||||||
_gamepadsIds.Remove(SDL2JoyConPair.Id);
|
|
||||||
_gamepadsIds.Add(SDL2JoyConPair.Id);
|
|
||||||
joyConPairConnected = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnGamepadConnected?.Invoke(id);
|
OnGamepadConnected?.Invoke(id);
|
||||||
if (joyConPairConnected)
|
|
||||||
{
|
|
||||||
OnGamepadConnected?.Invoke(SDL2JoyConPair.Id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleJoyBatteryUpdated(int joystickDeviceId, SDL_JoystickPowerLevel powerLevel)
|
|
||||||
{
|
|
||||||
Logger.Info?.Print(LogClass.Hid,
|
|
||||||
$"{SDL_GameControllerNameForIndex(joystickDeviceId)} power level: {powerLevel}");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
@@ -186,14 +157,6 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
public IGamepad GetGamepad(string id)
|
public IGamepad GetGamepad(string id)
|
||||||
{
|
{
|
||||||
if (id == SDL2JoyConPair.Id)
|
|
||||||
{
|
|
||||||
lock (_lock)
|
|
||||||
{
|
|
||||||
return SDL2JoyConPair.GetGamepad(_gamepadsIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int joystickIndex = GetJoystickIndexByGamepadId(id);
|
int joystickIndex = GetJoystickIndexByGamepadId(id);
|
||||||
|
|
||||||
if (joystickIndex == -1)
|
if (joystickIndex == -1)
|
||||||
@@ -202,16 +165,12 @@ namespace Ryujinx.Input.SDL2
|
|||||||
}
|
}
|
||||||
|
|
||||||
nint gamepadHandle = SDL_GameControllerOpen(joystickIndex);
|
nint gamepadHandle = SDL_GameControllerOpen(joystickIndex);
|
||||||
|
|
||||||
if (gamepadHandle == nint.Zero)
|
if (gamepadHandle == nint.Zero)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_GameControllerName(gamepadHandle).StartsWith(SDL2JoyCon.Prefix))
|
|
||||||
{
|
|
||||||
return new SDL2JoyCon(gamepadHandle, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SDL2Gamepad(gamepadHandle, id);
|
return new SDL2Gamepad(gamepadHandle, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,409 +0,0 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
|
||||||
using Ryujinx.Common.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Threading;
|
|
||||||
using static SDL2.SDL;
|
|
||||||
|
|
||||||
namespace Ryujinx.Input.SDL2
|
|
||||||
{
|
|
||||||
internal class SDL2JoyCon : IGamepad
|
|
||||||
{
|
|
||||||
private bool HasConfiguration => _configuration != null;
|
|
||||||
|
|
||||||
private readonly record struct ButtonMappingEntry(GamepadButtonInputId To, GamepadButtonInputId From)
|
|
||||||
{
|
|
||||||
public bool IsValid => To is not GamepadButtonInputId.Unbound && From is not GamepadButtonInputId.Unbound;
|
|
||||||
}
|
|
||||||
|
|
||||||
private StandardControllerInputConfig _configuration;
|
|
||||||
|
|
||||||
private readonly Dictionary<GamepadButtonInputId,SDL_GameControllerButton> _leftButtonsDriverMapping = new()
|
|
||||||
{
|
|
||||||
{ GamepadButtonInputId.LeftStick , SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSTICK },
|
|
||||||
{GamepadButtonInputId.DpadUp ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_Y},
|
|
||||||
{GamepadButtonInputId.DpadDown ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_A},
|
|
||||||
{GamepadButtonInputId.DpadLeft ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_B},
|
|
||||||
{GamepadButtonInputId.DpadRight ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_X},
|
|
||||||
{GamepadButtonInputId.Minus ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_START},
|
|
||||||
{GamepadButtonInputId.LeftShoulder,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE2},
|
|
||||||
{GamepadButtonInputId.LeftTrigger,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE4},
|
|
||||||
{GamepadButtonInputId.SingleRightTrigger0,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER},
|
|
||||||
{GamepadButtonInputId.SingleLeftTrigger0,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSHOULDER},
|
|
||||||
};
|
|
||||||
private readonly Dictionary<GamepadButtonInputId,SDL_GameControllerButton> _rightButtonsDriverMapping = new()
|
|
||||||
{
|
|
||||||
{GamepadButtonInputId.RightStick,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSTICK},
|
|
||||||
{GamepadButtonInputId.A,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_B},
|
|
||||||
{GamepadButtonInputId.B,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_Y},
|
|
||||||
{GamepadButtonInputId.X,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_A},
|
|
||||||
{GamepadButtonInputId.Y,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_X},
|
|
||||||
{GamepadButtonInputId.Plus,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_START},
|
|
||||||
{GamepadButtonInputId.RightShoulder,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE1},
|
|
||||||
{GamepadButtonInputId.RightTrigger,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE3},
|
|
||||||
{GamepadButtonInputId.SingleRightTrigger1,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER},
|
|
||||||
{GamepadButtonInputId.SingleLeftTrigger1,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSHOULDER}
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly Dictionary<GamepadButtonInputId, SDL_GameControllerButton> _buttonsDriverMapping;
|
|
||||||
private readonly Lock _userMappingLock = new();
|
|
||||||
|
|
||||||
private readonly List<ButtonMappingEntry> _buttonsUserMapping;
|
|
||||||
|
|
||||||
private readonly StickInputId[] _stickUserMapping = new StickInputId[(int)StickInputId.Count]
|
|
||||||
{
|
|
||||||
StickInputId.Unbound, StickInputId.Left, StickInputId.Right,
|
|
||||||
};
|
|
||||||
|
|
||||||
public GamepadFeaturesFlag Features { get; }
|
|
||||||
|
|
||||||
private nint _gamepadHandle;
|
|
||||||
|
|
||||||
private enum JoyConType
|
|
||||||
{
|
|
||||||
Left, Right
|
|
||||||
}
|
|
||||||
|
|
||||||
public const string Prefix = "Nintendo Switch Joy-Con";
|
|
||||||
public const string LeftName = "Nintendo Switch Joy-Con (L)";
|
|
||||||
public const string RightName = "Nintendo Switch Joy-Con (R)";
|
|
||||||
|
|
||||||
private readonly JoyConType _joyConType;
|
|
||||||
|
|
||||||
public SDL2JoyCon(nint gamepadHandle, string driverId)
|
|
||||||
{
|
|
||||||
_gamepadHandle = gamepadHandle;
|
|
||||||
_buttonsUserMapping = new List<ButtonMappingEntry>(10);
|
|
||||||
|
|
||||||
Name = SDL_GameControllerName(_gamepadHandle);
|
|
||||||
Id = driverId;
|
|
||||||
Features = GetFeaturesFlag();
|
|
||||||
|
|
||||||
// Enable motion tracking
|
|
||||||
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
|
||||||
{
|
|
||||||
if (SDL_GameControllerSetSensorEnabled(_gamepadHandle, SDL_SensorType.SDL_SENSOR_ACCEL,
|
|
||||||
SDL_bool.SDL_TRUE) != 0)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Hid,
|
|
||||||
$"Could not enable data reporting for SensorType {SDL_SensorType.SDL_SENSOR_ACCEL}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SDL_GameControllerSetSensorEnabled(_gamepadHandle, SDL_SensorType.SDL_SENSOR_GYRO,
|
|
||||||
SDL_bool.SDL_TRUE) != 0)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Hid,
|
|
||||||
$"Could not enable data reporting for SensorType {SDL_SensorType.SDL_SENSOR_GYRO}.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Name)
|
|
||||||
{
|
|
||||||
case LeftName:
|
|
||||||
{
|
|
||||||
_buttonsDriverMapping = _leftButtonsDriverMapping;
|
|
||||||
_joyConType = JoyConType.Left;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RightName:
|
|
||||||
{
|
|
||||||
_buttonsDriverMapping = _rightButtonsDriverMapping;
|
|
||||||
_joyConType = JoyConType.Right;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private GamepadFeaturesFlag GetFeaturesFlag()
|
|
||||||
{
|
|
||||||
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;
|
|
||||||
|
|
||||||
if (SDL_GameControllerHasSensor(_gamepadHandle, SDL_SensorType.SDL_SENSOR_ACCEL) == SDL_bool.SDL_TRUE &&
|
|
||||||
SDL_GameControllerHasSensor(_gamepadHandle, SDL_SensorType.SDL_SENSOR_GYRO) == SDL_bool.SDL_TRUE)
|
|
||||||
{
|
|
||||||
result |= GamepadFeaturesFlag.Motion;
|
|
||||||
}
|
|
||||||
|
|
||||||
int error = SDL_GameControllerRumble(_gamepadHandle, 0, 0, 100);
|
|
||||||
|
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
result |= GamepadFeaturesFlag.Rumble;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Id { get; }
|
|
||||||
public string Name { get; }
|
|
||||||
public bool IsConnected => SDL_GameControllerGetAttached(_gamepadHandle) == SDL_bool.SDL_TRUE;
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && _gamepadHandle != nint.Zero)
|
|
||||||
{
|
|
||||||
SDL_GameControllerClose(_gamepadHandle);
|
|
||||||
|
|
||||||
_gamepadHandle = nint.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SetTriggerThreshold(float triggerThreshold)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
|
|
||||||
{
|
|
||||||
if (!Features.HasFlag(GamepadFeaturesFlag.Rumble))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ushort lowFrequencyRaw = (ushort)(lowFrequency * ushort.MaxValue);
|
|
||||||
ushort highFrequencyRaw = (ushort)(highFrequency * ushort.MaxValue);
|
|
||||||
|
|
||||||
if (durationMs == uint.MaxValue)
|
|
||||||
{
|
|
||||||
if (SDL_GameControllerRumble(_gamepadHandle, lowFrequencyRaw, highFrequencyRaw, SDL_HAPTIC_INFINITY) !=
|
|
||||||
0)
|
|
||||||
Logger.Error?.Print(LogClass.Hid, "Rumble is not supported on this game controller.");
|
|
||||||
}
|
|
||||||
else if (durationMs > SDL_HAPTIC_INFINITY)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Hid, $"Unsupported rumble duration {durationMs}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (SDL_GameControllerRumble(_gamepadHandle, lowFrequencyRaw, highFrequencyRaw, durationMs) != 0)
|
|
||||||
Logger.Error?.Print(LogClass.Hid, "Rumble is not supported on this game controller.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3 GetMotionData(MotionInputId inputId)
|
|
||||||
{
|
|
||||||
SDL_SensorType sensorType = inputId switch
|
|
||||||
{
|
|
||||||
MotionInputId.Accelerometer => SDL_SensorType.SDL_SENSOR_ACCEL,
|
|
||||||
MotionInputId.Gyroscope => SDL_SensorType.SDL_SENSOR_GYRO,
|
|
||||||
_ => SDL_SensorType.SDL_SENSOR_INVALID
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!Features.HasFlag(GamepadFeaturesFlag.Motion) || sensorType is SDL_SensorType.SDL_SENSOR_INVALID)
|
|
||||||
return Vector3.Zero;
|
|
||||||
|
|
||||||
const int ElementCount = 3;
|
|
||||||
|
|
||||||
unsafe
|
|
||||||
{
|
|
||||||
float* values = stackalloc float[ElementCount];
|
|
||||||
|
|
||||||
int result = SDL_GameControllerGetSensorData(_gamepadHandle, sensorType, (nint)values, ElementCount);
|
|
||||||
|
|
||||||
if (result != 0)
|
|
||||||
return Vector3.Zero;
|
|
||||||
|
|
||||||
Vector3 value = _joyConType switch
|
|
||||||
{
|
|
||||||
JoyConType.Left => new Vector3(-values[2], values[1], values[0]),
|
|
||||||
JoyConType.Right => new Vector3(values[2], values[1], -values[0])
|
|
||||||
};
|
|
||||||
|
|
||||||
return inputId switch
|
|
||||||
{
|
|
||||||
MotionInputId.Gyroscope => RadToDegree(value),
|
|
||||||
MotionInputId.Accelerometer => GsToMs2(value),
|
|
||||||
_ => value
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Vector3 RadToDegree(Vector3 rad) => rad * (180 / MathF.PI);
|
|
||||||
|
|
||||||
private static Vector3 GsToMs2(Vector3 gs) => gs / SDL_STANDARD_GRAVITY;
|
|
||||||
|
|
||||||
public void SetConfiguration(InputConfig configuration)
|
|
||||||
{
|
|
||||||
lock (_userMappingLock)
|
|
||||||
{
|
|
||||||
_configuration = (StandardControllerInputConfig)configuration;
|
|
||||||
|
|
||||||
_buttonsUserMapping.Clear();
|
|
||||||
|
|
||||||
// First update sticks
|
|
||||||
_stickUserMapping[(int)StickInputId.Left] = (StickInputId)_configuration.LeftJoyconStick.Joystick;
|
|
||||||
_stickUserMapping[(int)StickInputId.Right] = (StickInputId)_configuration.RightJoyconStick.Joystick;
|
|
||||||
|
|
||||||
|
|
||||||
switch (_joyConType)
|
|
||||||
{
|
|
||||||
case JoyConType.Left:
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftStick, (GamepadButtonInputId)_configuration.LeftJoyconStick.StickButton));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadUp, (GamepadButtonInputId)_configuration.LeftJoycon.DpadUp));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadDown, (GamepadButtonInputId)_configuration.LeftJoycon.DpadDown));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (GamepadButtonInputId)_configuration.LeftJoycon.DpadLeft));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (GamepadButtonInputId)_configuration.LeftJoycon.DpadRight));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonMinus));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonL));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonZl));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonSr));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger0, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonSl));
|
|
||||||
break;
|
|
||||||
case JoyConType.Right:
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightStick, (GamepadButtonInputId)_configuration.RightJoyconStick.StickButton));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.A, (GamepadButtonInputId)_configuration.RightJoycon.ButtonA));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.B, (GamepadButtonInputId)_configuration.RightJoycon.ButtonB));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.X, (GamepadButtonInputId)_configuration.RightJoycon.ButtonX));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Y, (GamepadButtonInputId)_configuration.RightJoycon.ButtonY));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Plus, (GamepadButtonInputId)_configuration.RightJoycon.ButtonPlus));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightShoulder, (GamepadButtonInputId)_configuration.RightJoycon.ButtonR));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightTrigger, (GamepadButtonInputId)_configuration.RightJoycon.ButtonZr));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger1, (GamepadButtonInputId)_configuration.RightJoycon.ButtonSr));
|
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (GamepadButtonInputId)_configuration.RightJoycon.ButtonSl));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
SetTriggerThreshold(_configuration.TriggerThreshold);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public GamepadStateSnapshot GetStateSnapshot()
|
|
||||||
{
|
|
||||||
return IGamepad.GetStateSnapshot(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GamepadStateSnapshot GetMappedStateSnapshot()
|
|
||||||
{
|
|
||||||
GamepadStateSnapshot rawState = GetStateSnapshot();
|
|
||||||
GamepadStateSnapshot result = default;
|
|
||||||
|
|
||||||
lock (_userMappingLock)
|
|
||||||
{
|
|
||||||
if (_buttonsUserMapping.Count == 0)
|
|
||||||
return rawState;
|
|
||||||
|
|
||||||
|
|
||||||
// ReSharper disable once ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
|
|
||||||
foreach (ButtonMappingEntry entry in _buttonsUserMapping)
|
|
||||||
{
|
|
||||||
if (!entry.IsValid)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Do not touch state of button already pressed
|
|
||||||
if (!result.IsPressed(entry.To))
|
|
||||||
{
|
|
||||||
result.SetPressed(entry.To, rawState.IsPressed(entry.From));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
(float leftStickX, float leftStickY) = rawState.GetStick(_stickUserMapping[(int)StickInputId.Left]);
|
|
||||||
(float rightStickX, float rightStickY) = rawState.GetStick(_stickUserMapping[(int)StickInputId.Right]);
|
|
||||||
|
|
||||||
result.SetStick(StickInputId.Left, leftStickX, leftStickY);
|
|
||||||
result.SetStick(StickInputId.Right, rightStickX, rightStickY);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static float ConvertRawStickValue(short value)
|
|
||||||
{
|
|
||||||
const float ConvertRate = 1.0f / (short.MaxValue + 0.5f);
|
|
||||||
|
|
||||||
return value * ConvertRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JoyconConfigControllerStick<GamepadInputId, Common.Configuration.Hid.Controller.StickInputId>
|
|
||||||
GetLogicalJoyStickConfig(StickInputId inputId)
|
|
||||||
{
|
|
||||||
switch (inputId)
|
|
||||||
{
|
|
||||||
case StickInputId.Left:
|
|
||||||
if (_configuration.RightJoyconStick.Joystick ==
|
|
||||||
Common.Configuration.Hid.Controller.StickInputId.Left)
|
|
||||||
return _configuration.RightJoyconStick;
|
|
||||||
else
|
|
||||||
return _configuration.LeftJoyconStick;
|
|
||||||
case StickInputId.Right:
|
|
||||||
if (_configuration.LeftJoyconStick.Joystick ==
|
|
||||||
Common.Configuration.Hid.Controller.StickInputId.Right)
|
|
||||||
return _configuration.LeftJoyconStick;
|
|
||||||
else
|
|
||||||
return _configuration.RightJoyconStick;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public (float, float) GetStick(StickInputId inputId)
|
|
||||||
{
|
|
||||||
if (inputId == StickInputId.Unbound)
|
|
||||||
return (0.0f, 0.0f);
|
|
||||||
|
|
||||||
if (inputId == StickInputId.Left && _joyConType == JoyConType.Right || inputId == StickInputId.Right && _joyConType == JoyConType.Left)
|
|
||||||
{
|
|
||||||
return (0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
(short stickX, short stickY) = GetStickXY();
|
|
||||||
|
|
||||||
float resultX = ConvertRawStickValue(stickX);
|
|
||||||
float resultY = -ConvertRawStickValue(stickY);
|
|
||||||
|
|
||||||
if (HasConfiguration)
|
|
||||||
{
|
|
||||||
var joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
|
||||||
|
|
||||||
if (joyconStickConfig != null)
|
|
||||||
{
|
|
||||||
if (joyconStickConfig.InvertStickX)
|
|
||||||
resultX = -resultX;
|
|
||||||
|
|
||||||
if (joyconStickConfig.InvertStickY)
|
|
||||||
resultY = -resultY;
|
|
||||||
|
|
||||||
if (joyconStickConfig.Rotate90CW)
|
|
||||||
{
|
|
||||||
float temp = resultX;
|
|
||||||
resultX = resultY;
|
|
||||||
resultY = -temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return inputId switch
|
|
||||||
{
|
|
||||||
StickInputId.Left when _joyConType == JoyConType.Left => (resultY, -resultX),
|
|
||||||
StickInputId.Right when _joyConType == JoyConType.Right => (-resultY, resultX),
|
|
||||||
_ => (0.0f, 0.0f)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private (short, short) GetStickXY()
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTX),
|
|
||||||
SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTY));
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsPressed(GamepadButtonInputId inputId)
|
|
||||||
{
|
|
||||||
if (!_buttonsDriverMapping.TryGetValue(inputId, out var button))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SDL_GameControllerGetButton(_gamepadHandle, button) == 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Numerics;
|
|
||||||
using static SDL2.SDL;
|
|
||||||
|
|
||||||
namespace Ryujinx.Input.SDL2
|
|
||||||
{
|
|
||||||
internal class SDL2JoyConPair(IGamepad left, IGamepad right) : IGamepad
|
|
||||||
{
|
|
||||||
private StandardControllerInputConfig _configuration;
|
|
||||||
|
|
||||||
private readonly StickInputId[] _stickUserMapping =
|
|
||||||
[
|
|
||||||
StickInputId.Unbound,
|
|
||||||
StickInputId.Left,
|
|
||||||
StickInputId.Right
|
|
||||||
];
|
|
||||||
|
|
||||||
public GamepadFeaturesFlag Features => (left?.Features ?? GamepadFeaturesFlag.None) |
|
|
||||||
(right?.Features ?? GamepadFeaturesFlag.None);
|
|
||||||
|
|
||||||
public const string Id = "JoyConPair";
|
|
||||||
string IGamepad.Id => Id;
|
|
||||||
|
|
||||||
public string Name => "* Nintendo Switch Joy-Con (L/R)";
|
|
||||||
public bool IsConnected => left is { IsConnected: true } && right is { IsConnected: true };
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
left?.Dispose();
|
|
||||||
right?.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public GamepadStateSnapshot GetMappedStateSnapshot()
|
|
||||||
{
|
|
||||||
return GetStateSnapshot();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3 GetMotionData(MotionInputId inputId)
|
|
||||||
{
|
|
||||||
return inputId switch
|
|
||||||
{
|
|
||||||
MotionInputId.Accelerometer or
|
|
||||||
MotionInputId.Gyroscope => left.GetMotionData(inputId),
|
|
||||||
MotionInputId.SecondAccelerometer => right.GetMotionData(MotionInputId.Accelerometer),
|
|
||||||
MotionInputId.SecondGyroscope => right.GetMotionData(MotionInputId.Gyroscope),
|
|
||||||
_ => Vector3.Zero
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public GamepadStateSnapshot GetStateSnapshot()
|
|
||||||
{
|
|
||||||
return IGamepad.GetStateSnapshot(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public (float, float) GetStick(StickInputId inputId)
|
|
||||||
{
|
|
||||||
return inputId switch
|
|
||||||
{
|
|
||||||
StickInputId.Left => left.GetStick(StickInputId.Left),
|
|
||||||
StickInputId.Right => right.GetStick(StickInputId.Right),
|
|
||||||
_ => (0, 0)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsPressed(GamepadButtonInputId inputId)
|
|
||||||
{
|
|
||||||
return left.IsPressed(inputId) || right.IsPressed(inputId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
|
|
||||||
{
|
|
||||||
if (lowFrequency != 0)
|
|
||||||
{
|
|
||||||
right.Rumble(lowFrequency, lowFrequency, durationMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (highFrequency != 0)
|
|
||||||
{
|
|
||||||
left.Rumble(highFrequency, highFrequency, durationMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lowFrequency == 0 && highFrequency == 0)
|
|
||||||
{
|
|
||||||
left.Rumble(0, 0, durationMs);
|
|
||||||
right.Rumble(0, 0, durationMs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetConfiguration(InputConfig configuration)
|
|
||||||
{
|
|
||||||
left.SetConfiguration(configuration);
|
|
||||||
right.SetConfiguration(configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetTriggerThreshold(float triggerThreshold)
|
|
||||||
{
|
|
||||||
left.SetTriggerThreshold(triggerThreshold);
|
|
||||||
right.SetTriggerThreshold(triggerThreshold);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsCombinable(List<string> gamepadsIds)
|
|
||||||
{
|
|
||||||
(int leftIndex, int rightIndex) = DetectJoyConPair(gamepadsIds);
|
|
||||||
return leftIndex >= 0 && rightIndex >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static (int leftIndex, int rightIndex) DetectJoyConPair(List<string> gamepadsIds)
|
|
||||||
{
|
|
||||||
var gamepadNames = gamepadsIds.Where(gamepadId => gamepadId != Id)
|
|
||||||
.Select((_, index) => SDL_GameControllerNameForIndex(index)).ToList();
|
|
||||||
int leftIndex = gamepadNames.IndexOf(SDL2JoyCon.LeftName);
|
|
||||||
int rightIndex = gamepadNames.IndexOf(SDL2JoyCon.RightName);
|
|
||||||
|
|
||||||
return (leftIndex, rightIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IGamepad GetGamepad(List<string> gamepadsIds)
|
|
||||||
{
|
|
||||||
(int leftIndex, int rightIndex) = DetectJoyConPair(gamepadsIds);
|
|
||||||
if (leftIndex == -1 || rightIndex == -1)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
nint leftGamepadHandle = SDL_GameControllerOpen(leftIndex);
|
|
||||||
nint rightGamepadHandle = SDL_GameControllerOpen(rightIndex);
|
|
||||||
|
|
||||||
if (leftGamepadHandle == nint.Zero || rightGamepadHandle == nint.Zero)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return new SDL2JoyConPair(new SDL2JoyCon(leftGamepadHandle, gamepadsIds[leftIndex]),
|
|
||||||
new SDL2JoyCon(rightGamepadHandle, gamepadsIds[rightIndex]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -269,7 +269,6 @@ namespace Ryujinx.Input.HLE
|
|||||||
if (motionConfig.MotionBackend != MotionInputBackendType.CemuHook)
|
if (motionConfig.MotionBackend != MotionInputBackendType.CemuHook)
|
||||||
{
|
{
|
||||||
_leftMotionInput = new MotionInput();
|
_leftMotionInput = new MotionInput();
|
||||||
_rightMotionInput = new MotionInput();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -302,20 +301,7 @@ namespace Ryujinx.Input.HLE
|
|||||||
|
|
||||||
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
|
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
|
||||||
{
|
{
|
||||||
if (gamepad.Id== "JoyConPair")
|
_rightMotionInput = _leftMotionInput;
|
||||||
{
|
|
||||||
Vector3 rightAccelerometer = gamepad.GetMotionData(MotionInputId.SecondAccelerometer);
|
|
||||||
Vector3 rightGyroscope = gamepad.GetMotionData(MotionInputId.SecondGyroscope);
|
|
||||||
|
|
||||||
rightAccelerometer = new Vector3(rightAccelerometer.X, -rightAccelerometer.Z, rightAccelerometer.Y);
|
|
||||||
rightGyroscope = new Vector3(rightGyroscope.X, -rightGyroscope.Z, rightGyroscope.Y);
|
|
||||||
|
|
||||||
_rightMotionInput.Update(rightAccelerometer, rightGyroscope, (ulong)PerformanceCounter.ElapsedNanoseconds / 1000, controllerConfig.Motion.Sensitivity, (float)controllerConfig.Motion.GyroDeadzone);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_rightMotionInput = _leftMotionInput;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,7 +336,6 @@ namespace Ryujinx.Input.HLE
|
|||||||
// Reset states
|
// Reset states
|
||||||
State = default;
|
State = default;
|
||||||
_leftMotionInput = null;
|
_leftMotionInput = null;
|
||||||
_rightMotionInput = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,17 +21,5 @@ namespace Ryujinx.Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Values are in degrees</remarks>
|
/// <remarks>Values are in degrees</remarks>
|
||||||
Gyroscope,
|
Gyroscope,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Second accelerometer.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>Values are in m/s^2</remarks>
|
|
||||||
SecondAccelerometer,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Second gyroscope.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>Values are in degrees</remarks>
|
|
||||||
SecondGyroscope
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,17 +25,14 @@ namespace Ryujinx.SDL2.Common
|
|||||||
|
|
||||||
public static Action<Action> MainThreadDispatcher { get; set; }
|
public static Action<Action> MainThreadDispatcher { get; set; }
|
||||||
|
|
||||||
private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK |
|
private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO;
|
||||||
SDL_INIT_AUDIO | SDL_INIT_VIDEO;
|
|
||||||
|
|
||||||
private bool _isRunning;
|
private bool _isRunning;
|
||||||
private uint _refereceCount;
|
private uint _refereceCount;
|
||||||
private Thread _worker;
|
private Thread _worker;
|
||||||
|
|
||||||
private const uint SDL_JOYBATTERYUPDATED = 1543;
|
|
||||||
public event Action<int, int> OnJoyStickConnected;
|
public event Action<int, int> OnJoyStickConnected;
|
||||||
public event Action<int> OnJoystickDisconnected;
|
public event Action<int> OnJoystickDisconnected;
|
||||||
public event Action<int, SDL_JoystickPowerLevel> OnJoyBatteryUpdated;
|
|
||||||
|
|
||||||
private ConcurrentDictionary<uint, Action<SDL_Event>> _registeredWindowHandlers;
|
private ConcurrentDictionary<uint, Action<SDL_Event>> _registeredWindowHandlers;
|
||||||
|
|
||||||
@@ -81,14 +78,12 @@ namespace Ryujinx.SDL2.Common
|
|||||||
// First ensure that we only enable joystick events (for connected/disconnected).
|
// First ensure that we only enable joystick events (for connected/disconnected).
|
||||||
if (SDL_GameControllerEventState(SDL_IGNORE) != SDL_IGNORE)
|
if (SDL_GameControllerEventState(SDL_IGNORE) != SDL_IGNORE)
|
||||||
{
|
{
|
||||||
Logger.Error?.PrintMsg(LogClass.Application,
|
Logger.Error?.PrintMsg(LogClass.Application, "Couldn't change the state of game controller events.");
|
||||||
"Couldn't change the state of game controller events.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_JoystickEventState(SDL_ENABLE) < 0)
|
if (SDL_JoystickEventState(SDL_ENABLE) < 0)
|
||||||
{
|
{
|
||||||
Logger.Error?.PrintMsg(LogClass.Application,
|
Logger.Error?.PrintMsg(LogClass.Application, $"Failed to enable joystick event polling: {SDL_GetError()}");
|
||||||
$"Failed to enable joystick event polling: {SDL_GetError()}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable all joysticks information, we don't need them no need to flood the event queue for that.
|
// Disable all joysticks information, we don't need them no need to flood the event queue for that.
|
||||||
@@ -148,12 +143,7 @@ namespace Ryujinx.SDL2.Common
|
|||||||
|
|
||||||
OnJoystickDisconnected?.Invoke(evnt.cbutton.which);
|
OnJoystickDisconnected?.Invoke(evnt.cbutton.which);
|
||||||
}
|
}
|
||||||
else if ((uint)evnt.type == SDL_JOYBATTERYUPDATED)
|
else if (evnt.type is SDL_EventType.SDL_WINDOWEVENT or SDL_EventType.SDL_MOUSEBUTTONDOWN or SDL_EventType.SDL_MOUSEBUTTONUP)
|
||||||
{
|
|
||||||
OnJoyBatteryUpdated?.Invoke(evnt.cbutton.which, (SDL_JoystickPowerLevel)evnt.user.code);
|
|
||||||
}
|
|
||||||
else if (evnt.type is SDL_EventType.SDL_WINDOWEVENT or SDL_EventType.SDL_MOUSEBUTTONDOWN
|
|
||||||
or SDL_EventType.SDL_MOUSEBUTTONUP)
|
|
||||||
{
|
{
|
||||||
if (_registeredWindowHandlers.TryGetValue(evnt.window.windowID, out Action<SDL_Event> handler))
|
if (_registeredWindowHandlers.TryGetValue(evnt.window.windowID, out Action<SDL_Event> handler))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
using DiscordRPC;
|
using DiscordRPC;
|
||||||
using Gommon;
|
using Gommon;
|
||||||
|
using MsgPack;
|
||||||
using Ryujinx.Ava.Utilities;
|
using Ryujinx.Ava.Utilities;
|
||||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
using Ryujinx.Ava.Utilities.Configuration;
|
using Ryujinx.Ava.Utilities.Configuration;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
|
using Ryujinx.Common.Helper;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.Loaders.Processes;
|
using Ryujinx.HLE.Loaders.Processes;
|
||||||
|
using Ryujinx.Horizon;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Ryujinx.Ava
|
namespace Ryujinx.Ava
|
||||||
@@ -16,12 +24,12 @@ namespace Ryujinx.Ava
|
|||||||
public static Timestamps GuestAppStartedAt { get; set; }
|
public static Timestamps GuestAppStartedAt { get; set; }
|
||||||
|
|
||||||
private static string VersionString
|
private static string VersionString
|
||||||
=> (ReleaseInformation.IsCanaryBuild ? "Canary " : string.Empty) + $"v{ReleaseInformation.Version}";
|
=> (ReleaseInformation.IsCanaryBuild ? "Canary " : string.Empty) + $"v{ReleaseInformation.Version}";
|
||||||
|
|
||||||
private static readonly string _description =
|
private static readonly string _description =
|
||||||
ReleaseInformation.IsValid
|
ReleaseInformation.IsValid
|
||||||
? $"{VersionString} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelSourceRepo}@{ReleaseInformation.BuildGitHash}"
|
? $"{VersionString} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelSourceRepo}@{ReleaseInformation.BuildGitHash}"
|
||||||
: "dev build";
|
: "dev build";
|
||||||
|
|
||||||
private const string ApplicationId = "1293250299716173864";
|
private const string ApplicationId = "1293250299716173864";
|
||||||
|
|
||||||
@@ -30,6 +38,7 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
private static DiscordRpcClient _discordClient;
|
private static DiscordRpcClient _discordClient;
|
||||||
private static RichPresence _discordPresenceMain;
|
private static RichPresence _discordPresenceMain;
|
||||||
|
private static RichPresence _discordPresencePlaying;
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
@@ -37,8 +46,7 @@ namespace Ryujinx.Ava
|
|||||||
{
|
{
|
||||||
Assets = new Assets
|
Assets = new Assets
|
||||||
{
|
{
|
||||||
LargeImageKey = "ryujinx",
|
LargeImageKey = "ryujinx", LargeImageText = TruncateToByteLength(_description)
|
||||||
LargeImageText = TruncateToByteLength(_description)
|
|
||||||
},
|
},
|
||||||
Details = "Main Menu",
|
Details = "Main Menu",
|
||||||
State = "Idling",
|
State = "Idling",
|
||||||
@@ -47,6 +55,7 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
||||||
TitleIDs.CurrentApplication.Event += (_, e) => Use(e.NewValue);
|
TitleIDs.CurrentApplication.Event += (_, e) => Use(e.NewValue);
|
||||||
|
HorizonStatic.PlayReportPrinted += HandlePlayReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Update(object sender, ReactiveEventArgs<bool> evnt)
|
private static void Update(object sender, ReactiveEventArgs<bool> evnt)
|
||||||
@@ -73,20 +82,49 @@ namespace Ryujinx.Ava
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string MarioKart8(object obj)
|
||||||
|
{
|
||||||
|
return obj switch
|
||||||
|
{
|
||||||
|
// Single Player
|
||||||
|
"Single" => "Single Player",
|
||||||
|
// Multiplayer
|
||||||
|
"Multi-2players" => "Multiplayer 2 Players",
|
||||||
|
"Multi-3players" => "Multiplayer 3 Players",
|
||||||
|
"Multi-4players" => "Multiplayer 4 Players",
|
||||||
|
// Wireless/LAN Play
|
||||||
|
"Local-Single" => "Wireless/LAN Play",
|
||||||
|
"Local-2players" => "Wireless/LAN Play 2 Players",
|
||||||
|
// CC Classes
|
||||||
|
"50cc" => "50cc",
|
||||||
|
"100cc" => "100cc",
|
||||||
|
"150cc" => "150cc",
|
||||||
|
"Mirror" => "Mirror (150cc)",
|
||||||
|
"200cc" => "200cc",
|
||||||
|
// Modes
|
||||||
|
"GrandPrix" => "Grand Prix",
|
||||||
|
"TimeAttack" => "Time Trials",
|
||||||
|
"VS" => "VS Races",
|
||||||
|
"Battle" => "Battle Mode",
|
||||||
|
"RaceStart" => "Selecting a Course",
|
||||||
|
"Race" => "Racing",
|
||||||
|
_ => "Playing Mario Kart 8 Deluxe"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static void Use(Optional<string> titleId)
|
public static void Use(Optional<string> titleId)
|
||||||
{
|
{
|
||||||
if (titleId.TryGet(out string tid))
|
if (titleId.TryGet(out string tid))
|
||||||
SwitchToPlayingState(
|
SwitchToPlayingState(
|
||||||
ApplicationLibrary.LoadAndSaveMetaData(tid),
|
ApplicationLibrary.LoadAndSaveMetaData(tid),
|
||||||
Switch.Shared.Processes.ActiveApplication
|
Switch.Shared.Processes.ActiveApplication
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
SwitchToMainState();
|
SwitchToMainState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SwitchToPlayingState(ApplicationMetadata appMeta, ProcessResult procRes)
|
private static RichPresence CreatePlayingState(ApplicationMetadata appMeta, ProcessResult procRes) =>
|
||||||
{
|
new()
|
||||||
_discordClient?.SetPresence(new RichPresence
|
|
||||||
{
|
{
|
||||||
Assets = new Assets
|
Assets = new Assets
|
||||||
{
|
{
|
||||||
@@ -100,10 +138,69 @@ namespace Ryujinx.Ava
|
|||||||
? $"Total play time: {ValueFormatUtils.FormatTimeSpan(appMeta.TimePlayed)}"
|
? $"Total play time: {ValueFormatUtils.FormatTimeSpan(appMeta.TimePlayed)}"
|
||||||
: "Never played",
|
: "Never played",
|
||||||
Timestamps = GuestAppStartedAt ??= Timestamps.Now
|
Timestamps = GuestAppStartedAt ??= Timestamps.Now
|
||||||
});
|
};
|
||||||
|
|
||||||
|
private static void SwitchToPlayingState(ApplicationMetadata appMeta, ProcessResult procRes)
|
||||||
|
{
|
||||||
|
_discordClient?.SetPresence(_discordPresencePlaying ??= CreatePlayingState(appMeta, procRes));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SwitchToMainState() => _discordClient?.SetPresence(_discordPresenceMain);
|
private static void UpdatePlayingState()
|
||||||
|
{
|
||||||
|
_discordClient?.SetPresence(_discordPresencePlaying);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SwitchToMainState()
|
||||||
|
{
|
||||||
|
_discordClient?.SetPresence(_discordPresenceMain);
|
||||||
|
_discordPresencePlaying = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly PlayReportAnalyzer _playReportAnalyzer = new PlayReportAnalyzer()
|
||||||
|
.AddSpec( // Breath of the Wild
|
||||||
|
"01007ef00011e000",
|
||||||
|
gameSpec =>
|
||||||
|
gameSpec.AddValueFormatter("IsHardMode", val => val is 1 ? "Playing Master Mode" : "Playing Normal Mode")
|
||||||
|
)
|
||||||
|
.AddSpec( // Super Mario Odyssey
|
||||||
|
"0100000000010000",
|
||||||
|
gameSpec =>
|
||||||
|
gameSpec.AddValueFormatter("is_kids_mode", val => val is 1 ? "Playing in Assist Mode" : "Playing in Regular Mode")
|
||||||
|
)
|
||||||
|
.AddSpec( // Super Mario Odyssey (China)
|
||||||
|
"010075000ECBE000",
|
||||||
|
gameSpec =>
|
||||||
|
gameSpec.AddValueFormatter("is_kids_mode", val => val is 1 ? "Playing in 帮助模式" : "Playing in 普通模式")
|
||||||
|
)
|
||||||
|
.AddSpec( // Super Mario 3D World + Bowser's Fury
|
||||||
|
"010028600EBDA000",
|
||||||
|
gameSpec =>
|
||||||
|
gameSpec.AddValueFormatter("mode", val => val is 0 ? "Playing Super Mario 3D World" : "Playing Bowser's Fury")
|
||||||
|
)
|
||||||
|
.AddSpec( // Mario Kart 8 Deluxe
|
||||||
|
"0100152000022000",
|
||||||
|
gameSpec =>
|
||||||
|
gameSpec.AddValueFormatter("To", MarioKart8)
|
||||||
|
)
|
||||||
|
.AddSpec( // Mario Kart 8 Deluxe (China)
|
||||||
|
"010075100E8EC000",
|
||||||
|
gameSpec =>
|
||||||
|
gameSpec.AddValueFormatter("To", MarioKart8)
|
||||||
|
);
|
||||||
|
|
||||||
|
private static void HandlePlayReport(MessagePackObject playReport)
|
||||||
|
{
|
||||||
|
if (!TitleIDs.CurrentApplication.Value.HasValue) return;
|
||||||
|
if (_discordPresencePlaying is null) return;
|
||||||
|
|
||||||
|
Optional<string> details = _playReportAnalyzer.Run(TitleIDs.CurrentApplication.Value, playReport);
|
||||||
|
|
||||||
|
if (!details.HasValue) return;
|
||||||
|
|
||||||
|
_discordPresencePlaying.Details = details;
|
||||||
|
UpdatePlayingState();
|
||||||
|
Logger.Info?.Print(LogClass.UI, "Updated Discord RPC based on a supported play report.");
|
||||||
|
}
|
||||||
|
|
||||||
private static string TruncateToByteLength(string input)
|
private static string TruncateToByteLength(string input)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,12 +144,12 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
case KeyboardMode.Numeric:
|
case KeyboardMode.Numeric:
|
||||||
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeNumeric);
|
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeNumeric);
|
||||||
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
|
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
|
||||||
_checkInput = text => text.All(NumericCharacterValidation.IsNumeric);
|
_checkInput = text => text.All(CharacterValidation.IsNumeric);
|
||||||
break;
|
break;
|
||||||
case KeyboardMode.Alphabet:
|
case KeyboardMode.Alphabet:
|
||||||
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeAlphabet);
|
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeAlphabet);
|
||||||
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
|
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
|
||||||
_checkInput = text => text.All(value => !CJKCharacterValidation.IsCJK(value));
|
_checkInput = text => text.All(value => !CharacterValidation.IsCJK(value));
|
||||||
break;
|
break;
|
||||||
case KeyboardMode.ASCII:
|
case KeyboardMode.ASCII:
|
||||||
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeASCII);
|
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeASCII);
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
Symbol = (Symbol)symbol,
|
Symbol = (Symbol)symbol,
|
||||||
Margin = new Thickness(10),
|
Margin = new Thickness(10),
|
||||||
FontSize = 40,
|
FontSize = 40,
|
||||||
|
FlowDirection = FlowDirection.LeftToRight,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Common.Helper;
|
||||||
using SharpMetal.QuartzCore;
|
using SharpMetal.QuartzCore;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@@ -7,14 +8,12 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
{
|
{
|
||||||
public CAMetalLayer CreateSurface()
|
public CAMetalLayer CreateSurface()
|
||||||
{
|
{
|
||||||
if (OperatingSystem.IsMacOS())
|
if (OperatingSystem.IsMacOS() && RunningPlatform.IsArm)
|
||||||
{
|
{
|
||||||
return new CAMetalLayer(MetalLayer);
|
return new CAMetalLayer(MetalLayer);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
throw new NotSupportedException($"Cannot create a {nameof(CAMetalLayer)} without being on ARM Mac.");
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,19 +43,19 @@ namespace Ryujinx.Ava.UI.Renderer
|
|||||||
|
|
||||||
public RendererHost(string titleId)
|
public RendererHost(string titleId)
|
||||||
{
|
{
|
||||||
switch (TitleIDs.SelectGraphicsBackend(titleId, ConfigurationState.Instance.Graphics.GraphicsBackend))
|
Focusable = true;
|
||||||
{
|
FlowDirection = FlowDirection.LeftToRight;
|
||||||
case GraphicsBackend.OpenGl:
|
|
||||||
EmbeddedWindow = new EmbeddedWindowOpenGL();
|
EmbeddedWindow =
|
||||||
break;
|
#pragma warning disable CS8509
|
||||||
case GraphicsBackend.Metal:
|
TitleIDs.SelectGraphicsBackend(titleId, ConfigurationState.Instance.Graphics.GraphicsBackend) switch
|
||||||
EmbeddedWindow = new EmbeddedWindowMetal();
|
#pragma warning restore CS8509
|
||||||
break;
|
{
|
||||||
case GraphicsBackend.Vulkan:
|
GraphicsBackend.OpenGl => new EmbeddedWindowOpenGL(),
|
||||||
EmbeddedWindow = new EmbeddedWindowVulkan();
|
GraphicsBackend.Metal => new EmbeddedWindowMetal(),
|
||||||
break;
|
GraphicsBackend.Vulkan => new EmbeddedWindowVulkan(),
|
||||||
}
|
};
|
||||||
|
|
||||||
string backendText = EmbeddedWindow switch
|
string backendText = EmbeddedWindow switch
|
||||||
{
|
{
|
||||||
EmbeddedWindowVulkan => "Vulkan",
|
EmbeddedWindowVulkan => "Vulkan",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Ryujinx.Ava.Utilities.Configuration.System;
|
|||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Multiplayer;
|
using Ryujinx.Common.Configuration.Multiplayer;
|
||||||
using Ryujinx.Common.GraphicsDriver;
|
using Ryujinx.Common.GraphicsDriver;
|
||||||
|
using Ryujinx.Common.Helper;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Vulkan;
|
using Ryujinx.Graphics.Vulkan;
|
||||||
@@ -330,9 +331,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratedRegex("Ryujinx-[0-9a-f]{8}")]
|
|
||||||
private static partial Regex LdnPassphraseRegex();
|
|
||||||
|
|
||||||
public bool IsInvalidLdnPassphraseVisible { get; set; }
|
public bool IsInvalidLdnPassphraseVisible { get; set; }
|
||||||
|
|
||||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
||||||
@@ -470,7 +468,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
private bool ValidateLdnPassphrase(string passphrase)
|
private bool ValidateLdnPassphrase(string passphrase)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(passphrase) || (passphrase.Length == 16 && LdnPassphraseRegex().IsMatch(passphrase));
|
return string.IsNullOrEmpty(passphrase) || (passphrase.Length == 16 && Patterns.LdnPassphrase.IsMatch(passphrase));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ValidateAndSetTimeZone(string location)
|
public void ValidateAndSetTimeZone(string location)
|
||||||
|
|||||||
Reference in New Issue
Block a user