mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
fsdev: Added fsdevMountSaveData/SystemSaveData wrappers
This commit is contained in:
parent
54f6fa5420
commit
13fbde91b0
@ -30,6 +30,12 @@ NX_CONSTEXPR FsDirectoryEntry* fsdevDirGetEntries(fsdev_dir_t *dir)
|
||||
/// Initializes and mounts the sdmc device if accessible.
|
||||
Result fsdevMountSdmc(void);
|
||||
|
||||
/// Mounts the specified save data.
|
||||
Result fsdevMountSaveData(const char *name, u64 titleID, AccountUid *userID);
|
||||
|
||||
/// Mounts the specified system save data.
|
||||
Result fsdevMountSystemSaveData(const char *name, u64 saveID);
|
||||
|
||||
/// Mounts the input fs with the specified device name. fsdev will handle closing the fs when required, including when fsdevMountDevice() fails.
|
||||
/// Returns -1 when any errors occur.
|
||||
int fsdevMountDevice(const char *name, FsFileSystem fs);
|
||||
|
@ -443,6 +443,32 @@ Result fsdevMountSdmc(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsdevMountSaveData(const char *name, u64 titleID, AccountUid *userID)
|
||||
{
|
||||
FsFileSystem fs;
|
||||
Result rc = fsOpen_SaveData(&fs, titleID, userID);
|
||||
if(R_SUCCEEDED(rc))
|
||||
{
|
||||
int ret = fsdevMountDevice(name, fs);
|
||||
if(ret==-1)
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsdevMountSystemSaveData(const char *name, u64 saveID)
|
||||
{
|
||||
FsFileSystem fs;
|
||||
Result rc = fsOpen_SystemSaveData(&fs, saveID);
|
||||
if(R_SUCCEEDED(rc))
|
||||
{
|
||||
int ret = fsdevMountDevice(name, fs);
|
||||
if(ret==-1)
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void __libnx_init_cwd(void)
|
||||
{
|
||||
if(envIsNso() || __system_argc==0 || __system_argv[0] == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user