Add Software Keyboard, Edit maxSets and more

This commit is contained in:
Stossy11 2025-02-11 20:22:50 +11:00
parent c3ade6f5cd
commit eb4a4593ea
28 changed files with 283 additions and 1709 deletions

View file

@ -81,57 +81,10 @@ namespace Ryujinx.Ui.Applet
return okPressed;
}
public bool DisplayInputDialog(SoftwareKeyboardUiArgs args, out string userText)
public void DisplayInputDialog(SoftwareKeyboardUiArgs args, Action<string> onTextEntered)
{
ManualResetEvent dialogCloseEvent = new(false);
bool okPressed = false;
bool error = false;
string inputText = args.InitialText ?? "";
Application.Invoke(delegate
{
try
{
var swkbdDialog = new SwkbdAppletDialog(_parent)
{
Title = "Software Keyboard",
Text = args.HeaderText,
SecondaryText = args.SubtitleText,
};
swkbdDialog.InputEntry.Text = inputText;
swkbdDialog.InputEntry.PlaceholderText = args.GuideText;
swkbdDialog.OkButton.Label = args.SubmitText;
swkbdDialog.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax);
swkbdDialog.SetInputValidation(args.KeyboardMode);
if (swkbdDialog.Run() == (int)ResponseType.Ok)
{
inputText = swkbdDialog.InputEntry.Text;
okPressed = true;
}
swkbdDialog.Dispose();
}
catch (Exception ex)
{
error = true;
GtkDialog.CreateErrorDialog($"Error displaying Software Keyboard: {ex}");
}
finally
{
dialogCloseEvent.Set();
}
});
dialogCloseEvent.WaitOne();
userText = error ? null : inputText;
return error || okPressed;
onTextEntered?.Invoke("MeloNX");
return;
}
public void ExecuteProgram(HLE.Switch device, ProgramSpecifyKind kind, ulong value)