Compare commits

...

3 Commits

Author SHA1 Message Date
Ac_K
c250e3392c Fix using in Ava 2022-12-02 15:08:57 +01:00
Ac_K
e56b069081 Update Crowdin configuration file 2022-12-02 14:54:56 +01:00
merry
204c031fef SDL2Driver: Invoke dispatcher on main thread (#3818) 2022-12-02 14:37:22 +01:00
6 changed files with 36 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
using ARMeilleure.Translation.PTC; using ARMeilleure.Translation.PTC;
using Avalonia; using Avalonia;
using Avalonia.Threading;
using Ryujinx.Ava.Ui.Windows; using Ryujinx.Ava.Ui.Windows;
using Ryujinx.Common; using Ryujinx.Common;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
@@ -8,6 +9,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.Common.System; using Ryujinx.Common.System;
using Ryujinx.Common.SystemInfo; using Ryujinx.Common.SystemInfo;
using Ryujinx.Modules; using Ryujinx.Modules;
using Ryujinx.SDL2.Common;
using Ryujinx.Ui.Common; using Ryujinx.Ui.Common;
using Ryujinx.Ui.Common.Configuration; using Ryujinx.Ui.Common.Configuration;
using Ryujinx.Ui.Common.Helper; using Ryujinx.Ui.Common.Helper;
@@ -94,6 +96,9 @@ namespace Ryujinx.Ava
// Initialize Discord integration. // Initialize Discord integration.
DiscordIntegrationModule.Initialize(); DiscordIntegrationModule.Initialize();
// Initialize SDL2 driver
SDL2Driver.MainThreadDispatcher = action => Dispatcher.UIThread.InvokeAsync(action, DispatcherPriority.Input);
ReloadConfig(); ReloadConfig();
ForceDpiAware.Windows(); ForceDpiAware.Windows();
@@ -219,4 +224,4 @@ namespace Ryujinx.Ava
Logger.Shutdown(); Logger.Shutdown();
} }
} }
} }

View File

@@ -638,16 +638,7 @@ namespace Ryujinx.Headless.SDL2
Translator.IsReadyForTranslation.Reset(); Translator.IsReadyForTranslation.Reset();
Thread windowThread = new Thread(() => ExecutionEntrypoint();
{
ExecutionEntrypoint();
})
{
Name = "GUI.WindowThread"
};
windowThread.Start();
windowThread.Join();
return true; return true;
} }

View File

@@ -168,14 +168,6 @@ namespace Ryujinx.Headless.SDL2
public void Render() public void Render()
{ {
InitializeWindowRenderer();
Device.Gpu.Renderer.Initialize(_glLogLevel);
InitializeRenderer();
_gpuVendorName = GetGpuVendorName();
Device.Gpu.Renderer.RunLoop(() => Device.Gpu.Renderer.RunLoop(() =>
{ {
Device.Gpu.SetGpuThread(); Device.Gpu.SetGpuThread();
@@ -323,6 +315,14 @@ namespace Ryujinx.Headless.SDL2
InitializeWindow(); InitializeWindow();
InitializeWindowRenderer();
Device.Gpu.Renderer.Initialize(_glLogLevel);
InitializeRenderer();
_gpuVendorName = GetGpuVendorName();
Thread renderLoopThread = new Thread(Render) Thread renderLoopThread = new Thread(Render)
{ {
Name = "GUI.RenderLoop" Name = "GUI.RenderLoop"

View File

@@ -28,6 +28,8 @@ namespace Ryujinx.SDL2.Common
} }
} }
public static Action<Action> MainThreadDispatcher { get; set; }
private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO; private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO;
private bool _isRunning; private bool _isRunning;
@@ -154,10 +156,13 @@ namespace Ryujinx.SDL2.Common
while (_isRunning) while (_isRunning)
{ {
while (SDL_PollEvent(out SDL_Event evnt) != 0) MainThreadDispatcher?.Invoke(() =>
{ {
HandleSDLEvent(ref evnt); while (SDL_PollEvent(out SDL_Event evnt) != 0)
} {
HandleSDLEvent(ref evnt);
}
});
waitHandle.Wait(WaitTimeMs); waitHandle.Wait(WaitTimeMs);
} }

View File

@@ -7,6 +7,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.Common.System; using Ryujinx.Common.System;
using Ryujinx.Common.SystemInfo; using Ryujinx.Common.SystemInfo;
using Ryujinx.Modules; using Ryujinx.Modules;
using Ryujinx.SDL2.Common;
using Ryujinx.Ui; using Ryujinx.Ui;
using Ryujinx.Ui.Common; using Ryujinx.Ui.Common;
using Ryujinx.Ui.Common.Configuration; using Ryujinx.Ui.Common.Configuration;
@@ -111,6 +112,15 @@ namespace Ryujinx
// Initialize Discord integration. // Initialize Discord integration.
DiscordIntegrationModule.Initialize(); DiscordIntegrationModule.Initialize();
// Initialize SDL2 driver
SDL2Driver.MainThreadDispatcher = action =>
{
Gtk.Application.Invoke(delegate
{
action();
});
};
// Sets ImageSharp Jpeg Encoder Quality. // Sets ImageSharp Jpeg Encoder Quality.
SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.SetEncoder(JpegFormat.Instance, new JpegEncoder() SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.SetEncoder(JpegFormat.Instance, new JpegEncoder()
{ {

3
crowdin.yml Normal file
View File

@@ -0,0 +1,3 @@
files:
- source: Ryujinx.Ava/Assets/Locales/en_US.json
translation: Ryujinx.Ava/Assets/Locales/%locale_with_underscore%.json