mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 09:53:35 +01:00
Implement OpenDataStorageWithProgramIndex partially (#3765)
* Implement OpenDataStorageWithProgramIndex partially * Was not supposed to change this
This commit is contained in:
parent
beacf8c1c8
commit
7c1d2bbb98
1 changed files with 21 additions and 0 deletions
|
@ -12,6 +12,7 @@ using LibHac.Tools.FsSystem.NcaUtils;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy;
|
using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using static Ryujinx.HLE.Utilities.StringUtils;
|
using static Ryujinx.HLE.Utilities.StringUtils;
|
||||||
|
@ -787,6 +788,26 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandHipc(205)]
|
||||||
|
// OpenDataStorageWithProgramIndex(u8 program_index) -> object<nn::fssrv::sf::IStorage>
|
||||||
|
public ResultCode OpenDataStorageWithProgramIndex(ServiceCtx context)
|
||||||
|
{
|
||||||
|
byte programIndex = context.RequestData.ReadByte();
|
||||||
|
|
||||||
|
if ((context.Device.Application.TitleId & 0xf) != programIndex)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException($"Accessing storage from other programs is not supported (program index = {programIndex}).");
|
||||||
|
}
|
||||||
|
|
||||||
|
var storage = context.Device.FileSystem.RomFs.AsStorage(true);
|
||||||
|
using var sharedStorage = new SharedRef<LibHac.Fs.IStorage>(storage);
|
||||||
|
using var sfStorage = new SharedRef<IStorage>(new StorageInterfaceAdapter(ref sharedStorage.Ref()));
|
||||||
|
|
||||||
|
MakeObject(context, new FileSystemProxy.IStorage(ref sfStorage.Ref()));
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandHipc(400)]
|
[CommandHipc(400)]
|
||||||
// OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
|
// OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
|
||||||
public ResultCode OpenDeviceOperator(ServiceCtx context)
|
public ResultCode OpenDeviceOperator(ServiceCtx context)
|
||||||
|
|
Loading…
Reference in a new issue