/ src / Ryujinx.HLE / HOS / Applets / SoftwareKeyboard / SoftwareKeyboardConfig.cs
SoftwareKeyboardConfig.cs
  1  using System.Runtime.InteropServices;
  2  
  3  namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
  4  {
  5      /// <summary>
  6      /// A structure that defines the configuration options of the software keyboard.
  7      /// </summary>
  8      [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  9      struct SoftwareKeyboardConfig
 10      {
 11          private const int SubmitTextLength = 8;
 12          private const int HeaderTextLength = 64;
 13          private const int SubtitleTextLength = 128;
 14          private const int GuideTextLength = 256;
 15  
 16          /// <summary>
 17          /// Type of keyboard.
 18          /// </summary>
 19          public KeyboardMode Mode;
 20  
 21          /// <summary>
 22          /// The string displayed in the Submit button.
 23          /// </summary>
 24          [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubmitTextLength + 1)]
 25          public string SubmitText;
 26  
 27          /// <summary>
 28          /// The character displayed in the left button of the numeric keyboard.
 29          /// This is ignored when Mode is not set to NumbersOnly.
 30          /// </summary>
 31          public char LeftOptionalSymbolKey;
 32  
 33          /// <summary>
 34          /// The character displayed in the right button of the numeric keyboard.
 35          /// This is ignored when Mode is not set to NumbersOnly.
 36          /// </summary>
 37          public char RightOptionalSymbolKey;
 38  
 39          /// <summary>
 40          /// When set, predictive typing is enabled making use of the system dictionary,
 41          /// and any custom user dictionary.
 42          /// </summary>
 43          [MarshalAs(UnmanagedType.I1)]
 44          public bool PredictionEnabled;
 45  
 46          /// <summary>
 47          /// Specifies prohibited characters that cannot be input into the text entry area.
 48          /// </summary>
 49          public InvalidCharFlags InvalidCharFlag;
 50  
 51          /// <summary>
 52          /// The initial position of the text cursor displayed in the text entry area.
 53          /// </summary>
 54          public InitialCursorPosition InitialCursorPosition;
 55  
 56          /// <summary>
 57          /// The string displayed in the header area of the keyboard.
 58          /// </summary>
 59          [MarshalAs(UnmanagedType.ByValTStr, SizeConst = HeaderTextLength + 1)]
 60          public string HeaderText;
 61  
 62          /// <summary>
 63          /// The string displayed in the subtitle area of the keyboard.
 64          /// </summary>
 65          [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubtitleTextLength + 1)]
 66          public string SubtitleText;
 67  
 68          /// <summary>
 69          /// The placeholder string displayed in the text entry area when no text is entered.
 70          /// </summary>
 71          [MarshalAs(UnmanagedType.ByValTStr, SizeConst = GuideTextLength + 1)]
 72          public string GuideText;
 73  
 74          /// <summary>
 75          /// When non-zero, specifies the maximum allowed length of the string entered into the text entry area.
 76          /// </summary>
 77          public int StringLengthMax;
 78  
 79          /// <summary>
 80          /// When non-zero, specifies the minimum allowed length of the string entered into the text entry area.
 81          /// </summary>
 82          public int StringLengthMin;
 83  
 84          /// <summary>
 85          /// When enabled, hides input characters as dots in the text entry area.
 86          /// </summary>
 87          public PasswordMode PasswordMode;
 88  
 89          /// <summary>
 90          /// Specifies whether the text entry area is displayed as a single-line entry, or a multi-line entry field.
 91          /// </summary>
 92          public InputFormMode InputFormMode;
 93  
 94          /// <summary>
 95          /// When set, enables or disables the return key. This value is ignored when single-line entry is specified as the InputFormMode.
 96          /// </summary>
 97          [MarshalAs(UnmanagedType.I1)]
 98          public bool UseNewLine;
 99  
100          /// <summary>
101          /// When set, the software keyboard will return a UTF-8 encoded string, rather than UTF-16.
102          /// </summary>
103          [MarshalAs(UnmanagedType.I1)]
104          public bool UseUtf8;
105  
106          /// <summary>
107          /// When set, the software keyboard will blur the game application rendered behind the keyboard.
108          /// </summary>
109          [MarshalAs(UnmanagedType.I1)]
110          public bool UseBlurBackground;
111  
112          /// <summary>
113          /// Offset into the work buffer of the initial text when the keyboard is first displayed.
114          /// </summary>
115          public int InitialStringOffset;
116  
117          /// <summary>
118          /// Length of the initial text.
119          /// </summary>
120          public int InitialStringLength;
121  
122          /// <summary>
123          /// Offset into the work buffer of the custom user dictionary.
124          /// </summary>
125          public int CustomDictionaryOffset;
126  
127          /// <summary>
128          /// Number of entries in the custom user dictionary.
129          /// </summary>
130          public int CustomDictionaryCount;
131  
132          /// <summary>
133          /// When set, the text entered will be validated on the application side after the keyboard has been submitted.
134          /// </summary>
135          [MarshalAs(UnmanagedType.I1)]
136          public bool CheckText;
137      }
138  }