From 58835fae1a9de870477f9cc3afd0e0908f06dab4 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 10 Apr 2018 17:06:33 -0400 Subject: [PATCH] Use Service for AccountProfile. --- nx/include/switch/services/acc.h | 2 +- nx/source/services/acc.c | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/nx/include/switch/services/acc.h b/nx/include/switch/services/acc.h index 826f2cba..35480055 100644 --- a/nx/include/switch/services/acc.h +++ b/nx/include/switch/services/acc.h @@ -9,7 +9,7 @@ #include "sm.h" typedef struct { - Handle h; + Service s; } AccountProfile; typedef struct diff --git a/nx/source/services/acc.c b/nx/source/services/acc.c index 4db65dc1..8c5d04b8 100644 --- a/nx/source/services/acc.c +++ b/nx/source/services/acc.c @@ -104,7 +104,7 @@ Result accountGetProfile(AccountProfile* out, u128 userID) { rc = resp->result; if (R_SUCCEEDED(rc)) { - out->h = r.Handles[0]; + serviceCreate(&out->s, r.Handles[0]); } } @@ -127,7 +127,7 @@ Result accountProfileGet(AccountProfile* profile, AccountUserData* userdata, Acc raw->magic = SFCI_MAGIC; raw->cmd_id = userdata==NULL ? 1 : 0; - Result rc = ipcDispatch(profile->h); + Result rc = serviceIpcDispatch(&profile->s); if (R_SUCCEEDED(rc)) { IpcParsedCommand r; @@ -161,7 +161,7 @@ Result accountProfileGetImageSize(AccountProfile* profile, size_t* image_size) { raw->magic = SFCI_MAGIC; raw->cmd_id = 10; - Result rc = ipcDispatch(profile->h); + Result rc = serviceIpcDispatch(&profile->s); if (R_SUCCEEDED(rc)) { IpcParsedCommand r; @@ -198,7 +198,7 @@ Result accountProfileLoadImage(AccountProfile* profile, void* buf, size_t len, s raw->magic = SFCI_MAGIC; raw->cmd_id = 11; - Result rc = ipcDispatch(profile->h); + Result rc = serviceIpcDispatch(&profile->s); if (R_SUCCEEDED(rc)) { IpcParsedCommand r; @@ -221,9 +221,6 @@ Result accountProfileLoadImage(AccountProfile* profile, void* buf, size_t len, s } void accountProfileClose(AccountProfile* profile) { - if(profile->h != INVALID_HANDLE) { - svcCloseHandle(profile->h); - profile->h = INVALID_HANDLE; - } + serviceClose(&profile->s); }