|
@@ -8,7 +8,6 @@ using LibHac.FsSystem;
|
|
|
using LibHac.FsSystem.NcaUtils;
|
|
using LibHac.FsSystem.NcaUtils;
|
|
|
using LibHac.Ncm;
|
|
using LibHac.Ncm;
|
|
|
using LibHac.Ns;
|
|
using LibHac.Ns;
|
|
|
-using LibHac.Spl;
|
|
|
|
|
using Ryujinx.Common.Configuration;
|
|
using Ryujinx.Common.Configuration;
|
|
|
using Ryujinx.Common.Logging;
|
|
using Ryujinx.Common.Logging;
|
|
|
using Ryujinx.Common.Utilities;
|
|
using Ryujinx.Common.Utilities;
|
|
@@ -20,64 +19,97 @@ using System.Globalization;
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
using System.Reflection;
|
|
using System.Reflection;
|
|
|
using System.Threading;
|
|
using System.Threading;
|
|
|
|
|
+
|
|
|
using static LibHac.Fs.ApplicationSaveDataManagement;
|
|
using static LibHac.Fs.ApplicationSaveDataManagement;
|
|
|
-using GUI = Gtk.Builder.ObjectAttribute;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Ui
|
|
namespace Ryujinx.Ui
|
|
|
{
|
|
{
|
|
|
public class GameTableContextMenu : Menu
|
|
public class GameTableContextMenu : Menu
|
|
|
{
|
|
{
|
|
|
- private ListStore _gameTableStore;
|
|
|
|
|
- private TreeIter _rowIter;
|
|
|
|
|
- private VirtualFileSystem _virtualFileSystem;
|
|
|
|
|
- private MessageDialog _dialog;
|
|
|
|
|
- private bool _cancel;
|
|
|
|
|
-
|
|
|
|
|
- private BlitStruct<ApplicationControlProperty> _controlData;
|
|
|
|
|
-
|
|
|
|
|
-#pragma warning disable CS0649
|
|
|
|
|
-#pragma warning disable IDE0044
|
|
|
|
|
- [GUI] MenuItem _openSaveUserDir;
|
|
|
|
|
- [GUI] MenuItem _openSaveDeviceDir;
|
|
|
|
|
- [GUI] MenuItem _openSaveBcatDir;
|
|
|
|
|
- [GUI] MenuItem _manageTitleUpdates;
|
|
|
|
|
- [GUI] MenuItem _extractRomFs;
|
|
|
|
|
- [GUI] MenuItem _extractExeFs;
|
|
|
|
|
- [GUI] MenuItem _extractLogo;
|
|
|
|
|
-#pragma warning restore CS0649
|
|
|
|
|
-#pragma warning restore IDE0044
|
|
|
|
|
|
|
+ private readonly ListStore _gameTableStore;
|
|
|
|
|
+ private readonly TreeIter _rowIter;
|
|
|
|
|
+ private readonly VirtualFileSystem _virtualFileSystem;
|
|
|
|
|
|
|
|
- public GameTableContextMenu(ListStore gameTableStore, BlitStruct<ApplicationControlProperty> controlData, TreeIter rowIter, VirtualFileSystem virtualFileSystem)
|
|
|
|
|
- : this(new Builder("Ryujinx.Ui.GameTableContextMenu.glade"), gameTableStore, controlData, rowIter, virtualFileSystem) { }
|
|
|
|
|
|
|
+ private readonly BlitStruct<ApplicationControlProperty> _controlData;
|
|
|
|
|
|
|
|
- private GameTableContextMenu(Builder builder, ListStore gameTableStore, BlitStruct<ApplicationControlProperty> controlData, TreeIter rowIter, VirtualFileSystem virtualFileSystem) : base(builder.GetObject("_contextMenu").Handle)
|
|
|
|
|
- {
|
|
|
|
|
- builder.Autoconnect(this);
|
|
|
|
|
|
|
+ private MessageDialog _dialog;
|
|
|
|
|
+ private bool _cancel;
|
|
|
|
|
|
|
|
|
|
+ public GameTableContextMenu(ListStore gameTableStore, BlitStruct<ApplicationControlProperty> controlData, TreeIter rowIter, VirtualFileSystem virtualFileSystem)
|
|
|
|
|
+ {
|
|
|
_gameTableStore = gameTableStore;
|
|
_gameTableStore = gameTableStore;
|
|
|
_rowIter = rowIter;
|
|
_rowIter = rowIter;
|
|
|
_virtualFileSystem = virtualFileSystem;
|
|
_virtualFileSystem = virtualFileSystem;
|
|
|
_controlData = controlData;
|
|
_controlData = controlData;
|
|
|
|
|
|
|
|
- _openSaveUserDir.Activated += OpenSaveUserDir_Clicked;
|
|
|
|
|
- _openSaveDeviceDir.Activated += OpenSaveDeviceDir_Clicked;
|
|
|
|
|
- _openSaveBcatDir.Activated += OpenSaveBcatDir_Clicked;
|
|
|
|
|
- _manageTitleUpdates.Activated += ManageTitleUpdates_Clicked;
|
|
|
|
|
- _extractRomFs.Activated += ExtractRomFs_Clicked;
|
|
|
|
|
- _extractExeFs.Activated += ExtractExeFs_Clicked;
|
|
|
|
|
- _extractLogo.Activated += ExtractLogo_Clicked;
|
|
|
|
|
|
|
+ MenuItem openSaveUserDir = new MenuItem("Open User Save Directory")
|
|
|
|
|
+ {
|
|
|
|
|
+ Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0,
|
|
|
|
|
+ TooltipText = "Open the folder where the User save for the application is loaded"
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- _openSaveUserDir.Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0;
|
|
|
|
|
- _openSaveDeviceDir.Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0;
|
|
|
|
|
- _openSaveBcatDir.Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0;
|
|
|
|
|
|
|
+ MenuItem openSaveDeviceDir = new MenuItem("Open Device Save Directory")
|
|
|
|
|
+ {
|
|
|
|
|
+ Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0,
|
|
|
|
|
+ TooltipText = "Open the folder where the Device save for the application is loaded"
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- string ext = System.IO.Path.GetExtension(_gameTableStore.GetValue(_rowIter, 9).ToString()).ToLower();
|
|
|
|
|
- if (ext != ".nca" && ext != ".nsp" && ext != ".pfs0" && ext != ".xci")
|
|
|
|
|
|
|
+ MenuItem openSaveBcatDir = new MenuItem("Open BCAT Save Directory")
|
|
|
{
|
|
{
|
|
|
- _extractRomFs.Sensitive = false;
|
|
|
|
|
- _extractExeFs.Sensitive = false;
|
|
|
|
|
- _extractLogo.Sensitive = false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0,
|
|
|
|
|
+ TooltipText = "Open the folder where the BCAT save for the application is loaded"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem manageTitleUpdates = new MenuItem("Manage Title Updates")
|
|
|
|
|
+ {
|
|
|
|
|
+ TooltipText = "Open the title update management window"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem manageDlc = new MenuItem("Manage DLC")
|
|
|
|
|
+ {
|
|
|
|
|
+ TooltipText = "Open the DLC management window"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ string ext = System.IO.Path.GetExtension(_gameTableStore.GetValue(_rowIter, 9).ToString()).ToLower();
|
|
|
|
|
+ bool hasNca = ext == ".nca" || ext == ".nsp" || ext == ".pfs0" || ext == ".xci";
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem extractRomFs = new MenuItem("Extract RomFS Section")
|
|
|
|
|
+ {
|
|
|
|
|
+ Sensitive = hasNca,
|
|
|
|
|
+ TooltipText = "Exctact the RomFs section present in the main NCA"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem extractExeFs = new MenuItem("Extract ExeFS Section")
|
|
|
|
|
+ {
|
|
|
|
|
+ Sensitive = hasNca,
|
|
|
|
|
+ TooltipText = "Exctact the ExeFs section present in the main NCA"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ MenuItem extractLogo = new MenuItem("Extract Logo Section")
|
|
|
|
|
+ {
|
|
|
|
|
+ Sensitive = hasNca,
|
|
|
|
|
+ TooltipText = "Exctact the Logo section present in the main NCA"
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ openSaveUserDir.Activated += OpenSaveUserDir_Clicked;
|
|
|
|
|
+ openSaveDeviceDir.Activated += OpenSaveDeviceDir_Clicked;
|
|
|
|
|
+ openSaveBcatDir.Activated += OpenSaveBcatDir_Clicked;
|
|
|
|
|
+ manageTitleUpdates.Activated += ManageTitleUpdates_Clicked;
|
|
|
|
|
+ manageDlc.Activated += ManageDlc_Clicked;
|
|
|
|
|
+ extractRomFs.Activated += ExtractRomFs_Clicked;
|
|
|
|
|
+ extractExeFs.Activated += ExtractExeFs_Clicked;
|
|
|
|
|
+ extractLogo.Activated += ExtractLogo_Clicked;
|
|
|
|
|
+
|
|
|
|
|
+ this.Add(openSaveUserDir);
|
|
|
|
|
+ this.Add(openSaveDeviceDir);
|
|
|
|
|
+ this.Add(openSaveBcatDir);
|
|
|
|
|
+ this.Add(new SeparatorMenuItem());
|
|
|
|
|
+ this.Add(manageTitleUpdates);
|
|
|
|
|
+ this.Add(manageDlc);
|
|
|
|
|
+ this.Add(new SeparatorMenuItem());
|
|
|
|
|
+ this.Add(extractRomFs);
|
|
|
|
|
+ this.Add(extractExeFs);
|
|
|
|
|
+ this.Add(extractLogo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private bool TryFindSaveData(string titleName, ulong titleId, BlitStruct<ApplicationControlProperty> controlHolder, SaveDataFilter filter, out ulong saveDataId)
|
|
private bool TryFindSaveData(string titleName, ulong titleId, BlitStruct<ApplicationControlProperty> controlHolder, SaveDataFilter filter, out ulong saveDataId)
|
|
@@ -478,7 +510,7 @@ namespace Ryujinx.Ui
|
|
|
|
|
|
|
|
string saveDir = GetSaveDataDirectory(saveDataId);
|
|
string saveDir = GetSaveDataDirectory(saveDataId);
|
|
|
|
|
|
|
|
- Process.Start(new ProcessStartInfo()
|
|
|
|
|
|
|
+ Process.Start(new ProcessStartInfo
|
|
|
{
|
|
{
|
|
|
FileName = saveDir,
|
|
FileName = saveDir,
|
|
|
UseShellExecute = true,
|
|
UseShellExecute = true,
|
|
@@ -531,6 +563,15 @@ namespace Ryujinx.Ui
|
|
|
titleUpdateWindow.Show();
|
|
titleUpdateWindow.Show();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void ManageDlc_Clicked(object sender, EventArgs args)
|
|
|
|
|
+ {
|
|
|
|
|
+ string titleName = _gameTableStore.GetValue(_rowIter, 2).ToString().Split("\n")[0];
|
|
|
|
|
+ string titleId = _gameTableStore.GetValue(_rowIter, 2).ToString().Split("\n")[1].ToLower();
|
|
|
|
|
+
|
|
|
|
|
+ DlcWindow dlcWindow = new DlcWindow(titleId, titleName, _virtualFileSystem);
|
|
|
|
|
+ dlcWindow.Show();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void ExtractRomFs_Clicked(object sender, EventArgs args)
|
|
private void ExtractRomFs_Clicked(object sender, EventArgs args)
|
|
|
{
|
|
{
|
|
|
ExtractSection(NcaSectionType.Data);
|
|
ExtractSection(NcaSectionType.Data);
|