mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added fsExit and fsGetServiceSession. Check whether initialization was already done in fsInitialize, etc. Added fs to __appInit/__appExit.
This commit is contained in:
parent
6280e1ba58
commit
68dbb72b04
@ -26,6 +26,10 @@ typedef enum {
|
||||
#define FS_MAX_PATH 0x301
|
||||
|
||||
Result fsInitialize();
|
||||
void fsExit(void);
|
||||
|
||||
Handle fsGetServiceSession(void);
|
||||
|
||||
Result fsMountSdcard(FsFileSystem* out);
|
||||
// todo: Rest of commands here
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
// Copyright 2017 plutoo
|
||||
#include <switch.h>
|
||||
|
||||
static Handle g_fsHandle = -1;
|
||||
static Handle g_fsHandle = INVALID_HANDLE;
|
||||
|
||||
Result fsInitialize() {
|
||||
if(g_fsHandle != INVALID_HANDLE)return 0;
|
||||
Result rc = smGetService(&g_fsHandle, "fsp-srv");
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
@ -41,6 +42,16 @@ Result fsInitialize() {
|
||||
return rc;
|
||||
}
|
||||
|
||||
void fsExit(void) {
|
||||
if(g_fsHandle == INVALID_HANDLE)return;
|
||||
svcCloseHandle(g_fsHandle);
|
||||
g_fsHandle = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
Handle fsGetServiceSession(void) {
|
||||
return g_fsHandle;
|
||||
}
|
||||
|
||||
Result fsMountSdcard(FsFileSystem* out) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
@ -31,11 +31,13 @@ void __attribute__((weak)) __appInit(void)
|
||||
{
|
||||
// Initialize default services.
|
||||
smInitialize();
|
||||
fsInitialize();
|
||||
}
|
||||
|
||||
void __attribute__((weak)) __appExit(void)
|
||||
{
|
||||
// Cleanup default services.
|
||||
fsExit();
|
||||
smExit();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user