Result formatting
This commit is contained in:
parent
1ed524dabc
commit
fef7f153d1
6 changed files with 72 additions and 37 deletions
|
@ -307,17 +307,22 @@ namespace Ryujinx.HLE.HOS
|
|||
foreach (DirectoryEntryEx ticketEntry in securePartition.EnumerateEntries("/", "*.tik"))
|
||||
{
|
||||
Result result = securePartition.OpenFile(out IFile ticketFile, ticketEntry.FullPath, OpenMode.Read);
|
||||
if (result.IsFailure()) continue;
|
||||
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
|
||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (DirectoryEntryEx fileEntry in securePartition.EnumerateEntries("/", "*.nca"))
|
||||
{
|
||||
Result result = securePartition.OpenFile(out IFile ncaFile, fileEntry.FullPath, OpenMode.Read);
|
||||
if (result.IsFailure()) continue;
|
||||
if (result.IsFailure())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Nca nca = new Nca(KeySet, ncaFile.AsStorage());
|
||||
|
||||
|
@ -358,11 +363,13 @@ namespace Ryujinx.HLE.HOS
|
|||
IFileSystem controlFs = controlNca.OpenFileSystem(NcaSectionType.Data, FsIntegrityCheckLevel);
|
||||
|
||||
Result result = controlFs.OpenFile(out IFile controlFile, "/control.nacp", OpenMode.Read);
|
||||
if (result.IsFailure()) return;
|
||||
|
||||
ControlData = new Nacp(controlFile.AsStream());
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
ControlData = new Nacp(controlFile.AsStream());
|
||||
|
||||
TitleName = CurrentTitle = ControlData.Descriptions[(int)State.DesiredTitleLanguage].Title;
|
||||
TitleName = CurrentTitle = ControlData.Descriptions[(int) State.DesiredTitleLanguage].Title;
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadNca(string ncaFile)
|
||||
|
@ -383,11 +390,13 @@ namespace Ryujinx.HLE.HOS
|
|||
foreach (DirectoryEntryEx ticketEntry in nsp.EnumerateEntries("/", "*.tik"))
|
||||
{
|
||||
Result result = nsp.OpenFile(out IFile ticketFile, ticketEntry.FullPath, OpenMode.Read);
|
||||
if (result.IsFailure()) continue;
|
||||
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
|
||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
||||
}
|
||||
}
|
||||
|
||||
Nca mainNca = null;
|
||||
|
|
|
@ -29,7 +29,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
LocalFileSystem fileSystem = new LocalFileSystem(savePath);
|
||||
|
||||
Result result = DirectorySaveDataFileSystem.CreateNew(out DirectorySaveDataFileSystem dirFileSystem, fileSystem);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
LibHac.Fs.IFileSystem saveFileSystem = dirFileSystem;
|
||||
|
||||
|
@ -121,7 +124,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
string filename = fullPath.Replace(archivePath.FullName, string.Empty).TrimStart('\\');
|
||||
|
||||
Result result = nsp.OpenFile(out LibHac.Fs.IFile ncaFile, filename, OpenMode.Read);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
return OpenNcaFs(context, fullPath, ncaFile.AsStorage(), out openedFileSystem);
|
||||
}
|
||||
|
@ -139,11 +145,13 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
foreach (DirectoryEntryEx ticketEntry in nsp.EnumerateEntries("/", "*.tik"))
|
||||
{
|
||||
Result result = nsp.OpenFile(out LibHac.Fs.IFile ticketFile, ticketEntry.FullPath, OpenMode.Read);
|
||||
if (result.IsFailure()) continue;
|
||||
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
|
||||
keySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(keySet)));
|
||||
keySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(keySet)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,13 +106,15 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
string name = ReadUtf8String(context);
|
||||
|
||||
Result result = _fileSystem.OpenFile(out LibHac.Fs.IFile file, name, mode);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
|
||||
IFile fileInterface = new IFile(file);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
IFile fileInterface = new IFile(file);
|
||||
|
||||
MakeObject(context, fileInterface);
|
||||
MakeObject(context, fileInterface);
|
||||
}
|
||||
|
||||
return ResultCode.Success;
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
[Command(9)]
|
||||
|
@ -124,13 +126,15 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
string name = ReadUtf8String(context);
|
||||
|
||||
Result result = _fileSystem.OpenDirectory(out LibHac.Fs.IDirectory dir, name, mode);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
|
||||
IDirectory dirInterface = new IDirectory(dir);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
IDirectory dirInterface = new IDirectory(dir);
|
||||
|
||||
MakeObject(context, dirInterface);
|
||||
MakeObject(context, dirInterface);
|
||||
}
|
||||
|
||||
return ResultCode.Success;
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
[Command(10)]
|
||||
|
@ -182,7 +186,6 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
string name = ReadUtf8String(context);
|
||||
|
||||
Result result = _fileSystem.GetFileTimeStampRaw(out FileTimeStampRaw timestamp, name);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
|
||||
context.ResponseData.Write(timestamp.Created);
|
||||
context.ResponseData.Write(timestamp.Modified);
|
||||
|
@ -195,7 +198,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
|
||||
context.ResponseData.Write(data);
|
||||
|
||||
return ResultCode.Success;
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -140,11 +140,13 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
GameCardPartitionRaw partitionId = (GameCardPartitionRaw)context.RequestData.ReadInt32();
|
||||
|
||||
Result result = _baseFileSystemProxy.OpenGameCardStorage(out LibHac.Fs.IStorage storage, handle, partitionId);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
|
||||
MakeObject(context, new FileSystemProxy.IStorage(storage));
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
MakeObject(context, new FileSystemProxy.IStorage(storage));
|
||||
}
|
||||
|
||||
return ResultCode.Success;
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
[Command(51)]
|
||||
|
@ -273,11 +275,13 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
public ResultCode OpenDeviceOperator(ServiceCtx context)
|
||||
{
|
||||
Result result = _baseFileSystemProxy.OpenDeviceOperator(out LibHac.FsService.IDeviceOperator deviceOperator);
|
||||
if (result.IsFailure()) return (ResultCode)result.Value;
|
||||
|
||||
MakeObject(context, new IDeviceOperator(deviceOperator));
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
MakeObject(context, new IDeviceOperator(deviceOperator));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
[Command(1005)]
|
||||
|
|
|
@ -188,15 +188,24 @@ namespace Ryujinx.HLE.HOS.Services.Settings
|
|||
IFileSystem firmwareRomFs = firmwareContent.OpenFileSystem(NcaSectionType.Data, device.System.FsIntegrityCheckLevel);
|
||||
|
||||
Result result = firmwareRomFs.OpenFile(out IFile firmwareFile, "/file", OpenMode.Read);
|
||||
if (result.IsFailure()) return null;
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
result = firmwareFile.GetSize(out long fileSize);
|
||||
if (result.IsFailure()) return null;
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] data = new byte[fileSize];
|
||||
|
||||
result = firmwareFile.Read(out _, 0, data);
|
||||
if (result.IsFailure()) return null;
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -353,11 +353,13 @@ namespace Ryujinx.UI
|
|||
foreach (DirectoryEntryEx ticketEntry in Pfs.EnumerateEntries("/", "*.tik"))
|
||||
{
|
||||
Result result = Pfs.OpenFile(out IFile ticketFile, ticketEntry.FullPath, OpenMode.Read);
|
||||
if (result.IsFailure()) continue;
|
||||
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
Ticket ticket = new Ticket(ticketFile.AsStream());
|
||||
|
||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
||||
KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
|
||||
}
|
||||
}
|
||||
|
||||
// Find the Control NCA and store it in variable called controlNca
|
||||
|
|
Loading…
Add table
Reference in a new issue