Compare commits

...

2 Commits

Author SHA1 Message Date
Isaac Marovitz
12cbacffca Fix numeric SWKB validation (#5627)
* Fix numeric swkbd validation

* GTK
2023-09-01 20:08:42 +02:00
Ac_K
437c78e198 opus: Implement GetWorkBufferSizeExEx and GetWorkBufferSizeForMultiStreamExEx (#5624)
* opus: Implement GetWorkBufferSizeExEx and GetWorkBufferSizeForMultiStreamExEx

* Fix comments
2023-08-30 22:04:25 +02:00
6 changed files with 48 additions and 9 deletions

View File

@@ -544,7 +544,7 @@
"SwkbdMinCharacters": "Must be at least {0} characters long",
"SwkbdMinRangeCharacters": "Must be {0}-{1} characters long",
"SoftwareKeyboard": "Software Keyboard",
"SoftwareKeyboardModeNumbersOnly": "Must be numbers only",
"SoftwareKeyboardModeNumeric": "Must be 0-9 or '.' only",
"SoftwareKeyboardModeAlphabet": "Must be non CJK-characters only",
"SoftwareKeyboardModeASCII": "Must be ASCII text only",
"DialogControllerAppletMessagePlayerRange": "Application requests {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.",

View File

@@ -136,10 +136,10 @@ namespace Ryujinx.Ava.UI.Controls
string localeText;
switch (mode)
{
case KeyboardMode.NumbersOnly:
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeNumbersOnly);
case KeyboardMode.Numeric:
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeNumeric);
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
_checkInput = text => text.All(char.IsDigit);
_checkInput = text => text.All(NumericCharacterValidation.IsNumeric);
break;
case KeyboardMode.Alphabet:
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeAlphabet);

View File

@@ -11,9 +11,9 @@
Default = 0,
/// <summary>
/// Only numbers allowed.
/// Only 0-9 or '.' allowed.
/// </summary>
NumbersOnly = 1,
Numeric = 1,
/// <summary>
/// Only ASCII characters allowed.

View File

@@ -0,0 +1,17 @@
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();
}
}

View File

@@ -154,6 +154,28 @@ namespace Ryujinx.HLE.HOS.Services.Audio
return ResultCode.Success;
}
[CommandCmif(8)] // 16.0.0+
// GetWorkBufferSizeExEx(OpusParametersEx) -> u32
public ResultCode GetWorkBufferSizeExEx(ServiceCtx context)
{
// NOTE: GetWorkBufferSizeEx use hardcoded values to compute the returned size.
// GetWorkBufferSizeExEx fixes that by using dynamic values.
// Since we're already doing that, it's fine to call it directly.
return GetWorkBufferSizeEx(context);
}
[CommandCmif(9)] // 16.0.0+
// GetWorkBufferSizeForMultiStreamExEx(buffer<unknown<0x118>, 0x19>) -> u32
public ResultCode GetWorkBufferSizeForMultiStreamExEx(ServiceCtx context)
{
// NOTE: GetWorkBufferSizeForMultiStreamEx use hardcoded values to compute the returned size.
// GetWorkBufferSizeForMultiStreamExEx fixes that by using dynamic values.
// Since we're already doing that, it's fine to call it directly.
return GetWorkBufferSizeForMultiStreamEx(context);
}
private static int GetOpusMultistreamDecoderSize(int streams, int coupledStreams)
{
if (streams < 1 || coupledStreams > streams || coupledStreams < 0)

View File

@@ -90,9 +90,9 @@ namespace Ryujinx.Ui.Applet
switch (mode)
{
case KeyboardMode.NumbersOnly:
_validationInfoText += "<i>Must be numbers only.</i>";
_checkInput = text => text.All(char.IsDigit);
case KeyboardMode.Numeric:
_validationInfoText += "<i>Must be 0-9 or '.' only.</i>";
_checkInput = text => text.All(NumericCharacterValidation.IsNumeric);
break;
case KeyboardMode.Alphabet:
_validationInfoText += "<i>Must be non CJK-characters only.</i>";