Add documentation

This commit is contained in:
jduncanator 2019-11-18 10:32:15 +11:00
parent 1c3c229fad
commit 99386091c0
4 changed files with 47 additions and 2 deletions

View file

@ -56,16 +56,22 @@ namespace Ryujinx.HLE.HOS.Applets
private void Execute()
{
// If the keyboard type is numbers only, we swap to a default
// text that only contains numbers.
if (_keyboardConfig.Type == SoftwareKeyboardType.NumbersOnly)
{
_textValue = DEFAULT_NUMB;
}
// If the max string length is 0, we set it to a large default
// length.
if (_keyboardConfig.StringLengthMax == 0)
{
_keyboardConfig.StringLengthMax = 100;
}
// If our default text is longer than the allowed length,
// we trunacte it.
if (_textValue.Length > _keyboardConfig.StringLengthMax)
{
_textValue = _textValue.Substring(0, (int)_keyboardConfig.StringLengthMax);
@ -120,6 +126,7 @@ namespace Ryujinx.HLE.HOS.Applets
}
else
{
// We shouldn't be able to get here through standard swkbd execution.
throw new InvalidOperationException("Software Keyboard is in an invalid state.");
}
}

View file

@ -6,15 +6,27 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
[StructLayout(LayoutKind.Explicit)]
struct SoftwareKeyboardConfig
{
/// <summary>
/// Type of keyboard.
/// </summary>
[FieldOffset(0x0)]
public SoftwareKeyboardType Type;
/// <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).
/// </summary>
[FieldOffset(0x3AC)]
public uint StringLengthMax;
/// <summary>
/// When non-zero, specifies the max string length. When the input is too long, swkbd will display an icon and disable the ok-button.
/// </summary>
[FieldOffset(0x3B0)]
public uint StringLengthMaxExtended;
/// <summary>
/// When set, the application will validate the entered text whilst the swkbd is still on screen.
/// </summary>
[FieldOffset(0x3D0), MarshalAs(UnmanagedType.I1)]
public bool CheckText;
}

View file

@ -2,9 +2,24 @@
{
internal enum SoftwareKeyboardState
{
/// <summary>
/// swkbd is uninitialized.
/// </summary>
Uninitialized,
/// <summary>
/// swkbd is ready to process data.
/// </summary>
Ready,
/// <summary>
/// swkbd is awaiting an interactive reply with a validation status.
/// </summary>
ValidationPending,
/// <summary>
/// swkbd has completed.
/// </summary>
Complete
}
}

View file

@ -2,8 +2,19 @@
{
internal enum SoftwareKeyboardType : uint
{
/// <summary>
/// Normal keyboard.
/// </summary>
Default = 0,
/// <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 = 1,
/// <summary>
/// QWERTY (and variants) keyboard only.
/// </summary>
LettersOnly = 2
}
}