aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs
diff options
context:
space:
mode:
authorCaian Benedicto <caianbene@gmail.com>2021-10-12 16:54:21 -0300
committerGitHub <noreply@github.com>2021-10-12 21:54:21 +0200
commit380b95bc59e7dc419f89df951cdc086e792cb0ff (patch)
tree59a636b48db991d8e13132d7d3f41464d9b04b24 /Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs
parent69093cf2d69490862aff974f170cee63a0016fd0 (diff)
Inline software keyboard without input pop up dialog (#2180)
* Initial implementation * Refactor dynamic text input keys out to facilitate configuration via UI * Fix code styling * Add per applet indirect layer handles * Remove static functions from SoftwareKeyboardRenderer * Remove inline keyboard reset delay * Remove inline keyboard V2 responses * Add inline keyboard soft-lock recovering * Add comments * Forward accept and cancel key names to the keyboard and add soft-lock prevention line * Add dummy window to handle paste events * Rework inline keyboard state machine and graphics * Implement IHostUiHandler interfaces on headless WindowBase class * Add inline keyboard assets * Fix coding style * Fix coding style * Change mode cycling shortcut to F6 * Fix invalid calc size error in games using extended calc * Remove unnecessary namespaces
Diffstat (limited to 'Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs')
-rw-r--r--Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs79
1 files changed, 76 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs
index a80690c3..d6b2d05f 100644
--- a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs
+++ b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardCalc.cs
@@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet = CharSet.Unicode)]
struct SoftwareKeyboardCalc
{
- private const int InputTextLength = 505;
+ public const int InputTextLength = SoftwareKeyboardCalcEx.InputTextLength;
public uint Unknown;
@@ -21,22 +21,26 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
public byte Unknown2;
/// <summary>
- /// Configuration flags. Their purpose is currently unknown.
+ /// Configuration flags. Each bit in the bitfield enabled a different operation of the keyboard
+ /// using the data provided with the Calc structure.
/// </summary>
- public ulong Flags;
+ public KeyboardCalcFlags Flags;
/// <summary>
/// The original parameters used when initializing the keyboard applet.
+ /// Flag: 0x1
/// </summary>
public SoftwareKeyboardInitialize Initialize;
/// <summary>
/// The audio volume used by the sound effects of the keyboard.
+ /// Flag: 0x2
/// </summary>
public float Volume;
/// <summary>
/// The initial position of the text cursor (caret) in the provided input text.
+ /// Flag: 0x10
/// </summary>
public int CursorPos;
@@ -47,12 +51,14 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
/// <summary>
/// The initial input text to be used by the software keyboard.
+ /// Flag: 0x8
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = InputTextLength + 1)]
public string InputText;
/// <summary>
/// When set, the strings communicated by software keyboard will be encoded as UTF-8 instead of UTF-16.
+ /// Flag: 0x20
/// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool UseUtf8;
@@ -61,6 +67,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
/// <summary>
/// [5.0.0+] Enable the backspace key in the software keyboard.
+ /// Flag: 0x8000
/// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool BackspaceEnabled;
@@ -68,25 +75,39 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
public short Unknown4;
public byte Unknown5;
+ /// <summary>
+ /// Flag: 0x200
+ /// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool KeytopAsFloating;
+ /// <summary>
+ /// Flag: 0x100
+ /// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool FooterScalable;
+ /// <summary>
+ /// Flag: 0x100
+ /// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool AlphaEnabledInInputMode;
+ /// <summary>
+ /// Flag: 0x100
+ /// </summary>
public byte InputModeFadeType;
/// <summary>
/// When set, the software keyboard ignores touch input.
+ /// Flag: 0x200
/// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool TouchDisabled;
/// <summary>
/// When set, the software keyboard ignores hardware keyboard commands.
+ /// Flag: 0x800
/// </summary>
[MarshalAs(UnmanagedType.I1)]
public bool HardwareKeyboardDisabled;
@@ -96,11 +117,13 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
/// <summary>
/// Default value is 1.0.
+ /// Flag: 0x200
/// </summary>
public float KeytopScale0;
/// <summary>
/// Default value is 1.0.
+ /// Flag: 0x200
/// </summary>
public float KeytopScale1;
@@ -109,16 +132,19 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
/// <summary>
/// Default value is 1.0.
+ /// Flag: 0x100
/// </summary>
public float KeytopBgAlpha;
/// <summary>
/// Default value is 1.0.
+ /// Flag: 0x100
/// </summary>
public float FooterBgAlpha;
/// <summary>
/// Default value is 1.0.
+ /// Flag: 0x200
/// </summary>
public float BalloonScale;
@@ -129,6 +155,8 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
/// <summary>
/// [5.0.0+] Enable sound effect.
+ /// Flag: Enable: 0x2000
+ /// Disable: 0x4000
/// </summary>
public byte SeGroup;
@@ -143,5 +171,50 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
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;
+ }
}
}