mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-13 13:37:00 +00:00
use a helper to get key path instead of checking mode & userpath existing every time
This commit is contained in:
parent
c149de7bfe
commit
c261818ef0
7 changed files with 23 additions and 38 deletions
|
|
@ -31,6 +31,11 @@ namespace Ryujinx.Common.Configuration
|
||||||
public static string KeysDirPath { get; private set; }
|
public static string KeysDirPath { get; private set; }
|
||||||
public static string KeysDirPathUser { get; }
|
public static string KeysDirPathUser { get; }
|
||||||
|
|
||||||
|
public static string GetKeysDir() =>
|
||||||
|
Mode is LaunchMode.UserProfile && Directory.Exists(KeysDirPathUser)
|
||||||
|
? KeysDirPathUser
|
||||||
|
: KeysDirPath;
|
||||||
|
|
||||||
public static string LogsDirPath { get; private set; }
|
public static string LogsDirPath { get; private set; }
|
||||||
|
|
||||||
public const string DefaultNandDir = "bis";
|
public const string DefaultNandDir = "bis";
|
||||||
|
|
|
||||||
|
|
@ -230,15 +230,20 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
string consoleKeyFile = null;
|
string consoleKeyFile = null;
|
||||||
string devKeyFile = null;
|
string devKeyFile = null;
|
||||||
|
|
||||||
if (AppDataManager.Mode == AppDataManager.LaunchMode.UserProfile)
|
LoadSetAtPath(AppDataManager.GetKeysDir());
|
||||||
{
|
|
||||||
LoadSetAtPath(AppDataManager.KeysDirPathUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadSetAtPath(AppDataManager.KeysDirPath);
|
|
||||||
|
|
||||||
HasKeySet = (prodKeyFile != null && titleKeyFile != null) || prodKeyFile != null;
|
HasKeySet = (prodKeyFile != null && titleKeyFile != null) || prodKeyFile != null;
|
||||||
|
|
||||||
|
|
||||||
|
ExternalKeyReader.ReadKeyFile(
|
||||||
|
KeySet,
|
||||||
|
prodKeyFile,
|
||||||
|
devKeyFile,
|
||||||
|
titleKeyFile,
|
||||||
|
consoleKeyFile);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
void LoadSetAtPath(string basePath)
|
void LoadSetAtPath(string basePath)
|
||||||
{
|
{
|
||||||
string localProdKeyFile = Path.Combine(basePath, "prod.keys");
|
string localProdKeyFile = Path.Combine(basePath, "prod.keys");
|
||||||
|
|
@ -266,13 +271,6 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
devKeyFile = localDevKeyFile;
|
devKeyFile = localDevKeyFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalKeyReader.ReadKeyFile(
|
|
||||||
KeySet,
|
|
||||||
prodKeyFile,
|
|
||||||
devKeyFile,
|
|
||||||
titleKeyFile,
|
|
||||||
consoleKeyFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ImportTickets(IFileSystem fs)
|
public void ImportTickets(IFileSystem fs)
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
|
||||||
|
|
||||||
private static string GetKeyRetailBinPath()
|
private static string GetKeyRetailBinPath()
|
||||||
{
|
{
|
||||||
return Path.Combine(AppDataManager.KeysDirPath, "key_retail.bin");
|
return Path.Combine(AppDataManager.GetKeysDir(), "key_retail.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath());
|
public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath());
|
||||||
|
|
|
||||||
|
|
@ -156,13 +156,10 @@ namespace Ryujinx.Headless
|
||||||
option.UserProfile = profile.Name;
|
option.UserProfile = profile.Name;
|
||||||
|
|
||||||
// Check if keys exists.
|
// Check if keys exists.
|
||||||
if (!File.Exists(Path.Combine(AppDataManager.KeysDirPath, "prod.keys")))
|
if (!File.Exists(Path.Combine(AppDataManager.GetKeysDir(), "prod.keys")))
|
||||||
{
|
|
||||||
if (!(AppDataManager.Mode == AppDataManager.LaunchMode.UserProfile && File.Exists(Path.Combine(AppDataManager.KeysDirPathUser, "prod.keys"))))
|
|
||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, "Keys not found");
|
Logger.Error?.Print(LogClass.Application, "Keys not found");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ReloadConfig();
|
ReloadConfig();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,13 +189,10 @@ namespace Ryujinx.Ava
|
||||||
DriverUtilities.InitDriverConfig(ConfigurationState.Instance.Graphics.BackendThreading == BackendThreading.Off);
|
DriverUtilities.InitDriverConfig(ConfigurationState.Instance.Graphics.BackendThreading == BackendThreading.Off);
|
||||||
|
|
||||||
// Check if keys exists.
|
// Check if keys exists.
|
||||||
if (!File.Exists(Path.Combine(AppDataManager.KeysDirPath, "prod.keys")))
|
if (!File.Exists(Path.Combine(AppDataManager.GetKeysDir(), "prod.keys")))
|
||||||
{
|
|
||||||
if (!(AppDataManager.Mode == AppDataManager.LaunchMode.UserProfile && File.Exists(Path.Combine(AppDataManager.KeysDirPathUser, "prod.keys"))))
|
|
||||||
{
|
{
|
||||||
MainWindow.ShowKeyErrorOnLoad = true;
|
MainWindow.ShowKeyErrorOnLoad = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (CommandLineState.LaunchPathArg != null)
|
if (CommandLineState.LaunchPathArg != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -83,16 +83,9 @@ namespace Ryujinx.Ava.UI.SetupWizard.Pages
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string systemDirectory = AppDataManager.KeysDirPath;
|
|
||||||
if (AppDataManager.Mode == AppDataManager.LaunchMode.UserProfile &&
|
|
||||||
Directory.Exists(AppDataManager.KeysDirPathUser))
|
|
||||||
{
|
|
||||||
systemDirectory = AppDataManager.KeysDirPathUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, $"Installing keys from {KeysFolderPath}");
|
Logger.Info?.Print(LogClass.Application, $"Installing keys from {KeysFolderPath}");
|
||||||
|
|
||||||
ContentManager.InstallKeys(KeysFolderPath, systemDirectory);
|
ContentManager.InstallKeys(KeysFolderPath, AppDataManager.GetKeysDir());
|
||||||
|
|
||||||
NotificationManager.Information(
|
NotificationManager.Information(
|
||||||
title: LocaleManager.Instance[LocaleKeys.RyujinxInfo],
|
title: LocaleManager.Instance[LocaleKeys.RyujinxInfo],
|
||||||
|
|
|
||||||
|
|
@ -1018,12 +1018,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string systemDirectory = AppDataManager.KeysDirPath;
|
string systemDirectory = AppDataManager.GetKeysDir();
|
||||||
if (AppDataManager.Mode == AppDataManager.LaunchMode.UserProfile &&
|
|
||||||
Directory.Exists(AppDataManager.KeysDirPathUser))
|
|
||||||
{
|
|
||||||
systemDirectory = AppDataManager.KeysDirPathUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
string dialogTitle =
|
string dialogTitle =
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogKeysInstallerKeysInstallTitle);
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogKeysInstallerKeysInstallTitle);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue