Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new window for shortcut configuration #607

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d76da6e
Added --backend-threading parameter for launching games via shortcut
Goodfeat Jan 29, 2025
b8fe778
Added a window with settings for shortcuts.
Goodfeat Feb 1, 2025
fd258a1
Merge branch 'Ryubing:master' into master
Goodfeat Feb 1, 2025
d8cf67d
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 1, 2025
3a8737f
fixed bugs and renamed method to GetArguments
Goodfeat Feb 1, 2025
32df1da
Merge branch 'master' into master
Goodfeat Feb 1, 2025
25c4736
Merge branch 'master' into master
Goodfeat Feb 1, 2025
720a81e
Add ConfigFileNameOverride in ReleaseInformation
Goodfeat Feb 1, 2025
9397ef8
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 1, 2025
03b4a24
Added ReleaseInformation
Goodfeat Feb 1, 2025
068f6be
Merge branch 'Ryubing:master' into master
Goodfeat Feb 1, 2025
b742bcb
Merge branch 'master' into master
Goodfeat Feb 2, 2025
2e13cdc
Merge branch 'master' into master
Goodfeat Feb 2, 2025
4efd20c
Merge branch 'master' into master
Goodfeat Feb 3, 2025
6e5861d
Merge branch 'master' into master
Goodfeat Feb 3, 2025
d679725
"IsMacOS" to "RunningPlatform.IsMacOS"
Goodfeat Feb 3, 2025
2d30adb
Merge branch 'master' into master
Goodfeat Feb 3, 2025
41c67b4
Merge branch 'master' into master
Goodfeat Feb 4, 2025
e48b64a
Merge branch 'master' into master
Goodfeat Feb 4, 2025
b82aff5
Merge branch 'master' into master
Goodfeat Feb 5, 2025
713ae74
Merge branch 'master' into master
Goodfeat Feb 5, 2025
4d3e5a4
Merge branch 'master' into master
Goodfeat Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Ryujinx.Common/ReleaseInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static class ReleaseInformation
public const string ReleaseChannelRepo = "%%RYUJINX_TARGET_RELEASE_CHANNEL_REPO%%";

public static string ConfigName => !ConfigFileName.StartsWith("%%") ? ConfigFileName : "Config.json";
public static string CustomConfigNameOverride => !ConfigFileName.StartsWith("%%") ? ConfigFileName : "CustomConfigOverride.json";

public static bool IsValid =>
!BuildGitHash.StartsWith("%%") &&
Expand Down
51 changes: 50 additions & 1 deletion src/Ryujinx/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,28 @@ public static void ReloadConfig()
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.ConfigName);
string appDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, ReleaseInformation.ConfigName);

string overrideLocalConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.CustomConfigNameOverride);
string overrideAppDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, ReleaseInformation.CustomConfigNameOverride);

// Copies and reloads the configuration file if the game was loaded with arguments
// based on global configuration
if (CommandLineState.CountArguments > 0)
{
if (File.Exists(localConfigurationPath))
{
File.Copy(localConfigurationPath, overrideLocalConfigurationPath, overwrite: true);
}

localConfigurationPath = overrideLocalConfigurationPath;

if (File.Exists(appDataConfigurationPath))
{
File.Copy(appDataConfigurationPath, overrideAppDataConfigurationPath, overwrite: true);
}

appDataConfigurationPath = overrideAppDataConfigurationPath;
}

// Now load the configuration as the other subsystems are now registered
if (File.Exists(localConfigurationPath))
{
Expand Down Expand Up @@ -232,8 +254,35 @@ public static void ReloadConfig()
_ => ConfigurationState.Instance.HideCursor,
};

// Check if memoryManagerMode was overridden.
if (CommandLineState.OverrideMemoryManagerMode is not null)
if (Enum.TryParse(CommandLineState.OverrideMemoryManagerMode, true, out MemoryManagerMode result))
{
ConfigurationState.Instance.System.MemoryManagerMode.Value = result;
}

// Check if PPTC was overridden.
if (CommandLineState.OverridePPTC is not null)
if (Enum.TryParse(CommandLineState.OverridePPTC, true, out bool result))
{
ConfigurationState.Instance.System.EnablePtc.Value = result;
}

// Check if region was overridden.
if (CommandLineState.OverrideSystemRegion is not null)
if (Enum.TryParse(CommandLineState.OverrideSystemRegion, true, out Ryujinx.HLE.HOS.SystemState.RegionCode result))
{
ConfigurationState.Instance.System.Region.Value = (Utilities.Configuration.System.Region)result;
}

//Check if language was overridden.
if (CommandLineState.OverrideSystemLanguage is not null)
if (Enum.TryParse(CommandLineState.OverrideSystemLanguage, true, out Ryujinx.HLE.HOS.SystemState.SystemLanguage result))
{
ConfigurationState.Instance.System.Language.Value = (Utilities.Configuration.System.Language)result;
}

// Check if hardware-acceleration was overridden.
// Check if hardware-acceleration was overridden. MemoryManagerMode ( outdated! )
if (CommandLineState.OverrideHardwareAcceleration != null)
UseHardwareAcceleration = CommandLineState.OverrideHardwareAcceleration.Value;
}
Expand Down
10 changes: 3 additions & 7 deletions src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,11 @@ public async void ExtractApplicationLogo_Click(object sender, RoutedEventArgs ar
png.SaveTo(fileStream);
}

public void CreateApplicationShortcut_Click(object sender, RoutedEventArgs args)
public async void CreateApplicationShortcut_Click(object sender, RoutedEventArgs args)
{
if (sender is MenuItem { DataContext: MainWindowViewModel { SelectedApplication: not null } viewModel })
ShortcutHelper.CreateAppShortcut(
viewModel.SelectedApplication.Path,
viewModel.SelectedApplication.Name,
viewModel.SelectedApplication.IdString,
viewModel.SelectedApplication.Icon
);
await new ArgumentsConfigWindows(viewModel).ShowDialog((Window)viewModel.TopLevel);

}

public async void RunApplication_Click(object sender, RoutedEventArgs args)
Expand Down
76 changes: 76 additions & 0 deletions src/Ryujinx/UI/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using Gommon;
using LibHac.Tools.Fs;
using LibHac.Tools.FsSystem;
using Ryujinx.Audio.Backends.OpenAL;
using Ryujinx.Audio.Backends.SDL2;
Expand All @@ -25,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -62,12 +65,56 @@ public partial class SettingsViewModel : BaseModel

public event Action CloseWindow;
public event Action SaveSettingsEvent;
public event Action CompareSettingsEvent;
private int _networkInterfaceIndex;
private int _multiplayerModeIndex;
private string _ldnPassphrase;
[ObservableProperty] private string _ldnServer;

public SettingsHacksViewModel DirtyHacks { get; }
public string GamePath { get; }
public string GameName { get; }

private Bitmap _gameIcon;

private string _gameTitle;
private string _gameId;
public Bitmap GameIcon
{
get => _gameIcon;
set
{
if (_gameIcon != value)
{
_gameIcon = value;
}
}
}

public string GameTitle
{
get => _gameTitle;
set
{
if (_gameTitle != value)
{
_gameTitle = value;
}
}
}

public string GameId
{
get => _gameId;
set
{
if (_gameId != value)
{
_gameId = value;
}
}
}


public int ResolutionScale
{
Expand Down Expand Up @@ -348,6 +395,30 @@ public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager con
}
}

public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager, string gamePath, string gameName, string gameId, byte[] gameIconData) : this()
{
_virtualFileSystem = virtualFileSystem;
_contentManager = contentManager;

if (gameIconData != null && gameIconData.Length > 0)
{
using (var ms = new MemoryStream(gameIconData))
{
GameIcon = new Bitmap(ms);
}
}

GameTitle = gameName;
GameId = gameId;

if (Program.PreviewerDetached)
{
Task.Run(LoadTimeZones);

DirtyHacks = new SettingsHacksViewModel(this);
}
}

public SettingsViewModel()
{
GameDirectories = [];
Expand Down Expand Up @@ -728,6 +799,11 @@ public void ApplyButton()
SaveSettings();
}

public void CreateShortcut()
{
CompareSettingsEvent?.Invoke(); //raises an event to create a shortcut with arguments
}

public void OkButton()
{
SaveSettings();
Expand Down
Loading