Restore service session parameter in FSUSER_Initialize()

This commit is contained in:
fincs 2015-09-16 23:58:12 +02:00
parent e409f1ea1d
commit 6892a71eec
2 changed files with 6 additions and 8 deletions

View File

@ -133,7 +133,7 @@ Handle *fsGetSessionHandle(void);
FS_path FS_makePath(FS_pathType type, const char *path); FS_path FS_makePath(FS_pathType type, const char *path);
Result FSUSER_Initialize(void); Result FSUSER_Initialize(Handle handle);
Result FSUSER_OpenArchive(FS_archive* archive); Result FSUSER_OpenArchive(FS_archive* archive);
Result FSUSER_OpenDirectory(Handle* out, FS_archive archive, FS_path dirLowPath); Result FSUSER_OpenDirectory(Handle* out, FS_archive archive, FS_path dirLowPath);
Result FSUSER_OpenFile(Handle* out, FS_archive archive, FS_path fileLowPath, u32 openflags, u32 attributes); Result FSUSER_OpenFile(Handle* out, FS_archive archive, FS_path fileLowPath, u32 openflags, u32 attributes);

View File

@ -48,7 +48,7 @@ fsInit(void)
if (fsInitialised) return ret; if (fsInitialised) return ret;
if((ret=srvGetServiceHandle(&fsuHandle, "fs:USER"))!=0)return ret; if((ret=srvGetServiceHandle(&fsuHandle, "fs:USER"))!=0)return ret;
if(__get_handle_from_list("fs:USER")==0)ret=FSUSER_Initialize(); if(__get_handle_from_list("fs:USER")==0)ret=FSUSER_Initialize(fsuHandle);
fsInitialised = true; fsInitialised = true;
@ -82,6 +82,8 @@ Handle *fsGetSessionHandle(void)
* *
* @returns error * @returns error
* *
* @param[in] handle fs:USER service handle
*
* @internal * @internal
* *
* #### Request * #### Request
@ -99,19 +101,15 @@ Handle *fsGetSessionHandle(void)
* 1 | Result code * 1 | Result code
*/ */
Result Result
FSUSER_Initialize(void) FSUSER_Initialize(Handle handle)
{ {
// don't run command if we got handle from the list
if(fsuHandle != 0 && __get_handle_from_list("fs:USER")!=0)
return 0;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = 0x08010002; cmdbuf[0] = 0x08010002;
cmdbuf[1] = 0x20; cmdbuf[1] = 0x20;
Result ret = 0; Result ret = 0;
if((ret = svcSendSyncRequest(fsuHandle))) if((ret = svcSendSyncRequest(handle)))
return ret; return ret;
return cmdbuf[1]; return cmdbuf[1];