Misc content loading improvements (#432)
* Misc content loading improvements
This commit is contained in:
parent
bba9bf97d0
commit
5821ff675d
4 changed files with 26 additions and 13 deletions
|
@ -51,6 +51,8 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
public string CurrentTitle { get; private set; }
|
||||
|
||||
public bool EnableFsIntegrityChecks { get; set; }
|
||||
|
||||
public Horizon(Switch Device)
|
||||
{
|
||||
this.Device = Device;
|
||||
|
@ -220,12 +222,19 @@ namespace Ryujinx.HLE.HOS
|
|||
ReadControlData(ControlNca);
|
||||
}
|
||||
|
||||
if (PatchNca != null)
|
||||
{
|
||||
PatchNca.SetBaseNca(MainNca);
|
||||
|
||||
return (PatchNca, ControlNca);
|
||||
}
|
||||
|
||||
return (MainNca, ControlNca);
|
||||
}
|
||||
|
||||
public void ReadControlData(Nca ControlNca)
|
||||
{
|
||||
Romfs ControlRomfs = new Romfs(ControlNca.OpenSection(0, false));
|
||||
Romfs ControlRomfs = new Romfs(ControlNca.OpenSection(0, false, EnableFsIntegrityChecks));
|
||||
|
||||
byte[] ControlFile = ControlRomfs.GetFile("/control.nacp");
|
||||
|
||||
|
@ -254,8 +263,7 @@ namespace Ryujinx.HLE.HOS
|
|||
// Load title key from the NSP's ticket in case the user doesn't have a title key file
|
||||
if (TicketFile != null)
|
||||
{
|
||||
// todo Change when Ticket(Stream) overload is added
|
||||
Ticket Ticket = new Ticket(new BinaryReader(Nsp.OpenFile(TicketFile)));
|
||||
Ticket Ticket = new Ticket(Nsp.OpenFile(TicketFile));
|
||||
|
||||
KeySet.TitleKeys[Ticket.RightsId] = Ticket.GetTitleKey(KeySet);
|
||||
}
|
||||
|
@ -289,7 +297,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
public void LoadNca(Nca MainNca, Nca ControlNca)
|
||||
{
|
||||
NcaSection RomfsSection = MainNca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
|
||||
NcaSection RomfsSection = MainNca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs || x?.Type == SectionType.Bktr);
|
||||
NcaSection ExefsSection = MainNca.Sections.FirstOrDefault(x => x?.IsExefs == true);
|
||||
|
||||
if (ExefsSection == null)
|
||||
|
@ -301,16 +309,16 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
if (RomfsSection == null)
|
||||
{
|
||||
Device.Log.PrintError(LogClass.Loader, "No RomFS found in NCA");
|
||||
Device.Log.PrintWarning(LogClass.Loader, "No RomFS found in NCA");
|
||||
}
|
||||
else
|
||||
{
|
||||
Stream RomfsStream = MainNca.OpenSection(RomfsSection.SectionNum, false, EnableFsIntegrityChecks);
|
||||
|
||||
return;
|
||||
Device.FileSystem.SetRomFs(RomfsStream);
|
||||
}
|
||||
|
||||
Stream RomfsStream = MainNca.OpenSection(RomfsSection.SectionNum, false);
|
||||
|
||||
Device.FileSystem.SetRomFs(RomfsStream);
|
||||
|
||||
Stream ExefsStream = MainNca.OpenSection(ExefsSection.SectionNum, false);
|
||||
Stream ExefsStream = MainNca.OpenSection(ExefsSection.SectionNum, false, EnableFsIntegrityChecks);
|
||||
|
||||
Pfs Exefs = new Pfs(ExefsStream);
|
||||
|
||||
|
@ -350,7 +358,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
Nacp ReadControlData()
|
||||
{
|
||||
Romfs ControlRomfs = new Romfs(ControlNca.OpenSection(0, false));
|
||||
Romfs ControlRomfs = new Romfs(ControlNca.OpenSection(0, false, EnableFsIntegrityChecks));
|
||||
|
||||
byte[] ControlFile = ControlRomfs.GetFile("/control.nacp");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue