Update to LibHac 0.12.0 (#1485)

* Update to LibHac 0.12.0

* Auto-formatting. Fixed a bug in SetApplicationCopyrightImage
This commit is contained in:
Alex Barney 2020-09-01 13:08:59 -07:00 committed by GitHub
parent 6cc187da59
commit 1bb7fdaca4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 122 additions and 110 deletions

View file

@ -1,12 +1,10 @@
using LibHac;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Shim;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils;
using LibHac.Ncm;
using LibHac.Ns;
using LibHac.Spl;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Configuration;
using Ryujinx.Configuration.System;
@ -14,13 +12,11 @@ using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.Loaders.Npdm;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.Json;
using RightsId = LibHac.Fs.RightsId;
using JsonHelper = Ryujinx.Common.Utilities.JsonHelper;
namespace Ryujinx.Ui
@ -212,9 +208,6 @@ namespace Ryujinx.Ui
ReadControlData(controlFs, controlHolder.ByteSpan);
// Creates NACP class from the NACP file
controlFs.OpenFile(out IFile controlNacpFile, "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure();
// Get the title name, title ID, developer name and version number from the NACP
version = IsUpdateApplied(titleId, out string updateVersion) ? updateVersion : controlHolder.Value.DisplayVersion.ToString();

View file

@ -1,9 +1,10 @@
using Gtk;
using LibHac;
using LibHac.Common;
using LibHac.FsSystem.NcaUtils;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;

View file

@ -3,6 +3,7 @@ using LibHac;
using LibHac.Account;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.Fs.Shim;
using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils;
@ -45,19 +46,19 @@ namespace Ryujinx.Ui
MenuItem openSaveUserDir = new MenuItem("Open User Save Directory")
{
Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0,
Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0,
TooltipText = "Open the directory which contains Application's User Saves."
};
MenuItem openSaveDeviceDir = new MenuItem("Open Device Save Directory")
{
Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0,
Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0,
TooltipText = "Open the directory which contains Application's Device Saves."
};
MenuItem openSaveBcatDir = new MenuItem("Open BCAT Save Directory")
{
Sensitive = !Util.IsEmpty(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0,
Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0,
TooltipText = "Open the directory which contains Application's BCAT Saves."
};
@ -175,7 +176,7 @@ namespace Ryujinx.Ui
ref ApplicationControlProperty control = ref controlHolder.Value;
if (LibHac.Util.IsEmpty(controlHolder.ByteSpan))
if (LibHac.Utilities.IsEmpty(controlHolder.ByteSpan))
{
// If the current application doesn't have a loaded control property, create a dummy one
// and set the savedata sizes so a user savedata will be created.
@ -191,7 +192,7 @@ namespace Ryujinx.Ui
Uid user = new Uid(1, 0);
result = EnsureApplicationSaveData(_virtualFileSystem.FsClient, out _, new TitleId(titleId), ref control, ref user);
result = EnsureApplicationSaveData(_virtualFileSystem.FsClient, out _, new LibHac.Ncm.ApplicationId(titleId), ref control, ref user);
if (result.IsFailure())
{
@ -539,7 +540,7 @@ namespace Ryujinx.Ui
private void OpenSaveDir(string titleName, ulong titleId, SaveDataFilter filter)
{
filter.SetProgramId(new TitleId(titleId));
filter.SetProgramId(new ProgramId(titleId));
if (!TryFindSaveData(titleName, titleId, _controlData, filter, out ulong saveDataId))
{

View file

@ -11,6 +11,8 @@ using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using ApplicationId = LibHac.Ncm.ApplicationId;
namespace Ryujinx.Ui
{
internal class SaveImporter
@ -57,7 +59,7 @@ namespace Ryujinx.Ui
{
SaveDataAttribute key = save.Attribute;
Result result = fs.CreateSaveData(key.TitleId, key.UserId, key.TitleId, 0, 0, 0);
Result result = fs.CreateSaveData(new ApplicationId(key.ProgramId.Value), key.UserId, key.ProgramId.Value, 0, 0, 0);
if (result.IsFailure()) return result;
bool isOldMounted = false;
@ -70,7 +72,7 @@ namespace Ryujinx.Ui
isOldMounted = true;
result = fs.MountSaveData("NewSave".ToU8Span(), key.TitleId, key.UserId);
result = fs.MountSaveData("NewSave".ToU8Span(), new ApplicationId(key.ProgramId.Value), key.UserId);
if (result.IsFailure()) return result;
isNewMounted = true;
@ -132,7 +134,7 @@ namespace Ryujinx.Ui
{
Type = SaveDataType.Account,
UserId = userId,
TitleId = new TitleId(titleId)
ProgramId = new ProgramId(titleId)
};
SaveToImport save = new SaveToImport(dataPath, attribute);

View file

@ -2,6 +2,7 @@ using Gtk;
using LibHac;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils;
using LibHac.Ns;