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