forked from Mirror/Ryujinx
UI: Fix sections extraction (#4820)
* UI: Fix sections extraction There is currently an issue when the update NCA doesn't contains the section we want to extract, this is fixed by adding a check. I have fixed the inverted handler of ExeFs/Logo introduced in #4755. Fixes #4521 * Addresses feedback
This commit is contained in:
parent
e5c9838b0b
commit
d6698680be
4 changed files with 22 additions and 11 deletions
|
@ -233,8 +233,13 @@ namespace Ryujinx.Ava.Common
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IFileSystem ncaFileSystem = patchNca != null
|
bool sectionExistsInPatch = false;
|
||||||
? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
if (patchNca != null)
|
||||||
|
{
|
||||||
|
sectionExistsInPatch = patchNca.CanOpenSection(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileSystem ncaFileSystem = sectionExistsInPatch ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
||||||
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
||||||
|
|
||||||
FileSystemClient fsClient = _horizonClient.Fs;
|
FileSystemClient fsClient = _horizonClient.Fs;
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
|
<MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Click="ExtractApplicationLogo_Click"
|
Click="ExtractApplicationExeFs_Click"
|
||||||
Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
|
Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
|
Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Click="ExtractApplicationExeFs_Click"
|
Click="ExtractApplicationLogo_Click"
|
||||||
Header="{locale:Locale GameListContextMenuExtractDataLogo}"
|
Header="{locale:Locale GameListContextMenuExtractDataLogo}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
|
@ -289,13 +289,13 @@ namespace Ryujinx.Ava.UI.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ExtractApplicationLogo_Click(object sender, RoutedEventArgs args)
|
public async void ExtractApplicationExeFs_Click(object sender, RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
||||||
|
|
||||||
if (viewModel?.SelectedApplication != null)
|
if (viewModel?.SelectedApplication != null)
|
||||||
{
|
{
|
||||||
await ApplicationHelper.ExtractSection(NcaSectionType.Logo, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
await ApplicationHelper.ExtractSection(NcaSectionType.Code, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,13 +309,13 @@ namespace Ryujinx.Ava.UI.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ExtractApplicationExeFs_Click(object sender, RoutedEventArgs args)
|
public async void ExtractApplicationLogo_Click(object sender, RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
||||||
|
|
||||||
if (viewModel?.SelectedApplication != null)
|
if (viewModel?.SelectedApplication != null)
|
||||||
{
|
{
|
||||||
await ApplicationHelper.ExtractSection(NcaSectionType.Code, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
await ApplicationHelper.ExtractSection(NcaSectionType.Logo, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,13 @@ namespace Ryujinx.Ui.Widgets
|
||||||
|
|
||||||
int index = Nca.GetSectionIndexFromType(ncaSectionType, mainNca.Header.ContentType);
|
int index = Nca.GetSectionIndexFromType(ncaSectionType, mainNca.Header.ContentType);
|
||||||
|
|
||||||
IFileSystem ncaFileSystem = patchNca != null ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
bool sectionExistsInPatch = false;
|
||||||
|
if (patchNca != null)
|
||||||
|
{
|
||||||
|
sectionExistsInPatch = patchNca.CanOpenSection(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileSystem ncaFileSystem = sectionExistsInPatch ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
||||||
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
||||||
|
|
||||||
FileSystemClient fsClient = _horizonClient.Fs;
|
FileSystemClient fsClient = _horizonClient.Fs;
|
||||||
|
|
Loading…
Reference in a new issue