Misc content loading improvements
Open patched games if opening an XCI with a patch Update to LibHac 0.1.2 Enable RomFS validation Allow loading an NCA without a RomFS
This commit is contained in:
parent
54ed9096bd
commit
1a56b1bdbd
2 changed files with 22 additions and 14 deletions
|
@ -18,6 +18,8 @@ namespace Ryujinx.HLE.HOS
|
||||||
internal const int HidSize = 0x40000;
|
internal const int HidSize = 0x40000;
|
||||||
internal const int FontSize = 0x1100000;
|
internal const int FontSize = 0x1100000;
|
||||||
|
|
||||||
|
private const bool EnableFsIntegrityChecks = true;
|
||||||
|
|
||||||
private Switch Device;
|
private Switch Device;
|
||||||
|
|
||||||
private ConcurrentDictionary<int, Process> Processes;
|
private ConcurrentDictionary<int, Process> Processes;
|
||||||
|
@ -218,12 +220,19 @@ namespace Ryujinx.HLE.HOS
|
||||||
ReadControlData(ControlNca);
|
ReadControlData(ControlNca);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PatchNca != null)
|
||||||
|
{
|
||||||
|
PatchNca.SetBaseNca(MainNca);
|
||||||
|
|
||||||
|
return (PatchNca, ControlNca);
|
||||||
|
}
|
||||||
|
|
||||||
return (MainNca, ControlNca);
|
return (MainNca, ControlNca);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadControlData(Nca 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");
|
byte[] ControlFile = ControlRomfs.GetFile("/control.nacp");
|
||||||
|
|
||||||
|
@ -252,8 +261,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
// Load title key from the NSP's ticket in case the user doesn't have a title key file
|
// Load title key from the NSP's ticket in case the user doesn't have a title key file
|
||||||
if (TicketFile != null)
|
if (TicketFile != null)
|
||||||
{
|
{
|
||||||
// todo Change when Ticket(Stream) overload is added
|
Ticket Ticket = new Ticket(Nsp.OpenFile(TicketFile));
|
||||||
Ticket Ticket = new Ticket(new BinaryReader(Nsp.OpenFile(TicketFile)));
|
|
||||||
|
|
||||||
KeySet.TitleKeys[Ticket.RightsId] = Ticket.GetTitleKey(KeySet);
|
KeySet.TitleKeys[Ticket.RightsId] = Ticket.GetTitleKey(KeySet);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +295,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
public void LoadNca(Nca MainNca, Nca ControlNca)
|
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);
|
NcaSection ExefsSection = MainNca.Sections.FirstOrDefault(x => x?.IsExefs == true);
|
||||||
|
|
||||||
if (ExefsSection == null)
|
if (ExefsSection == null)
|
||||||
|
@ -299,16 +307,16 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
if (RomfsSection == null)
|
if (RomfsSection == null)
|
||||||
{
|
{
|
||||||
Device.Log.PrintError(LogClass.Loader, "No RomFS found in NCA");
|
Device.Log.PrintWarning(LogClass.Loader, "No RomFS found in NCA");
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
Stream RomfsStream = MainNca.OpenSection(RomfsSection.SectionNum, false);
|
{
|
||||||
|
Stream RomfsStream = MainNca.OpenSection(RomfsSection.SectionNum, false, EnableFsIntegrityChecks);
|
||||||
|
|
||||||
Device.FileSystem.SetRomFs(RomfsStream);
|
Device.FileSystem.SetRomFs(RomfsStream);
|
||||||
|
}
|
||||||
|
|
||||||
Stream ExefsStream = MainNca.OpenSection(ExefsSection.SectionNum, false);
|
Stream ExefsStream = MainNca.OpenSection(ExefsSection.SectionNum, false, EnableFsIntegrityChecks);
|
||||||
|
|
||||||
Pfs Exefs = new Pfs(ExefsStream);
|
Pfs Exefs = new Pfs(ExefsStream);
|
||||||
|
|
||||||
|
@ -348,7 +356,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
Nacp ReadControlData()
|
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");
|
byte[] ControlFile = ControlRomfs.GetFile("/control.nacp");
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<ProjectReference Include="..\ChocolArm64\ChocolArm64.csproj" />
|
<ProjectReference Include="..\ChocolArm64\ChocolArm64.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />
|
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />
|
||||||
<ProjectReference Include="..\Ryujinx.Graphics\Ryujinx.Graphics.csproj" />
|
<ProjectReference Include="..\Ryujinx.Graphics\Ryujinx.Graphics.csproj" />
|
||||||
<PackageReference Include="LibHac" Version="0.1.1" />
|
<PackageReference Include="LibHac" Version="0.1.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue