Avalonia - Use embedded window for avalonia (#3674)
* wip * use embedded window * fix race condition on opengl Windows * fix glx issues on prime nvidia * fix mouse support win32 * clean up * addressed review * addressed review * fix warnings * fix sotware keyboard dialog * Update Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * remove double semi Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This commit is contained in:
parent
b9f1ff3c77
commit
6f0395538b
58 changed files with 868 additions and 3531 deletions
|
@ -10,7 +10,6 @@ using Ryujinx.Audio.Backends.SoundIo;
|
|||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Input;
|
||||
using Ryujinx.Ava.Ui.Controls;
|
||||
using Ryujinx.Ava.Ui.Vulkan;
|
||||
using Ryujinx.Ava.Ui.Windows;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
|
@ -252,34 +251,19 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||
{
|
||||
_gpuIds = new List<string>();
|
||||
List<string> names = new List<string>();
|
||||
if (!Program.UseVulkan)
|
||||
{
|
||||
var devices = VulkanRenderer.GetPhysicalDevices();
|
||||
var devices = VulkanRenderer.GetPhysicalDevices();
|
||||
|
||||
if (devices.Length == 0)
|
||||
{
|
||||
IsVulkanAvailable = false;
|
||||
GraphicsBackendIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var device in devices)
|
||||
{
|
||||
_gpuIds.Add(device.Id);
|
||||
names.Add($"{device.Name} {(device.IsDiscrete ? "(dGPU)" : "")}");
|
||||
}
|
||||
}
|
||||
if (devices.Length == 0)
|
||||
{
|
||||
IsVulkanAvailable = false;
|
||||
GraphicsBackendIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var device in VulkanPhysicalDevice.SuitableDevices)
|
||||
foreach (var device in devices)
|
||||
{
|
||||
_gpuIds.Add(
|
||||
VulkanInitialization.StringFromIdPair(device.Value.VendorID, device.Value.DeviceID));
|
||||
var value = device.Value;
|
||||
var name = value.DeviceName;
|
||||
names.Add(
|
||||
$"{Marshal.PtrToStringAnsi((IntPtr)name)} {(device.Value.DeviceType == PhysicalDeviceType.DiscreteGpu ? "(dGPU)" : "")}");
|
||||
_gpuIds.Add(device.Id);
|
||||
names.Add($"{device.Name} {(device.IsDiscrete ? "(dGPU)" : "")}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,7 +391,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||
_previousVolumeLevel = Volume;
|
||||
}
|
||||
|
||||
public async Task SaveSettings()
|
||||
public void SaveSettings()
|
||||
{
|
||||
ConfigurationState config = ConfigurationState.Instance;
|
||||
|
||||
|
@ -422,8 +406,6 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||
config.System.TimeZone.Value = TimeZone;
|
||||
}
|
||||
|
||||
bool requiresRestart = config.Graphics.GraphicsBackend.Value != (GraphicsBackend)GraphicsBackendIndex;
|
||||
|
||||
config.Logger.EnableError.Value = EnableError;
|
||||
config.Logger.EnableTrace.Value = EnableTrace;
|
||||
config.Logger.EnableWarn.Value = EnableWarn;
|
||||
|
@ -456,19 +438,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||
config.System.Language.Value = (Language)Language;
|
||||
config.System.Region.Value = (Region)Region;
|
||||
|
||||
var selectedGpu = _gpuIds.ElementAtOrDefault(PreferredGpuIndex);
|
||||
if (!requiresRestart)
|
||||
{
|
||||
var platform = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||||
if (platform != null)
|
||||
{
|
||||
var physicalDevice = platform.PhysicalDevice;
|
||||
|
||||
requiresRestart = physicalDevice.DeviceId != selectedGpu;
|
||||
}
|
||||
}
|
||||
|
||||
config.Graphics.PreferredGpu.Value = selectedGpu;
|
||||
config.Graphics.PreferredGpu.Value = _gpuIds.ElementAtOrDefault(PreferredGpuIndex);
|
||||
|
||||
if (ConfigurationState.Instance.Graphics.BackendThreading != (BackendThreading)GraphicsBackendMultithreadingIndex)
|
||||
{
|
||||
|
@ -507,20 +477,6 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||
MainWindow.UpdateGraphicsConfig();
|
||||
|
||||
_previousVolumeLevel = Volume;
|
||||
|
||||
if (requiresRestart)
|
||||
{
|
||||
var choice = await ContentDialogHelper.CreateChoiceDialog(
|
||||
LocaleManager.Instance["SettingsAppRequiredRestartMessage"],
|
||||
LocaleManager.Instance["SettingsGpuBackendRestartMessage"],
|
||||
LocaleManager.Instance["SettingsGpuBackendRestartSubMessage"]);
|
||||
|
||||
if (choice)
|
||||
{
|
||||
Process.Start(Environment.ProcessPath);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RevertIfNotSaved()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue