mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-07-10 09:16:27 +02:00
Add Software Keyboard, Edit maxSets and more
This commit is contained in:
parent
c3ade6f5cd
commit
eb4a4593ea
28 changed files with 283 additions and 1709 deletions
42
src/Ryujinx.Headless.SDL2/Keyboard-iOS.cs
Normal file
42
src/Ryujinx.Headless.SDL2/Keyboard-iOS.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Ryujinx.Ui.Common.Helper;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
public static class AlertHelper
|
||||
{
|
||||
[DllImport("RyujinxKeyboard.framework/RyujinxKeyboard", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void showKeyboardAlert(string title, string message, string placeholder);
|
||||
|
||||
[DllImport("RyujinxKeyboard.framework/RyujinxKeyboard", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr getKeyboardInput();
|
||||
|
||||
[DllImport("RyujinxKeyboard.framework/RyujinxKeyboard", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void clearKeyboardInput();
|
||||
|
||||
public static void ShowAlertWithTextInput(string title, string message, string placeholder, Action<string> onTextEntered)
|
||||
{
|
||||
showKeyboardAlert(title, message, placeholder);
|
||||
|
||||
ThreadPool.QueueUserWorkItem(_ =>
|
||||
{
|
||||
string result = null;
|
||||
while (result == null)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
|
||||
IntPtr inputPtr = getKeyboardInput();
|
||||
if (inputPtr != IntPtr.Zero)
|
||||
{
|
||||
result = Marshal.PtrToStringAnsi(inputPtr);
|
||||
clearKeyboardInput();
|
||||
|
||||
onTextEntered?.Invoke(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -460,12 +460,19 @@ namespace Ryujinx.Headless.SDL2
|
|||
Exit();
|
||||
}
|
||||
|
||||
public bool DisplayInputDialog(SoftwareKeyboardUiArgs args, out string userText)
|
||||
public void DisplayInputDialog(SoftwareKeyboardUiArgs args, Action<string> onTextEntered)
|
||||
{
|
||||
// SDL2 doesn't support input dialogs
|
||||
userText = "Ryujinx";
|
||||
|
||||
return true;
|
||||
// Trying to use Objective-C on iDevices
|
||||
if (OperatingSystem.IsIOS())
|
||||
{
|
||||
AlertHelper.ShowAlertWithTextInput(args.HeaderText, args.SubtitleText, args.GuideText, (inputText) =>
|
||||
{
|
||||
onTextEntered?.Invoke(inputText);
|
||||
});
|
||||
} else {
|
||||
onTextEntered?.Invoke("");
|
||||
}
|
||||
}
|
||||
|
||||
public bool DisplayMessageDialog(string title, string message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue