2021-01-11 19:27:55 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// A structure with configuration options of the software keyboard when starting a new input request in inline mode.
|
2021-01-11 19:27:55 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet = CharSet.Unicode)]
|
|
|
|
|
struct SoftwareKeyboardCalc
|
|
|
|
|
{
|
2021-10-12 21:54:21 +02:00
|
|
|
|
public const int InputTextLength = SoftwareKeyboardCalcEx.InputTextLength;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
|
|
|
|
public uint Unknown;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The size of the Calc struct, as reported by the process communicating with the applet.
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public ushort Size;
|
|
|
|
|
|
|
|
|
|
public byte Unknown1;
|
|
|
|
|
public byte Unknown2;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Configuration flags. Each bit in the bitfield enabled a different operation of the keyboard
|
|
|
|
|
/// using the data provided with the Calc structure.
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-10-12 21:54:21 +02:00
|
|
|
|
public KeyboardCalcFlags Flags;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The original parameters used when initializing the keyboard applet.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x1
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public SoftwareKeyboardInitialize Initialize;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The audio volume used by the sound effects of the keyboard.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x2
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float Volume;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The initial position of the text cursor (caret) in the provided input text.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x10
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public int CursorPos;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Appearance configurations for the on-screen keyboard.
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public SoftwareKeyboardAppear Appear;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The initial input text to be used by the software keyboard.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x8
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = InputTextLength + 1)]
|
|
|
|
|
public string InputText;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// When set, the strings communicated by software keyboard will be encoded as UTF-8 instead of UTF-16.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x20
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
|
|
|
|
public bool UseUtf8;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
|
|
|
|
public byte Unknown3;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// [5.0.0+] Enable the backspace key in the software keyboard.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x8000
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
|
|
|
|
public bool BackspaceEnabled;
|
|
|
|
|
|
|
|
|
|
public short Unknown4;
|
|
|
|
|
public byte Unknown5;
|
|
|
|
|
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Flag: 0x200
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
2021-02-11 01:28:44 +01:00
|
|
|
|
public bool KeytopAsFloating;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Flag: 0x100
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
2021-02-11 01:28:44 +01:00
|
|
|
|
public bool FooterScalable;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Flag: 0x100
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
2021-02-11 01:28:44 +01:00
|
|
|
|
public bool AlphaEnabledInInputMode;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Flag: 0x100
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public byte InputModeFadeType;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// When set, the software keyboard ignores touch input.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x200
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
2021-02-11 01:28:44 +01:00
|
|
|
|
public bool TouchDisabled;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// When set, the software keyboard ignores hardware keyboard commands.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x800
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
2021-02-11 01:28:44 +01:00
|
|
|
|
public bool HardwareKeyboardDisabled;
|
2021-01-11 19:27:55 +01:00
|
|
|
|
|
|
|
|
|
public uint Unknown6;
|
|
|
|
|
public uint Unknown7;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default value is 1.0.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x200
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float KeytopScale0;
|
2021-02-11 01:28:44 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default value is 1.0.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x200
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float KeytopScale1;
|
2021-02-11 01:28:44 +01:00
|
|
|
|
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float KeytopTranslate0;
|
|
|
|
|
public float KeytopTranslate1;
|
2021-02-11 01:28:44 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default value is 1.0.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x100
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float KeytopBgAlpha;
|
2021-02-11 01:28:44 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default value is 1.0.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x100
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float FooterBgAlpha;
|
2021-02-11 01:28:44 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default value is 1.0.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: 0x200
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public float BalloonScale;
|
|
|
|
|
|
|
|
|
|
public float Unknown8;
|
|
|
|
|
public uint Unknown9;
|
|
|
|
|
public uint Unknown10;
|
|
|
|
|
public uint Unknown11;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// [5.0.0+] Enable sound effect.
|
2021-10-12 21:54:21 +02:00
|
|
|
|
/// Flag: Enable: 0x2000
|
|
|
|
|
/// Disable: 0x4000
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public byte SeGroup;
|
|
|
|
|
|
2021-02-11 01:28:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// [6.0.0+] Enables the Trigger field when Trigger is non-zero.
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public byte TriggerFlag;
|
2021-02-11 01:28:44 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// [6.0.0+] Always set to zero.
|
|
|
|
|
/// </summary>
|
2021-01-11 19:27:55 +01:00
|
|
|
|
public byte Trigger;
|
|
|
|
|
|
|
|
|
|
public byte Padding;
|
2021-10-12 21:54:21 +02:00
|
|
|
|
|
|
|
|
|
public SoftwareKeyboardCalcEx ToExtended()
|
|
|
|
|
{
|
|
|
|
|
SoftwareKeyboardCalcEx calc = new SoftwareKeyboardCalcEx();
|
|
|
|
|
|
|
|
|
|
calc.Unknown = Unknown;
|
|
|
|
|
calc.Size = Size;
|
|
|
|
|
calc.Unknown1 = Unknown1;
|
|
|
|
|
calc.Unknown2 = Unknown2;
|
|
|
|
|
calc.Flags = Flags;
|
|
|
|
|
calc.Initialize = Initialize;
|
|
|
|
|
calc.Volume = Volume;
|
|
|
|
|
calc.CursorPos = CursorPos;
|
|
|
|
|
calc.Appear = Appear.ToExtended();
|
|
|
|
|
calc.InputText = InputText;
|
|
|
|
|
calc.UseUtf8 = UseUtf8;
|
|
|
|
|
calc.Unknown3 = Unknown3;
|
|
|
|
|
calc.BackspaceEnabled = BackspaceEnabled;
|
|
|
|
|
calc.Unknown4 = Unknown4;
|
|
|
|
|
calc.Unknown5 = Unknown5;
|
|
|
|
|
calc.KeytopAsFloating = KeytopAsFloating;
|
|
|
|
|
calc.FooterScalable = FooterScalable;
|
|
|
|
|
calc.AlphaEnabledInInputMode = AlphaEnabledInInputMode;
|
|
|
|
|
calc.InputModeFadeType = InputModeFadeType;
|
|
|
|
|
calc.TouchDisabled = TouchDisabled;
|
|
|
|
|
calc.HardwareKeyboardDisabled = HardwareKeyboardDisabled;
|
|
|
|
|
calc.Unknown6 = Unknown6;
|
|
|
|
|
calc.Unknown7 = Unknown7;
|
|
|
|
|
calc.KeytopScale0 = KeytopScale0;
|
|
|
|
|
calc.KeytopScale1 = KeytopScale1;
|
|
|
|
|
calc.KeytopTranslate0 = KeytopTranslate0;
|
|
|
|
|
calc.KeytopTranslate1 = KeytopTranslate1;
|
|
|
|
|
calc.KeytopBgAlpha = KeytopBgAlpha;
|
|
|
|
|
calc.FooterBgAlpha = FooterBgAlpha;
|
|
|
|
|
calc.BalloonScale = BalloonScale;
|
|
|
|
|
calc.Unknown8 = Unknown8;
|
|
|
|
|
calc.Unknown9 = Unknown9;
|
|
|
|
|
calc.Unknown10 = Unknown10;
|
|
|
|
|
calc.Unknown11 = Unknown11;
|
|
|
|
|
calc.SeGroup = SeGroup;
|
|
|
|
|
calc.TriggerFlag = TriggerFlag;
|
|
|
|
|
calc.Trigger = Trigger;
|
|
|
|
|
|
|
|
|
|
return calc;
|
|
|
|
|
}
|
2021-01-11 19:27:55 +01:00
|
|
|
|
}
|
|
|
|
|
}
|