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 System;
|
||||
using System.IO;
|
||||
|
@ -43,7 +42,11 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||
var transferMemory = _normalSession.Pop();
|
||||
|
||||
_keyboardConfig = ReadStruct<SoftwareKeyboardConfig>(keyboardConfig);
|
||||
_encoding = _keyboardConfig.UseUtf8 ? Encoding.UTF8 : Encoding.Unicode;
|
||||
|
||||
if (_keyboardConfig.UseUtf8)
|
||||
{
|
||||
_encoding = Encoding.UTF8;
|
||||
}
|
||||
|
||||
_state = SoftwareKeyboardState.Ready;
|
||||
|
||||
|
@ -90,7 +93,17 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||
}
|
||||
|
||||
// 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,
|
||||
// we push the data to the non-interactive output buffer
|
||||
|
@ -101,16 +114,6 @@ namespace Ryujinx.HLE.HOS.Applets
|
|||
|
||||
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)
|
||||
|
|
|
@ -3,121 +3,15 @@
|
|||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// A structure that defines the configuration options of the software keyboard.
|
||||
/// </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)]
|
||||
struct SoftwareKeyboardConfig
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const int SubmitTextLength = 8;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const int HeaderTextLength = 64;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const int SubtitleTextLength = 128;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
const int GuideTextLength = 256;
|
||||
private const int SubmitTextLength = 8;
|
||||
private const int HeaderTextLength = 64;
|
||||
private const int SubtitleTextLength = 128;
|
||||
private const int GuideTextLength = 256;
|
||||
|
||||
/// <summary>
|
||||
/// Type of keyboard.
|
||||
|
@ -125,115 +19,118 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||
public KeyboardMode Mode;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The string displayed in the Submit button.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubmitTextLength + 1)]
|
||||
public string SubmitText;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The character displayed in the left button of the numeric keyboard.
|
||||
/// This is ignored when Mode is not set to NumbersOnly.
|
||||
/// </summary>
|
||||
public char LeftOptionalSymbolKey;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The character displayed in the right button of the numeric keyboard.
|
||||
/// This is ignored when Mode is not set to NumbersOnly.
|
||||
/// </summary>
|
||||
public char RightOptionalSymbolKey;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// When set, predictive typing is enabled making use of the system dictionary,
|
||||
/// and any custom user dictionary.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool PredictionEnabled;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Specifies prohibited characters that cannot be input into the text entry area.
|
||||
/// </summary>
|
||||
public InvalidCharFlags InvalidCharFlag;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The initial position of the text cursor displayed in the text entry area.
|
||||
/// </summary>
|
||||
public InitialCursorPosition InitialCursorPosition;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The string displayed in the header area of the keyboard.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HeaderTextLength + 1)]
|
||||
public string HeaderText;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The string displayed in the subtitle area of the keyboard.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubtitleTextLength + 1)]
|
||||
public string SubtitleText;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The placeholder string displayed in the text entry area when no text is entered.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = GuideTextLength + 1)]
|
||||
public string GuideText;
|
||||
|
||||
/// <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>
|
||||
public int StringLengthMax;
|
||||
|
||||
/// <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>
|
||||
public int StringLengthMin;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// When enabled, hides input characters as dots in the text entry area.
|
||||
/// </summary>
|
||||
public PasswordMode PasswordMode;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Specifies whether the text entry area is displayed as a single-line entry, or a multi-line entry field.
|
||||
/// </summary>
|
||||
public InputFormMode InputFormMode;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// When set, enables or disables the return key. This value is ignored when single-line entry is specified as the InputFormMode.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool UseNewLine;
|
||||
|
||||
/// <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>
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool UseUtf8;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// When set, the software keyboard will blur the game application rendered behind the keyboard.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool UseBlurBackground;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Offset into the work buffer of the initial text when the keyboard is first displayed.
|
||||
/// </summary>
|
||||
public int InitialStringOffset;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Length of the initial text.
|
||||
/// </summary>
|
||||
public int InitialStringLength;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Offset into the work buffer of the custom user dictionary.
|
||||
/// </summary>
|
||||
public int CustomDictionaryOffset;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Number of entries in the custom user dictionary.
|
||||
/// </summary>
|
||||
public int CustomDictionaryCount;
|
||||
|
||||
/// <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>
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool CheckText;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the software keyboard state.
|
||||
/// </summary>
|
||||
internal enum SoftwareKeyboardState
|
||||
{
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Reference in a new issue