Add documentation
This commit is contained in:
parent
4e38cadcad
commit
d970e17209
8 changed files with 187 additions and 146 deletions
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the initial position of the cursor displayed in the area.
|
||||||
|
/// </summary>
|
||||||
|
internal enum InitialCursorPosition : uint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Position the cursor at the beginning of the text
|
||||||
|
/// </summary>
|
||||||
|
Start,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Position the cursor at the end of the text
|
||||||
|
/// </summary>
|
||||||
|
End
|
||||||
|
}
|
||||||
|
}
|
18
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/InputFormMode.cs
Normal file
18
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/InputFormMode.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the text entry mode.
|
||||||
|
/// </summary>
|
||||||
|
internal enum InputFormMode : uint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Displays the text entry area as a single-line field.
|
||||||
|
/// </summary>
|
||||||
|
SingleLine,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Displays the text entry area as a multi-line field.
|
||||||
|
/// </summary>
|
||||||
|
MultiLine
|
||||||
|
}
|
||||||
|
}
|
56
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/InvalidCharFlags.cs
Normal file
56
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/InvalidCharFlags.cs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies prohibited character sets.
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
internal enum InvalidCharFlags : uint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// No characters are prohibited.
|
||||||
|
/// </summary>
|
||||||
|
None = 0 << 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits spaces.
|
||||||
|
/// </summary>
|
||||||
|
Space = 1 << 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits the at (@) symbol.
|
||||||
|
/// </summary>
|
||||||
|
AtSymbol = 1 << 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits the percent (%) symbol.
|
||||||
|
/// </summary>
|
||||||
|
Percent = 1 << 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits the forward slash (/) symbol.
|
||||||
|
/// </summary>
|
||||||
|
ForwardSlash = 1 << 4,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits the backward slash (\) symbol.
|
||||||
|
/// </summary>
|
||||||
|
BackSlash = 1 << 5,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits numbers.
|
||||||
|
/// </summary>
|
||||||
|
Numbers = 1 << 6,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits characters outside of those allowed in download codes.
|
||||||
|
/// </summary>
|
||||||
|
DownloadCode = 1 << 7,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prohibits characters outside of those allowed in Mii Nicknames.
|
||||||
|
/// </summary>
|
||||||
|
Username = 1 << 8
|
||||||
|
}
|
||||||
|
}
|
28
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs
Normal file
28
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the variant of keyboard displayed on screen.
|
||||||
|
/// </summary>
|
||||||
|
internal enum KeyboardMode : uint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A full alpha-numeric keyboard.
|
||||||
|
/// </summary>
|
||||||
|
Default,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number pad.
|
||||||
|
/// </summary>
|
||||||
|
NumbersOnly,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// QWERTY (and variants) keyboard only.
|
||||||
|
/// </summary>
|
||||||
|
LettersOnly,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unknown keyboard variant.
|
||||||
|
/// </summary>
|
||||||
|
Unknown
|
||||||
|
}
|
||||||
|
}
|
18
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/PasswordMode.cs
Normal file
18
Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/PasswordMode.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the display mode of text in a password field.
|
||||||
|
/// </summary>
|
||||||
|
internal enum PasswordMode : uint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Display input characters.
|
||||||
|
/// </summary>
|
||||||
|
Disabled,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hide input characters.
|
||||||
|
/// </summary>
|
||||||
|
Enabled
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
|
||||||
using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -43,7 +42,11 @@ namespace Ryujinx.HLE.HOS.Applets
|
||||||
var transferMemory = _normalSession.Pop();
|
var transferMemory = _normalSession.Pop();
|
||||||
|
|
||||||
_keyboardConfig = ReadStruct<SoftwareKeyboardConfig>(keyboardConfig);
|
_keyboardConfig = ReadStruct<SoftwareKeyboardConfig>(keyboardConfig);
|
||||||
_encoding = _keyboardConfig.UseUtf8 ? Encoding.UTF8 : Encoding.Unicode;
|
|
||||||
|
if (_keyboardConfig.UseUtf8)
|
||||||
|
{
|
||||||
|
_encoding = Encoding.UTF8;
|
||||||
|
}
|
||||||
|
|
||||||
_state = SoftwareKeyboardState.Ready;
|
_state = SoftwareKeyboardState.Ready;
|
||||||
|
|
||||||
|
@ -90,7 +93,17 @@ namespace Ryujinx.HLE.HOS.Applets
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does the application want to validate the text itself?
|
// Does the application want to validate the text itself?
|
||||||
if (!_keyboardConfig.CheckText)
|
if (_keyboardConfig.CheckText)
|
||||||
|
{
|
||||||
|
// The application needs to validate the response, so we
|
||||||
|
// submit it to the interactive output buffer, and poll it
|
||||||
|
// for validation. Once validated, the application will submit
|
||||||
|
// back a validation status, which is handled in OnInteractiveDataPushIn.
|
||||||
|
_state = SoftwareKeyboardState.ValidationPending;
|
||||||
|
|
||||||
|
_interactiveSession.Push(BuildResponse(_textValue, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// If the application doesn't need to validate the response,
|
// If the application doesn't need to validate the response,
|
||||||
// we push the data to the non-interactive output buffer
|
// we push the data to the non-interactive output buffer
|
||||||
|
@ -101,16 +114,6 @@ namespace Ryujinx.HLE.HOS.Applets
|
||||||
|
|
||||||
AppletStateChanged?.Invoke(this, null);
|
AppletStateChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// The application needs to validate the response, so we
|
|
||||||
// submit it to the interactive output buffer, and poll it
|
|
||||||
// for validation. Once validated, the application will submit
|
|
||||||
// back a validation status, which is handled in OnInteractiveDataPushIn.
|
|
||||||
_state = SoftwareKeyboardState.ValidationPending;
|
|
||||||
|
|
||||||
_interactiveSession.Push(BuildResponse(_textValue, true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInteractiveData(object sender, EventArgs e)
|
private void OnInteractiveData(object sender, EventArgs e)
|
||||||
|
|
|
@ -3,121 +3,15 @@
|
||||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// A structure that defines the configuration options of the software keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal enum KeyboardMode : uint
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Normal keyboard.
|
|
||||||
/// </summary>
|
|
||||||
Default,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number pad. The buttons at the bottom left/right are only available when they're set in the config by leftButtonText / rightButtonText.
|
|
||||||
/// </summary>
|
|
||||||
NumbersOnly,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// QWERTY (and variants) keyboard only.
|
|
||||||
/// </summary>
|
|
||||||
LettersOnly
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
internal enum InvalidCharFlags : uint
|
|
||||||
{
|
|
||||||
None = 0 << 1,
|
|
||||||
|
|
||||||
Space = 1 << 1,
|
|
||||||
|
|
||||||
AtSymbol = 1 << 2,
|
|
||||||
|
|
||||||
Percent = 1 << 3,
|
|
||||||
|
|
||||||
ForwardSlash = 1 << 4,
|
|
||||||
|
|
||||||
BackSlash = 1 << 5,
|
|
||||||
|
|
||||||
Numbers = 1 << 6,
|
|
||||||
|
|
||||||
DownloadCode = 1 << 7,
|
|
||||||
|
|
||||||
Username = 1 << 8
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
internal enum PasswordMode : uint
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
Disabled,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
Enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
internal enum InputFormMode : uint
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
SingleLine,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
MultiLine
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
internal enum InitialCursorPosition : uint
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
Start,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
End
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
struct SoftwareKeyboardConfig
|
struct SoftwareKeyboardConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
private const int SubmitTextLength = 8;
|
||||||
///
|
private const int HeaderTextLength = 64;
|
||||||
/// </summary>
|
private const int SubtitleTextLength = 128;
|
||||||
const int SubmitTextLength = 8;
|
private const int GuideTextLength = 256;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
const int HeaderTextLength = 64;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
const int SubtitleTextLength = 128;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
const int GuideTextLength = 256;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Type of keyboard.
|
/// Type of keyboard.
|
||||||
|
@ -125,115 +19,118 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
public KeyboardMode Mode;
|
public KeyboardMode Mode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The string displayed in the Submit button.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubmitTextLength + 1)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubmitTextLength + 1)]
|
||||||
public string SubmitText;
|
public string SubmitText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The character displayed in the left button of the numeric keyboard.
|
||||||
|
/// This is ignored when Mode is not set to NumbersOnly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public char LeftOptionalSymbolKey;
|
public char LeftOptionalSymbolKey;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The character displayed in the right button of the numeric keyboard.
|
||||||
|
/// This is ignored when Mode is not set to NumbersOnly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public char RightOptionalSymbolKey;
|
public char RightOptionalSymbolKey;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// When set, predictive typing is enabled making use of the system dictionary,
|
||||||
|
/// and any custom user dictionary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool PredictionEnabled;
|
public bool PredictionEnabled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Specifies prohibited characters that cannot be input into the text entry area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InvalidCharFlags InvalidCharFlag;
|
public InvalidCharFlags InvalidCharFlag;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The initial position of the text cursor displayed in the text entry area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InitialCursorPosition InitialCursorPosition;
|
public InitialCursorPosition InitialCursorPosition;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The string displayed in the header area of the keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HeaderTextLength + 1)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HeaderTextLength + 1)]
|
||||||
public string HeaderText;
|
public string HeaderText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The string displayed in the subtitle area of the keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubtitleTextLength + 1)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubtitleTextLength + 1)]
|
||||||
public string SubtitleText;
|
public string SubtitleText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The placeholder string displayed in the text entry area when no text is entered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = GuideTextLength + 1)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = GuideTextLength + 1)]
|
||||||
public string GuideText;
|
public string GuideText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When non-zero, specifies the max string length. When the input is too long, swkbd will stop accepting more input until text is deleted via the B button (Backspace).
|
/// When non-zero, specifies the maximum allowed length of the string entered into the text entry area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StringLengthMax;
|
public int StringLengthMax;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When non-zero, specifies the minimum string length.
|
/// When non-zero, specifies the minimum allowed length of the string entered into the text entry area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StringLengthMin;
|
public int StringLengthMin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// When enabled, hides input characters as dots in the text entry area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PasswordMode PasswordMode;
|
public PasswordMode PasswordMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Specifies whether the text entry area is displayed as a single-line entry, or a multi-line entry field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InputFormMode InputFormMode;
|
public InputFormMode InputFormMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// When set, enables or disables the return key. This value is ignored when single-line entry is specified as the InputFormMode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool UseNewLine;
|
public bool UseNewLine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When set, the software keyboard will return a string UTF-8 encoded, rather than UTF-16.
|
/// When set, the software keyboard will return a UTF-8 encoded string, rather than UTF-16.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool UseUtf8;
|
public bool UseUtf8;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// When set, the software keyboard will blur the game application rendered behind the keyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool UseBlurBackground;
|
public bool UseBlurBackground;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Offset into the work buffer of the initial text when the keyboard is first displayed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int InitialStringOffset;
|
public int InitialStringOffset;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Length of the initial text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int InitialStringLength;
|
public int InitialStringLength;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Offset into the work buffer of the custom user dictionary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int CustomDictionaryOffset;
|
public int CustomDictionaryOffset;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number of entries in the custom user dictionary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int CustomDictionaryCount;
|
public int CustomDictionaryCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When set, the application will validate the entered text whilst the swkbd is still on screen.
|
/// When set, the text entered will be validated on the application side after the keyboard has been submitted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool CheckText;
|
public bool CheckText;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the software keyboard state.
|
||||||
|
/// </summary>
|
||||||
internal enum SoftwareKeyboardState
|
internal enum SoftwareKeyboardState
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue