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

Custom configuration for each game #632

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
2640f08
Added custom setting function for each game
Goodfeat Feb 6, 2025
5dc7fb4
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 6, 2025
fbe1a7d
Added custom setting function for each game
Goodfeat Feb 6, 2025
fe94224
keys returned to their place, minor fixes, local ones added
Goodfeat Feb 6, 2025
afdfcc1
fix
Goodfeat Feb 6, 2025
6d37d79
Ops
Goodfeat Feb 6, 2025
df1c761
returned the deleted field
Goodfeat Feb 6, 2025
7f4a161
Merge branch 'master' into master
Goodfeat Feb 7, 2025
3a8e6e3
Added gamepad configuration for custom configuration
Goodfeat Feb 7, 2025
fa463c5
code cleaning
Goodfeat Feb 7, 2025
fc01f7b
Merge branch 'master' into master
Goodfeat Feb 8, 2025
4cb2170
Merge branch 'master' into master
Goodfeat Feb 8, 2025
4d5ae23
Added game name to user settings window
Goodfeat Feb 8, 2025
a92475b
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 8, 2025
5f5c761
Fixed a ban where a custom setting was mistakenly created when starti…
Goodfeat Feb 8, 2025
e4e38c4
Merge branch 'master' into master
Goodfeat Feb 8, 2025
11a68a2
Fixed bug crash due to incorrect System.SystemTimeOffset.Value,
Goodfeat Feb 8, 2025
39fbbb3
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 8, 2025
45b1794
Returned an erroneously modified Convert time string
Goodfeat Feb 8, 2025
ae16360
Code cleaning
Goodfeat Feb 8, 2025
cdc4557
Merge branch 'master' into master
Goodfeat Feb 8, 2025
57ac90a
Merge branch 'master' into master
Goodfeat Feb 9, 2025
4bbcec2
Fixed a bug where control would not return after changing settings.
Goodfeat Feb 9, 2025
7568dd4
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 9, 2025
a301a14
Merge branch 'master' into master
Goodfeat Feb 9, 2025
b9982c0
Merge branch 'master' into master
Goodfeat Feb 9, 2025
966860a
Change: initialization of user configuration is now a separate function
Goodfeat Feb 10, 2025
1d68546
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 10, 2025
3e40532
Merge branch 'master' into master
Goodfeat Feb 10, 2025
0399af0
Replace the "delete" button with "apply" during the game in the custo…
Goodfeat Feb 10, 2025
8efceb3
Merge branch 'master' into master
Goodfeat Feb 10, 2025
1ca5407
Added autorestart of the emulator if it is necessary to change the gr…
Goodfeat Feb 11, 2025
6f4930d
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 11, 2025
03692e6
Merge branch 'master' into master
Goodfeat Feb 11, 2025
af13f4b
fix latest changes
Goodfeat Feb 11, 2025
7f7055a
Merge branch 'master' into master
Goodfeat Feb 11, 2025
32f9b33
Merge branch 'master' into master
Goodfeat Feb 12, 2025
c21e63e
Removed irrelevant functions.
Goodfeat Feb 12, 2025
5d061a1
Merge branch 'master' of https://github.com/Goodfeat/Ryujinx_alt
Goodfeat Feb 12, 2025
acc06a8
Merge branch 'master' into master
Goodfeat Feb 12, 2025
22299e6
Merge branch 'master' into master
Goodfeat Feb 12, 2025
42bd991
Merge branch 'master' into master
Goodfeat Feb 12, 2025
2dd787f
Changed: Hid.DisableInputWhenOutOfFocus only for global config
Goodfeat Feb 12, 2025
3f185f5
Merge branch 'master' into master
Goodfeat Feb 13, 2025
1dedf4c
fixed: when loading a game with a custom configuration via a shortcut…
Goodfeat Feb 13, 2025
4f02b6a
Merge branch 'master' into master
Goodfeat Feb 13, 2025
ca8329d
Merge branch 'master' into master
Goodfeat Feb 13, 2025
139e869
Merge branch 'master' into master
GreemDev Feb 14, 2025
7f2dfac
Merge branch 'master' into master
Goodfeat Feb 14, 2025
f73c9ac
Merge branch 'master' into master
Goodfeat Feb 15, 2025
451525e
Merge branch 'master' into master
Goodfeat Feb 15, 2025
931da5e
fix update
Goodfeat Feb 15, 2025
af00ca6
Merge branch 'master' into master
Goodfeat Feb 15, 2025
24867ec
Code refinement. Added UI menu to user settings
Goodfeat Feb 15, 2025
e7c9913
Removed unused library
Goodfeat Feb 15, 2025
edfd58b
small fix
Goodfeat Feb 15, 2025
4461a7c
Removed extra line added by mistake
Goodfeat Feb 15, 2025
5d4052f
Merge branch 'master' into master
Goodfeat Feb 16, 2025
6b48836
Merge branch 'master' into master
Goodfeat Feb 16, 2025
1ec0390
Merge branch 'master' into master
Goodfeat Feb 16, 2025
ced618d
Enabled per-game configuration of discord presence
GreemDev Feb 17, 2025
65527cf
Reload configuration from global & reload app list at the end of the …
GreemDev Feb 17, 2025
01ef387
Merge branch 'master' into master
GreemDev Feb 17, 2025
43e5553
Merge branch 'master' into master
Goodfeat Feb 17, 2025
b61ca06
Merge branch 'master' into master
Goodfeat Feb 19, 2025
313847e
Merge branch 'master' into master
Goodfeat Feb 19, 2025
ee886e5
Merge branch 'master' into master
Goodfeat Feb 19, 2025
7f08469
Merge branch 'master' into master
Goodfeat Feb 21, 2025
c4817b7
Merge branch 'master' into master
Goodfeat Feb 21, 2025
d1efa27
Merge branch 'master' into master
GreemDev Feb 21, 2025
88bf2f0
Merge branch 'master' into master
Goodfeat Feb 22, 2025
efc671c
Merge branch 'master' into master
Goodfeat Feb 23, 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
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ env:
POWERSHELL_TELEMETRY_OPTOUT: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
RYUJINX_BASE_VERSION: "1.2"
RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "release"
RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "Ryubing"
RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "Ryujinx"
RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "master"
RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "Goodfeat"
RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "Ryujinx_alt"
RELEASE: 1

jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using VSyncMode = Ryujinx.Common.Configuration.VSyncMode;

namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
Expand Down
4 changes: 4 additions & 0 deletions src/Ryujinx/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ private void Exit()
Rainbow.Disable();
Rainbow.Reset();

//Reload settings when the game is turned off
//(resets custom settings if there were any)
Program.ReloadConfig();

_isStopped = true;
Stop();
}
Expand Down
23 changes: 20 additions & 3 deletions src/Ryujinx/Assets/Styles/Styles.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Styles
<Styles
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia">
<Design.PreviewWith>
<Border Height="2000"
Expand All @@ -27,10 +28,11 @@
Height="28"
HorizontalAlignment="Right"
Content="Addy" />
<Button
<Button
Name="btnRem"
HorizontalAlignment="Right"
Content="Add" />
Content="Add"
Classes="red"/>
<TextBox
Width="100"
VerticalAlignment="Center"
Expand All @@ -41,7 +43,12 @@
</StackPanel>
</Grid>
<ui:NumberBox Value="1" />
<MenuItem
IconSource="Settings"
Header="123 0000"
ToolTip.Tip="What this"/>
</StackPanel>

</Border>
</Design.PreviewWith>
<Style Selector="DropDownButton">
Expand Down Expand Up @@ -373,6 +380,16 @@
<Setter Property="Background"
Value="{DynamicResource AppListHoverBackgroundColor}" />
</Style>
<Style Selector="Button.red /template/ ContentPresenter">
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Background" Value="red"/>
<Setter Property="Foreground" Value="White"/>
</Style>
<Style Selector="Button.red:pointerover /template/ ContentPresenter">
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Background" Value="{DynamicResource WarningBackgroundColor}" />
<Setter Property="Foreground" Value="White"/>
</Style>
<Styles.Resources>
<SolidColorBrush x:Key="ThemeAccentColorBrush"
Color="{DynamicResource SystemAccentColor}" />
Expand Down
8 changes: 7 additions & 1 deletion src/Ryujinx/Assets/Styles/Themes.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
Expand All @@ -12,11 +12,13 @@
<Color x:Key="MenuFlyoutPresenterBorderColor">#C1C1C1</Color>
<Color x:Key="AppListBackgroundColor">#b3ffffff</Color>
<Color x:Key="AppListHoverBackgroundColor">#80cccccc</Color>
<Color x:Key="WarningBackgroundColor">#FF6347</Color>
<Color x:Key="SecondaryTextColor">#A0000000</Color>
<Color x:Key="FavoriteApplicationIconColor">#fffcd12a</Color>
<Color x:Key="Switch">#FF2EEAC9</Color>
<Color x:Key="Unbounded">#FFFF4554</Color>
<Color x:Key="Custom">#6483F5</Color>
<Color x:Key="Warning">#800080</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="DataGridSelectionBackgroundBrush"
Expand All @@ -29,11 +31,13 @@
<Color x:Key="MenuFlyoutPresenterBorderColor">#C1C1C1</Color>
<Color x:Key="AppListBackgroundColor">#b3ffffff</Color>
<Color x:Key="AppListHoverBackgroundColor">#80cccccc</Color>
<Color x:Key="WarningBackgroundColor">#FF6347</Color>
<Color x:Key="SecondaryTextColor">#A0000000</Color>
<Color x:Key="FavoriteApplicationIconColor">#fffcd12a</Color>
<Color x:Key="Switch">#13c3a4</Color>
<Color x:Key="Unbounded">#FFFF4554</Color>
<Color x:Key="Custom">#6483F5</Color>
<Color x:Key="Warning">#800080</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="DataGridSelectionBackgroundBrush"
Expand All @@ -46,11 +50,13 @@
<Color x:Key="MenuFlyoutPresenterBorderColor">#3D3D3D</Color>
<Color x:Key="AppListBackgroundColor">#0FFFFFFF</Color>
<Color x:Key="AppListHoverBackgroundColor">#1EFFFFFF</Color>
<Color x:Key="WarningBackgroundColor">#FF6347</Color>
<Color x:Key="SecondaryTextColor">#A0FFFFFF</Color>
<Color x:Key="FavoriteApplicationIconColor">#fffcd12a</Color>
<Color x:Key="Switch">#FF2EEAC9</Color>
<Color x:Key="Unbounded">#FFFF4554</Color>
<Color x:Key="Custom">#6483F5</Color>
<Color x:Key="Warning">#FFA500</Color>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
25 changes: 25 additions & 0 deletions src/Ryujinx/Assets/locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,31 @@
"zh_TW": "在 macOS 的應用程式資料夾中建立捷徑,啟動選取的應用程式"
}
},
{
"ID": "EditGameConfigurationToolTip",
"Translations": {
"ar_SA": "ينشئ تكوينًا مستقلًا للعبة الحالية",
"de_DE": "Erstellt eine unabhängige Konfiguration für das aktuelle Spiel",
"el_GR": "Δημιουργεί μια ανεξάρτητη διαμόρφωση για το τρέχον παιχνίδι",
"en_US": "Creates an independent configuration for the current game",
"es_ES": "Crea una configuración independiente para el juego actual",
"fr_FR": "Crée une configuration indépendante pour le jeu en cours",
"he_IL": "יוצר תצורה עצמאית למשחק הנוכחי",
"it_IT": "Crea una configurazione indipendente per il gioco attuale",
"ja_JP": "現在のゲーム用の独立した設定を作成します",
"ko_KR": "현재 게임에 대한 독립적인 설정을 생성합니다",
"no_NO": "Oppretter en uavhengig konfigurasjon for det gjeldende spillet",
"pl_PL": "Tworzy niezależną konfigurację dla bieżącej gry",
"pt_BR": "Cria uma configuração independente para o jogo atual",
"ru_RU": "Создает независимую конфигурацию для текущей игры",
"sv_SE": "Skapar en oberoende konfiguration för det aktuella spelet",
"th_TH": "สร้างการกำหนดค่าที่เป็นอิสระสำหรับเกมปัจจุบัน",
"tr_TR": "Mevcut oyun için bağımsız bir yapılandırma oluşturur",
"uk_UA": "Створює незалежну конфігурацію для поточної гри",
"zh_CN": "为当前游戏创建独立的配置",
"zh_TW": "為當前遊戲創建獨立的配置"
}
},
{
"ID": "GameListContextMenuShowCompatEntry",
"Translations": {
Expand Down
62 changes: 61 additions & 1 deletion src/Ryujinx/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace Ryujinx.Ava
{
Expand All @@ -32,6 +33,7 @@ internal partial class Program
public static double DesktopScaleFactor { get; set; } = 1.0;
public static string Version { get; private set; }
public static string ConfigurationPath { get; private set; }
public static string GlobalConfigurationPath { get; private set; }
public static bool PreviewerDetached { get; private set; }
public static bool UseHardwareAcceleration { get; private set; }

Expand Down Expand Up @@ -155,11 +157,42 @@ private static void Initialize(string[] args)
}
}

public static void ReloadGameConfig(string gamedir)
{
if (File.Exists(gamedir))
{
ConfigurationPath = gamedir;
}

}

public static string GetDirGameUserConfig(string gameId, bool rememberGlobalDir = false, bool changeFolderForGame = false)
{
string gameDir = Path.Combine(AppDataManager.GamesDirPath, gameId, ReleaseInformation.ConfigName);

// Should load with the game if there is a custom setting for the game
if (rememberGlobalDir)
{
GlobalConfigurationPath = ConfigurationPath;
}

if (changeFolderForGame)
{
ConfigurationPath = gameDir;
}

return gameDir;
}

public static void ReloadConfig()
{
//It is necessary that when a user setting appears, the global setting remains available
GlobalConfigurationPath = null;

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
if (File.Exists(localConfigurationPath))
{
Expand Down Expand Up @@ -232,8 +265,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
7 changes: 6 additions & 1 deletion src/Ryujinx/Ryujinx.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<OutputType>Exe</OutputType>
Expand Down Expand Up @@ -172,5 +172,10 @@
<ItemGroup>
<Folder Include="Assets\Fonts\Mono\" />
</ItemGroup>
<ItemGroup>
<Compile Update="UI\Windows\UserConfigWindows.axaml.cs">
<DependentUpon>UserConfigWindows.axaml</DependentUpon>
</Compile>
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
Header="{ext:Locale GameListContextMenuCreateShortcut}"
Icon="{ext:Icon fa-solid fa-bookmark}"
ToolTip.Tip="{OnPlatform Default={ext:Locale GameListContextMenuCreateShortcutToolTip}, macOS={ext:Locale GameListContextMenuCreateShortcutToolTipMacOS}}" />
<MenuItem
Click="EditGameConfiguration_Click"
Header="Edit Game Configuration"
Icon="{ext:Icon fa-solid fa-gear}"
ToolTip.Tip="{ext:Locale EditGameConfigurationToolTip}" />
<MenuItem
IsVisible="{Binding HasCompatibilityEntry}"
Click="OpenApplicationCompatibility_Click"
Expand Down
34 changes: 32 additions & 2 deletions src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Ryujinx.Ava.Utilities;
using Ryujinx.Ava.Utilities.AppLibrary;
using Ryujinx.Ava.Utilities.Compat;
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Helper;
using Ryujinx.HLE.HOS;
Expand All @@ -36,6 +37,21 @@ private void InitializeComponent()
AvaloniaXamlLoader.Load(this);
}

public void ToggleUserControl_Click(object sender, RoutedEventArgs args)
{
if (sender is not MenuItem { DataContext: MainWindowViewModel { SelectedApplication: not null } viewModel })
return;

viewModel.SelectedApplication.Favorite = !viewModel.SelectedApplication.Favorite;

ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.IdString, appMetadata =>
{
appMetadata.Favorite = viewModel.SelectedApplication.Favorite;
});

viewModel.RefreshView();
}

public void ToggleFavorite_Click(object sender, RoutedEventArgs args)
{
if (sender is not MenuItem { DataContext: MainWindowViewModel { SelectedApplication: not null } viewModel })
Expand Down Expand Up @@ -386,13 +402,27 @@ public void CreateApplicationShortcut_Click(object sender, RoutedEventArgs args)
viewModel.SelectedApplication.Icon
);
}


public async void EditGameConfiguration_Click(object sender, RoutedEventArgs args)
{
if (sender is MenuItem { DataContext: MainWindowViewModel { SelectedApplication: not null } viewModel })
{
await new UserConfigWindows(viewModel).ShowDialog((Window)viewModel.TopLevel);

//just checking for file presence
viewModel.SelectedApplication.UserConfig = File.Exists(Program.GetDirGameUserConfig(viewModel.SelectedApplication.IdString,false,false));

viewModel.RefreshView();
}

}

public async void OpenApplicationCompatibility_Click(object sender, RoutedEventArgs args)
{
if (sender is MenuItem { DataContext: MainWindowViewModel { SelectedApplication: not null } viewModel })
await CompatibilityList.Show(viewModel.SelectedApplication.IdString);
}

public async void OpenApplicationData_Click(object sender, RoutedEventArgs args)
{
if (sender is MenuItem { DataContext: MainWindowViewModel { SelectedApplication: not null } viewModel })
Expand Down
Loading