Code style changes
This commit is contained in:
parent
70f6514716
commit
013879af73
3 changed files with 43 additions and 44 deletions
|
@ -125,75 +125,74 @@ namespace Ryujinx.HLE.HOS
|
||||||
MainProcess.Run();
|
MainProcess.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadXci(string xciFile)
|
public void LoadXci(string XciFile)
|
||||||
{
|
{
|
||||||
var file = new FileStream(xciFile, FileMode.Open, FileAccess.Read);
|
FileStream File = new FileStream(XciFile, FileMode.Open, FileAccess.Read);
|
||||||
var xci = new Xci(Keyset, file);
|
Xci Xci = new Xci(Keyset, File);
|
||||||
var nca = GetXciMainNca(xci);
|
Nca Nca = GetXciMainNca(Xci);
|
||||||
LoadNca(nca);
|
LoadNca(Nca);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Nca GetXciMainNca(Xci xci)
|
private Nca GetXciMainNca(Xci Xci)
|
||||||
{
|
{
|
||||||
if (xci.SecurePartition == null)
|
if (Xci.SecurePartition == null)
|
||||||
{
|
{
|
||||||
Device.Log.PrintError(LogClass.Loader, "Could not find XCI secure partition");
|
Device.Log.PrintError(LogClass.Loader, "Could not find XCI secure partition");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Nca mainNca = null;
|
Nca MainNca = null;
|
||||||
|
|
||||||
foreach (var fileEntry in xci.SecurePartition.Files.Where(x => x.Name.EndsWith(".nca")))
|
foreach (PfsFileEntry FileEntry in Xci.SecurePartition.Files.Where(x => x.Name.EndsWith(".nca")))
|
||||||
{
|
{
|
||||||
var ncaStream = xci.SecurePartition.OpenFile(fileEntry);
|
Stream NcaStream = Xci.SecurePartition.OpenFile(FileEntry);
|
||||||
var nca = new Nca(Keyset, ncaStream, true);
|
Nca Nca = new Nca(Keyset, NcaStream, true);
|
||||||
|
|
||||||
if (nca.Header.ContentType == ContentType.Program)
|
if (Nca.Header.ContentType == ContentType.Program)
|
||||||
{
|
{
|
||||||
mainNca = nca;
|
MainNca = Nca;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mainNca;
|
return MainNca;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadNca(string ncaFile)
|
public void LoadNca(string NcaFile)
|
||||||
{
|
{
|
||||||
var file = new FileStream(ncaFile, FileMode.Open, FileAccess.Read);
|
FileStream File = new FileStream(NcaFile, FileMode.Open, FileAccess.Read);
|
||||||
var nca = new Nca(Keyset, file, true);
|
Nca Nca = new Nca(Keyset, File, true);
|
||||||
LoadNca(nca);
|
LoadNca(Nca);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadNca(Nca nca)
|
public void LoadNca(Nca Nca)
|
||||||
{
|
{
|
||||||
NcaSection romfsSection = nca.Sections.FirstOrDefault(x => x.Type == SectionType.Romfs);
|
NcaSection RomfsSection = Nca.Sections.FirstOrDefault(x => x.Type == SectionType.Romfs);
|
||||||
NcaSection exefsSection = nca.Sections.FirstOrDefault(x => x.IsExefs);
|
NcaSection ExefsSection = Nca.Sections.FirstOrDefault(x => x.IsExefs);
|
||||||
|
|
||||||
if (exefsSection == null)
|
if (ExefsSection == null)
|
||||||
{
|
{
|
||||||
Device.Log.PrintError(LogClass.Loader, "No ExeFS found in NCA");
|
Device.Log.PrintError(LogClass.Loader, "No ExeFS found in NCA");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (romfsSection == null)
|
if (RomfsSection == null)
|
||||||
{
|
{
|
||||||
Device.Log.PrintError(LogClass.Loader, "No RomFS found in NCA");
|
Device.Log.PrintError(LogClass.Loader, "No RomFS found in NCA");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var romfsStream = nca.OpenSection(romfsSection.SectionNum, false);
|
Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false);
|
||||||
Device.FileSystem.SetRomFs(romfsStream);
|
Device.FileSystem.SetRomFs(RomfsStream);
|
||||||
|
|
||||||
var exefsStream = nca.OpenSection(exefsSection.SectionNum, false);
|
Stream ExefsStream = Nca.OpenSection(ExefsSection.SectionNum, false);
|
||||||
var exefs = new Pfs(exefsStream);
|
Pfs Exefs = new Pfs(ExefsStream);
|
||||||
|
|
||||||
Npdm MetaData = null;
|
Npdm MetaData = null;
|
||||||
|
|
||||||
if (exefs.FileExists("main.npdm"))
|
if (Exefs.FileExists("main.npdm"))
|
||||||
{
|
{
|
||||||
Device.Log.PrintInfo(LogClass.Loader, "Loading main.npdm...");
|
Device.Log.PrintInfo(LogClass.Loader, "Loading main.npdm...");
|
||||||
MetaData = new Npdm(exefs.OpenFile("main.npdm"));
|
MetaData = new Npdm(Exefs.OpenFile("main.npdm"));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -202,20 +201,20 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
Process MainProcess = MakeProcess(MetaData);
|
Process MainProcess = MakeProcess(MetaData);
|
||||||
|
|
||||||
void LoadNso(string filename)
|
void LoadNso(string Filename)
|
||||||
{
|
{
|
||||||
foreach (var File in exefs.Files.Where(x => x.Name.StartsWith(filename)))
|
foreach (PfsFileEntry File in Exefs.Files.Where(x => x.Name.StartsWith(Filename)))
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(File.Name) != string.Empty)
|
if (Path.GetExtension(File.Name) != string.Empty)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Device.Log.PrintInfo(LogClass.Loader, $"Loading {filename}...");
|
Device.Log.PrintInfo(LogClass.Loader, $"Loading {Filename}...");
|
||||||
|
|
||||||
string Name = Path.GetFileNameWithoutExtension(File.Name);
|
string Name = Path.GetFileNameWithoutExtension(File.Name);
|
||||||
|
|
||||||
Nso Program = new Nso(exefs.OpenFile(File), Name);
|
Nso Program = new Nso(Exefs.OpenFile(File), Name);
|
||||||
|
|
||||||
MainProcess.LoadProgram(Program);
|
MainProcess.LoadProgram(Program);
|
||||||
}
|
}
|
||||||
|
@ -276,10 +275,10 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
public void LoadDefaultKeyset()
|
public void LoadDefaultKeyset()
|
||||||
{
|
{
|
||||||
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
var homeKeyFile = Path.Combine(home, ".switch", "prod.keys");
|
string homeKeyFile = Path.Combine(home, ".switch", "prod.keys");
|
||||||
var homeTitleKeyFile = Path.Combine(home, ".switch", "title.keys");
|
string homeTitleKeyFile = Path.Combine(home, ".switch", "title.keys");
|
||||||
var homeConsoleKeyFile = Path.Combine(home, ".switch", "console.keys");
|
string homeConsoleKeyFile = Path.Combine(home, ".switch", "console.keys");
|
||||||
|
|
||||||
string keyFile = null;
|
string keyFile = null;
|
||||||
string titleKeyFile = null;
|
string titleKeyFile = null;
|
||||||
|
|
|
@ -61,14 +61,14 @@ namespace Ryujinx.HLE
|
||||||
System.LoadCart(ExeFsDir, RomFsFile);
|
System.LoadCart(ExeFsDir, RomFsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadXci(string xciFile)
|
public void LoadXci(string XciFile)
|
||||||
{
|
{
|
||||||
System.LoadXci(xciFile);
|
System.LoadXci(XciFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadNca(string ncaFile)
|
public void LoadNca(string NcaFile)
|
||||||
{
|
{
|
||||||
System.LoadNca(ncaFile);
|
System.LoadNca(NcaFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadProgram(string FileName)
|
public void LoadProgram(string FileName)
|
||||||
|
|
|
@ -17,10 +17,10 @@ namespace Ryujinx.HLE
|
||||||
RomFs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
|
RomFs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRomFs(Stream romfsStream)
|
public void SetRomFs(Stream RomfsStream)
|
||||||
{
|
{
|
||||||
RomFs?.Close();
|
RomFs?.Close();
|
||||||
RomFs = romfsStream;
|
RomFs = RomfsStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetFullPath(string BasePath, string FileName)
|
public string GetFullPath(string BasePath, string FileName)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue