mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 14:02:01 +00:00
parent
1af6c31dc0
commit
72157e03eb
2 changed files with 57 additions and 1 deletions
|
@ -394,8 +394,63 @@ namespace Ryujinx.HLE.HOS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is not a normal NSP, it's actually a ExeFS as a NSP
|
||||||
|
Npdm metaData = null;
|
||||||
|
|
||||||
|
PfsFileEntry npdmFile = nsp.Files.FirstOrDefault(x => x.Name.Equals("main.npdm"));
|
||||||
|
|
||||||
|
if (npdmFile != null)
|
||||||
|
{
|
||||||
|
Logger.PrintInfo(LogClass.Loader, $"Loading main.npdm...");
|
||||||
|
|
||||||
|
metaData = new Npdm(nsp.OpenFile(npdmFile).AsStream());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.PrintWarning(LogClass.Loader, $"NPDM file not found, using default values!");
|
||||||
|
|
||||||
|
metaData = GetDefaultNpdm();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IExecutable> staticObjects = new List<IExecutable>();
|
||||||
|
|
||||||
|
void LoadNso(string searchPattern)
|
||||||
|
{
|
||||||
|
PfsFileEntry entry = nsp.Files.FirstOrDefault(x => x.Name.Equals(searchPattern));
|
||||||
|
|
||||||
|
if (entry != null)
|
||||||
|
{
|
||||||
|
Logger.PrintInfo(LogClass.Loader, $"Loading {entry.Name}...");
|
||||||
|
|
||||||
|
NxStaticObject staticObject = new NxStaticObject(nsp.OpenFile(entry).AsStream());
|
||||||
|
|
||||||
|
staticObjects.Add(staticObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!metaData.Is64Bits)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("32-bit titles are unsupported!");
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentTitle = metaData.Aci0.TitleId.ToString("x16");
|
||||||
|
|
||||||
|
LoadNso("rtld");
|
||||||
|
LoadNso("main");
|
||||||
|
LoadNso("subsdk*");
|
||||||
|
LoadNso("sdk");
|
||||||
|
|
||||||
|
ContentManager.LoadEntries();
|
||||||
|
|
||||||
|
if (staticObjects.Count == 0)
|
||||||
|
{
|
||||||
Logger.PrintError(LogClass.Loader, "Could not find an Application NCA in the provided NSP file");
|
Logger.PrintError(LogClass.Loader, "Could not find an Application NCA in the provided NSP file");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ProgramLoader.LoadStaticObjects(this, metaData, staticObjects.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadNca(Nca mainNca, Nca controlNca)
|
public void LoadNca(Nca mainNca, Nca controlNca)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ namespace Ryujinx
|
||||||
device.LoadNca(args[0]);
|
device.LoadNca(args[0]);
|
||||||
break;
|
break;
|
||||||
case ".nsp":
|
case ".nsp":
|
||||||
|
case ".pfs0":
|
||||||
Console.WriteLine("Loading as NSP.");
|
Console.WriteLine("Loading as NSP.");
|
||||||
device.LoadNsp(args[0]);
|
device.LoadNsp(args[0]);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue