Use libhac for loading NSO and KIP (#1047)

* Use libhac for loading NSOs and KIPs

* Fix formatting

* Refactor KIP and NSO executables for libhac

* Fix up formatting

* Remove Ryujinx.HLE.Loaders.Compression

* Remove reference to Ryujinx.HLE.Loaders.Compression in NxStaticObject.cs

* Remove reference to Ryujinx.HLE.Loaders.Compression in KernelInitialProcess.cs

* Rename classes in Ryujinx.HLE.Loaders.Executables

* Fix space alignment

* Fix up formatting
This commit is contained in:
Elise 2020-04-08 00:41:02 +02:00 committed by GitHub
parent 468d8f841f
commit dc144d2e19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 89 additions and 466 deletions

View file

@ -32,7 +32,7 @@ using System.Reflection;
using System.Threading;
using TimeServiceManager = Ryujinx.HLE.HOS.Services.Time.TimeManager;
using NxStaticObject = Ryujinx.HLE.Loaders.Executables.NxStaticObject;
using NsoExecutable = Ryujinx.HLE.Loaders.Executables.NsoExecutable;
using static LibHac.Fs.ApplicationSaveDataManagement;
@ -271,9 +271,9 @@ namespace Ryujinx.HLE.HOS
public void LoadKip(string kipFile)
{
using (FileStream fs = new FileStream(kipFile, FileMode.Open))
using (IStorage fs = new LocalStorage(kipFile, FileAccess.Read))
{
ProgramLoader.LoadKernelInitalProcess(this, new KernelInitialProcess(fs));
ProgramLoader.LoadKernelInitalProcess(this, new KipExecutable(fs));
}
}
@ -543,9 +543,9 @@ namespace Ryujinx.HLE.HOS
Logger.PrintInfo(LogClass.Loader, $"Loading {file.Name}...");
codeFs.OpenFile(out IFile nsoFile, file.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
NxStaticObject staticObject = new NxStaticObject(nsoFile.AsStream());
codeFs.OpenFile(out IFile nsoFile, file.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
NsoExecutable staticObject = new NsoExecutable(nsoFile.AsStorage());
staticObjects.Add(staticObject);
}
@ -569,13 +569,13 @@ namespace Ryujinx.HLE.HOS
bool isNro = Path.GetExtension(filePath).ToLower() == ".nro";
FileStream input = new FileStream(filePath, FileMode.Open);
IExecutable staticObject;
if (isNro)
{
NxRelocatableObject obj = new NxRelocatableObject(input);
FileStream input = new FileStream(filePath, FileMode.Open);
NroExecutable obj = new NroExecutable(input);
staticObject = obj;
// homebrew NRO can actually have some data after the actual NRO
@ -648,7 +648,7 @@ namespace Ryujinx.HLE.HOS
}
else
{
staticObject = new NxStaticObject(input);
staticObject = new NsoExecutable(new LocalStorage(filePath, FileAccess.Read));
}
ContentManager.LoadEntries(Device);