/ src / Ryujinx.HLE / HOS / Applets / SoftwareKeyboard / SoftwareKeyboardAppear.cs
SoftwareKeyboardAppear.cs
  1  using System.Runtime.InteropServices;
  2  
  3  namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
  4  {
  5      /// <summary>
  6      /// A structure with appearance configurations for the software keyboard when running in inline mode.
  7      /// </summary>
  8      [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
  9      struct SoftwareKeyboardAppear
 10      {
 11          public const int OkTextLength = SoftwareKeyboardAppearEx.OkTextLength;
 12  
 13          public KeyboardMode KeyboardMode;
 14  
 15          /// <summary>
 16          /// The string displayed in the Submit button.
 17          /// </summary>
 18          [MarshalAs(UnmanagedType.ByValTStr, SizeConst = OkTextLength + 1)]
 19          public string OkText;
 20  
 21          /// <summary>
 22          /// The character displayed in the left button of the numeric keyboard.
 23          /// </summary>
 24          public char LeftOptionalSymbolKey;
 25  
 26          /// <summary>
 27          /// The character displayed in the right button of the numeric keyboard.
 28          /// </summary>
 29          public char RightOptionalSymbolKey;
 30  
 31          /// <summary>
 32          /// When set, predictive typing is enabled making use of the system dictionary, and any custom user dictionary.
 33          /// </summary>
 34          [MarshalAs(UnmanagedType.I1)]
 35          public bool PredictionEnabled;
 36  
 37          /// <summary>
 38          /// When set, there is only the option to accept the input.
 39          /// </summary>
 40          [MarshalAs(UnmanagedType.I1)]
 41          public bool CancelButtonDisabled;
 42  
 43          /// <summary>
 44          /// Specifies prohibited characters that cannot be input into the text entry area.
 45          /// </summary>
 46          public InvalidCharFlags InvalidChars;
 47  
 48          /// <summary>
 49          /// Maximum text length allowed.
 50          /// </summary>
 51          public int TextMaxLength;
 52  
 53          /// <summary>
 54          /// Minimum text length allowed.
 55          /// </summary>
 56          public int TextMinLength;
 57  
 58          /// <summary>
 59          /// Indicates the return button is enabled in the keyboard. This allows for input with multiple lines.
 60          /// </summary>
 61          [MarshalAs(UnmanagedType.I1)]
 62          public bool UseNewLine;
 63  
 64          /// <summary>
 65          /// [10.0.0+] If value is 1 or 2, then keytopAsFloating=0 and footerScalable=1 in Calc.
 66          /// </summary>
 67          public KeyboardMiniaturizationMode MiniaturizationMode;
 68  
 69          public byte Reserved1;
 70          public byte Reserved2;
 71  
 72          /// <summary>
 73          /// Bit field with invalid buttons for the keyboard.
 74          /// </summary>
 75          public InvalidButtonFlags InvalidButtons;
 76  
 77          [MarshalAs(UnmanagedType.I1)]
 78          public bool UseSaveData;
 79  
 80          public uint Reserved3;
 81          public ushort Reserved4;
 82          public byte Reserved5;
 83          public ulong Reserved6;
 84          public ulong Reserved7;
 85  
 86          public SoftwareKeyboardAppearEx ToExtended()
 87          {
 88              SoftwareKeyboardAppearEx appear = new()
 89              {
 90                  KeyboardMode = KeyboardMode,
 91                  OkText = OkText,
 92                  LeftOptionalSymbolKey = LeftOptionalSymbolKey,
 93                  RightOptionalSymbolKey = RightOptionalSymbolKey,
 94                  PredictionEnabled = PredictionEnabled,
 95                  CancelButtonDisabled = CancelButtonDisabled,
 96                  InvalidChars = InvalidChars,
 97                  TextMaxLength = TextMaxLength,
 98                  TextMinLength = TextMinLength,
 99                  UseNewLine = UseNewLine,
100                  MiniaturizationMode = MiniaturizationMode,
101                  Reserved1 = Reserved1,
102                  Reserved2 = Reserved2,
103                  InvalidButtons = InvalidButtons,
104                  UseSaveData = UseSaveData,
105                  Reserved3 = Reserved3,
106                  Reserved4 = Reserved4,
107                  Reserved5 = Reserved5,
108                  Uid0 = Reserved6,
109                  Uid1 = Reserved7,
110                  SamplingNumber = 0,
111                  Reserved6 = 0,
112                  Reserved7 = 0,
113                  Reserved8 = 0,
114                  Reserved9 = 0,
115              };
116  
117              return appear;
118          }
119      }
120  }