lots of style fixes
This commit is contained in:
parent
452564aed2
commit
e535683235
12 changed files with 55 additions and 150 deletions
|
@ -91,9 +91,7 @@ namespace Ryujinx.HLE.FileSystem.Content
|
||||||
ContentDictionary.Add((Nca.Header.TitleId, Nca.Header.ContentType), NcaName);
|
ContentDictionary.Add((Nca.Header.TitleId, Nca.Header.ContentType), NcaName);
|
||||||
|
|
||||||
NcaFile.Close();
|
NcaFile.Close();
|
||||||
|
|
||||||
Nca.Dispose();
|
Nca.Dispose();
|
||||||
|
|
||||||
NcaFile.Dispose();
|
NcaFile.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,9 +123,7 @@ namespace Ryujinx.HLE.FileSystem.Content
|
||||||
ContentDictionary.Add((Nca.Header.TitleId, Nca.Header.ContentType), NcaName);
|
ContentDictionary.Add((Nca.Header.TitleId, Nca.Header.ContentType), NcaName);
|
||||||
|
|
||||||
NcaFile.Close();
|
NcaFile.Close();
|
||||||
|
|
||||||
Nca.Dispose();
|
Nca.Dispose();
|
||||||
|
|
||||||
NcaFile.Dispose();
|
NcaFile.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,13 +169,10 @@ namespace Ryujinx.HLE.FileSystem.Content
|
||||||
{
|
{
|
||||||
if (ContentDictionary.ContainsValue(NcaId))
|
if (ContentDictionary.ContainsValue(NcaId))
|
||||||
{
|
{
|
||||||
var Content = ContentDictionary.FirstOrDefault(x => x.Value == NcaId);
|
var Content = ContentDictionary.FirstOrDefault(x => x.Value == NcaId);
|
||||||
|
long TitleId = (long)Content.Key.Item1;
|
||||||
long TitleId = (long)Content.Key.Item1;
|
|
||||||
|
|
||||||
ContentType ContentType = Content.Key.Item2;
|
ContentType ContentType = Content.Key.Item2;
|
||||||
|
StorageId Storage = GetInstalledStorage(TitleId, ContentType, StorageId);
|
||||||
StorageId Storage = GetInstalledStorage(TitleId, ContentType, StorageId);
|
|
||||||
|
|
||||||
return Storage == StorageId;
|
return Storage == StorageId;
|
||||||
}
|
}
|
||||||
|
@ -231,22 +224,18 @@ namespace Ryujinx.HLE.FileSystem.Content
|
||||||
|
|
||||||
private bool VerifyContentType(LocationEntry LocationEntry, ContentType ContentType)
|
private bool VerifyContentType(LocationEntry LocationEntry, ContentType ContentType)
|
||||||
{
|
{
|
||||||
StorageId StorageId = LocationHelper.GetStorageId(LocationEntry.ContentPath);
|
StorageId StorageId = LocationHelper.GetStorageId(LocationEntry.ContentPath);
|
||||||
|
string InstalledPath = Device.FileSystem.SwitchPathToSystemPath(LocationEntry.ContentPath);
|
||||||
string InstalledPath = Device.FileSystem.SwitchPathToSystemPath(LocationEntry.ContentPath);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(InstalledPath))
|
if (!string.IsNullOrWhiteSpace(InstalledPath))
|
||||||
{
|
{
|
||||||
if (File.Exists(InstalledPath))
|
if (File.Exists(InstalledPath))
|
||||||
{
|
{
|
||||||
FileStream File = new FileStream(InstalledPath, FileMode.Open, FileAccess.Read);
|
FileStream File = new FileStream(InstalledPath, FileMode.Open, FileAccess.Read);
|
||||||
|
Nca Nca = new Nca(Device.System.KeySet, File, false);
|
||||||
Nca Nca = new Nca(Device.System.KeySet, File, false);
|
bool ContentCheck = Nca.Header.ContentType == ContentType;
|
||||||
|
|
||||||
bool ContentCheck = Nca.Header.ContentType == ContentType;
|
|
||||||
|
|
||||||
Nca.Dispose();
|
Nca.Dispose();
|
||||||
|
|
||||||
File.Dispose();
|
File.Dispose();
|
||||||
|
|
||||||
return ContentCheck;
|
return ContentCheck;
|
||||||
|
@ -290,7 +279,6 @@ namespace Ryujinx.HLE.FileSystem.Content
|
||||||
LocationEntry Entry =
|
LocationEntry Entry =
|
||||||
LocationList.ToList().Find(x => x.TitleId == TitleId && x.ContentType == ContentType);
|
LocationList.ToList().Find(x => x.TitleId == TitleId && x.ContentType == ContentType);
|
||||||
|
|
||||||
|
|
||||||
if (Entry.ContentPath != null)
|
if (Entry.ContentPath != null)
|
||||||
{
|
{
|
||||||
LocationList.Remove(Entry);
|
LocationList.Remove(Entry);
|
||||||
|
|
|
@ -68,7 +68,6 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
|
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File.Delete(Name);
|
File.Delete(Name);
|
||||||
|
@ -106,8 +105,7 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
|
|
||||||
foreach (string File in Directory.EnumerateFiles(Path))
|
foreach (string File in Directory.EnumerateFiles(Path))
|
||||||
{
|
{
|
||||||
FileInfo FileInfo = new FileInfo(File);
|
FileInfo FileInfo = new FileInfo(File);
|
||||||
|
|
||||||
DirectoryEntry DirectoryEntry = new DirectoryEntry(File, DirectoryEntryType.File, FileInfo.Length);
|
DirectoryEntry DirectoryEntry = new DirectoryEntry(File, DirectoryEntryType.File, FileInfo.Length);
|
||||||
|
|
||||||
Entries.Add(DirectoryEntry);
|
Entries.Add(DirectoryEntry);
|
||||||
|
@ -123,8 +121,7 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
|
|
||||||
foreach (string File in Directory.EnumerateFiles(Path))
|
foreach (string File in Directory.EnumerateFiles(Path))
|
||||||
{
|
{
|
||||||
FileInfo FileInfo = new FileInfo(File);
|
FileInfo FileInfo = new FileInfo(File);
|
||||||
|
|
||||||
DirectoryEntry DirectoryEntry = new DirectoryEntry(File, DirectoryEntryType.File, FileInfo.Length);
|
DirectoryEntry DirectoryEntry = new DirectoryEntry(File, DirectoryEntryType.File, FileInfo.Length);
|
||||||
|
|
||||||
Entries.Add(DirectoryEntry);
|
Entries.Add(DirectoryEntry);
|
||||||
|
@ -252,17 +249,5 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
|
|
||||||
throw new InvalidOperationException($"Path {Path} is not a child directory of {RootPath}");
|
throw new InvalidOperationException($"Path {Path} is not a child directory of {RootPath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Disposed { get; private set; }
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
Disposed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.FileSystem
|
namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
interface IFileSystemProvider : IDisposable
|
interface IFileSystemProvider
|
||||||
{
|
{
|
||||||
bool Disposed { get; }
|
|
||||||
|
|
||||||
long CreateFile(string Name, long Size);
|
long CreateFile(string Name, long Size);
|
||||||
|
|
||||||
long CreateDirectory(string Name);
|
long CreateDirectory(string Name);
|
||||||
|
|
|
@ -14,8 +14,6 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
private Pfs Pfs;
|
private Pfs Pfs;
|
||||||
|
|
||||||
public bool Disposed { get; private set; }
|
|
||||||
|
|
||||||
public PFsProvider(Pfs Pfs)
|
public PFsProvider(Pfs Pfs)
|
||||||
{
|
{
|
||||||
this.Pfs = Pfs;
|
this.Pfs = Pfs;
|
||||||
|
@ -145,15 +143,5 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
private Romfs RomFs;
|
private Romfs RomFs;
|
||||||
|
|
||||||
public bool Disposed { get; private set; }
|
|
||||||
|
|
||||||
public RomFsProvider(Stream StorageStream)
|
public RomFsProvider(Stream StorageStream)
|
||||||
{
|
{
|
||||||
RomFs = new Romfs(StorageStream);
|
RomFs = new Romfs(StorageStream);
|
||||||
|
@ -161,15 +159,5 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
Disposed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,8 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
|
|
||||||
if (SystemPath.StartsWith(BaseSystemPath))
|
if (SystemPath.StartsWith(BaseSystemPath))
|
||||||
{
|
{
|
||||||
string RawPath = SystemPath.Replace(BaseSystemPath, "");
|
string RawPath = SystemPath.Replace(BaseSystemPath, "");
|
||||||
|
int FirstSeparatorOffset = RawPath.IndexOf(Path.DirectorySeparatorChar);
|
||||||
int FirstSeparatorOffset = RawPath.IndexOf(Path.DirectorySeparatorChar);
|
|
||||||
|
|
||||||
if (FirstSeparatorOffset == -1)
|
if (FirstSeparatorOffset == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,8 +55,7 @@ namespace Ryujinx.HLE.HOS.Font
|
||||||
if (ContentManager.TryGetFontTitle(Name, out long FontTitle))
|
if (ContentManager.TryGetFontTitle(Name, out long FontTitle))
|
||||||
{
|
{
|
||||||
string ContentPath = ContentManager.GetInstalledContentPath(FontTitle, StorageId.NandSystem, ContentType.Data);
|
string ContentPath = ContentManager.GetInstalledContentPath(FontTitle, StorageId.NandSystem, ContentType.Data);
|
||||||
|
string FontPath = Device.FileSystem.SwitchPathToSystemPath(ContentPath);
|
||||||
string FontPath = Device.FileSystem.SwitchPathToSystemPath(ContentPath);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(FontPath))
|
if (!string.IsNullOrWhiteSpace(FontPath))
|
||||||
{
|
{
|
||||||
|
@ -69,16 +68,12 @@ namespace Ryujinx.HLE.HOS.Font
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStream NcaFileStream = new FileStream(FontPath, FileMode.Open, FileAccess.Read);
|
FileStream NcaFileStream = new FileStream(FontPath, FileMode.Open, FileAccess.Read);
|
||||||
|
Nca Nca = new Nca(Device.System.KeySet, NcaFileStream, false);
|
||||||
|
NcaSection RomfsSection = Nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
|
||||||
|
Romfs Romfs = new Romfs(Nca.OpenSection(RomfsSection.SectionNum, false, Device.System.FsIntegrityCheckLevel));
|
||||||
|
Stream FontFile = Romfs.OpenFile(Romfs.Files[FileIndex]);
|
||||||
|
|
||||||
Nca Nca = new Nca(Device.System.KeySet, NcaFileStream, false);
|
byte[] Data = DecryptFont(FontFile);
|
||||||
|
|
||||||
NcaSection RomfsSection = Nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
|
|
||||||
|
|
||||||
Romfs Romfs = new Romfs(Nca.OpenSection(RomfsSection.SectionNum, false, Device.System.FsIntegrityCheckLevel));
|
|
||||||
|
|
||||||
Stream EncryptedFontFile = Romfs.OpenFile(Romfs.Files[FileIndex]);
|
|
||||||
|
|
||||||
byte[] Data = DecryptFont(EncryptedFontFile);
|
|
||||||
|
|
||||||
FontInfo Info = new FontInfo((int)FontOffset, Data.Length);
|
FontInfo Info = new FontInfo((int)FontOffset, Data.Length);
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
{ 1, GetEntryCount }
|
{ 1, GetEntryCount }
|
||||||
};
|
};
|
||||||
|
|
||||||
this.Provider = Provider;
|
this.Provider = Provider;
|
||||||
|
|
||||||
this.DirectoryPath = DirectoryPath;
|
this.DirectoryPath = DirectoryPath;
|
||||||
|
|
||||||
DirectoryEntries = new List<DirectoryEntry>();
|
DirectoryEntries = new List<DirectoryEntry>();
|
||||||
|
|
|
@ -9,7 +9,7 @@ using static Ryujinx.HLE.Utilities.StringUtils;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.FspSrv
|
namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
{
|
{
|
||||||
class IFileSystem : IpcService, IDisposable
|
class IFileSystem : IpcService
|
||||||
{
|
{
|
||||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
|
|
||||||
OpenPaths = new HashSet<string>();
|
OpenPaths = new HashSet<string>();
|
||||||
|
|
||||||
this.Path = Path;
|
this.Path = Path;
|
||||||
|
|
||||||
this.Provider = Provider;
|
this.Provider = Provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,15 +385,5 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
OpenPaths.Remove(DirInterface.DirectoryPath);
|
OpenPaths.Remove(DirInterface.DirectoryPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
Provider.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,10 +42,8 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
|
|
||||||
public long OpenBisFileSystem(ServiceCtx Context)
|
public long OpenBisFileSystem(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
int BisPartitionId = Context.RequestData.ReadInt32();
|
int BisPartitionId = Context.RequestData.ReadInt32();
|
||||||
|
|
||||||
string PartitionString = ReadUtf8String(Context);
|
string PartitionString = ReadUtf8String(Context);
|
||||||
|
|
||||||
string BisPartitonPath = string.Empty;
|
string BisPartitonPath = string.Empty;
|
||||||
|
|
||||||
switch (BisPartitionId)
|
switch (BisPartitionId)
|
||||||
|
@ -76,12 +74,9 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
public long OpenFileSystemWithId(ServiceCtx Context)
|
public long OpenFileSystemWithId(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
FileSystemType FileSystemType = (FileSystemType)Context.RequestData.ReadInt32();
|
FileSystemType FileSystemType = (FileSystemType)Context.RequestData.ReadInt32();
|
||||||
|
long TitleId = Context.RequestData.ReadInt64();
|
||||||
long TitleId = Context.RequestData.ReadInt64();
|
string SwitchPath = ReadUtf8String(Context);
|
||||||
|
string FullPath = Context.Device.FileSystem.SwitchPathToSystemPath(SwitchPath);
|
||||||
string SwitchPath = ReadUtf8String(Context);
|
|
||||||
|
|
||||||
string FullPath = Context.Device.FileSystem.SwitchPathToSystemPath(SwitchPath);
|
|
||||||
|
|
||||||
if (!File.Exists(FullPath))
|
if (!File.Exists(FullPath))
|
||||||
{
|
{
|
||||||
|
@ -94,8 +89,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStream FileStream = new FileStream(FullPath, FileMode.Open, FileAccess.Read);
|
FileStream FileStream = new FileStream(FullPath, FileMode.Open, FileAccess.Read);
|
||||||
|
string Extension = Path.GetExtension(FullPath);
|
||||||
string Extension = Path.GetExtension(FullPath);
|
|
||||||
|
|
||||||
if (Extension == ".nca")
|
if (Extension == ".nca")
|
||||||
{
|
{
|
||||||
|
@ -144,10 +138,8 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
public long OpenDataStorageByDataId(ServiceCtx Context)
|
public long OpenDataStorageByDataId(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
StorageId StorageId = (StorageId)Context.RequestData.ReadByte();
|
StorageId StorageId = (StorageId)Context.RequestData.ReadByte();
|
||||||
|
byte[] Padding = Context.RequestData.ReadBytes(7);
|
||||||
byte[] Padding = Context.RequestData.ReadBytes(7);
|
long TitleId = Context.RequestData.ReadInt64();
|
||||||
|
|
||||||
long TitleId = Context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
StorageId InstalledStorage =
|
StorageId InstalledStorage =
|
||||||
Context.Device.System.ContentManager.GetInstalledStorage(TitleId, ContentType.Data, StorageId);
|
Context.Device.System.ContentManager.GetInstalledStorage(TitleId, ContentType.Data, StorageId);
|
||||||
|
@ -166,6 +158,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
{
|
{
|
||||||
ContentPath = Context.Device.System.ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.AocData);
|
ContentPath = Context.Device.System.ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.AocData);
|
||||||
}
|
}
|
||||||
|
|
||||||
string InstallPath = Context.Device.FileSystem.SwitchPathToSystemPath(ContentPath);
|
string InstallPath = Context.Device.FileSystem.SwitchPathToSystemPath(ContentPath);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(InstallPath))
|
if (!string.IsNullOrWhiteSpace(InstallPath))
|
||||||
|
@ -174,23 +167,24 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
|
|
||||||
if (File.Exists(NcaPath))
|
if (File.Exists(NcaPath))
|
||||||
{
|
{
|
||||||
FileStream NcaStream = new FileStream(NcaPath, FileMode.Open, FileAccess.Read);
|
FileStream NcaStream = new FileStream(NcaPath, FileMode.Open, FileAccess.Read);
|
||||||
|
Nca Nca = new Nca(Context.Device.System.KeySet, NcaStream, false);
|
||||||
Nca Nca = new Nca(Context.Device.System.KeySet, NcaStream, false);
|
|
||||||
|
|
||||||
NcaSection RomfsSection = Nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
|
NcaSection RomfsSection = Nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
|
||||||
|
Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
|
||||||
Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
|
|
||||||
|
|
||||||
MakeObject(Context, new IStorage(RomfsStream));
|
MakeObject(Context, new IStorage(RomfsStream));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw new FileNotFoundException($"No Nca found in Path `{NcaPath}`.");
|
throw new FileNotFoundException($"No Nca found in Path `{NcaPath}`.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw new DirectoryNotFoundException($"Path for title id {TitleId:x16} on Storage {StorageId} was not found in Path {InstallPath}.");
|
throw new DirectoryNotFoundException($"Path for title id {TitleId:x16} on Storage {StorageId} was not found in Path {InstallPath}.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FileNotFoundException($"System archive with titleid {TitleId:x16} was not found on Storage {StorageId}. Found in {InstalledStorage}.");
|
throw new FileNotFoundException($"System archive with titleid {TitleId:x16} was not found on Storage {StorageId}. Found in {InstalledStorage}.");
|
||||||
|
@ -220,14 +214,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
Context.RequestData.ReadInt64(),
|
Context.RequestData.ReadInt64(),
|
||||||
Context.RequestData.ReadInt64());
|
Context.RequestData.ReadInt64());
|
||||||
|
|
||||||
long SaveId = Context.RequestData.ReadInt64();
|
long SaveId = Context.RequestData.ReadInt64();
|
||||||
|
SaveDataType SaveDataType = (SaveDataType)Context.RequestData.ReadByte();
|
||||||
SaveDataType SaveDataType = (SaveDataType)Context.RequestData.ReadByte();
|
SaveInfo SaveInfo = new SaveInfo(TitleId, SaveId, SaveDataType, UserId, SaveSpaceId);
|
||||||
|
string SavePath = Context.Device.FileSystem.GetGameSavePath(SaveInfo, Context);
|
||||||
SaveInfo SaveInfo = new SaveInfo(TitleId, SaveId, SaveDataType, UserId, SaveSpaceId);
|
|
||||||
|
|
||||||
string SavePath = Context.Device.FileSystem.GetGameSavePath(SaveInfo, Context);
|
|
||||||
|
|
||||||
FileSystemProvider FileSystemProvider = new FileSystemProvider(SavePath, Context.Device.FileSystem.GetBasePath());
|
FileSystemProvider FileSystemProvider = new FileSystemProvider(SavePath, Context.Device.FileSystem.GetBasePath());
|
||||||
|
|
||||||
MakeObject(Context, new IFileSystem(SavePath, FileSystemProvider));
|
MakeObject(Context, new IFileSystem(SavePath, FileSystemProvider));
|
||||||
|
@ -235,10 +225,8 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
|
|
||||||
private long OpenNsp(ServiceCtx Context, string PfsPath)
|
private long OpenNsp(ServiceCtx Context, string PfsPath)
|
||||||
{
|
{
|
||||||
FileStream PfsFile = new FileStream(PfsPath, FileMode.Open, FileAccess.Read);
|
FileStream PfsFile = new FileStream(PfsPath, FileMode.Open, FileAccess.Read);
|
||||||
|
Pfs Nsp = new Pfs(PfsFile);
|
||||||
Pfs Nsp = new Pfs(PfsFile);
|
|
||||||
|
|
||||||
PfsFileEntry TicketFile = Nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
|
PfsFileEntry TicketFile = Nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
|
||||||
|
|
||||||
if (TicketFile != null)
|
if (TicketFile != null)
|
||||||
|
@ -265,18 +253,15 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
|
|
||||||
if (RomfsSection != null)
|
if (RomfsSection != null)
|
||||||
{
|
{
|
||||||
Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
|
Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
|
||||||
|
|
||||||
IFileSystem NcaFileSystem = new IFileSystem(NcaPath, new RomFsProvider(RomfsStream));
|
IFileSystem NcaFileSystem = new IFileSystem(NcaPath, new RomFsProvider(RomfsStream));
|
||||||
|
|
||||||
MakeObject(Context, NcaFileSystem);
|
MakeObject(Context, NcaFileSystem);
|
||||||
}
|
}
|
||||||
else if(PfsSection !=null)
|
else if(PfsSection !=null)
|
||||||
{
|
{
|
||||||
Stream PfsStream = Nca.OpenSection(PfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
|
Stream PfsStream = Nca.OpenSection(PfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
|
||||||
|
Pfs Pfs = new Pfs(PfsStream);
|
||||||
Pfs Pfs = new Pfs(PfsStream);
|
|
||||||
|
|
||||||
IFileSystem NcaFileSystem = new IFileSystem(NcaPath, new PFsProvider(Pfs));
|
IFileSystem NcaFileSystem = new IFileSystem(NcaPath, new PFsProvider(Pfs));
|
||||||
|
|
||||||
MakeObject(Context, NcaFileSystem);
|
MakeObject(Context, NcaFileSystem);
|
||||||
|
@ -305,8 +290,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
||||||
FileMode.Open,
|
FileMode.Open,
|
||||||
FileAccess.Read);
|
FileAccess.Read);
|
||||||
|
|
||||||
Pfs Nsp = new Pfs(PfsFile);
|
Pfs Nsp = new Pfs(PfsFile);
|
||||||
|
|
||||||
PfsFileEntry TicketFile = Nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
|
PfsFileEntry TicketFile = Nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
|
||||||
|
|
||||||
if (TicketFile != null)
|
if (TicketFile != null)
|
||||||
|
|
|
@ -220,8 +220,7 @@ namespace Ryujinx.HLE.HOS.Services.Lr
|
||||||
private bool ResolvePath(ServiceCtx Context, long TitleId,ContentType ContentType)
|
private bool ResolvePath(ServiceCtx Context, long TitleId,ContentType ContentType)
|
||||||
{
|
{
|
||||||
ContentManager ContentManager = Context.Device.System.ContentManager;
|
ContentManager ContentManager = Context.Device.System.ContentManager;
|
||||||
|
string ContentPath = ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.Program);
|
||||||
string ContentPath = ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.Program);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(ContentPath))
|
if (!string.IsNullOrWhiteSpace(ContentPath))
|
||||||
{
|
{
|
||||||
|
@ -243,8 +242,7 @@ namespace Ryujinx.HLE.HOS.Services.Lr
|
||||||
private void DeleteContentPath(ServiceCtx Context, long TitleId, ContentType ContentType)
|
private void DeleteContentPath(ServiceCtx Context, long TitleId, ContentType ContentType)
|
||||||
{
|
{
|
||||||
ContentManager ContentManager = Context.Device.System.ContentManager;
|
ContentManager ContentManager = Context.Device.System.ContentManager;
|
||||||
|
string ContentPath = ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.Manual);
|
||||||
string ContentPath = ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.Manual);
|
|
||||||
|
|
||||||
ContentManager.ClearEntry(TitleId, ContentType.Manual, StorageId);
|
ContentManager.ClearEntry(TitleId, ContentType.Manual, StorageId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,10 +168,8 @@ namespace Ryujinx.HLE.HOS.Services.Set
|
||||||
|
|
||||||
public static byte[] GetFirmwareData(Switch Device)
|
public static byte[] GetFirmwareData(Switch Device)
|
||||||
{
|
{
|
||||||
byte[] Data = null;
|
byte[] Data = null;
|
||||||
|
long TitleId = 0x0100000000000809;
|
||||||
long TitleId = 0x0100000000000809;
|
|
||||||
|
|
||||||
string ContentPath = Device.System.ContentManager.GetInstalledContentPath(TitleId, StorageId.NandSystem, ContentType.Data);
|
string ContentPath = Device.System.ContentManager.GetInstalledContentPath(TitleId, StorageId.NandSystem, ContentType.Data);
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(ContentPath))
|
if(string.IsNullOrWhiteSpace(ContentPath))
|
||||||
|
@ -179,13 +177,10 @@ namespace Ryujinx.HLE.HOS.Services.Set
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
string FirmwareTitlePath = Device.FileSystem.SwitchPathToSystemPath(ContentPath);
|
string FirmwareTitlePath = Device.FileSystem.SwitchPathToSystemPath(ContentPath);
|
||||||
|
FileStream FirmwareStream = File.Open(FirmwareTitlePath, FileMode.Open, FileAccess.Read);
|
||||||
FileStream FirmwareStream = File.Open(FirmwareTitlePath, FileMode.Open, FileAccess.Read);
|
Nca FirmwareContent = new Nca(Device.System.KeySet, FirmwareStream, false);
|
||||||
|
Stream RomFsStream = FirmwareContent.OpenSection(0, false, Device.System.FsIntegrityCheckLevel);
|
||||||
Nca FirmwareContent = new Nca(Device.System.KeySet, FirmwareStream, false);
|
|
||||||
|
|
||||||
Stream RomFsStream = FirmwareContent.OpenSection(0, false, Device.System.FsIntegrityCheckLevel);
|
|
||||||
|
|
||||||
if(RomFsStream == null)
|
if(RomFsStream == null)
|
||||||
{
|
{
|
||||||
|
@ -205,7 +200,6 @@ namespace Ryujinx.HLE.HOS.Services.Set
|
||||||
}
|
}
|
||||||
|
|
||||||
FirmwareContent.Dispose();
|
FirmwareContent.Dispose();
|
||||||
|
|
||||||
FirmwareStream.Dispose();
|
FirmwareStream.Dispose();
|
||||||
|
|
||||||
return Data;
|
return Data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue