aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/FspSrv
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2018-12-04 14:23:37 -0600
committergdkchan <gab.dark.100@gmail.com>2018-12-04 18:23:37 -0200
commit85dbb9559ad317a657dafd24da27fec4b3f5250f (patch)
treeecd92931bc2146e549484d9a3af308469089ad4e /Ryujinx.HLE/HOS/Services/FspSrv
parentc86aacde76b5f8e503e2b412385c8491ecc86b3b (diff)
Adjust naming conventions and general refactoring in HLE Project (#490)
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Remove unneeded property setters
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/FspSrv')
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/DirectoryEntry.cs18
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs2
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs70
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs70
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs246
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs238
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs36
7 files changed, 338 insertions, 342 deletions
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/DirectoryEntry.cs b/Ryujinx.HLE/HOS/Services/FspSrv/DirectoryEntry.cs
index 74ebddc2..bdb0c1cd 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/DirectoryEntry.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/DirectoryEntry.cs
@@ -1,21 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Ryujinx.HLE.HOS.Services.FspSrv
+namespace Ryujinx.HLE.HOS.Services.FspSrv
{
public struct DirectoryEntry
{
- public string Path { get; private set; }
- public long Size { get; private set; }
+ public string Path { get; }
+ public long Size { get; }
public DirectoryEntryType EntryType { get; set; }
- public DirectoryEntry(string Path, DirectoryEntryType DirectoryEntryType, long Size = 0)
+ public DirectoryEntry(string path, DirectoryEntryType directoryEntryType, long size = 0)
{
- this.Path = Path;
- EntryType = DirectoryEntryType;
- this.Size = Size;
+ Path = path;
+ EntryType = directoryEntryType;
+ Size = size;
}
}
}
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs b/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs
index 2fd59673..20fc9bdc 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/FileSystemType.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.HLE.HOS.Services.FspSrv
{
- enum FileSystemType : int
+ enum FileSystemType
{
Logo = 2,
ContentControl = 3,
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
index c964eecb..e5dcd8b1 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
@@ -11,88 +11,88 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
private const int DirectoryEntrySize = 0x310;
- private Dictionary<int, ServiceProcessRequest> m_Commands;
+ private Dictionary<int, ServiceProcessRequest> _commands;
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- private List<DirectoryEntry> DirectoryEntries;
+ private List<DirectoryEntry> _directoryEntries;
- private int CurrentItemIndex;
+ private int _currentItemIndex;
public event EventHandler<EventArgs> Disposed;
- public string DirectoryPath { get; private set; }
+ public string DirectoryPath { get; }
- private IFileSystemProvider Provider;
+ private IFileSystemProvider _provider;
- public IDirectory(string DirectoryPath, int Flags, IFileSystemProvider Provider)
+ public IDirectory(string directoryPath, int flags, IFileSystemProvider provider)
{
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ _commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, Read },
{ 1, GetEntryCount }
};
- this.Provider = Provider;
- this.DirectoryPath = DirectoryPath;
+ _provider = provider;
+ DirectoryPath = directoryPath;
- DirectoryEntries = new List<DirectoryEntry>();
+ _directoryEntries = new List<DirectoryEntry>();
- if ((Flags & 1) != 0)
+ if ((flags & 1) != 0)
{
- DirectoryEntries.AddRange(Provider.GetDirectories(DirectoryPath));
+ _directoryEntries.AddRange(provider.GetDirectories(directoryPath));
}
- if ((Flags & 2) != 0)
+ if ((flags & 2) != 0)
{
- DirectoryEntries.AddRange(Provider.GetFiles(DirectoryPath));
+ _directoryEntries.AddRange(provider.GetFiles(directoryPath));
}
- CurrentItemIndex = 0;
+ _currentItemIndex = 0;
}
// Read() -> (u64 count, buffer<nn::fssrv::sf::IDirectoryEntry, 6, 0> entries)
- public long Read(ServiceCtx Context)
+ public long Read(ServiceCtx context)
{
- long BufferPosition = Context.Request.ReceiveBuff[0].Position;
- long BufferLen = Context.Request.ReceiveBuff[0].Size;
+ long bufferPosition = context.Request.ReceiveBuff[0].Position;
+ long bufferLen = context.Request.ReceiveBuff[0].Size;
- int MaxReadCount = (int)(BufferLen / DirectoryEntrySize);
+ int maxReadCount = (int)(bufferLen / DirectoryEntrySize);
- int Count = Math.Min(DirectoryEntries.Count - CurrentItemIndex, MaxReadCount);
+ int count = Math.Min(_directoryEntries.Count - _currentItemIndex, maxReadCount);
- for (int Index = 0; Index < Count; Index++)
+ for (int index = 0; index < count; index++)
{
- long Position = BufferPosition + Index * DirectoryEntrySize;
+ long position = bufferPosition + index * DirectoryEntrySize;
- WriteDirectoryEntry(Context, Position, DirectoryEntries[CurrentItemIndex++]);
+ WriteDirectoryEntry(context, position, _directoryEntries[_currentItemIndex++]);
}
- Context.ResponseData.Write((long)Count);
+ context.ResponseData.Write((long)count);
return 0;
}
- private void WriteDirectoryEntry(ServiceCtx Context, long Position, DirectoryEntry Entry)
+ private void WriteDirectoryEntry(ServiceCtx context, long position, DirectoryEntry entry)
{
- for (int Offset = 0; Offset < 0x300; Offset += 8)
+ for (int offset = 0; offset < 0x300; offset += 8)
{
- Context.Memory.WriteInt64(Position + Offset, 0);
+ context.Memory.WriteInt64(position + offset, 0);
}
- byte[] NameBuffer = Encoding.UTF8.GetBytes(Path.GetFileName(Entry.Path));
+ byte[] nameBuffer = Encoding.UTF8.GetBytes(Path.GetFileName(entry.Path));
- Context.Memory.WriteBytes(Position, NameBuffer);
+ context.Memory.WriteBytes(position, nameBuffer);
- Context.Memory.WriteInt32(Position + 0x300, 0); //Padding?
- Context.Memory.WriteInt32(Position + 0x304, (byte)Entry.EntryType);
- Context.Memory.WriteInt64(Position + 0x308, Entry.Size);
+ context.Memory.WriteInt32(position + 0x300, 0); //Padding?
+ context.Memory.WriteInt32(position + 0x304, (byte)entry.EntryType);
+ context.Memory.WriteInt64(position + 0x308, entry.Size);
}
// GetEntryCount() -> u64
- public long GetEntryCount(ServiceCtx Context)
+ public long GetEntryCount(ServiceCtx context)
{
- Context.ResponseData.Write((long)DirectoryEntries.Count);
+ context.ResponseData.Write((long)_directoryEntries.Count);
return 0;
}
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs
index 9bf152c4..03cfad99 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs
@@ -7,19 +7,19 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
class IFile : IpcService, IDisposable
{
- private Dictionary<int, ServiceProcessRequest> m_Commands;
+ private Dictionary<int, ServiceProcessRequest> _commands;
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- private Stream BaseStream;
+ private Stream _baseStream;
public event EventHandler<EventArgs> Disposed;
- public string HostPath { get; private set; }
+ public string HostPath { get; }
- public IFile(Stream BaseStream, string HostPath)
+ public IFile(Stream baseStream, string hostPath)
{
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ _commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, Read },
{ 1, Write },
@@ -28,71 +28,71 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{ 4, GetSize }
};
- this.BaseStream = BaseStream;
- this.HostPath = HostPath;
+ _baseStream = baseStream;
+ HostPath = hostPath;
}
// Read(u32, u64 offset, u64 size) -> (u64 out_size, buffer<u8, 0x46, 0> out_buf)
- public long Read(ServiceCtx Context)
+ public long Read(ServiceCtx context)
{
- long Position = Context.Request.ReceiveBuff[0].Position;
+ long position = context.Request.ReceiveBuff[0].Position;
- long Zero = Context.RequestData.ReadInt64();
- long Offset = Context.RequestData.ReadInt64();
- long Size = Context.RequestData.ReadInt64();
+ long zero = context.RequestData.ReadInt64();
+ long offset = context.RequestData.ReadInt64();
+ long size = context.RequestData.ReadInt64();
- byte[] Data = new byte[Size];
+ byte[] data = new byte[size];
- BaseStream.Seek(Offset, SeekOrigin.Begin);
+ _baseStream.Seek(offset, SeekOrigin.Begin);
- int ReadSize = BaseStream.Read(Data, 0, (int)Size);
+ int readSize = _baseStream.Read(data, 0, (int)size);
- Context.Memory.WriteBytes(Position, Data);
+ context.Memory.WriteBytes(position, data);
- Context.ResponseData.Write((long)ReadSize);
+ context.ResponseData.Write((long)readSize);
return 0;
}
// Write(u32, u64 offset, u64 size, buffer<u8, 0x45, 0>)
- public long Write(ServiceCtx Context)
+ public long Write(ServiceCtx context)
{
- long Position = Context.Request.SendBuff[0].Position;
+ long position = context.Request.SendBuff[0].Position;
- long Zero = Context.RequestData.ReadInt64();
- long Offset = Context.RequestData.ReadInt64();
- long Size = Context.RequestData.ReadInt64();
+ long zero = context.RequestData.ReadInt64();
+ long offset = context.RequestData.ReadInt64();
+ long size = context.RequestData.ReadInt64();
- byte[] Data = Context.Memory.ReadBytes(Position, Size);
+ byte[] data = context.Memory.ReadBytes(position, size);
- BaseStream.Seek(Offset, SeekOrigin.Begin);
- BaseStream.Write(Data, 0, (int)Size);
+ _baseStream.Seek(offset, SeekOrigin.Begin);
+ _baseStream.Write(data, 0, (int)size);
return 0;
}
// Flush()
- public long Flush(ServiceCtx Context)
+ public long Flush(ServiceCtx context)
{
- BaseStream.Flush();
+ _baseStream.Flush();
return 0;
}
// SetSize(u64 size)
- public long SetSize(ServiceCtx Context)
+ public long SetSize(ServiceCtx context)
{
- long Size = Context.RequestData.ReadInt64();
+ long size = context.RequestData.ReadInt64();
- BaseStream.SetLength(Size);
+ _baseStream.SetLength(size);
return 0;
}
// GetSize() -> u64 fileSize
- public long GetSize(ServiceCtx Context)
+ public long GetSize(ServiceCtx context)
{
- Context.ResponseData.Write(BaseStream.Length);
+ context.ResponseData.Write(_baseStream.Length);
return 0;
}
@@ -104,9 +104,9 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
protected virtual void Dispose(bool disposing)
{
- if (disposing && BaseStream != null)
+ if (disposing && _baseStream != null)
{
- BaseStream.Dispose();
+ _baseStream.Dispose();
Disposed?.Invoke(this, EventArgs.Empty);
}
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs
index edcdfa58..9e294460 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs
@@ -11,19 +11,19 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
class IFileSystem : IpcService
{
- private Dictionary<int, ServiceProcessRequest> m_Commands;
+ private Dictionary<int, ServiceProcessRequest> _commands;
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- private HashSet<string> OpenPaths;
+ private HashSet<string> _openPaths;
- private string Path;
+ private string _path;
- private IFileSystemProvider Provider;
+ private IFileSystemProvider _provider;
- public IFileSystem(string Path, IFileSystemProvider Provider)
+ public IFileSystem(string path, IFileSystemProvider provider)
{
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ _commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, CreateFile },
{ 1, DeleteFile },
@@ -38,196 +38,196 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{ 10, Commit },
{ 11, GetFreeSpaceSize },
{ 12, GetTotalSpaceSize },
- { 13, CleanDirectoryRecursively },
+ { 13, CleanDirectoryRecursively }
//{ 14, GetFileTimeStampRaw }
};
- OpenPaths = new HashSet<string>();
+ _openPaths = new HashSet<string>();
- this.Path = Path;
- this.Provider = Provider;
+ _path = path;
+ _provider = provider;
}
// CreateFile(u32 mode, u64 size, buffer<bytes<0x301>, 0x19, 0x301> path)
- public long CreateFile(ServiceCtx Context)
+ public long CreateFile(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- long Mode = Context.RequestData.ReadInt64();
- int Size = Context.RequestData.ReadInt32();
+ long mode = context.RequestData.ReadInt64();
+ int size = context.RequestData.ReadInt32();
- string FileName = Provider.GetFullPath(Name);
+ string fileName = _provider.GetFullPath(name);
- if (FileName == null)
+ if (fileName == null)
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (Provider.FileExists(FileName))
+ if (_provider.FileExists(fileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
}
- if (IsPathAlreadyInUse(FileName))
+ if (IsPathAlreadyInUse(fileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- return Provider.CreateFile(FileName, Size);
+ return _provider.CreateFile(fileName, size);
}
// DeleteFile(buffer<bytes<0x301>, 0x19, 0x301> path)
- public long DeleteFile(ServiceCtx Context)
+ public long DeleteFile(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string FileName = Provider.GetFullPath(Name);
+ string fileName = _provider.GetFullPath(name);
- if (!Provider.FileExists(FileName))
+ if (!_provider.FileExists(fileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (IsPathAlreadyInUse(FileName))
+ if (IsPathAlreadyInUse(fileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- return Provider.DeleteFile(FileName);
+ return _provider.DeleteFile(fileName);
}
// CreateDirectory(buffer<bytes<0x301>, 0x19, 0x301> path)
- public long CreateDirectory(ServiceCtx Context)
+ public long CreateDirectory(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string DirName = Provider.GetFullPath(Name);
+ string dirName = _provider.GetFullPath(name);
- if (DirName == null)
+ if (dirName == null)
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (Provider.DirectoryExists(DirName))
+ if (_provider.DirectoryExists(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
}
- if (IsPathAlreadyInUse(DirName))
+ if (IsPathAlreadyInUse(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- Provider.CreateDirectory(DirName);
+ _provider.CreateDirectory(dirName);
return 0;
}
// DeleteDirectory(buffer<bytes<0x301>, 0x19, 0x301> path)
- public long DeleteDirectory(ServiceCtx Context)
+ public long DeleteDirectory(ServiceCtx context)
{
- return DeleteDirectory(Context, false);
+ return DeleteDirectory(context, false);
}
// DeleteDirectoryRecursively(buffer<bytes<0x301>, 0x19, 0x301> path)
- public long DeleteDirectoryRecursively(ServiceCtx Context)
+ public long DeleteDirectoryRecursively(ServiceCtx context)
{
- return DeleteDirectory(Context, true);
+ return DeleteDirectory(context, true);
}
- private long DeleteDirectory(ServiceCtx Context, bool Recursive)
+ private long DeleteDirectory(ServiceCtx context, bool recursive)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string DirName = Provider.GetFullPath(Name);
+ string dirName = _provider.GetFullPath(name);
- if (!Directory.Exists(DirName))
+ if (!Directory.Exists(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (IsPathAlreadyInUse(DirName))
+ if (IsPathAlreadyInUse(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- Provider.DeleteDirectory(DirName, Recursive);
+ _provider.DeleteDirectory(dirName, recursive);
return 0;
}
// RenameFile(buffer<bytes<0x301>, 0x19, 0x301> oldPath, buffer<bytes<0x301>, 0x19, 0x301> newPath)
- public long RenameFile(ServiceCtx Context)
+ public long RenameFile(ServiceCtx context)
{
- string OldName = ReadUtf8String(Context, 0);
- string NewName = ReadUtf8String(Context, 1);
+ string oldName = ReadUtf8String(context, 0);
+ string newName = ReadUtf8String(context, 1);
- string OldFileName = Provider.GetFullPath(OldName);
- string NewFileName = Provider.GetFullPath(NewName);
+ string oldFileName = _provider.GetFullPath(oldName);
+ string newFileName = _provider.GetFullPath(newName);
- if (Provider.FileExists(OldFileName))
+ if (_provider.FileExists(oldFileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (Provider.FileExists(NewFileName))
+ if (_provider.FileExists(newFileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
}
- if (IsPathAlreadyInUse(OldFileName))
+ if (IsPathAlreadyInUse(oldFileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- return Provider.RenameFile(OldFileName, NewFileName);
+ return _provider.RenameFile(oldFileName, newFileName);
}
// RenameDirectory(buffer<bytes<0x301>, 0x19, 0x301> oldPath, buffer<bytes<0x301>, 0x19, 0x301> newPath)
- public long RenameDirectory(ServiceCtx Context)
+ public long RenameDirectory(ServiceCtx context)
{
- string OldName = ReadUtf8String(Context, 0);
- string NewName = ReadUtf8String(Context, 1);
+ string oldName = ReadUtf8String(context, 0);
+ string newName = ReadUtf8String(context, 1);
- string OldDirName = Provider.GetFullPath(OldName);
- string NewDirName = Provider.GetFullPath(NewName);
+ string oldDirName = _provider.GetFullPath(oldName);
+ string newDirName = _provider.GetFullPath(newName);
- if (!Provider.DirectoryExists(OldDirName))
+ if (!_provider.DirectoryExists(oldDirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (!Provider.DirectoryExists(NewDirName))
+ if (!_provider.DirectoryExists(newDirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
}
- if (IsPathAlreadyInUse(OldDirName))
+ if (IsPathAlreadyInUse(oldDirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- return Provider.RenameDirectory(OldDirName, NewDirName);
+ return _provider.RenameDirectory(oldDirName, newDirName);
}
// GetEntryType(buffer<bytes<0x301>, 0x19, 0x301> path) -> nn::fssrv::sf::DirectoryEntryType
- public long GetEntryType(ServiceCtx Context)
+ public long GetEntryType(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string FileName = Provider.GetFullPath(Name);
+ string fileName = _provider.GetFullPath(name);
- if (Provider.FileExists(FileName))
+ if (_provider.FileExists(fileName))
{
- Context.ResponseData.Write(1);
+ context.ResponseData.Write(1);
}
- else if (Provider.DirectoryExists(FileName))
+ else if (_provider.DirectoryExists(fileName))
{
- Context.ResponseData.Write(0);
+ context.ResponseData.Write(0);
}
else
{
- Context.ResponseData.Write(0);
+ context.ResponseData.Write(0);
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
@@ -236,167 +236,167 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
}
// OpenFile(u32 mode, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IFile> file
- public long OpenFile(ServiceCtx Context)
+ public long OpenFile(ServiceCtx context)
{
- int FilterFlags = Context.RequestData.ReadInt32();
+ int filterFlags = context.RequestData.ReadInt32();
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string FileName = Provider.GetFullPath(Name);
+ string fileName = _provider.GetFullPath(name);
- if (!Provider.FileExists(FileName))
+ if (!_provider.FileExists(fileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (IsPathAlreadyInUse(FileName))
+ if (IsPathAlreadyInUse(fileName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- long Error = Provider.OpenFile(FileName, out IFile FileInterface);
+ long error = _provider.OpenFile(fileName, out IFile fileInterface);
- if (Error == 0)
+ if (error == 0)
{
- FileInterface.Disposed += RemoveFileInUse;
+ fileInterface.Disposed += RemoveFileInUse;
- lock (OpenPaths)
+ lock (_openPaths)
{
- OpenPaths.Add(FileName);
+ _openPaths.Add(fileName);
}
- MakeObject(Context, FileInterface);
+ MakeObject(context, fileInterface);
return 0;
}
- return Error;
+ return error;
}
// OpenDirectory(u32 filter_flags, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IDirectory> directory
- public long OpenDirectory(ServiceCtx Context)
+ public long OpenDirectory(ServiceCtx context)
{
- int FilterFlags = Context.RequestData.ReadInt32();
+ int filterFlags = context.RequestData.ReadInt32();
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string DirName = Provider.GetFullPath(Name);
+ string dirName = _provider.GetFullPath(name);
- if (!Provider.DirectoryExists(DirName))
+ if (!_provider.DirectoryExists(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (IsPathAlreadyInUse(DirName))
+ if (IsPathAlreadyInUse(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- long Error = Provider.OpenDirectory(DirName, FilterFlags, out IDirectory DirInterface);
+ long error = _provider.OpenDirectory(dirName, filterFlags, out IDirectory dirInterface);
- if (Error == 0)
+ if (error == 0)
{
- DirInterface.Disposed += RemoveDirectoryInUse;
+ dirInterface.Disposed += RemoveDirectoryInUse;
- lock (OpenPaths)
+ lock (_openPaths)
{
- OpenPaths.Add(DirName);
+ _openPaths.Add(dirName);
}
- MakeObject(Context, DirInterface);
+ MakeObject(context, dirInterface);
}
- return Error;
+ return error;
}
// Commit()
- public long Commit(ServiceCtx Context)
+ public long Commit(ServiceCtx context)
{
return 0;
}
// GetFreeSpaceSize(buffer<bytes<0x301>, 0x19, 0x301> path) -> u64 totalFreeSpace
- public long GetFreeSpaceSize(ServiceCtx Context)
+ public long GetFreeSpaceSize(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- Context.ResponseData.Write(Provider.GetFreeSpace(Context));
+ context.ResponseData.Write(_provider.GetFreeSpace(context));
return 0;
}
// GetTotalSpaceSize(buffer<bytes<0x301>, 0x19, 0x301> path) -> u64 totalSize
- public long GetTotalSpaceSize(ServiceCtx Context)
+ public long GetTotalSpaceSize(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- Context.ResponseData.Write(Provider.GetFreeSpace(Context));
+ context.ResponseData.Write(_provider.GetFreeSpace(context));
return 0;
}
// CleanDirectoryRecursively(buffer<bytes<0x301>, 0x19, 0x301> path)
- public long CleanDirectoryRecursively(ServiceCtx Context)
+ public long CleanDirectoryRecursively(ServiceCtx context)
{
- string Name = ReadUtf8String(Context);
+ string name = ReadUtf8String(context);
- string DirName = Provider.GetFullPath(Name);
+ string dirName = _provider.GetFullPath(name);
- if (!Provider.DirectoryExists(DirName))
+ if (!_provider.DirectoryExists(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- if (IsPathAlreadyInUse(DirName))
+ if (IsPathAlreadyInUse(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyInUse);
}
- foreach (DirectoryEntry Entry in Provider.GetEntries(DirName))
+ foreach (DirectoryEntry entry in _provider.GetEntries(dirName))
{
- if (Provider.DirectoryExists(Entry.Path))
+ if (_provider.DirectoryExists(entry.Path))
{
- Provider.DeleteDirectory(Entry.Path, true);
+ _provider.DeleteDirectory(entry.Path, true);
}
- else if (Provider.FileExists(Entry.Path))
+ else if (_provider.FileExists(entry.Path))
{
- Provider.DeleteFile(Entry.Path);
+ _provider.DeleteFile(entry.Path);
}
}
return 0;
}
- private bool IsPathAlreadyInUse(string Path)
+ private bool IsPathAlreadyInUse(string path)
{
- lock (OpenPaths)
+ lock (_openPaths)
{
- return OpenPaths.Contains(Path);
+ return _openPaths.Contains(path);
}
}
private void RemoveFileInUse(object sender, EventArgs e)
{
- IFile FileInterface = (IFile)sender;
+ IFile fileInterface = (IFile)sender;
- lock (OpenPaths)
+ lock (_openPaths)
{
- FileInterface.Disposed -= RemoveFileInUse;
+ fileInterface.Disposed -= RemoveFileInUse;
- OpenPaths.Remove(FileInterface.HostPath);
+ _openPaths.Remove(fileInterface.HostPath);
}
}
private void RemoveDirectoryInUse(object sender, EventArgs e)
{
- IDirectory DirInterface = (IDirectory)sender;
+ IDirectory dirInterface = (IDirectory)sender;
- lock (OpenPaths)
+ lock (_openPaths)
{
- DirInterface.Disposed -= RemoveDirectoryInUse;
+ dirInterface.Disposed -= RemoveDirectoryInUse;
- OpenPaths.Remove(DirInterface.DirectoryPath);
+ _openPaths.Remove(dirInterface.DirectoryPath);
}
}
}
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs
index 0fc1eb80..8764792c 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs
@@ -14,13 +14,13 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
class IFileSystemProxy : IpcService
{
- private Dictionary<int, ServiceProcessRequest> m_Commands;
+ private Dictionary<int, ServiceProcessRequest> _commands;
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public IFileSystemProxy()
{
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ _commands = new Dictionary<int, ServiceProcessRequest>
{
{ 1, Initialize },
{ 8, OpenFileSystemWithId },
@@ -36,246 +36,246 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
}
// Initialize(u64, pid)
- public long Initialize(ServiceCtx Context)
+ public long Initialize(ServiceCtx context)
{
return 0;
}
// OpenFileSystemWithId(nn::fssrv::sf::FileSystemType filesystem_type, nn::ApplicationId tid, buffer<bytes<0x301>, 0x19, 0x301> path)
// -> object<nn::fssrv::sf::IFileSystem> contentFs
- public long OpenFileSystemWithId(ServiceCtx Context)
+ public long OpenFileSystemWithId(ServiceCtx context)
{
- FileSystemType FileSystemType = (FileSystemType)Context.RequestData.ReadInt32();
- long TitleId = Context.RequestData.ReadInt64();
- string SwitchPath = ReadUtf8String(Context);
- string FullPath = Context.Device.FileSystem.SwitchPathToSystemPath(SwitchPath);
+ FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32();
+ long titleId = context.RequestData.ReadInt64();
+ string switchPath = ReadUtf8String(context);
+ string fullPath = context.Device.FileSystem.SwitchPathToSystemPath(switchPath);
- if (!File.Exists(FullPath))
+ if (!File.Exists(fullPath))
{
- if (FullPath.Contains("."))
+ if (fullPath.Contains("."))
{
- return OpenFileSystemFromInternalFile(Context, FullPath);
+ return OpenFileSystemFromInternalFile(context, fullPath);
}
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- FileStream FileStream = new FileStream(FullPath, FileMode.Open, FileAccess.Read);
- string Extension = Path.GetExtension(FullPath);
+ FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
+ string extension = Path.GetExtension(fullPath);
- if (Extension == ".nca")
+ if (extension == ".nca")
{
- return OpenNcaFs(Context, FullPath, FileStream);
+ return OpenNcaFs(context, fullPath, fileStream);
}
- else if (Extension == ".nsp")
+ else if (extension == ".nsp")
{
- return OpenNsp(Context, FullPath);
+ return OpenNsp(context, fullPath);
}
return MakeError(ErrorModule.Fs, FsErr.InvalidInput);
}
// OpenBisFileSystem(nn::fssrv::sf::Partition partitionID, buffer<bytes<0x301>, 0x19, 0x301>) -> object<nn::fssrv::sf::IFileSystem> Bis
- public long OpenBisFileSystem(ServiceCtx Context)
+ public long OpenBisFileSystem(ServiceCtx context)
{
- int BisPartitionId = Context.RequestData.ReadInt32();
- string PartitionString = ReadUtf8String(Context);
- string BisPartitonPath = string.Empty;
+ int bisPartitionId = context.RequestData.ReadInt32();
+ string partitionString = ReadUtf8String(context);
+ string bisPartitonPath = string.Empty;
- switch (BisPartitionId)
+ switch (bisPartitionId)
{
case 29:
- BisPartitonPath = SafeNandPath;
+ bisPartitonPath = SafeNandPath;
break;
case 30:
case 31:
- BisPartitonPath = SystemNandPath;
+ bisPartitonPath = SystemNandPath;
break;
case 32:
- BisPartitonPath = UserNandPath;
+ bisPartitonPath = UserNandPath;
break;
default:
return MakeError(ErrorModule.Fs, FsErr.InvalidInput);
}
- string FullPath = Context.Device.FileSystem.GetFullPartitionPath(BisPartitonPath);
+ string fullPath = context.Device.FileSystem.GetFullPartitionPath(bisPartitonPath);
- FileSystemProvider FileSystemProvider = new FileSystemProvider(FullPath, Context.Device.FileSystem.GetBasePath());
+ FileSystemProvider fileSystemProvider = new FileSystemProvider(fullPath, context.Device.FileSystem.GetBasePath());
- MakeObject(Context, new IFileSystem(FullPath, FileSystemProvider));
+ MakeObject(context, new IFileSystem(fullPath, fileSystemProvider));
return 0;
}
// OpenSdCardFileSystem() -> object<nn::fssrv::sf::IFileSystem>
- public long OpenSdCardFileSystem(ServiceCtx Context)
+ public long OpenSdCardFileSystem(ServiceCtx context)
{
- string SdCardPath = Context.Device.FileSystem.GetSdCardPath();
+ string sdCardPath = context.Device.FileSystem.GetSdCardPath();
- FileSystemProvider FileSystemProvider = new FileSystemProvider(SdCardPath, Context.Device.FileSystem.GetBasePath());
+ FileSystemProvider fileSystemProvider = new FileSystemProvider(sdCardPath, context.Device.FileSystem.GetBasePath());
- MakeObject(Context, new IFileSystem(SdCardPath, FileSystemProvider));
+ MakeObject(context, new IFileSystem(sdCardPath, fileSystemProvider));
return 0;
}
// OpenSaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> saveDataFs
- public long OpenSaveDataFileSystem(ServiceCtx Context)
+ public long OpenSaveDataFileSystem(ServiceCtx context)
{
- LoadSaveDataFileSystem(Context);
+ LoadSaveDataFileSystem(context);
return 0;
}
// OpenSaveDataFileSystemBySystemSaveDataId(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> systemSaveDataFs
- public long OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx Context)
+ public long OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
{
- LoadSaveDataFileSystem(Context);
+ LoadSaveDataFileSystem(context);
return 0;
}
// OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
- public long OpenDataStorageByCurrentProcess(ServiceCtx Context)
+ public long OpenDataStorageByCurrentProcess(ServiceCtx context)
{
- MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs));
+ MakeObject(context, new IStorage(context.Device.FileSystem.RomFs));
return 0;
}
// OpenDataStorageByDataId(u8 storageId, nn::ApplicationId tid) -> object<nn::fssrv::sf::IStorage> dataStorage
- public long OpenDataStorageByDataId(ServiceCtx Context)
+ public long OpenDataStorageByDataId(ServiceCtx context)
{
- StorageId StorageId = (StorageId)Context.RequestData.ReadByte();
- byte[] Padding = Context.RequestData.ReadBytes(7);
- long TitleId = Context.RequestData.ReadInt64();
+ StorageId storageId = (StorageId)context.RequestData.ReadByte();
+ byte[] padding = context.RequestData.ReadBytes(7);
+ long titleId = context.RequestData.ReadInt64();
- StorageId InstalledStorage =
- Context.Device.System.ContentManager.GetInstalledStorage(TitleId, ContentType.Data, StorageId);
+ StorageId installedStorage =
+ context.Device.System.ContentManager.GetInstalledStorage(titleId, ContentType.Data, storageId);
- if (InstalledStorage == StorageId.None)
+ if (installedStorage == StorageId.None)
{
- InstalledStorage =
- Context.Device.System.ContentManager.GetInstalledStorage(TitleId, ContentType.AocData, StorageId);
+ installedStorage =
+ context.Device.System.ContentManager.GetInstalledStorage(titleId, ContentType.AocData, storageId);
}
- if (InstalledStorage != StorageId.None)
+ if (installedStorage != StorageId.None)
{
- string ContentPath = Context.Device.System.ContentManager.GetInstalledContentPath(TitleId, StorageId, ContentType.AocData);
+ string contentPath = context.Device.System.ContentManager.GetInstalledContentPath(titleId, storageId, ContentType.AocData);
- if (string.IsNullOrWhiteSpace(ContentPath))
+ if (string.IsNullOrWhiteSpace(contentPath))
{
- 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))
{
- string NcaPath = InstallPath;
+ string ncaPath = installPath;
- if (File.Exists(NcaPath))
+ if (File.Exists(ncaPath))
{
- FileStream NcaStream = new FileStream(NcaPath, FileMode.Open, FileAccess.Read);
- Nca Nca = new Nca(Context.Device.System.KeySet, NcaStream, false);
- NcaSection RomfsSection = Nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
- Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
+ FileStream ncaStream = new FileStream(ncaPath, FileMode.Open, FileAccess.Read);
+ Nca nca = new Nca(context.Device.System.KeySet, ncaStream, false);
+ NcaSection romfsSection = nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
+ Stream romfsStream = nca.OpenSection(romfsSection.SectionNum, false, context.Device.System.FsIntegrityCheckLevel);
- MakeObject(Context, new IStorage(RomfsStream));
+ MakeObject(context, new IStorage(romfsStream));
return 0;
}
else
{
- throw new FileNotFoundException($"No Nca found in Path `{NcaPath}`.");
+ throw new FileNotFoundException($"No Nca found in Path `{ncaPath}`.");
}
}
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}.");
}
// OpenPatchDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage>
- public long OpenPatchDataStorageByCurrentProcess(ServiceCtx Context)
+ public long OpenPatchDataStorageByCurrentProcess(ServiceCtx context)
{
- MakeObject(Context, new IStorage(Context.Device.FileSystem.RomFs));
+ MakeObject(context, new IStorage(context.Device.FileSystem.RomFs));
return 0;
}
// GetGlobalAccessLogMode() -> u32 logMode
- public long GetGlobalAccessLogMode(ServiceCtx Context)
+ public long GetGlobalAccessLogMode(ServiceCtx context)
{
- Context.ResponseData.Write(0);
+ context.ResponseData.Write(0);
return 0;
}
- public void LoadSaveDataFileSystem(ServiceCtx Context)
+ public void LoadSaveDataFileSystem(ServiceCtx context)
{
- SaveSpaceId SaveSpaceId = (SaveSpaceId)Context.RequestData.ReadInt64();
+ SaveSpaceId saveSpaceId = (SaveSpaceId)context.RequestData.ReadInt64();
- long TitleId = Context.RequestData.ReadInt64();
+ long titleId = context.RequestData.ReadInt64();
- UInt128 UserId = new UInt128(
- Context.RequestData.ReadInt64(),
- Context.RequestData.ReadInt64());
+ UInt128 userId = new UInt128(
+ context.RequestData.ReadInt64(),
+ context.RequestData.ReadInt64());
- long SaveId = Context.RequestData.ReadInt64();
- SaveDataType SaveDataType = (SaveDataType)Context.RequestData.ReadByte();
- 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());
+ long saveId = context.RequestData.ReadInt64();
+ SaveDataType saveDataType = (SaveDataType)context.RequestData.ReadByte();
+ 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());
- MakeObject(Context, new IFileSystem(SavePath, FileSystemProvider));
+ MakeObject(context, new IFileSystem(savePath, fileSystemProvider));
}
- private long OpenNsp(ServiceCtx Context, string PfsPath)
+ private long OpenNsp(ServiceCtx context, string pfsPath)
{
- FileStream PfsFile = new FileStream(PfsPath, FileMode.Open, FileAccess.Read);
- Pfs Nsp = new Pfs(PfsFile);
- PfsFileEntry TicketFile = Nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
+ FileStream pfsFile = new FileStream(pfsPath, FileMode.Open, FileAccess.Read);
+ Pfs nsp = new Pfs(pfsFile);
+ PfsFileEntry ticketFile = nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
- if (TicketFile != null)
+ if (ticketFile != null)
{
- Ticket Ticket = new Ticket(Nsp.OpenFile(TicketFile));
+ Ticket ticket = new Ticket(nsp.OpenFile(ticketFile));
- Context.Device.System.KeySet.TitleKeys[Ticket.RightsId] =
- Ticket.GetTitleKey(Context.Device.System.KeySet);
+ context.Device.System.KeySet.TitleKeys[ticket.RightsId] =
+ ticket.GetTitleKey(context.Device.System.KeySet);
}
- IFileSystem NspFileSystem = new IFileSystem(PfsPath, new PFsProvider(Nsp));
+ IFileSystem nspFileSystem = new IFileSystem(pfsPath, new PFsProvider(nsp));
- MakeObject(Context, NspFileSystem);
+ MakeObject(context, nspFileSystem);
return 0;
}
- private long OpenNcaFs(ServiceCtx Context,string NcaPath, Stream NcaStream)
+ private long OpenNcaFs(ServiceCtx context,string ncaPath, Stream ncaStream)
{
- 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 PfsSection = Nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Pfs0);
+ NcaSection romfsSection = nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs);
+ NcaSection pfsSection = nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Pfs0);
- if (RomfsSection != null)
+ if (romfsSection != null)
{
- Stream RomfsStream = Nca.OpenSection(RomfsSection.SectionNum, false, Context.Device.System.FsIntegrityCheckLevel);
- IFileSystem NcaFileSystem = new IFileSystem(NcaPath, new RomFsProvider(RomfsStream));
+ Stream romfsStream = nca.OpenSection(romfsSection.SectionNum, false, context.Device.System.FsIntegrityCheckLevel);
+ 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);
- Pfs Pfs = new Pfs(PfsStream);
- IFileSystem NcaFileSystem = new IFileSystem(NcaPath, new PFsProvider(Pfs));
+ Stream pfsStream = nca.OpenSection(pfsSection.SectionNum, false, context.Device.System.FsIntegrityCheckLevel);
+ Pfs pfs = new Pfs(pfsStream);
+ IFileSystem ncaFileSystem = new IFileSystem(ncaPath, new PFsProvider(pfs));
- MakeObject(Context, NcaFileSystem);
+ MakeObject(context, ncaFileSystem);
}
else
{
@@ -285,38 +285,38 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
return 0;
}
- private long OpenFileSystemFromInternalFile(ServiceCtx Context, string FullPath)
+ private long OpenFileSystemFromInternalFile(ServiceCtx context, string fullPath)
{
- DirectoryInfo ArchivePath = new DirectoryInfo(FullPath).Parent;
+ DirectoryInfo archivePath = new DirectoryInfo(fullPath).Parent;
- while (string.IsNullOrWhiteSpace(ArchivePath.Extension))
+ while (string.IsNullOrWhiteSpace(archivePath.Extension))
{
- ArchivePath = ArchivePath.Parent;
+ archivePath = archivePath.Parent;
}
- if (ArchivePath.Extension == ".nsp" && File.Exists(ArchivePath.FullName))
+ if (archivePath.Extension == ".nsp" && File.Exists(archivePath.FullName))
{
- FileStream PfsFile = new FileStream(
- ArchivePath.FullName.TrimEnd(Path.DirectorySeparatorChar),
+ FileStream pfsFile = new FileStream(
+ archivePath.FullName.TrimEnd(Path.DirectorySeparatorChar),
FileMode.Open,
FileAccess.Read);
- Pfs Nsp = new Pfs(PfsFile);
- PfsFileEntry TicketFile = Nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
+ Pfs nsp = new Pfs(pfsFile);
+ PfsFileEntry ticketFile = nsp.Files.FirstOrDefault(x => x.Name.EndsWith(".tik"));
- if (TicketFile != null)
+ if (ticketFile != null)
{
- Ticket Ticket = new Ticket(Nsp.OpenFile(TicketFile));
+ Ticket ticket = new Ticket(nsp.OpenFile(ticketFile));
- Context.Device.System.KeySet.TitleKeys[Ticket.RightsId] =
- Ticket.GetTitleKey(Context.Device.System.KeySet);
+ context.Device.System.KeySet.TitleKeys[ticket.RightsId] =
+ ticket.GetTitleKey(context.Device.System.KeySet);
}
- string Filename = FullPath.Replace(ArchivePath.FullName, string.Empty).TrimStart('\\');
+ string filename = fullPath.Replace(archivePath.FullName, string.Empty).TrimStart('\\');
- if (Nsp.FileExists(Filename))
+ if (nsp.FileExists(filename))
{
- return OpenNcaFs(Context, FullPath, Nsp.OpenFile(Filename));
+ return OpenNcaFs(context, fullPath, nsp.OpenFile(filename));
}
}
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs
index 6a78cdfe..d000635d 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs
@@ -6,47 +6,47 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
class IStorage : IpcService
{
- private Dictionary<int, ServiceProcessRequest> m_Commands;
+ private Dictionary<int, ServiceProcessRequest> _commands;
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- private Stream BaseStream;
+ private Stream _baseStream;
- public IStorage(Stream BaseStream)
+ public IStorage(Stream baseStream)
{
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ _commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, Read }
};
- this.BaseStream = BaseStream;
+ _baseStream = baseStream;
}
// Read(u64 offset, u64 length) -> buffer<u8, 0x46, 0> buffer
- public long Read(ServiceCtx Context)
+ public long Read(ServiceCtx context)
{
- long Offset = Context.RequestData.ReadInt64();
- long Size = Context.RequestData.ReadInt64();
+ long offset = context.RequestData.ReadInt64();
+ long size = context.RequestData.ReadInt64();
- if (Context.Request.ReceiveBuff.Count > 0)
+ if (context.Request.ReceiveBuff.Count > 0)
{
- IpcBuffDesc BuffDesc = Context.Request.ReceiveBuff[0];
+ IpcBuffDesc buffDesc = context.Request.ReceiveBuff[0];
//Use smaller length to avoid overflows.
- if (Size > BuffDesc.Size)
+ if (size > buffDesc.Size)
{
- Size = BuffDesc.Size;
+ size = buffDesc.Size;
}
- byte[] Data = new byte[Size];
+ byte[] data = new byte[size];
- lock (BaseStream)
+ lock (_baseStream)
{
- BaseStream.Seek(Offset, SeekOrigin.Begin);
- BaseStream.Read(Data, 0, Data.Length);
+ _baseStream.Seek(offset, SeekOrigin.Begin);
+ _baseStream.Read(data, 0, data.Length);
}
- Context.Memory.WriteBytes(BuffDesc.Position, Data);
+ context.Memory.WriteBytes(buffDesc.Position, data);
}
return 0;