From a8b25afdefb486caaf872add364c09e45a0dda38 Mon Sep 17 00:00:00 2001
From: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
Date: Mon, 9 Sep 2024 23:03:16 +0200
Subject: [PATCH 1/5] Remove Ryujinx.Gtk3 from GitHub workflows
---
.github/labeler.yml | 2 +-
.github/workflows/build.yml | 12 ------------
.github/workflows/nightly_pr_comment.yml | 7 +------
3 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/.github/labeler.yml b/.github/labeler.yml
index cd7650a9d1..54f2757b00 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -20,7 +20,7 @@ gpu:
gui:
- changed-files:
- - any-glob-to-any-file: ['src/Ryujinx/**', 'src/Ryujinx.UI.Common/**', 'src/Ryujinx.UI.LocaleGenerator/**', 'src/Ryujinx.Gtk3/**']
+ - any-glob-to-any-file: ['src/Ryujinx/**', 'src/Ryujinx.UI.Common/**', 'src/Ryujinx.UI.LocaleGenerator/**']
horizon:
- changed-files:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 221c7732e9..2a1e5175c2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -67,15 +67,10 @@ jobs:
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:DebugType=embedded -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER src/Ryujinx.Headless.SDL2 --self-contained true
if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
- - name: Publish Ryujinx.Gtk3
- run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.platform.name }}" -o ./publish_gtk -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:DebugType=embedded -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER src/Ryujinx.Gtk3 --self-contained true
- if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
-
- name: Set executable bit
run: |
chmod +x ./publish/Ryujinx ./publish/Ryujinx.sh
chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh
- chmod +x ./publish_gtk/Ryujinx.Gtk3 ./publish_gtk/Ryujinx.sh
if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
- name: Upload Ryujinx artifact
@@ -92,13 +87,6 @@ jobs:
path: publish_sdl2_headless
if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
- - name: Upload Ryujinx.Gtk3 artifact
- uses: actions/upload-artifact@v4
- with:
- name: gtk-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }}
- path: publish_gtk
- if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
-
build_macos:
name: macOS Universal (${{ matrix.configuration }})
runs-on: ubuntu-latest
diff --git a/.github/workflows/nightly_pr_comment.yml b/.github/workflows/nightly_pr_comment.yml
index 38850df06c..974b2daa3e 100644
--- a/.github/workflows/nightly_pr_comment.yml
+++ b/.github/workflows/nightly_pr_comment.yml
@@ -39,24 +39,19 @@ jobs:
return core.error(`No artifacts found`);
}
let body = `Download the artifacts for this pull request:\n`;
- let hidden_gtk_artifacts = `\n\n Old GUI (GTK3)
\n`;
let hidden_headless_artifacts = `\n\n GUI-less (SDL2)
\n`;
let hidden_debug_artifacts = `\n\n Only for Developers
\n`;
for (const art of artifacts) {
if(art.name.includes('Debug')) {
hidden_debug_artifacts += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
- } else if(art.name.includes('gtk-ryujinx')) {
- hidden_gtk_artifacts += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
} else if(art.name.includes('sdl2-ryujinx-headless')) {
hidden_headless_artifacts += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
} else {
body += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
}
}
- hidden_gtk_artifacts += `\n `;
hidden_headless_artifacts += `\n `;
hidden_debug_artifacts += `\n `;
- body += hidden_gtk_artifacts;
body += hidden_headless_artifacts;
body += hidden_debug_artifacts;
@@ -68,4 +63,4 @@ jobs:
} else {
core.info(`Creating a comment`);
await github.rest.issues.createComment({repo, owner, issue_number, body});
- }
\ No newline at end of file
+ }
From cd48348b9b67b492800fcf0a5364695fb9f997b5 Mon Sep 17 00:00:00 2001
From: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
Date: Mon, 9 Sep 2024 23:03:53 +0200
Subject: [PATCH 2/5] Fix typo in flatpak GitHub workflow
---
.github/workflows/flatpak.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
index bfed328c96..578b0e253d 100644
--- a/.github/workflows/flatpak.yml
+++ b/.github/workflows/flatpak.yml
@@ -49,7 +49,7 @@ jobs:
run: python -m pip install PyYAML lxml
- name: Restore Nuget packages
- # With .NET 8.0.100, Microsoft.NET.ILLink.Tasks isn't restored by default and only seems to appears when publishing.
+ # With .NET 8.0.100, Microsoft.NET.ILLink.Tasks isn't restored by default and only seems to appear when publishing.
# So we just publish to grab the dependencies
run: |
dotnet publish -c Release -r linux-x64 Ryujinx/${{ env.RYUJINX_PROJECT_FILE }} --self-contained
@@ -209,4 +209,4 @@ jobs:
git config user.email "${{ env.GIT_COMMITTER_EMAIL }}"
git add .
git commit -m "$COMMIT_MESSAGE"
- git push origin master
\ No newline at end of file
+ git push origin master
From 6b9e959f0bdd0668b087a96fa2bdd74cbd87d08b Mon Sep 17 00:00:00 2001
From: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
Date: Mon, 9 Sep 2024 23:04:41 +0200
Subject: [PATCH 3/5] Remove Ryujinx.Gtk3 project
---
Ryujinx.sln | 6 -
src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs | 205 --
.../Input/GTK3/GTK3KeyboardDriver.cs | 99 -
.../Input/GTK3/GTK3MappingHelper.cs | 178 -
src/Ryujinx.Gtk3/Input/GTK3/GTK3Mouse.cs | 90 -
.../Input/GTK3/GTK3MouseDriver.cs | 108 -
.../Modules/Updater/UpdateDialog.cs | 95 -
.../Modules/Updater/UpdateDialog.glade | 127 -
src/Ryujinx.Gtk3/Modules/Updater/Updater.cs | 622 ----
src/Ryujinx.Gtk3/Program.cs | 403 ---
src/Ryujinx.Gtk3/Ryujinx.Gtk3.csproj | 103 -
src/Ryujinx.Gtk3/Ryujinx.ico | Bin 108122 -> 0 bytes
.../UI/Applet/ErrorAppletDialog.cs | 31 -
.../UI/Applet/GtkDynamicTextInputHandler.cs | 108 -
.../UI/Applet/GtkHostUIHandler.cs | 203 --
src/Ryujinx.Gtk3/UI/Applet/GtkHostUITheme.cs | 90 -
.../UI/Applet/SwkbdAppletDialog.cs | 127 -
src/Ryujinx.Gtk3/UI/Helper/ButtonHelper.cs | 158 -
src/Ryujinx.Gtk3/UI/Helper/MetalHelper.cs | 135 -
src/Ryujinx.Gtk3/UI/Helper/SortHelper.cs | 33 -
src/Ryujinx.Gtk3/UI/Helper/ThemeHelper.cs | 36 -
src/Ryujinx.Gtk3/UI/MainWindow.cs | 1993 ----------
src/Ryujinx.Gtk3/UI/MainWindow.glade | 1006 -----
src/Ryujinx.Gtk3/UI/OpenGLRenderer.cs | 142 -
.../UI/OpenToolkitBindingsContext.cs | 20 -
src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs | 813 -----
src/Ryujinx.Gtk3/UI/SPBOpenGLContext.cs | 49 -
src/Ryujinx.Gtk3/UI/StatusUpdatedEventArgs.cs | 28 -
src/Ryujinx.Gtk3/UI/VulkanRenderer.cs | 93 -
.../Widgets/GameTableContextMenu.Designer.cs | 233 --
.../UI/Widgets/GameTableContextMenu.cs | 634 ----
src/Ryujinx.Gtk3/UI/Widgets/GtkDialog.cs | 114 -
src/Ryujinx.Gtk3/UI/Widgets/GtkInputDialog.cs | 37 -
src/Ryujinx.Gtk3/UI/Widgets/ProfileDialog.cs | 57 -
.../UI/Widgets/ProfileDialog.glade | 124 -
.../UI/Widgets/RawInputToTextEntry.cs | 27 -
.../UI/Widgets/UserErrorDialog.cs | 123 -
.../UI/Windows/AboutWindow.Designer.cs | 511 ---
src/Ryujinx.Gtk3/UI/Windows/AboutWindow.cs | 85 -
.../UI/Windows/AmiiboWindow.Designer.cs | 190 -
src/Ryujinx.Gtk3/UI/Windows/AmiiboWindow.cs | 438 ---
src/Ryujinx.Gtk3/UI/Windows/AvatarWindow.cs | 298 --
src/Ryujinx.Gtk3/UI/Windows/CheatWindow.cs | 163 -
src/Ryujinx.Gtk3/UI/Windows/CheatWindow.glade | 150 -
.../UI/Windows/ControllerWindow.cs | 1232 -------
.../UI/Windows/ControllerWindow.glade | 2241 ------------
src/Ryujinx.Gtk3/UI/Windows/DlcWindow.cs | 288 --
src/Ryujinx.Gtk3/UI/Windows/DlcWindow.glade | 202 --
src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs | 847 -----
.../UI/Windows/SettingsWindow.glade | 3221 -----------------
.../UI/Windows/TitleUpdateWindow.cs | 234 --
.../UI/Windows/TitleUpdateWindow.glade | 214 --
.../UserProfilesManagerWindow.Designer.cs | 255 --
.../UI/Windows/UserProfilesManagerWindow.cs | 326 --
54 files changed, 19345 deletions(-)
delete mode 100644 src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs
delete mode 100644 src/Ryujinx.Gtk3/Input/GTK3/GTK3KeyboardDriver.cs
delete mode 100644 src/Ryujinx.Gtk3/Input/GTK3/GTK3MappingHelper.cs
delete mode 100644 src/Ryujinx.Gtk3/Input/GTK3/GTK3Mouse.cs
delete mode 100644 src/Ryujinx.Gtk3/Input/GTK3/GTK3MouseDriver.cs
delete mode 100644 src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.glade
delete mode 100644 src/Ryujinx.Gtk3/Modules/Updater/Updater.cs
delete mode 100644 src/Ryujinx.Gtk3/Program.cs
delete mode 100644 src/Ryujinx.Gtk3/Ryujinx.Gtk3.csproj
delete mode 100644 src/Ryujinx.Gtk3/Ryujinx.ico
delete mode 100644 src/Ryujinx.Gtk3/UI/Applet/ErrorAppletDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Applet/GtkDynamicTextInputHandler.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Applet/GtkHostUIHandler.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Applet/GtkHostUITheme.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Applet/SwkbdAppletDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Helper/ButtonHelper.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Helper/MetalHelper.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Helper/SortHelper.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Helper/ThemeHelper.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/MainWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/MainWindow.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/OpenGLRenderer.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/OpenToolkitBindingsContext.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/SPBOpenGLContext.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/StatusUpdatedEventArgs.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/VulkanRenderer.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/GameTableContextMenu.Designer.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/GameTableContextMenu.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/GtkDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/GtkInputDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/ProfileDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/ProfileDialog.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/RawInputToTextEntry.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Widgets/UserErrorDialog.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/AboutWindow.Designer.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/AboutWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/AmiiboWindow.Designer.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/AmiiboWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/AvatarWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/CheatWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/CheatWindow.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/DlcWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/DlcWindow.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/TitleUpdateWindow.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/TitleUpdateWindow.glade
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/UserProfilesManagerWindow.Designer.cs
delete mode 100644 src/Ryujinx.Gtk3/UI/Windows/UserProfilesManagerWindow.cs
diff --git a/Ryujinx.sln b/Ryujinx.sln
index 76ebd573f3..8a582d32de 100644
--- a/Ryujinx.sln
+++ b/Ryujinx.sln
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Gtk3", "src\Ryujinx.Gtk3\Ryujinx.Gtk3.csproj", "{074045D4-3ED2-4711-9169-E385F2BFB5A0}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Tests", "src\Ryujinx.Tests\Ryujinx.Tests.csproj", "{EBB55AEA-C7D7-4DEB-BF96-FA1789E225E9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Tests.Unicorn", "src\Ryujinx.Tests.Unicorn\Ryujinx.Tests.Unicorn.csproj", "{D8F72938-78EF-4E8C-BAFE-531C9C3C8F15}"
@@ -95,10 +93,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {074045D4-3ED2-4711-9169-E385F2BFB5A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {074045D4-3ED2-4711-9169-E385F2BFB5A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {074045D4-3ED2-4711-9169-E385F2BFB5A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {074045D4-3ED2-4711-9169-E385F2BFB5A0}.Release|Any CPU.Build.0 = Release|Any CPU
{EBB55AEA-C7D7-4DEB-BF96-FA1789E225E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBB55AEA-C7D7-4DEB-BF96-FA1789E225E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBB55AEA-C7D7-4DEB-BF96-FA1789E225E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs b/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs
deleted file mode 100644
index ff7a2c3b6c..0000000000
--- a/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-using Ryujinx.Common.Configuration.Hid;
-using Ryujinx.Common.Configuration.Hid.Keyboard;
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
-
-namespace Ryujinx.Input.GTK3
-{
- public class GTK3Keyboard : IKeyboard
- {
- private class ButtonMappingEntry
- {
- public readonly GamepadButtonInputId To;
- public readonly Key From;
-
- public ButtonMappingEntry(GamepadButtonInputId to, Key from)
- {
- To = to;
- From = from;
- }
- }
-
- private readonly object _userMappingLock = new();
-
- private readonly GTK3KeyboardDriver _driver;
- private StandardKeyboardInputConfig _configuration;
- private readonly List _buttonsUserMapping;
-
- public GTK3Keyboard(GTK3KeyboardDriver driver, string id, string name)
- {
- _driver = driver;
- Id = id;
- Name = name;
- _buttonsUserMapping = new List();
- }
-
- private bool HasConfiguration => _configuration != null;
-
- public string Id { get; }
-
- public string Name { get; }
-
- public bool IsConnected => true;
-
- public GamepadFeaturesFlag Features => GamepadFeaturesFlag.None;
-
- public void Dispose()
- {
- // No operations
- GC.SuppressFinalize(this);
- }
-
- public KeyboardStateSnapshot GetKeyboardStateSnapshot()
- {
- return IKeyboard.GetStateSnapshot(this);
- }
-
- private static float ConvertRawStickValue(short value)
- {
- const float ConvertRate = 1.0f / (short.MaxValue + 0.5f);
-
- return value * ConvertRate;
- }
-
- private static (short, short) GetStickValues(ref KeyboardStateSnapshot snapshot, JoyconConfigKeyboardStick stickConfig)
- {
- short stickX = 0;
- short stickY = 0;
-
- if (snapshot.IsPressed((Key)stickConfig.StickUp))
- {
- stickY += 1;
- }
-
- if (snapshot.IsPressed((Key)stickConfig.StickDown))
- {
- stickY -= 1;
- }
-
- if (snapshot.IsPressed((Key)stickConfig.StickRight))
- {
- stickX += 1;
- }
-
- if (snapshot.IsPressed((Key)stickConfig.StickLeft))
- {
- stickX -= 1;
- }
-
- OpenTK.Mathematics.Vector2 stick = new(stickX, stickY);
-
- stick.NormalizeFast();
-
- return ((short)(stick.X * short.MaxValue), (short)(stick.Y * short.MaxValue));
- }
-
- public GamepadStateSnapshot GetMappedStateSnapshot()
- {
- KeyboardStateSnapshot rawState = GetKeyboardStateSnapshot();
- GamepadStateSnapshot result = default;
-
- lock (_userMappingLock)
- {
- if (!HasConfiguration)
- {
- return result;
- }
-
- foreach (ButtonMappingEntry entry in _buttonsUserMapping)
- {
- if (entry.From == Key.Unknown || entry.From == Key.Unbound || entry.To == GamepadButtonInputId.Unbound)
- {
- continue;
- }
-
- // Do not touch state of button already pressed
- if (!result.IsPressed(entry.To))
- {
- result.SetPressed(entry.To, rawState.IsPressed(entry.From));
- }
- }
-
- (short leftStickX, short leftStickY) = GetStickValues(ref rawState, _configuration.LeftJoyconStick);
- (short rightStickX, short rightStickY) = GetStickValues(ref rawState, _configuration.RightJoyconStick);
-
- result.SetStick(StickInputId.Left, ConvertRawStickValue(leftStickX), ConvertRawStickValue(leftStickY));
- result.SetStick(StickInputId.Right, ConvertRawStickValue(rightStickX), ConvertRawStickValue(rightStickY));
- }
-
- return result;
- }
-
- public GamepadStateSnapshot GetStateSnapshot()
- {
- throw new NotSupportedException();
- }
-
- public (float, float) GetStick(StickInputId inputId)
- {
- throw new NotSupportedException();
- }
-
- public bool IsPressed(GamepadButtonInputId inputId)
- {
- throw new NotSupportedException();
- }
-
- public bool IsPressed(Key key)
- {
- return _driver.IsPressed(key);
- }
-
- public void SetConfiguration(InputConfig configuration)
- {
- lock (_userMappingLock)
- {
- _configuration = (StandardKeyboardInputConfig)configuration;
-
- _buttonsUserMapping.Clear();
-
- // Then left joycon
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftStick, (Key)_configuration.LeftJoyconStick.StickButton));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadUp, (Key)_configuration.LeftJoycon.DpadUp));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadDown, (Key)_configuration.LeftJoycon.DpadDown));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger0, (Key)_configuration.LeftJoycon.ButtonSl));
-
- // Finally right joycon
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightStick, (Key)_configuration.RightJoyconStick.StickButton));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.A, (Key)_configuration.RightJoycon.ButtonA));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.B, (Key)_configuration.RightJoycon.ButtonB));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.X, (Key)_configuration.RightJoycon.ButtonX));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Y, (Key)_configuration.RightJoycon.ButtonY));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Plus, (Key)_configuration.RightJoycon.ButtonPlus));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightShoulder, (Key)_configuration.RightJoycon.ButtonR));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightTrigger, (Key)_configuration.RightJoycon.ButtonZr));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger1, (Key)_configuration.RightJoycon.ButtonSr));
- _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (Key)_configuration.RightJoycon.ButtonSl));
- }
- }
-
- public void SetTriggerThreshold(float triggerThreshold)
- {
- // No operations
- }
-
- public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
- {
- // No operations
- }
-
- public Vector3 GetMotionData(MotionInputId inputId)
- {
- // No operations
-
- return Vector3.Zero;
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Input/GTK3/GTK3KeyboardDriver.cs b/src/Ryujinx.Gtk3/Input/GTK3/GTK3KeyboardDriver.cs
deleted file mode 100644
index bd71c7933f..0000000000
--- a/src/Ryujinx.Gtk3/Input/GTK3/GTK3KeyboardDriver.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using Gdk;
-using Gtk;
-using System;
-using System.Collections.Generic;
-using GtkKey = Gdk.Key;
-
-namespace Ryujinx.Input.GTK3
-{
- public class GTK3KeyboardDriver : IGamepadDriver
- {
- private readonly Widget _widget;
- private readonly HashSet _pressedKeys;
-
- public GTK3KeyboardDriver(Widget widget)
- {
- _widget = widget;
- _pressedKeys = new HashSet();
-
- _widget.KeyPressEvent += OnKeyPress;
- _widget.KeyReleaseEvent += OnKeyRelease;
- }
-
- public string DriverName => "GTK3";
-
- private static readonly string[] _keyboardIdentifers = new string[1] { "0" };
-
- public ReadOnlySpan GamepadsIds => _keyboardIdentifers;
-
- public event Action OnGamepadConnected
- {
- add { }
- remove { }
- }
-
- public event Action OnGamepadDisconnected
- {
- add { }
- remove { }
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- _widget.KeyPressEvent -= OnKeyPress;
- _widget.KeyReleaseEvent -= OnKeyRelease;
- }
- }
-
- public void Dispose()
- {
- GC.SuppressFinalize(this);
- Dispose(true);
- }
-
- [GLib.ConnectBefore]
- protected void OnKeyPress(object sender, KeyPressEventArgs args)
- {
- GtkKey key = (GtkKey)Keyval.ToLower((uint)args.Event.Key);
-
- _pressedKeys.Add(key);
- }
-
- [GLib.ConnectBefore]
- protected void OnKeyRelease(object sender, KeyReleaseEventArgs args)
- {
- GtkKey key = (GtkKey)Keyval.ToLower((uint)args.Event.Key);
-
- _pressedKeys.Remove(key);
- }
-
- internal bool IsPressed(Key key)
- {
- if (key == Key.Unbound || key == Key.Unknown)
- {
- return false;
- }
-
- GtkKey nativeKey = GTK3MappingHelper.ToGtkKey(key);
-
- return _pressedKeys.Contains(nativeKey);
- }
-
- public void Clear()
- {
- _pressedKeys.Clear();
- }
-
- public IGamepad GetGamepad(string id)
- {
- if (!_keyboardIdentifers[0].Equals(id))
- {
- return null;
- }
-
- return new GTK3Keyboard(this, _keyboardIdentifers[0], "All keyboards");
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Input/GTK3/GTK3MappingHelper.cs b/src/Ryujinx.Gtk3/Input/GTK3/GTK3MappingHelper.cs
deleted file mode 100644
index 422a960303..0000000000
--- a/src/Ryujinx.Gtk3/Input/GTK3/GTK3MappingHelper.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using GtkKey = Gdk.Key;
-
-namespace Ryujinx.Input.GTK3
-{
- public static class GTK3MappingHelper
- {
- private static readonly GtkKey[] _keyMapping = new GtkKey[(int)Key.Count]
- {
- // NOTE: invalid
- GtkKey.blank,
-
- GtkKey.Shift_L,
- GtkKey.Shift_R,
- GtkKey.Control_L,
- GtkKey.Control_R,
- GtkKey.Alt_L,
- GtkKey.Alt_R,
- GtkKey.Super_L,
- GtkKey.Super_R,
- GtkKey.Menu,
- GtkKey.F1,
- GtkKey.F2,
- GtkKey.F3,
- GtkKey.F4,
- GtkKey.F5,
- GtkKey.F6,
- GtkKey.F7,
- GtkKey.F8,
- GtkKey.F9,
- GtkKey.F10,
- GtkKey.F11,
- GtkKey.F12,
- GtkKey.F13,
- GtkKey.F14,
- GtkKey.F15,
- GtkKey.F16,
- GtkKey.F17,
- GtkKey.F18,
- GtkKey.F19,
- GtkKey.F20,
- GtkKey.F21,
- GtkKey.F22,
- GtkKey.F23,
- GtkKey.F24,
- GtkKey.F25,
- GtkKey.F26,
- GtkKey.F27,
- GtkKey.F28,
- GtkKey.F29,
- GtkKey.F30,
- GtkKey.F31,
- GtkKey.F32,
- GtkKey.F33,
- GtkKey.F34,
- GtkKey.F35,
- GtkKey.Up,
- GtkKey.Down,
- GtkKey.Left,
- GtkKey.Right,
- GtkKey.Return,
- GtkKey.Escape,
- GtkKey.space,
- GtkKey.Tab,
- GtkKey.BackSpace,
- GtkKey.Insert,
- GtkKey.Delete,
- GtkKey.Page_Up,
- GtkKey.Page_Down,
- GtkKey.Home,
- GtkKey.End,
- GtkKey.Caps_Lock,
- GtkKey.Scroll_Lock,
- GtkKey.Print,
- GtkKey.Pause,
- GtkKey.Num_Lock,
- GtkKey.Clear,
- GtkKey.KP_0,
- GtkKey.KP_1,
- GtkKey.KP_2,
- GtkKey.KP_3,
- GtkKey.KP_4,
- GtkKey.KP_5,
- GtkKey.KP_6,
- GtkKey.KP_7,
- GtkKey.KP_8,
- GtkKey.KP_9,
- GtkKey.KP_Divide,
- GtkKey.KP_Multiply,
- GtkKey.KP_Subtract,
- GtkKey.KP_Add,
- GtkKey.KP_Decimal,
- GtkKey.KP_Enter,
- GtkKey.a,
- GtkKey.b,
- GtkKey.c,
- GtkKey.d,
- GtkKey.e,
- GtkKey.f,
- GtkKey.g,
- GtkKey.h,
- GtkKey.i,
- GtkKey.j,
- GtkKey.k,
- GtkKey.l,
- GtkKey.m,
- GtkKey.n,
- GtkKey.o,
- GtkKey.p,
- GtkKey.q,
- GtkKey.r,
- GtkKey.s,
- GtkKey.t,
- GtkKey.u,
- GtkKey.v,
- GtkKey.w,
- GtkKey.x,
- GtkKey.y,
- GtkKey.z,
- GtkKey.Key_0,
- GtkKey.Key_1,
- GtkKey.Key_2,
- GtkKey.Key_3,
- GtkKey.Key_4,
- GtkKey.Key_5,
- GtkKey.Key_6,
- GtkKey.Key_7,
- GtkKey.Key_8,
- GtkKey.Key_9,
- GtkKey.grave,
- GtkKey.grave,
- GtkKey.minus,
- GtkKey.plus,
- GtkKey.bracketleft,
- GtkKey.bracketright,
- GtkKey.semicolon,
- GtkKey.quoteright,
- GtkKey.comma,
- GtkKey.period,
- GtkKey.slash,
- GtkKey.backslash,
-
- // NOTE: invalid
- GtkKey.blank,
- };
-
- private static readonly Dictionary _gtkKeyMapping;
-
- static GTK3MappingHelper()
- {
- var inputKeys = Enum.GetValues().SkipLast(1);
-
- // GtkKey is not contiguous and quite large, so use a dictionary instead of an array.
- _gtkKeyMapping = new Dictionary();
-
- foreach (var key in inputKeys)
- {
- var index = ToGtkKey(key);
- _gtkKeyMapping[index] = key;
- }
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static GtkKey ToGtkKey(Key key)
- {
- return _keyMapping[(int)key];
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Key ToInputKey(GtkKey key)
- {
- return _gtkKeyMapping.GetValueOrDefault(key, Key.Unknown);
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Input/GTK3/GTK3Mouse.cs b/src/Ryujinx.Gtk3/Input/GTK3/GTK3Mouse.cs
deleted file mode 100644
index 0ab817ecb6..0000000000
--- a/src/Ryujinx.Gtk3/Input/GTK3/GTK3Mouse.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using Ryujinx.Common.Configuration.Hid;
-using System;
-using System.Drawing;
-using System.Numerics;
-
-namespace Ryujinx.Input.GTK3
-{
- public class GTK3Mouse : IMouse
- {
- private GTK3MouseDriver _driver;
-
- public GamepadFeaturesFlag Features => throw new NotImplementedException();
-
- public string Id => "0";
-
- public string Name => "GTKMouse";
-
- public bool IsConnected => true;
-
- public bool[] Buttons => _driver.PressedButtons;
-
- public GTK3Mouse(GTK3MouseDriver driver)
- {
- _driver = driver;
- }
-
- public Size ClientSize => _driver.GetClientSize();
-
- public Vector2 GetPosition()
- {
- return _driver.CurrentPosition;
- }
-
- public Vector2 GetScroll()
- {
- return _driver.Scroll;
- }
-
- public GamepadStateSnapshot GetMappedStateSnapshot()
- {
- throw new NotImplementedException();
- }
-
- public Vector3 GetMotionData(MotionInputId inputId)
- {
- throw new NotImplementedException();
- }
-
- public GamepadStateSnapshot GetStateSnapshot()
- {
- throw new NotImplementedException();
- }
-
- public (float, float) GetStick(StickInputId inputId)
- {
- throw new NotImplementedException();
- }
-
- public bool IsButtonPressed(MouseButton button)
- {
- return _driver.IsButtonPressed(button);
- }
-
- public bool IsPressed(GamepadButtonInputId inputId)
- {
- throw new NotImplementedException();
- }
-
- public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
- {
- throw new NotImplementedException();
- }
-
- public void SetConfiguration(InputConfig configuration)
- {
- throw new NotImplementedException();
- }
-
- public void SetTriggerThreshold(float triggerThreshold)
- {
- throw new NotImplementedException();
- }
-
- public void Dispose()
- {
- GC.SuppressFinalize(this);
- _driver = null;
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Input/GTK3/GTK3MouseDriver.cs b/src/Ryujinx.Gtk3/Input/GTK3/GTK3MouseDriver.cs
deleted file mode 100644
index 5962bcb25b..0000000000
--- a/src/Ryujinx.Gtk3/Input/GTK3/GTK3MouseDriver.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using Gdk;
-using Gtk;
-using System;
-using System.Numerics;
-using Size = System.Drawing.Size;
-
-namespace Ryujinx.Input.GTK3
-{
- public class GTK3MouseDriver : IGamepadDriver
- {
- private Widget _widget;
- private bool _isDisposed;
-
- public bool[] PressedButtons { get; }
-
- public Vector2 CurrentPosition { get; private set; }
- public Vector2 Scroll { get; private set; }
-
- public GTK3MouseDriver(Widget parent)
- {
- _widget = parent;
-
- _widget.MotionNotifyEvent += Parent_MotionNotifyEvent;
- _widget.ButtonPressEvent += Parent_ButtonPressEvent;
- _widget.ButtonReleaseEvent += Parent_ButtonReleaseEvent;
- _widget.ScrollEvent += Parent_ScrollEvent;
-
- PressedButtons = new bool[(int)MouseButton.Count];
- }
-
-
- [GLib.ConnectBefore]
- private void Parent_ScrollEvent(object o, ScrollEventArgs args)
- {
- Scroll = new Vector2((float)args.Event.X, (float)args.Event.Y);
- }
-
- [GLib.ConnectBefore]
- private void Parent_ButtonReleaseEvent(object o, ButtonReleaseEventArgs args)
- {
- PressedButtons[args.Event.Button - 1] = false;
- }
-
- [GLib.ConnectBefore]
- private void Parent_ButtonPressEvent(object o, ButtonPressEventArgs args)
- {
- PressedButtons[args.Event.Button - 1] = true;
- }
-
- [GLib.ConnectBefore]
- private void Parent_MotionNotifyEvent(object o, MotionNotifyEventArgs args)
- {
- if (args.Event.Device.InputSource == InputSource.Mouse)
- {
- CurrentPosition = new Vector2((float)args.Event.X, (float)args.Event.Y);
- }
- }
-
- public bool IsButtonPressed(MouseButton button)
- {
- return PressedButtons[(int)button];
- }
-
- public Size GetClientSize()
- {
- return new Size(_widget.AllocatedWidth, _widget.AllocatedHeight);
- }
-
- public string DriverName => "GTK3";
-
- public event Action OnGamepadConnected
- {
- add { }
- remove { }
- }
-
- public event Action OnGamepadDisconnected
- {
- add { }
- remove { }
- }
-
- public ReadOnlySpan GamepadsIds => new[] { "0" };
-
- public IGamepad GetGamepad(string id)
- {
- return new GTK3Mouse(this);
- }
-
- public void Dispose()
- {
- if (_isDisposed)
- {
- return;
- }
-
- GC.SuppressFinalize(this);
-
- _isDisposed = true;
-
- _widget.MotionNotifyEvent -= Parent_MotionNotifyEvent;
- _widget.ButtonPressEvent -= Parent_ButtonPressEvent;
- _widget.ButtonReleaseEvent -= Parent_ButtonReleaseEvent;
-
- _widget = null;
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.cs b/src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.cs
deleted file mode 100644
index 43bde94207..0000000000
--- a/src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using Gdk;
-using Gtk;
-using Ryujinx.Common;
-using Ryujinx.Common.Configuration;
-using Ryujinx.UI;
-using Ryujinx.UI.Common.Configuration;
-using Ryujinx.UI.Common.Helper;
-using System;
-using System.Diagnostics;
-using System.Reflection;
-
-namespace Ryujinx.Modules
-{
- public class UpdateDialog : Gtk.Window
- {
-#pragma warning disable CS0649, IDE0044 // Field is never assigned to, Add readonly modifier
- [Builder.Object] public Label MainText;
- [Builder.Object] public Label SecondaryText;
- [Builder.Object] public LevelBar ProgressBar;
- [Builder.Object] public Button YesButton;
- [Builder.Object] public Button NoButton;
-#pragma warning restore CS0649, IDE0044
-
- private readonly MainWindow _mainWindow;
- private readonly string _buildUrl;
- private bool _restartQuery;
-
- public UpdateDialog(MainWindow mainWindow, Version newVersion, string buildUrl) : this(new Builder("Ryujinx.Gtk3.Modules.Updater.UpdateDialog.glade"), mainWindow, newVersion, buildUrl) { }
-
- private UpdateDialog(Builder builder, MainWindow mainWindow, Version newVersion, string buildUrl) : base(builder.GetRawOwnedObject("UpdateDialog"))
- {
- builder.Autoconnect(this);
-
- _mainWindow = mainWindow;
- _buildUrl = buildUrl;
-
- Icon = new Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Gtk3.UI.Common.Resources.Logo_Ryujinx.png");
- MainText.Text = "Do you want to update Ryujinx to the latest version?";
- SecondaryText.Text = $"{Program.Version} -> {newVersion}";
-
- ProgressBar.Hide();
-
- YesButton.Clicked += YesButton_Clicked;
- NoButton.Clicked += NoButton_Clicked;
- }
-
- private void YesButton_Clicked(object sender, EventArgs args)
- {
- if (_restartQuery)
- {
- string ryuName = OperatingSystem.IsWindows() ? "Ryujinx.exe" : "Ryujinx";
-
- ProcessStartInfo processStart = new(ryuName)
- {
- UseShellExecute = true,
- WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
- };
-
- foreach (string argument in CommandLineState.Arguments)
- {
- processStart.ArgumentList.Add(argument);
- }
-
- Process.Start(processStart);
-
- Environment.Exit(0);
- }
- else
- {
- Window.Functions = _mainWindow.Window.Functions = WMFunction.All & WMFunction.Close;
- _mainWindow.ExitMenuItem.Sensitive = false;
-
- YesButton.Hide();
- NoButton.Hide();
- ProgressBar.Show();
-
- SecondaryText.Text = "";
- _restartQuery = true;
-
- Updater.UpdateRyujinx(this, _buildUrl);
- }
- }
-
- private void NoButton_Clicked(object sender, EventArgs args)
- {
- Updater.Running = false;
- _mainWindow.Window.Functions = WMFunction.All;
-
- _mainWindow.ExitMenuItem.Sensitive = true;
- _mainWindow.UpdateMenuItem.Sensitive = true;
-
- Dispose();
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.glade b/src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.glade
deleted file mode 100644
index cc80167e09..0000000000
--- a/src/Ryujinx.Gtk3/Modules/Updater/UpdateDialog.glade
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
-
diff --git a/src/Ryujinx.Gtk3/Modules/Updater/Updater.cs b/src/Ryujinx.Gtk3/Modules/Updater/Updater.cs
deleted file mode 100644
index 8b006f63f6..0000000000
--- a/src/Ryujinx.Gtk3/Modules/Updater/Updater.cs
+++ /dev/null
@@ -1,622 +0,0 @@
-using Gtk;
-using ICSharpCode.SharpZipLib.GZip;
-using ICSharpCode.SharpZipLib.Tar;
-using ICSharpCode.SharpZipLib.Zip;
-using Ryujinx.Common;
-using Ryujinx.Common.Logging;
-using Ryujinx.Common.Utilities;
-using Ryujinx.UI;
-using Ryujinx.UI.Common.Models.Github;
-using Ryujinx.UI.Widgets;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Net.NetworkInformation;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Ryujinx.Modules
-{
- public static class Updater
- {
- private const string GitHubApiUrl = "https://api.github.com";
- private const int ConnectionCount = 4;
-
- internal static bool Running;
-
- private static readonly string _homeDir = AppDomain.CurrentDomain.BaseDirectory;
- private static readonly string _updateDir = Path.Combine(Path.GetTempPath(), "Ryujinx", "update");
- private static readonly string _updatePublishDir = Path.Combine(_updateDir, "publish");
-
- private static string _buildVer;
- private static string _platformExt;
- private static string _buildUrl;
- private static long _buildSize;
-
- private static readonly GithubReleasesJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
-
- // On Windows, GtkSharp.Dependencies adds these extra dirs that must be cleaned during updates.
- private static readonly string[] _windowsDependencyDirs = { "bin", "etc", "lib", "share" };
-
- private static HttpClient ConstructHttpClient()
- {
- HttpClient result = new();
-
- // Required by GitHub to interact with APIs.
- result.DefaultRequestHeaders.Add("User-Agent", "Ryujinx-Updater/1.0.0");
-
- return result;
- }
-
- public static async Task BeginParse(MainWindow mainWindow, bool showVersionUpToDate)
- {
- if (Running)
- {
- return;
- }
-
- Running = true;
- mainWindow.UpdateMenuItem.Sensitive = false;
-
- int artifactIndex = -1;
-
- // Detect current platform
- if (OperatingSystem.IsMacOS())
- {
- _platformExt = "osx_x64.zip";
- artifactIndex = 1;
- }
- else if (OperatingSystem.IsWindows())
- {
- _platformExt = "win_x64.zip";
- artifactIndex = 2;
- }
- else if (OperatingSystem.IsLinux())
- {
- var arch = RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "arm64" : "x64";
- _platformExt = $"linux_{arch}.tar.gz";
- artifactIndex = 0;
- }
-
- if (artifactIndex == -1)
- {
- GtkDialog.CreateErrorDialog("Your platform is not supported!");
-
- return;
- }
-
- Version newVersion;
- Version currentVersion;
-
- try
- {
- currentVersion = Version.Parse(Program.Version);
- }
- catch
- {
- GtkDialog.CreateWarningDialog("Failed to convert the current Ryujinx version.", "Cancelling Update!");
- Logger.Error?.Print(LogClass.Application, "Failed to convert the current Ryujinx version!");
-
- return;
- }
-
- // Get latest version number from GitHub API
- try
- {
- using HttpClient jsonClient = ConstructHttpClient();
- string buildInfoUrl = $"{GitHubApiUrl}/repos/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}/releases/latest";
-
- // Fetch latest build information
- string fetchedJson = await jsonClient.GetStringAsync(buildInfoUrl);
- var fetched = JsonHelper.Deserialize(fetchedJson, _serializerContext.GithubReleasesJsonResponse);
- _buildVer = fetched.Name;
-
- foreach (var asset in fetched.Assets)
- {
- if (asset.Name.StartsWith("gtk-ryujinx") && asset.Name.EndsWith(_platformExt))
- {
- _buildUrl = asset.BrowserDownloadUrl;
-
- if (asset.State != "uploaded")
- {
- if (showVersionUpToDate)
- {
- GtkDialog.CreateUpdaterInfoDialog("You are already using the latest version of Ryujinx!", "");
- }
-
- return;
- }
-
- break;
- }
- }
-
- if (_buildUrl == null)
- {
- if (showVersionUpToDate)
- {
- GtkDialog.CreateUpdaterInfoDialog("You are already using the latest version of Ryujinx!", "");
- }
-
- return;
- }
- }
- catch (Exception exception)
- {
- Logger.Error?.Print(LogClass.Application, exception.Message);
- GtkDialog.CreateErrorDialog("An error occurred when trying to get release information from GitHub Release. This can be caused if a new release is being compiled by GitHub Actions. Try again in a few minutes.");
-
- return;
- }
-
- try
- {
- newVersion = Version.Parse(_buildVer);
- }
- catch
- {
- GtkDialog.CreateWarningDialog("Failed to convert the received Ryujinx version from GitHub Release.", "Cancelling Update!");
- Logger.Error?.Print(LogClass.Application, "Failed to convert the received Ryujinx version from GitHub Release!");
-
- return;
- }
-
- if (newVersion <= currentVersion)
- {
- if (showVersionUpToDate)
- {
- GtkDialog.CreateUpdaterInfoDialog("You are already using the latest version of Ryujinx!", "");
- }
-
- Running = false;
- mainWindow.UpdateMenuItem.Sensitive = true;
-
- return;
- }
-
- // Fetch build size information to learn chunk sizes.
- using HttpClient buildSizeClient = ConstructHttpClient();
- try
- {
- buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0");
-
- HttpResponseMessage message = await buildSizeClient.GetAsync(new Uri(_buildUrl), HttpCompletionOption.ResponseHeadersRead);
-
- _buildSize = message.Content.Headers.ContentRange.Length.Value;
- }
- catch (Exception ex)
- {
- Logger.Warning?.Print(LogClass.Application, ex.Message);
- Logger.Warning?.Print(LogClass.Application, "Couldn't determine build size for update, using single-threaded updater");
-
- _buildSize = -1;
- }
-
- // Show a message asking the user if they want to update
- UpdateDialog updateDialog = new(mainWindow, newVersion, _buildUrl);
- updateDialog.Show();
- }
-
- public static void UpdateRyujinx(UpdateDialog updateDialog, string downloadUrl)
- {
- // Empty update dir, although it shouldn't ever have anything inside it
- if (Directory.Exists(_updateDir))
- {
- Directory.Delete(_updateDir, true);
- }
-
- Directory.CreateDirectory(_updateDir);
-
- string updateFile = Path.Combine(_updateDir, "update.bin");
-
- // Download the update .zip
- updateDialog.MainText.Text = "Downloading Update...";
- updateDialog.ProgressBar.Value = 0;
- updateDialog.ProgressBar.MaxValue = 100;
-
- if (_buildSize >= 0)
- {
- DoUpdateWithMultipleThreads(updateDialog, downloadUrl, updateFile);
- }
- else
- {
- DoUpdateWithSingleThread(updateDialog, downloadUrl, updateFile);
- }
- }
-
- private static void DoUpdateWithMultipleThreads(UpdateDialog updateDialog, string downloadUrl, string updateFile)
- {
- // Multi-Threaded Updater
- long chunkSize = _buildSize / ConnectionCount;
- long remainderChunk = _buildSize % ConnectionCount;
-
- int completedRequests = 0;
- int totalProgressPercentage = 0;
- int[] progressPercentage = new int[ConnectionCount];
-
- List list = new(ConnectionCount);
- List webClients = new(ConnectionCount);
-
- for (int i = 0; i < ConnectionCount; i++)
- {
- list.Add(Array.Empty());
- }
-
- for (int i = 0; i < ConnectionCount; i++)
- {
-#pragma warning disable SYSLIB0014
- // TODO: WebClient is obsolete and need to be replaced with a more complex logic using HttpClient.
- using WebClient client = new();
-#pragma warning restore SYSLIB0014
- webClients.Add(client);
-
- if (i == ConnectionCount - 1)
- {
- client.Headers.Add("Range", $"bytes={chunkSize * i}-{(chunkSize * (i + 1) - 1) + remainderChunk}");
- }
- else
- {
- client.Headers.Add("Range", $"bytes={chunkSize * i}-{chunkSize * (i + 1) - 1}");
- }
-
- client.DownloadProgressChanged += (_, args) =>
- {
- int index = (int)args.UserState;
-
- Interlocked.Add(ref totalProgressPercentage, -1 * progressPercentage[index]);
- Interlocked.Exchange(ref progressPercentage[index], args.ProgressPercentage);
- Interlocked.Add(ref totalProgressPercentage, args.ProgressPercentage);
-
- updateDialog.ProgressBar.Value = totalProgressPercentage / ConnectionCount;
- };
-
- client.DownloadDataCompleted += (_, args) =>
- {
- int index = (int)args.UserState;
-
- if (args.Cancelled)
- {
- webClients[index].Dispose();
-
- return;
- }
-
- list[index] = args.Result;
- Interlocked.Increment(ref completedRequests);
-
- if (Equals(completedRequests, ConnectionCount))
- {
- byte[] mergedFileBytes = new byte[_buildSize];
- for (int connectionIndex = 0, destinationOffset = 0; connectionIndex < ConnectionCount; connectionIndex++)
- {
- Array.Copy(list[connectionIndex], 0, mergedFileBytes, destinationOffset, list[connectionIndex].Length);
- destinationOffset += list[connectionIndex].Length;
- }
-
- File.WriteAllBytes(updateFile, mergedFileBytes);
-
- try
- {
- InstallUpdate(updateDialog, updateFile);
- }
- catch (Exception e)
- {
- Logger.Warning?.Print(LogClass.Application, e.Message);
- Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater.");
-
- DoUpdateWithSingleThread(updateDialog, downloadUrl, updateFile);
-
- return;
- }
- }
- };
-
- try
- {
- client.DownloadDataAsync(new Uri(downloadUrl), i);
- }
- catch (WebException ex)
- {
- Logger.Warning?.Print(LogClass.Application, ex.Message);
- Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater.");
-
- foreach (WebClient webClient in webClients)
- {
- webClient.CancelAsync();
- }
-
- DoUpdateWithSingleThread(updateDialog, downloadUrl, updateFile);
-
- return;
- }
- }
- }
-
- private static void DoUpdateWithSingleThreadWorker(UpdateDialog updateDialog, string downloadUrl, string updateFile)
- {
- using HttpClient client = new();
- // We do not want to timeout while downloading
- client.Timeout = TimeSpan.FromDays(1);
-
- using HttpResponseMessage response = client.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead).Result;
- using Stream remoteFileStream = response.Content.ReadAsStreamAsync().Result;
- using Stream updateFileStream = File.Open(updateFile, FileMode.Create);
-
- long totalBytes = response.Content.Headers.ContentLength.Value;
- long byteWritten = 0;
-
- byte[] buffer = new byte[32 * 1024];
-
- while (true)
- {
- int readSize = remoteFileStream.Read(buffer);
-
- if (readSize == 0)
- {
- break;
- }
-
- byteWritten += readSize;
-
- updateDialog.ProgressBar.Value = ((double)byteWritten / totalBytes) * 100;
- updateFileStream.Write(buffer, 0, readSize);
- }
-
- InstallUpdate(updateDialog, updateFile);
- }
-
- private static void DoUpdateWithSingleThread(UpdateDialog updateDialog, string downloadUrl, string updateFile)
- {
- Thread worker = new(() => DoUpdateWithSingleThreadWorker(updateDialog, downloadUrl, updateFile))
- {
- Name = "Updater.SingleThreadWorker",
- };
- worker.Start();
- }
-
- private static async void InstallUpdate(UpdateDialog updateDialog, string updateFile)
- {
- // Extract Update
- updateDialog.MainText.Text = "Extracting Update...";
- updateDialog.ProgressBar.Value = 0;
-
- if (OperatingSystem.IsLinux())
- {
- using Stream inStream = File.OpenRead(updateFile);
- using Stream gzipStream = new GZipInputStream(inStream);
- using TarInputStream tarStream = new(gzipStream, Encoding.ASCII);
- updateDialog.ProgressBar.MaxValue = inStream.Length;
-
- await Task.Run(() =>
- {
- TarEntry tarEntry;
-
- if (!OperatingSystem.IsWindows())
- {
- while ((tarEntry = tarStream.GetNextEntry()) != null)
- {
- if (tarEntry.IsDirectory)
- {
- continue;
- }
-
- string outPath = Path.Combine(_updateDir, tarEntry.Name);
-
- Directory.CreateDirectory(Path.GetDirectoryName(outPath));
-
- using FileStream outStream = File.OpenWrite(outPath);
- tarStream.CopyEntryContents(outStream);
-
- File.SetUnixFileMode(outPath, (UnixFileMode)tarEntry.TarHeader.Mode);
- File.SetLastWriteTime(outPath, DateTime.SpecifyKind(tarEntry.ModTime, DateTimeKind.Utc));
-
- TarEntry entry = tarEntry;
-
- Application.Invoke(delegate
- {
- updateDialog.ProgressBar.Value += entry.Size;
- });
- }
- }
- });
-
- updateDialog.ProgressBar.Value = inStream.Length;
- }
- else
- {
- using Stream inStream = File.OpenRead(updateFile);
- using ZipFile zipFile = new(inStream);
- updateDialog.ProgressBar.MaxValue = zipFile.Count;
-
- await Task.Run(() =>
- {
- foreach (ZipEntry zipEntry in zipFile)
- {
- if (zipEntry.IsDirectory)
- {
- continue;
- }
-
- string outPath = Path.Combine(_updateDir, zipEntry.Name);
-
- Directory.CreateDirectory(Path.GetDirectoryName(outPath));
-
- using Stream zipStream = zipFile.GetInputStream(zipEntry);
- using FileStream outStream = File.OpenWrite(outPath);
- zipStream.CopyTo(outStream);
-
- File.SetLastWriteTime(outPath, DateTime.SpecifyKind(zipEntry.DateTime, DateTimeKind.Utc));
-
- Application.Invoke(delegate
- {
- updateDialog.ProgressBar.Value++;
- });
- }
- });
- }
-
- // Delete downloaded zip
- File.Delete(updateFile);
-
- List allFiles = EnumerateFilesToDelete().ToList();
-
- updateDialog.MainText.Text = "Renaming Old Files...";
- updateDialog.ProgressBar.Value = 0;
- updateDialog.ProgressBar.MaxValue = allFiles.Count;
-
- // Replace old files
- await Task.Run(() =>
- {
- foreach (string file in allFiles)
- {
- try
- {
- File.Move(file, file + ".ryuold");
-
- Application.Invoke(delegate
- {
- updateDialog.ProgressBar.Value++;
- });
- }
- catch
- {
- Logger.Warning?.Print(LogClass.Application, "Updater was unable to rename file: " + file);
- }
- }
-
- Application.Invoke(delegate
- {
- updateDialog.MainText.Text = "Adding New Files...";
- updateDialog.ProgressBar.Value = 0;
- updateDialog.ProgressBar.MaxValue = Directory.GetFiles(_updatePublishDir, "*", SearchOption.AllDirectories).Length;
- });
-
- MoveAllFilesOver(_updatePublishDir, _homeDir, updateDialog);
- });
-
- Directory.Delete(_updateDir, true);
-
- updateDialog.MainText.Text = "Update Complete!";
- updateDialog.SecondaryText.Text = "Do you want to restart Ryujinx now?";
- updateDialog.Modal = true;
-
- updateDialog.ProgressBar.Hide();
- updateDialog.YesButton.Show();
- updateDialog.NoButton.Show();
- }
-
- public static bool CanUpdate(bool showWarnings)
- {
-#if !DISABLE_UPDATER
- if (!NetworkInterface.GetIsNetworkAvailable())
- {
- if (showWarnings)
- {
- GtkDialog.CreateWarningDialog("You are not connected to the Internet!", "Please verify that you have a working Internet connection!");
- }
-
- return false;
- }
-
- if (Program.Version.Contains("dirty") || !ReleaseInformation.IsValid)
- {
- if (showWarnings)
- {
- GtkDialog.CreateWarningDialog("You cannot update a Dirty build of Ryujinx!", "Please download Ryujinx at https://ryujinx.org/ if you are looking for a supported version.");
- }
-
- return false;
- }
-
- return true;
-#else
- if (showWarnings)
- {
- if (ReleaseInformation.IsFlatHubBuild)
- {
- GtkDialog.CreateWarningDialog("Updater Disabled!", "Please update Ryujinx via FlatHub.");
- }
- else
- {
- GtkDialog.CreateWarningDialog("Updater Disabled!", "Please download Ryujinx at https://ryujinx.org/ if you are looking for a supported version.");
- }
- }
-
- return false;
-#endif
- }
-
- // NOTE: This method should always reflect the latest build layout.
- private static IEnumerable EnumerateFilesToDelete()
- {
- var files = Directory.EnumerateFiles(_homeDir); // All files directly in base dir.
-
- // Determine and exclude user files only when the updater is running, not when cleaning old files
- if (Running)
- {
- // Compare the loose files in base directory against the loose files from the incoming update, and store foreign ones in a user list.
- var oldFiles = Directory.EnumerateFiles(_homeDir, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName);
- var newFiles = Directory.EnumerateFiles(_updatePublishDir, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName);
- var userFiles = oldFiles.Except(newFiles).Select(filename => Path.Combine(_homeDir, filename));
-
- // Remove user files from the paths in files.
- files = files.Except(userFiles);
- }
-
- if (OperatingSystem.IsWindows())
- {
- foreach (string dir in _windowsDependencyDirs)
- {
- string dirPath = Path.Combine(_homeDir, dir);
- if (Directory.Exists(dirPath))
- {
- files = files.Concat(Directory.EnumerateFiles(dirPath, "*", SearchOption.AllDirectories));
- }
- }
- }
-
- return files.Where(f => !new FileInfo(f).Attributes.HasFlag(FileAttributes.Hidden | FileAttributes.System));
- }
-
- private static void MoveAllFilesOver(string root, string dest, UpdateDialog dialog)
- {
- foreach (string directory in Directory.GetDirectories(root))
- {
- string dirName = Path.GetFileName(directory);
-
- if (!Directory.Exists(Path.Combine(dest, dirName)))
- {
- Directory.CreateDirectory(Path.Combine(dest, dirName));
- }
-
- MoveAllFilesOver(directory, Path.Combine(dest, dirName), dialog);
- }
-
- foreach (string file in Directory.GetFiles(root))
- {
- File.Move(file, Path.Combine(dest, Path.GetFileName(file)), true);
-
- Application.Invoke(delegate
- {
- dialog.ProgressBar.Value++;
- });
- }
- }
-
- public static void CleanupUpdate()
- {
- foreach (string file in EnumerateFilesToDelete())
- {
- if (Path.GetExtension(file).EndsWith(".ryuold"))
- {
- File.Delete(file);
- }
- }
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Program.cs b/src/Ryujinx.Gtk3/Program.cs
deleted file mode 100644
index 2d350374bf..0000000000
--- a/src/Ryujinx.Gtk3/Program.cs
+++ /dev/null
@@ -1,403 +0,0 @@
-using Gtk;
-using Ryujinx.Common;
-using Ryujinx.Common.Configuration;
-using Ryujinx.Common.GraphicsDriver;
-using Ryujinx.Common.Logging;
-using Ryujinx.Common.SystemInterop;
-using Ryujinx.Common.Utilities;
-using Ryujinx.Graphics.Vulkan.MoltenVK;
-using Ryujinx.Modules;
-using Ryujinx.SDL2.Common;
-using Ryujinx.UI;
-using Ryujinx.UI.App.Common;
-using Ryujinx.UI.Common;
-using Ryujinx.UI.Common.Configuration;
-using Ryujinx.UI.Common.Helper;
-using Ryujinx.UI.Common.SystemInfo;
-using Ryujinx.UI.Widgets;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace Ryujinx
-{
- partial class Program
- {
- public static double WindowScaleFactor { get; private set; }
-
- public static string Version { get; private set; }
-
- public static string ConfigurationPath { get; set; }
-
- public static string CommandLineProfile { get; set; }
-
- private const string X11LibraryName = "libX11";
-
- [LibraryImport(X11LibraryName)]
- private static partial int XInitThreads();
-
- [LibraryImport("user32.dll", SetLastError = true)]
- public static partial int MessageBoxA(IntPtr hWnd, [MarshalAs(UnmanagedType.LPStr)] string text, [MarshalAs(UnmanagedType.LPStr)] string caption, uint type);
-
- private const uint MbIconWarning = 0x30;
-
- static Program()
- {
- if (OperatingSystem.IsLinux())
- {
- NativeLibrary.SetDllImportResolver(typeof(Program).Assembly, (name, assembly, path) =>
- {
- if (name != X11LibraryName)
- {
- return IntPtr.Zero;
- }
-
- if (!NativeLibrary.TryLoad("libX11.so.6", assembly, path, out IntPtr result))
- {
- if (!NativeLibrary.TryLoad("libX11.so", assembly, path, out result))
- {
- return IntPtr.Zero;
- }
- }
-
- return result;
- });
- }
- }
-
- static void Main(string[] args)
- {
- Version = ReleaseInformation.Version;
-
- if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134))
- {
- MessageBoxA(IntPtr.Zero, "You are running an outdated version of Windows.\n\nRyujinx supports Windows 10 version 1803 and newer.\n", $"Ryujinx {Version}", MbIconWarning);
- }
-
- // Parse arguments
- CommandLineState.ParseArguments(args);
-
- // Hook unhandled exception and process exit events.
- GLib.ExceptionManager.UnhandledException += (GLib.UnhandledExceptionArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating);
- AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating);
- AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => Exit();
-
- // Make process DPI aware for proper window sizing on high-res screens.
- ForceDpiAware.Windows();
- WindowScaleFactor = ForceDpiAware.GetWindowScaleFactor();
-
- // Delete backup files after updating.
- Task.Run(Updater.CleanupUpdate);
-
- Console.Title = $"Ryujinx Console {Version}";
-
- // NOTE: GTK3 doesn't init X11 in a multi threaded way.
- // This ends up causing race condition and abort of XCB when a context is created by SPB (even if SPB do call XInitThreads).
- if (OperatingSystem.IsLinux())
- {
- if (XInitThreads() == 0)
- {
- throw new NotSupportedException("Failed to initialize multi-threading support.");
- }
-
- OsUtils.SetEnvironmentVariableNoCaching("GDK_BACKEND", "x11");
- }
-
- if (OperatingSystem.IsMacOS())
- {
- MVKInitialization.InitializeResolver();
-
- string baseDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
- string resourcesDataDir;
-
- if (Path.GetFileName(baseDirectory) == "MacOS")
- {
- resourcesDataDir = Path.Combine(Directory.GetParent(baseDirectory).FullName, "Resources");
- }
- else
- {
- resourcesDataDir = baseDirectory;
- }
-
- // On macOS, GTK3 needs XDG_DATA_DIRS to be set, otherwise it will try searching for "gschemas.compiled" in system directories.
- OsUtils.SetEnvironmentVariableNoCaching("XDG_DATA_DIRS", Path.Combine(resourcesDataDir, "share"));
-
- // On macOS, GTK3 needs GDK_PIXBUF_MODULE_FILE to be set, otherwise it will try searching for "loaders.cache" in system directories.
- OsUtils.SetEnvironmentVariableNoCaching("GDK_PIXBUF_MODULE_FILE", Path.Combine(resourcesDataDir, "lib", "gdk-pixbuf-2.0", "2.10.0", "loaders.cache"));
-
- OsUtils.SetEnvironmentVariableNoCaching("GTK_IM_MODULE_FILE", Path.Combine(resourcesDataDir, "lib", "gtk-3.0", "3.0.0", "immodules.cache"));
- }
-
- string systemPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
- Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPath}");
-
- // Setup base data directory.
- AppDataManager.Initialize(CommandLineState.BaseDirPathArg);
-
- // Initialize the configuration.
- ConfigurationState.Initialize();
-
- // Initialize the logger system.
- LoggerModule.Initialize();
-
- // Initialize Discord integration.
- DiscordIntegrationModule.Initialize();
-
- // Initialize SDL2 driver
- SDL2Driver.MainThreadDispatcher = action =>
- {
- Application.Invoke(delegate
- {
- action();
- });
- };
-
- string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.ConfigName);
- string appDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, ReleaseInformation.ConfigName);
-
- // Now load the configuration as the other subsystems are now registered
- ConfigurationPath = File.Exists(localConfigurationPath)
- ? localConfigurationPath
- : File.Exists(appDataConfigurationPath)
- ? appDataConfigurationPath
- : null;
-
- if (ConfigurationPath == null)
- {
- // No configuration, we load the default values and save it to disk
- ConfigurationPath = appDataConfigurationPath;
- Logger.Notice.Print(LogClass.Application, $"No configuration file found. Saving default configuration to: {ConfigurationPath}");
-
- ConfigurationState.Instance.LoadDefault();
- ConfigurationState.Instance.ToFileFormat().SaveConfig(ConfigurationPath);
- }
- else
- {
- Logger.Notice.Print(LogClass.Application, $"Loading configuration from: {ConfigurationPath}");
-
- if (ConfigurationFileFormat.TryLoad(ConfigurationPath, out ConfigurationFileFormat configurationFileFormat))
- {
- ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath);
- }
- else
- {
- Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location: {ConfigurationPath}");
-
- ConfigurationState.Instance.LoadDefault();
- }
- }
-
- // Check if graphics backend was overridden.
- if (CommandLineState.OverrideGraphicsBackend != null)
- {
- if (CommandLineState.OverrideGraphicsBackend.ToLower() == "opengl")
- {
- ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.OpenGl;
- }
- else if (CommandLineState.OverrideGraphicsBackend.ToLower() == "vulkan")
- {
- ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.Vulkan;
- }
- }
-
- // Check if HideCursor was overridden.
- if (CommandLineState.OverrideHideCursor is not null)
- {
- ConfigurationState.Instance.HideCursor.Value = CommandLineState.OverrideHideCursor!.ToLower() switch
- {
- "never" => HideCursorMode.Never,
- "onidle" => HideCursorMode.OnIdle,
- "always" => HideCursorMode.Always,
- _ => ConfigurationState.Instance.HideCursor.Value,
- };
- }
-
- // Check if docked mode was overridden.
- if (CommandLineState.OverrideDockedMode.HasValue)
- {
- ConfigurationState.Instance.System.EnableDockedMode.Value = CommandLineState.OverrideDockedMode.Value;
- }
-
- // Logging system information.
- PrintSystemInfo();
-
- // Enable OGL multithreading on the driver, and some other flags.
- BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;
- DriverUtilities.InitDriverConfig(threadingMode == BackendThreading.Off);
-
- // Initialize Gtk.
- Application.Init();
-
- // Check if keys exists.
- bool hasSystemProdKeys = File.Exists(Path.Combine(AppDataManager.KeysDirPath, "prod.keys"));
- bool hasCommonProdKeys = AppDataManager.Mode == AppDataManager.LaunchMode.UserProfile && File.Exists(Path.Combine(AppDataManager.KeysDirPathUser, "prod.keys"));
- if (!hasSystemProdKeys && !hasCommonProdKeys)
- {
- UserErrorDialog.CreateUserErrorDialog(UserError.NoKeys);
- }
-
- // Show the main window UI.
- MainWindow mainWindow = new();
- mainWindow.Show();
-
- // Load the game table if no application was requested by the command line
- if (CommandLineState.LaunchPathArg == null)
- {
- mainWindow.UpdateGameTable();
- }
-
- if (OperatingSystem.IsLinux())
- {
- int currentVmMaxMapCount = LinuxHelper.VmMaxMapCount;
-
- if (LinuxHelper.VmMaxMapCount < LinuxHelper.RecommendedVmMaxMapCount)
- {
- Logger.Warning?.Print(LogClass.Application, $"The value of vm.max_map_count is lower than {LinuxHelper.RecommendedVmMaxMapCount}. ({currentVmMaxMapCount})");
-
- if (LinuxHelper.PkExecPath is not null)
- {
- var buttonTexts = new Dictionary()
- {
- { 0, "Yes, until the next restart" },
- { 1, "Yes, permanently" },
- { 2, "No" },
- };
-
- ResponseType response = GtkDialog.CreateCustomDialog(
- "Ryujinx - Low limit for memory mappings detected",
- $"Would you like to increase the value of vm.max_map_count to {LinuxHelper.RecommendedVmMaxMapCount}?",
- "Some games might try to create more memory mappings than currently allowed. " +
- "Ryujinx will crash as soon as this limit gets exceeded.",
- buttonTexts,
- MessageType.Question);
-
- int rc;
-
- switch ((int)response)
- {
- case 0:
- rc = LinuxHelper.RunPkExec($"echo {LinuxHelper.RecommendedVmMaxMapCount} > {LinuxHelper.VmMaxMapCountPath}");
- if (rc == 0)
- {
- Logger.Info?.Print(LogClass.Application, $"vm.max_map_count set to {LinuxHelper.VmMaxMapCount} until the next restart.");
- }
- else
- {
- Logger.Error?.Print(LogClass.Application, $"Unable to change vm.max_map_count. Process exited with code: {rc}");
- }
- break;
- case 1:
- rc = LinuxHelper.RunPkExec($"echo \"vm.max_map_count = {LinuxHelper.RecommendedVmMaxMapCount}\" > {LinuxHelper.SysCtlConfigPath} && sysctl -p {LinuxHelper.SysCtlConfigPath}");
- if (rc == 0)
- {
- Logger.Info?.Print(LogClass.Application, $"vm.max_map_count set to {LinuxHelper.VmMaxMapCount}. Written to config: {LinuxHelper.SysCtlConfigPath}");
- }
- else
- {
- Logger.Error?.Print(LogClass.Application, $"Unable to write new value for vm.max_map_count to config. Process exited with code: {rc}");
- }
- break;
- }
- }
- else
- {
- GtkDialog.CreateWarningDialog(
- "Max amount of memory mappings is lower than recommended.",
- $"The current value of vm.max_map_count ({currentVmMaxMapCount}) is lower than {LinuxHelper.RecommendedVmMaxMapCount}." +
- "Some games might try to create more memory mappings than currently allowed. " +
- "Ryujinx will crash as soon as this limit gets exceeded.\n\n" +
- "You might want to either manually increase the limit or install pkexec, which allows Ryujinx to assist with that.");
- }
- }
- }
-
- if (CommandLineState.LaunchPathArg != null)
- {
- if (mainWindow.ApplicationLibrary.TryGetApplicationsFromFile(CommandLineState.LaunchPathArg, out List applications))
- {
- ApplicationData applicationData;
-
- if (CommandLineState.LaunchApplicationId != null)
- {
- applicationData = applications.Find(application => application.IdString == CommandLineState.LaunchApplicationId);
-
- if (applicationData != null)
- {
- mainWindow.RunApplication(applicationData, CommandLineState.StartFullscreenArg);
- }
- else
- {
- Logger.Error?.Print(LogClass.Application, $"Couldn't find requested application id '{CommandLineState.LaunchApplicationId}' in '{CommandLineState.LaunchPathArg}'.");
- UserErrorDialog.CreateUserErrorDialog(UserError.ApplicationNotFound);
- }
- }
- else
- {
- applicationData = applications[0];
- mainWindow.RunApplication(applicationData, CommandLineState.StartFullscreenArg);
- }
- }
- else
- {
- Logger.Error?.Print(LogClass.Application, $"Couldn't find any application in '{CommandLineState.LaunchPathArg}'.");
- UserErrorDialog.CreateUserErrorDialog(UserError.ApplicationNotFound);
- }
- }
-
- if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false))
- {
- Updater.BeginParse(mainWindow, false).ContinueWith(task =>
- {
- Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}");
- }, TaskContinuationOptions.OnlyOnFaulted);
- }
-
- Application.Run();
- }
-
- private static void PrintSystemInfo()
- {
- Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}");
- SystemInfo.Gather().Print();
-
- var enabledLogs = Logger.GetEnabledLevels();
- Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(enabledLogs.Count == 0 ? "" : string.Join(", ", enabledLogs))}");
-
- if (AppDataManager.Mode == AppDataManager.LaunchMode.Custom)
- {
- Logger.Notice.Print(LogClass.Application, $"Launch Mode: Custom Path {AppDataManager.BaseDirPath}");
- }
- else
- {
- Logger.Notice.Print(LogClass.Application, $"Launch Mode: {AppDataManager.Mode}");
- }
- }
-
- private static void ProcessUnhandledException(Exception ex, bool isTerminating)
- {
- string message = $"Unhandled exception caught: {ex}";
-
- Logger.Error?.PrintMsg(LogClass.Application, message);
-
- if (Logger.Error == null)
- {
- Logger.Notice.PrintMsg(LogClass.Application, message);
- }
-
- if (isTerminating)
- {
- Exit();
- }
- }
-
- public static void Exit()
- {
- DiscordIntegrationModule.Exit();
-
- Logger.Shutdown();
- }
- }
-}
diff --git a/src/Ryujinx.Gtk3/Ryujinx.Gtk3.csproj b/src/Ryujinx.Gtk3/Ryujinx.Gtk3.csproj
deleted file mode 100644
index 722d6080be..0000000000
--- a/src/Ryujinx.Gtk3/Ryujinx.Gtk3.csproj
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
- net8.0
- win-x64;osx-x64;linux-x64
- Exe
- true
- 1.0.0-dirty
- $(DefineConstants);$(ExtraDefineConstants)
-
- true
- true
-
-
-
- true
- false
- true
- partial
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Always
- alsoft.ini
-
-
- Always
- THIRDPARTY.md
-
-
- Always
- LICENSE.txt
-
-
-
-
-
- Always
-
-
- Always
- mime\Ryujinx.xml
-
-
-
-
-
- false
- Ryujinx.ico
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Ryujinx.Gtk3/Ryujinx.ico b/src/Ryujinx.Gtk3/Ryujinx.ico
deleted file mode 100644
index edf1b93f71fc22179767d13e0ad307a217d440b9..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 108122
zcmZQzU}Rup00Bk@1%@{Y3=C-u3=9noAaMl-4GuI(VDOsA$RHp9;b*WgFnn6b$j}+!=g!L|#l^tD!0YMZ5(JV3VGfYh
zF-0rV7#I{bd%8G=RNQ(yx4I|hd+B}q=jG{X^HrwD>7HTGfTF(aP)98iTE0Pfv>8
zwBmd7qvW3gJD=>6H!gnvQvUh9xr(ZjHkX&BKRY*%-(b$uH*fZq%k6*v{?9qf{lzVE
z%09mA4h=>E4U7r)1>yxPJ52Y=Gv_g~HP$+?@T9lDJg_vZv7SGMMUHJ!N|DmLZ@-^g
zNH4tdmYXB^assoR*ZcMjjC;6+8v_&c3k>$kGrL`S9-6_?x}<%|H2-^c%`+TQn;tVg
z5b0XS&CuIuKQZon^#;a&n-9o6_?H*|fOp+*_lDpZ9-)m<+x1TsnmJu(QSkBQPcr^7
z@5{fnH*$W}-gvW*{l?9=<}cJTs*2}0UGn9Az_4vwy~5sl`wh%H*51xP#n#cdRy%eNoQ+ppNSdG3oPtP?6<)-(KwKETgd&eU!&`F`OX
zzRgdW1ePt+zTs2P{mf)HyKrOkjWzM_zRiAMaeJy?1cRtf*?+zV$~S}_2t51wKIO!@
z!a3PDj2JnBFRSJpvuCIg>3%4G@Y+wiAF|8YZ+LMlTsU#3nm>)Rr{p)Qb>HQLU{(bm
zU-y^&_MJyR{FfEGecv(tQnBpun+(y3j2s4imOtLT`o>)%^ZZxNHikbU(++;Wy<_Kl
z3)}O{I2^Kmv7fmj@BP00w&k+N7SZR^A{izhczfg94eMQh7s(vY?A^wq;QL84`S(Zu
z$DX!*!5X)=GN^4ZxZgZO^up`i-_4}Yrx$Sf>M?qle{;F9re6NpSN+X@*$$Ug@AaEM
z@j8=6vfn;=X1kuXzukBLP1@BEQ(Qd9X<|6TH^%$?cjo@Hx$su}k}6YgQHmae-@_By
z48jMh4L|=kxc&XK{EjFVndJdF9t@X^;@CIL{4e|R{O!tb#oPxpO{CABU!QQhGXLPE
zn)1zi_y5@Uubj)*Tg)M9*Y1|3KmSSeHp$(#efQqaVflqEyI4-_d(eF2fc){`TG{0v
zwrDX3h8=w#x2Ed-yS(^{{sq_X$Se=o@{0LHR4H$QZ1tXw<&VEGnr~&ev}V8JnpNj-
zZxC3pzPxvaTRy{fhB=2WcCjkF{Op!-<#Vyja{i2?>;cEV{itW?X0qT-TDOe}WK$|*tOA=#>tL^=(Z@b?**1UZ$GAoQF!9MTTeGc&kJpp-ZDMq0SeQJv{
zUom;B2-gR?mgr7NYPfj5ZehUv_Ar(Qc{)FjS1Pyu+VH!_Xq(O5R?B79Un5hVuUu+>
z-9SEIDpOR;T8;y`5#jRBkBPi$*4O%4@=W}TosQ90J)J<^cNbJu8rULOl0w8C!`mOf
zlG!jt#(Eda8if$y2oIO616fat`@cQ;zBrUo;`O)IZx*&cAAZw}WPSB}L+4BRq-zdq
zou8jqvYURnIF3oIq45%+pTs+gsgU%bn}Wz*fjuP&GL&wr=XB=rHZ#
zH7`Gko=Fclrt>;$yZ)E7H%q_!=p5Ia^k4P#4qKiT3)&l_JijWoraw-0-_KQJS@mRN
ze#x&xQGyL;Uca*Nt4-qSzIFQ=2cE@9j+0HCe0{6Nn
zl)L=7qVbWdph(;A8Pfxcy+;$O>UlhlIJIp)uzdTY6g`H%%gr1ttb!Hh8z#tD|ME?+
zwE1*{``1N&vw7ct9=~nX&)x9&i`vpFpa0eANEOIw&_m*$uAj
zby73>`ekc18)q)~^(al|4oF=3U{#S_gDdMkwmnMo>p?=>1O+$PFW}dzS^e+9#oz-z
zFCQM)+g2PP&Tw3ljnP|ipMTEoj~25hXuj~Y>kF1)+IIK@yYkg|?p5}i|7_&%*QtMV
zcxU