Add documentation
This commit is contained in:
parent
1c3c229fad
commit
99386091c0
4 changed files with 47 additions and 2 deletions
|
@ -56,16 +56,22 @@ namespace Ryujinx.HLE.HOS.Applets
|
||||||
|
|
||||||
private void Execute()
|
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)
|
if (_keyboardConfig.Type == SoftwareKeyboardType.NumbersOnly)
|
||||||
{
|
{
|
||||||
_textValue = DEFAULT_NUMB;
|
_textValue = DEFAULT_NUMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the max string length is 0, we set it to a large default
|
||||||
|
// length.
|
||||||
if (_keyboardConfig.StringLengthMax == 0)
|
if (_keyboardConfig.StringLengthMax == 0)
|
||||||
{
|
{
|
||||||
_keyboardConfig.StringLengthMax = 100;
|
_keyboardConfig.StringLengthMax = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If our default text is longer than the allowed length,
|
||||||
|
// we trunacte it.
|
||||||
if (_textValue.Length > _keyboardConfig.StringLengthMax)
|
if (_textValue.Length > _keyboardConfig.StringLengthMax)
|
||||||
{
|
{
|
||||||
_textValue = _textValue.Substring(0, (int)_keyboardConfig.StringLengthMax);
|
_textValue = _textValue.Substring(0, (int)_keyboardConfig.StringLengthMax);
|
||||||
|
@ -120,6 +126,7 @@ namespace Ryujinx.HLE.HOS.Applets
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// We shouldn't be able to get here through standard swkbd execution.
|
||||||
throw new InvalidOperationException("Software Keyboard is in an invalid state.");
|
throw new InvalidOperationException("Software Keyboard is in an invalid state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,27 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
struct SoftwareKeyboardConfig
|
struct SoftwareKeyboardConfig
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of keyboard.
|
||||||
|
/// </summary>
|
||||||
[FieldOffset(0x0)]
|
[FieldOffset(0x0)]
|
||||||
public SoftwareKeyboardType Type;
|
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)]
|
[FieldOffset(0x3AC)]
|
||||||
public uint StringLengthMax;
|
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)]
|
[FieldOffset(0x3B0)]
|
||||||
public uint StringLengthMaxExtended;
|
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)]
|
[FieldOffset(0x3D0), MarshalAs(UnmanagedType.I1)]
|
||||||
public bool CheckText;
|
public bool CheckText;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,24 @@
|
||||||
{
|
{
|
||||||
internal enum SoftwareKeyboardState
|
internal enum SoftwareKeyboardState
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// swkbd is uninitialized.
|
||||||
|
/// </summary>
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// swkbd is ready to process data.
|
||||||
|
/// </summary>
|
||||||
Ready,
|
Ready,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// swkbd is awaiting an interactive reply with a validation status.
|
||||||
|
/// </summary>
|
||||||
ValidationPending,
|
ValidationPending,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// swkbd has completed.
|
||||||
|
/// </summary>
|
||||||
Complete
|
Complete
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,8 +2,19 @@
|
||||||
{
|
{
|
||||||
internal enum SoftwareKeyboardType : uint
|
internal enum SoftwareKeyboardType : uint
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Normal keyboard.
|
||||||
|
/// </summary>
|
||||||
Default = 0,
|
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,
|
NumbersOnly = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// QWERTY (and variants) keyboard only.
|
||||||
|
/// </summary>
|
||||||
LettersOnly = 2
|
LettersOnly = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue