aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2018-10-06 09:11:47 -0600
committeremmauss <emmausssss@gmail.com>2018-10-06 18:11:47 +0300
commit5821ff675dba32458193ea0a4d9b4657dfe949c2 (patch)
treeeb8d908d63bcb554c7a9cfcbcd39104ba0dea28d
parentbba9bf97d03596b89972cc77390311b9e9472688 (diff)
Misc content loading improvements (#432)
* Misc content loading improvements
-rw-r--r--Ryujinx.HLE/HOS/Horizon.cs32
-rw-r--r--Ryujinx.HLE/Ryujinx.HLE.csproj2
-rw-r--r--Ryujinx/Config.cs2
-rw-r--r--Ryujinx/Ryujinx.conf3
4 files changed, 26 insertions, 13 deletions
diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs
index d52c8af0..a3eaae4f 100644
--- a/Ryujinx.HLE/HOS/Horizon.cs
+++ b/Ryujinx.HLE/HOS/Horizon.cs
@@ -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");
-
- return;
+ Device.Log.PrintWarning(LogClass.Loader, "No RomFS found in NCA");
}
+ else
+ {
+ Stream RomfsStream = MainNca.OpenSection(RomfsSection.SectionNum, false, EnableFsIntegrityChecks);
- Stream RomfsStream = MainNca.OpenSection(RomfsSection.SectionNum, false);
-
- 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);
@@ -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");
diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj
index cd1bb034..d24cd833 100644
--- a/Ryujinx.HLE/Ryujinx.HLE.csproj
+++ b/Ryujinx.HLE/Ryujinx.HLE.csproj
@@ -25,7 +25,7 @@
<ProjectReference Include="..\ChocolArm64\ChocolArm64.csproj" />
<ProjectReference Include="..\Ryujinx.Audio\Ryujinx.Audio.csproj" />
<ProjectReference Include="..\Ryujinx.Graphics\Ryujinx.Graphics.csproj" />
- <PackageReference Include="LibHac" Version="0.1.1" />
+ <PackageReference Include="LibHac" Version="0.1.2" />
</ItemGroup>
</Project>
diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs
index f4dd77ba..197a8cad 100644
--- a/Ryujinx/Config.cs
+++ b/Ryujinx/Config.cs
@@ -68,6 +68,8 @@ namespace Ryujinx
Device.System.EnableMultiCoreScheduling();
}
+ Device.System.EnableFsIntegrityChecks = Convert.ToBoolean(Parser.Value("Enable_FS_Integrity_Checks"));
+
JoyConKeyboard = new JoyConKeyboard(
new JoyConKeyboardLeft
diff --git a/Ryujinx/Ryujinx.conf b/Ryujinx/Ryujinx.conf
index bf361db3..45f545d0 100644
--- a/Ryujinx/Ryujinx.conf
+++ b/Ryujinx/Ryujinx.conf
@@ -31,6 +31,9 @@ Enable_Vsync = true
#Enable or Disable Multi-core scheduling of threads
Enable_MultiCore_Scheduling = false
+#Enable integrity checks on Switch content files
+Enable_FS_Integrity_Checks = true
+
#Controller Device Index
GamePad_Index = 0