aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx/Ui/MainWindow.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2021-06-28 20:54:45 +0200
committerGitHub <noreply@github.com>2021-06-28 20:54:45 +0200
commita79b39b91347816ea14677b58af738b70df03e9c (patch)
tree824a7e056bcd18aced7679df5adb7f5b1d4f6405 /Ryujinx/Ui/MainWindow.cs
parentfefd4619a5347b4ef86314a4e17e1d6e63ced297 (diff)
no name: Mii Editor applet support (#2419)
* no name: Mii Editor applet support * addresses gdkchan feedback * Fix comment * Bypass MountCounter of MiiDatabaseManager * Fix GetSettingsPlatformRegion * Disable Applet Menu for unsupported firmwares
Diffstat (limited to 'Ryujinx/Ui/MainWindow.cs')
-rw-r--r--Ryujinx/Ui/MainWindow.cs47
1 files changed, 45 insertions, 2 deletions
diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs
index 9eb6f303..113ac639 100644
--- a/Ryujinx/Ui/MainWindow.cs
+++ b/Ryujinx/Ui/MainWindow.cs
@@ -3,6 +3,7 @@ using ARMeilleure.Translation.PTC;
using Gtk;
using LibHac.Common;
using LibHac.FsSystem;
+using LibHac.FsSystem.NcaUtils;
using LibHac.Ns;
using Ryujinx.Audio.Backends.Dummy;
using Ryujinx.Audio.Backends.OpenAL;
@@ -87,6 +88,10 @@ namespace Ryujinx.Ui
[GUI] Box _statusBar;
[GUI] MenuItem _optionMenu;
[GUI] MenuItem _manageUserProfiles;
+ [GUI] MenuItem _fileMenu;
+ [GUI] MenuItem _loadApplicationFile;
+ [GUI] MenuItem _loadApplicationFolder;
+ [GUI] MenuItem _appletMenu;
[GUI] MenuItem _actionMenu;
[GUI] MenuItem _stopEmulation;
[GUI] MenuItem _simulateWakeUpMessage;
@@ -165,6 +170,7 @@ namespace Ryujinx.Ui
_applicationLibrary.ApplicationAdded += Application_Added;
_applicationLibrary.ApplicationCountUpdated += ApplicationCount_Updated;
+ _fileMenu.StateChanged += FileMenu_StateChanged;
_actionMenu.StateChanged += ActionMenu_StateChanged;
_optionMenu.StateChanged += OptionMenu_StateChanged;
@@ -575,7 +581,15 @@ namespace Ryujinx.Ui
SystemVersion firmwareVersion = _contentManager.GetCurrentFirmwareVersion();
- bool isDirectory = Directory.Exists(path);
+ bool isDirectory = Directory.Exists(path);
+ bool isFirmwareTitle = false;
+
+ if (path.StartsWith("@SystemContent"))
+ {
+ path = _virtualFileSystem.SwitchPathToSystemPath(path);
+
+ isFirmwareTitle = true;
+ }
if (!SetupValidator.CanStartApplication(_contentManager, path, out UserError userError))
{
@@ -636,7 +650,13 @@ namespace Ryujinx.Ui
Logger.Notice.Print(LogClass.Application, $"Using Firmware Version: {firmwareVersion?.VersionString}");
- if (Directory.Exists(path))
+ if (isFirmwareTitle)
+ {
+ Logger.Info?.Print(LogClass.Application, "Loading as Firmware Title (NCA).");
+
+ _emulationContext.LoadNca(path);
+ }
+ else if (Directory.Exists(path))
{
string[] romFsFiles = Directory.GetFiles(path, "*.istorage");
@@ -1100,6 +1120,20 @@ namespace Ryujinx.Ui
}
}
+ private void FileMenu_StateChanged(object o, StateChangedArgs args)
+ {
+ _appletMenu.Sensitive = _emulationContext == null && _contentManager.GetCurrentFirmwareVersion() != null && _contentManager.GetCurrentFirmwareVersion().Major > 3;
+ _loadApplicationFile.Sensitive = _emulationContext == null;
+ _loadApplicationFolder.Sensitive = _emulationContext == null;
+ }
+
+ private void Load_Mii_Edit_Applet(object sender, EventArgs args)
+ {
+ string contentPath = _contentManager.GetInstalledContentPath(0x0100000000001009, StorageId.NandSystem, NcaContentType.Program);
+
+ LoadApplication(contentPath);
+ }
+
private void Open_Ryu_Folder(object sender, EventArgs args)
{
OpenHelper.OpenFolder(AppDataManager.BaseDirPath);
@@ -1217,6 +1251,15 @@ namespace Ryujinx.Ui
GtkDialog.CreateInfoDialog(dialogTitle, message);
Logger.Info?.Print(LogClass.Application, message);
+
+ // Purge Applet Cache.
+
+ DirectoryInfo miiEditorCacheFolder = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, "0100000000001009", "cache"));
+
+ if (miiEditorCacheFolder.Exists)
+ {
+ miiEditorCacheFolder.Delete(true);
+ }
});
}
catch (Exception ex)