/ src / Ryujinx.HLE / HOS / Applets / SoftwareKeyboard / SoftwareKeyboardCalcEx.cs
SoftwareKeyboardCalcEx.cs
  1  using System.Runtime.InteropServices;
  2  
  3  namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
  4  {
  5      /// <summary>
  6      /// A structure with configuration options of the software keyboard when starting a new input request in inline mode.
  7      /// This is the extended version of the structure with extended appear options.
  8      /// </summary>
  9      [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
 10      struct SoftwareKeyboardCalcEx
 11      {
 12          /// <summary>
 13          /// This struct was built following Switchbrew's specs, but this size (larger) is also found in real games.
 14          /// It's assumed that this is padding at the end of this struct, because all members seem OK.
 15          /// </summary>
 16          public const int AlternativeSize = 1256;
 17  
 18          public const int InputTextLength = 505;
 19  
 20          public uint Unknown;
 21  
 22          /// <summary>
 23          /// The size of the Calc struct, as reported by the process communicating with the applet.
 24          /// </summary>
 25          public ushort Size;
 26  
 27          public byte Unknown1;
 28          public byte Unknown2;
 29  
 30          /// <summary>
 31          /// Configuration flags. Each bit in the bitfield enabled a different operation of the keyboard
 32          /// using the data provided with the Calc structure.
 33          /// </summary>
 34          public KeyboardCalcFlags Flags;
 35  
 36          /// <summary>
 37          /// The original parameters used when initializing the keyboard applet.
 38          /// Flag: 0x1
 39          /// </summary>
 40          public SoftwareKeyboardInitialize Initialize;
 41  
 42          /// <summary>
 43          /// The audio volume used by the sound effects of the keyboard.
 44          /// Flag: 0x2
 45          /// </summary>
 46          public float Volume;
 47  
 48          /// <summary>
 49          /// The initial position of the text cursor (caret) in the provided input text.
 50          /// Flag: 0x10
 51          /// </summary>
 52          public int CursorPos;
 53  
 54          /// <summary>
 55          /// Appearance configurations for the on-screen keyboard.
 56          /// </summary>
 57          public SoftwareKeyboardAppearEx Appear;
 58  
 59          /// <summary>
 60          /// The initial input text to be used by the software keyboard.
 61          /// Flag: 0x8
 62          /// </summary>
 63          [MarshalAs(UnmanagedType.ByValTStr, SizeConst = InputTextLength + 1)]
 64          public string InputText;
 65  
 66          /// <summary>
 67          /// When set, the strings communicated by software keyboard will be encoded as UTF-8 instead of UTF-16.
 68          /// Flag: 0x20
 69          /// </summary>
 70          [MarshalAs(UnmanagedType.I1)]
 71          public bool UseUtf8;
 72  
 73          public byte Unknown3;
 74  
 75          /// <summary>
 76          /// [5.0.0+] Enable the backspace key in the software keyboard.
 77          /// Flag: 0x8000
 78          /// </summary>
 79          [MarshalAs(UnmanagedType.I1)]
 80          public bool BackspaceEnabled;
 81  
 82          public short Unknown4;
 83          public byte Unknown5;
 84  
 85          /// <summary>
 86          /// Flag: 0x200
 87          /// </summary>
 88          [MarshalAs(UnmanagedType.I1)]
 89          public bool KeytopAsFloating;
 90  
 91          /// <summary>
 92          /// Flag: 0x100
 93          /// </summary>
 94          [MarshalAs(UnmanagedType.I1)]
 95          public bool FooterScalable;
 96  
 97          /// <summary>
 98          /// Flag: 0x100
 99          /// </summary>
100          [MarshalAs(UnmanagedType.I1)]
101          public bool AlphaEnabledInInputMode;
102  
103          /// <summary>
104          /// Flag: 0x100
105          /// </summary>
106          public byte InputModeFadeType;
107  
108          /// <summary>
109          /// When set, the software keyboard ignores touch input.
110          /// Flag: 0x200
111          /// </summary>
112          [MarshalAs(UnmanagedType.I1)]
113          public bool TouchDisabled;
114  
115          /// <summary>
116          /// When set, the software keyboard ignores hardware keyboard commands.
117          /// Flag: 0x800
118          /// </summary>
119          [MarshalAs(UnmanagedType.I1)]
120          public bool HardwareKeyboardDisabled;
121  
122          public uint Unknown6;
123          public uint Unknown7;
124  
125          /// <summary>
126          /// Default value is 1.0.
127          /// Flag: 0x200
128          /// </summary>
129          public float KeytopScale0;
130  
131          /// <summary>
132          /// Default value is 1.0.
133          /// Flag: 0x200
134          /// </summary>
135          public float KeytopScale1;
136  
137          public float KeytopTranslate0;
138          public float KeytopTranslate1;
139  
140          /// <summary>
141          /// Default value is 1.0.
142          /// Flag: 0x100
143          /// </summary>
144          public float KeytopBgAlpha;
145  
146          /// <summary>
147          /// Default value is 1.0.
148          /// Flag: 0x100
149          /// </summary>
150          public float FooterBgAlpha;
151  
152          /// <summary>
153          /// Default value is 1.0.
154          /// Flag: 0x200
155          /// </summary>
156          public float BalloonScale;
157  
158          public float Unknown8;
159          public uint Unknown9;
160          public uint Unknown10;
161          public uint Unknown11;
162  
163          /// <summary>
164          /// [5.0.0+] Enable sound effect.
165          /// Flag: Enable:  0x2000
166          ///       Disable: 0x4000
167          /// </summary>
168          public byte SeGroup;
169  
170          /// <summary>
171          /// [6.0.0+] Enables the Trigger field when Trigger is non-zero.
172          /// </summary>
173          public byte TriggerFlag;
174  
175          /// <summary>
176          /// [6.0.0+] Always set to zero.
177          /// </summary>
178          public byte Trigger;
179  
180          public byte Padding;
181      }
182  }