aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Fs/IMultiCommitManager.cs
blob: f8245819ff9a3a79575f900ab5a3e9a96b692a64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using LibHac;
using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy;

namespace Ryujinx.HLE.HOS.Services.Fs
{
    class IMultiCommitManager : DisposableIpcService // 6.0.0+
    {
        private ReferenceCountedDisposable<LibHac.FsSrv.Sf.IMultiCommitManager> _baseCommitManager;

        public IMultiCommitManager(ReferenceCountedDisposable<LibHac.FsSrv.Sf.IMultiCommitManager> baseCommitManager)
        {
            _baseCommitManager = baseCommitManager;
        }

        [CommandHipc(1)] // 6.0.0+
        // Add(object<nn::fssrv::sf::IFileSystem>)
        public ResultCode Add(ServiceCtx context)
        {
            IFileSystem fileSystem = GetObject<IFileSystem>(context, 0);

            Result result = _baseCommitManager.Target.Add(fileSystem.GetBaseFileSystem());

            return (ResultCode)result.Value;
        }

        [CommandHipc(2)] // 6.0.0+
        // Commit()
        public ResultCode Commit(ServiceCtx context)
        {
            Result result = _baseCommitManager.Target.Commit();

            return (ResultCode)result.Value;
        }

        protected override void Dispose(bool isDisposing)
        {
            if (isDisposing)
            {
                _baseCommitManager?.Dispose();
            }
        }
    }
}