diff --git a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
index 0c374125f1..5d7b1e05c6 100644
--- a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
+++ b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
@@ -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.");
}
}
diff --git a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardConfig.cs b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardConfig.cs
index 22d1c0ab82..183da774ce 100644
--- a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardConfig.cs
+++ b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardConfig.cs
@@ -6,15 +6,27 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
[StructLayout(LayoutKind.Explicit)]
struct SoftwareKeyboardConfig
{
+ ///
+ /// Type of keyboard.
+ ///
[FieldOffset(0x0)]
public SoftwareKeyboardType Type;
-
+
+ ///
+ /// 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).
+ ///
[FieldOffset(0x3AC)]
public uint StringLengthMax;
-
+
+ ///
+ /// When non-zero, specifies the max string length. When the input is too long, swkbd will display an icon and disable the ok-button.
+ ///
[FieldOffset(0x3B0)]
public uint StringLengthMaxExtended;
+ ///
+ /// When set, the application will validate the entered text whilst the swkbd is still on screen.
+ ///
[FieldOffset(0x3D0), MarshalAs(UnmanagedType.I1)]
public bool CheckText;
}
diff --git a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardState.cs b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardState.cs
index a8a71aa36f..42a2831ec9 100644
--- a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardState.cs
+++ b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardState.cs
@@ -2,9 +2,24 @@
{
internal enum SoftwareKeyboardState
{
+ ///
+ /// swkbd is uninitialized.
+ ///
Uninitialized,
+
+ ///
+ /// swkbd is ready to process data.
+ ///
Ready,
+
+ ///
+ /// swkbd is awaiting an interactive reply with a validation status.
+ ///
ValidationPending,
+
+ ///
+ /// swkbd has completed.
+ ///
Complete
}
}
\ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardType.cs b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardType.cs
index 7e7f3a758a..4875da8098 100644
--- a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardType.cs
+++ b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardType.cs
@@ -2,8 +2,19 @@
{
internal enum SoftwareKeyboardType : uint
{
+ ///
+ /// Normal keyboard.
+ ///
Default = 0,
+
+ ///
+ /// Number pad. The buttons at the bottom left/right are only available when they're set in the config by leftButtonText / rightButtonText.
+ ///
NumbersOnly = 1,
+
+ ///
+ /// QWERTY (and variants) keyboard only.
+ ///
LettersOnly = 2
}
}
\ No newline at end of file