mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Ensure all complete shim classes are updated for 13.1.0
- ProgramIndexMapInfo - ProgramRegistry - SystemSaveData
This commit is contained in:
parent
74ed435dee
commit
c389f471d4
3 changed files with 36 additions and 19 deletions
|
@ -1,11 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using LibHac.Common;
|
using LibHac.Common;
|
||||||
using LibHac.FsSrv.Sf;
|
using LibHac.FsSrv.Sf;
|
||||||
using LibHac.Sf;
|
using LibHac.Sf;
|
||||||
|
|
||||||
namespace LibHac.Fs.Shim;
|
namespace LibHac.Fs.Shim;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains functions for registering multi-program application
|
||||||
|
/// information of the currently running application with FS.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Based on nnSdk 13.4.0</remarks>
|
||||||
public static class ProgramIndexMapInfoShim
|
public static class ProgramIndexMapInfoShim
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,10 +27,10 @@ public static class ProgramIndexMapInfoShim
|
||||||
|
|
||||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||||
|
|
||||||
var mapInfoBuffer = new InBuffer(MemoryMarshal.Cast<ProgramIndexMapInfo, byte>(mapInfo));
|
Result rc = fileSystemProxy.Get.RegisterProgramIndexMapInfo(InBuffer.FromSpan(mapInfo), mapInfo.Length);
|
||||||
|
|
||||||
Result rc = fileSystemProxy.Get.RegisterProgramIndexMapInfo(mapInfoBuffer, mapInfo.Length);
|
|
||||||
fs.Impl.AbortIfNeeded(rc);
|
fs.Impl.AbortIfNeeded(rc);
|
||||||
return rc;
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using LibHac.Common;
|
using LibHac.Common;
|
||||||
|
using LibHac.Diag;
|
||||||
using LibHac.FsSrv;
|
using LibHac.FsSrv;
|
||||||
using LibHac.FsSrv.Sf;
|
using LibHac.FsSrv.Sf;
|
||||||
using LibHac.Ncm;
|
using LibHac.Ncm;
|
||||||
|
@ -7,6 +8,11 @@ using LibHac.Sf;
|
||||||
|
|
||||||
namespace LibHac.Fs.Shim;
|
namespace LibHac.Fs.Shim;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains functions for registering and unregistering currently running
|
||||||
|
/// processes and their permissions in the FS program registry.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Based on nnSdk 13.4.0</remarks>
|
||||||
public static class ProgramRegistry
|
public static class ProgramRegistry
|
||||||
{
|
{
|
||||||
/// <inheritdoc cref="ProgramRegistryImpl.RegisterProgram"/>
|
/// <inheritdoc cref="ProgramRegistryImpl.RegisterProgram"/>
|
||||||
|
@ -33,11 +39,8 @@ public static class ProgramRegistry
|
||||||
{
|
{
|
||||||
using SharedRef<IProgramRegistry> programRegistry = fs.Impl.GetProgramRegistryServiceObject();
|
using SharedRef<IProgramRegistry> programRegistry = fs.Impl.GetProgramRegistryServiceObject();
|
||||||
|
|
||||||
Result rc = programRegistry.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value);
|
Abort.DoAbortUnlessSuccess(programRegistry.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value));
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
Abort.DoAbortUnlessSuccess(programRegistry.Get.UnregisterProgram(processId));
|
||||||
|
|
||||||
rc = programRegistry.Get.UnregisterProgram(processId);
|
|
||||||
if (rc.IsFailure()) return rc.Miss();
|
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,10 @@ using IFileSystemSf = LibHac.FsSrv.Sf.IFileSystem;
|
||||||
|
|
||||||
namespace LibHac.Fs.Shim;
|
namespace LibHac.Fs.Shim;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains functions for mounting system save data file systems.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Based on nnSdk 13.4.0</remarks>
|
||||||
[SkipLocalsInit]
|
[SkipLocalsInit]
|
||||||
public static class SystemSaveData
|
public static class SystemSaveData
|
||||||
{
|
{
|
||||||
|
@ -19,18 +23,18 @@ public static class SystemSaveData
|
||||||
return fs.MountSystemSaveData(mountName, saveDataId, Fs.SaveData.InvalidUserId);
|
return fs.MountSystemSaveData(mountName, saveDataId, Fs.SaveData.InvalidUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId,
|
|
||||||
ulong saveDataId)
|
|
||||||
{
|
|
||||||
return fs.MountSystemSaveData(mountName, spaceId, saveDataId, Fs.SaveData.InvalidUserId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName, ulong saveDataId,
|
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName, ulong saveDataId,
|
||||||
UserId userId)
|
UserId userId)
|
||||||
{
|
{
|
||||||
return fs.MountSystemSaveData(mountName, SaveDataSpaceId.System, saveDataId, userId);
|
return fs.MountSystemSaveData(mountName, SaveDataSpaceId.System, saveDataId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId,
|
||||||
|
ulong saveDataId)
|
||||||
|
{
|
||||||
|
return fs.MountSystemSaveData(mountName, spaceId, saveDataId, Fs.SaveData.InvalidUserId);
|
||||||
|
}
|
||||||
|
|
||||||
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName,
|
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName,
|
||||||
SaveDataSpaceId spaceId, ulong saveDataId, UserId userId)
|
SaveDataSpaceId spaceId, ulong saveDataId, UserId userId)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +62,11 @@ public static class SystemSaveData
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.Impl.AbortIfNeeded(rc);
|
fs.Impl.AbortIfNeeded(rc);
|
||||||
|
if (rc.IsFailure()) return rc.Miss();
|
||||||
|
|
||||||
|
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||||
|
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
static Result Mount(FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId, ulong saveDataId,
|
static Result Mount(FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId, ulong saveDataId,
|
||||||
|
@ -86,8 +95,9 @@ public static class SystemSaveData
|
||||||
if (spaceId == SaveDataSpaceId.System)
|
if (spaceId == SaveDataSpaceId.System)
|
||||||
{
|
{
|
||||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||||
return fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(),
|
return fs.Register(mountName, multiCommitTarget: fileSystemAdapterRaw, ref fileSystemAdapter.Ref(),
|
||||||
ref mountNameGenerator.Ref(), false, null, false);
|
ref mountNameGenerator.Ref(), useDataCache: false, storageForPurgeFileDataCache: null,
|
||||||
|
usePathCache: false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue