2020-03-25 09:14:35 +01:00
|
|
|
|
using LibHac;
|
2021-12-23 17:55:50 +01:00
|
|
|
|
using LibHac.Common;
|
2020-03-25 09:14:35 +01:00
|
|
|
|
using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Fs
|
|
|
|
|
{
|
2021-08-12 23:56:24 +02:00
|
|
|
|
class IMultiCommitManager : DisposableIpcService // 6.0.0+
|
2020-03-25 09:14:35 +01:00
|
|
|
|
{
|
2021-12-23 17:55:50 +01:00
|
|
|
|
private SharedRef<LibHac.FsSrv.Sf.IMultiCommitManager> _baseCommitManager;
|
2020-03-25 09:14:35 +01:00
|
|
|
|
|
2021-12-23 17:55:50 +01:00
|
|
|
|
public IMultiCommitManager(ref SharedRef<LibHac.FsSrv.Sf.IMultiCommitManager> baseCommitManager)
|
2020-03-25 09:14:35 +01:00
|
|
|
|
{
|
2021-12-23 17:55:50 +01:00
|
|
|
|
_baseCommitManager = SharedRef<LibHac.FsSrv.Sf.IMultiCommitManager>.CreateMove(ref baseCommitManager);
|
2020-03-25 09:14:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-15 01:00:34 +02:00
|
|
|
|
[CommandCmif(1)] // 6.0.0+
|
2020-03-25 09:14:35 +01:00
|
|
|
|
// Add(object<nn::fssrv::sf::IFileSystem>)
|
|
|
|
|
public ResultCode Add(ServiceCtx context)
|
|
|
|
|
{
|
2021-12-23 17:55:50 +01:00
|
|
|
|
using SharedRef<LibHac.FsSrv.Sf.IFileSystem> fileSystem = GetObject<IFileSystem>(context, 0).GetBaseFileSystem();
|
2020-03-25 09:14:35 +01:00
|
|
|
|
|
2023-03-02 03:42:27 +01:00
|
|
|
|
Result result = _baseCommitManager.Get.Add(ref fileSystem.Ref);
|
2020-03-25 09:14:35 +01:00
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-15 01:00:34 +02:00
|
|
|
|
[CommandCmif(2)] // 6.0.0+
|
2020-03-25 09:14:35 +01:00
|
|
|
|
// Commit()
|
|
|
|
|
public ResultCode Commit(ServiceCtx context)
|
|
|
|
|
{
|
2021-12-23 17:55:50 +01:00
|
|
|
|
Result result = _baseCommitManager.Get.Commit();
|
2020-03-25 09:14:35 +01:00
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
2021-08-12 23:56:24 +02:00
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
|
|
|
|
if (isDisposing)
|
|
|
|
|
{
|
2021-12-23 17:55:50 +01:00
|
|
|
|
_baseCommitManager.Destroy();
|
2021-08-12 23:56:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-25 09:14:35 +01:00
|
|
|
|
}
|
|
|
|
|
}
|