Add directory installation option and fix 9.x support for directory

This commit is contained in:
Thog 2020-01-06 14:34:58 +01:00
commit 881111038b
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
3 changed files with 72 additions and 15 deletions

View file

@ -747,10 +747,19 @@ namespace Ryujinx.HLE.FileSystem.Content
if (updateNcas.TryGetValue(metaEntry.TitleId, out var ncaEntry))
{
var metaNcaEntry = ncaEntry.Find(x => x.Item1 == NcaContentType.Meta);
var contentNcaEntry = ncaEntry.Find(x => x.Item1 != NcaContentType.Meta);
string contentPath = ncaEntry.Find(x => x.Item1 != NcaContentType.Meta).Item2;
// Nintendo in 9.0.0, removed PPC and only kept the meta nca of it.
// This is a perfect valid case, so we should just ignore the missing content nca and continue.
if (contentPath == null)
{
updateNcas.Remove(metaEntry.TitleId);
continue;
}
IStorage metaStorage = OpenPossibleFragmentedFile(filesystem, metaNcaEntry.Item2, OpenMode.Read).AsStorage();
IStorage contentStorage = OpenPossibleFragmentedFile(filesystem, contentNcaEntry.Item2, OpenMode.Read).AsStorage();
IStorage contentStorage = OpenPossibleFragmentedFile(filesystem, contentPath, OpenMode.Read).AsStorage();
Nca metaNca = new Nca(_device.System.KeySet, metaStorage);

View file

@ -45,7 +45,8 @@ namespace Ryujinx.Ui
[GUI] CheckMenuItem _fullScreen;
[GUI] MenuItem _stopEmulation;
[GUI] CheckMenuItem _favToggle;
[GUI] MenuItem _firmwareInstall;
[GUI] MenuItem _firmwareInstallFile;
[GUI] MenuItem _firmwareInstallDirectory;
[GUI] CheckMenuItem _iconToggle;
[GUI] CheckMenuItem _appToggle;
[GUI] CheckMenuItem _developerToggle;
@ -298,7 +299,9 @@ namespace Ryujinx.Ui
_gameLoaded = true;
_stopEmulation.Sensitive = true;
_firmwareInstall.Sensitive = false;
_firmwareInstallFile.Sensitive = false;
_firmwareInstallDirectory.Sensitive = false;
DiscordIntegrationModule.SwitchToPlayingState(_device.System.TitleId, _device.System.TitleName);
@ -559,9 +562,9 @@ namespace Ryujinx.Ui
_gameLoaded = false;
}
private void Installer_Pressed(object o, EventArgs args)
private void Installer_File_Pressed(object o, EventArgs args)
{
FileChooserDialog fileChooser = new FileChooserDialog("Choose the folder to open",
FileChooserDialog fileChooser = new FileChooserDialog("Choose the firmware file to open",
this,
FileChooserAction.Open,
"Cancel",
@ -569,6 +572,28 @@ namespace Ryujinx.Ui
"Open",
ResponseType.Accept);
fileChooser.Filter = new FileFilter();
fileChooser.Filter.AddPattern("*.zip");
fileChooser.Filter.AddPattern("*.xci");
HandleInstallerDialog(fileChooser);
}
private void Installer_Directory_Pressed(object o, EventArgs args)
{
FileChooserDialog directoryChooser = new FileChooserDialog("Choose the firmware directory to open",
this,
FileChooserAction.SelectFolder,
"Cancel",
ResponseType.Cancel,
"Open",
ResponseType.Accept);
HandleInstallerDialog(directoryChooser);
}
private void HandleInstallerDialog(FileChooserDialog fileChooser)
{
if (fileChooser.Run() == (int)ResponseType.Accept)
{
MessageDialog dialog = null;

View file

@ -268,12 +268,35 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="_firmwareInstall">
<object class="GtkMenuItem" id="FirmwareSubMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Install Firmware</property>
<property name="use_underline">True</property>
<signal name="activate" handler="Installer_Pressed" swapped="no"/>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="_firmwareInstallFile">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Install a firmware from XCI or ZIP</property>
<property name="use_underline">True</property>
<signal name="activate" handler="Installer_File_Pressed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="_firmwareInstallDirectory">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Install a firmware from a directory</property>
<property name="use_underline">True</property>
<signal name="activate" handler="Installer_Directory_Pressed" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>