make pl:s accessible (#400)

This commit is contained in:
HookedBehemoth 2020-04-15 18:18:14 +02:00 committed by GitHub
parent 7e581f6110
commit a272fa75b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 5 deletions

View File

@ -8,6 +8,11 @@
#include "../types.h"
#include "../sf/service.h"
typedef enum {
PlServiceType_User = 0, ///< Initializes pl:u.
PlServiceType_System = 1, ///< Initializes pl:s.
} PlServiceType;
/// SharedFontType
typedef enum {
PlSharedFontType_Standard = 0, ///< Japan, US and Europe
@ -28,7 +33,7 @@ typedef struct {
} PlFontData;
/// Initialize pl.
Result plInitialize(void);
Result plInitialize(PlServiceType service_type);
/// Exit pl.
void plExit(void);

View File

@ -6,18 +6,27 @@
#define SHAREDMEMFONT_SIZE 0x1100000
static PlServiceType g_plServiceType;
static Service g_plSrv;
static SharedMemory g_plSharedmem;
static Result _plGetSharedMemoryNativeHandle(Handle* handle_out);
NX_GENERATE_SERVICE_GUARD(pl);
NX_GENERATE_SERVICE_GUARD_PARAMS(pl, (PlServiceType service_type), (service_type));
Result _plInitialize(void) {
Result rc=0;
Result _plInitialize(PlServiceType service_type) {
Result rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
Handle sharedmem_handle=0;
rc = smGetService(&g_plSrv, "pl:u");
g_plServiceType = service_type;
switch (g_plServiceType) {
case PlServiceType_User:
rc = smGetService(&g_plSrv, "pl:u");
break;
case PlServiceType_System:
rc = smGetService(&g_plSrv, "pl:s");
break;
}
if (R_SUCCEEDED(rc)) {
rc = _plGetSharedMemoryNativeHandle(&sharedmem_handle);