Refactor to use ReadOnly, no more directory creation.
This commit is contained in:
parent
ea574a4d0d
commit
9c2d9e47cd
2 changed files with 33 additions and 2 deletions
|
@ -60,6 +60,11 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath);
|
||||
|
||||
public string GetReadOnlyGameSavePath(SaveInfo save, ServiceCtx context)
|
||||
{
|
||||
return GetReadOnlyFullPath(SaveHelper.GetSavePath(save, context));
|
||||
}
|
||||
|
||||
public string GetGameSavePath(SaveInfo save, ServiceCtx context)
|
||||
{
|
||||
return MakeDirAndGetFullPath(SaveHelper.GetSavePath(save, context));
|
||||
|
@ -104,7 +109,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
return null;
|
||||
}
|
||||
|
||||
private string MakeDirAndGetFullPath(string dir)
|
||||
private string GetReadOnlyFullPath(string dir)
|
||||
{
|
||||
// Handles Common Switch Content Paths
|
||||
switch (dir)
|
||||
|
@ -131,6 +136,13 @@ namespace Ryujinx.HLE.FileSystem
|
|||
}
|
||||
|
||||
string fullPath = Path.Combine(GetBasePath(), dir);
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
private string MakeDirAndGetFullPath(string dir)
|
||||
{
|
||||
// Handles Common Switch Content Paths
|
||||
string fullPath = GetReadOnlyFullPath(dir);
|
||||
|
||||
if (!Directory.Exists(fullPath))
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
|||
// OpenReadOnlySaveDataFileSystem(u8 save_data_space_id, ...) -> object<> ...
|
||||
public long OpenReadOnlySaveDataFileSystem(ServiceCtx context)
|
||||
{
|
||||
LoadSaveDataFileSystem(context);
|
||||
LoadReadOnlySaveDataFileSystem(context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -224,6 +224,25 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void LoadReadOnlySaveDataFileSystem(ServiceCtx context)
|
||||
{
|
||||
SaveSpaceId saveSpaceId = (SaveSpaceId)context.RequestData.ReadInt64();
|
||||
|
||||
long titleId = 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.GetReadOnlyGameSavePath(saveInfo, context);
|
||||
FileSystemProvider fileSystemProvider = new FileSystemProvider(savePath, context.Device.FileSystem.GetBasePath());
|
||||
|
||||
MakeObject(context, new IFileSystem(savePath, fileSystemProvider));
|
||||
}
|
||||
|
||||
public void LoadSaveDataFileSystem(ServiceCtx context)
|
||||
{
|
||||
SaveSpaceId saveSpaceId = (SaveSpaceId)context.RequestData.ReadInt64();
|
||||
|
|
Loading…
Add table
Reference in a new issue