From be6cd3955a7d11c031314694a0caf6f4f8905ad4 Mon Sep 17 00:00:00 2001 From: HookedBehemoth Date: Sun, 23 Feb 2020 16:23:30 +0100 Subject: [PATCH] add warning to tc, cleanup --- nx/include/switch/services/tc.h | 5 +++-- nx/source/services/tc.c | 17 ++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/nx/include/switch/services/tc.h b/nx/include/switch/services/tc.h index 1ca1db0d..96fa4450 100644 --- a/nx/include/switch/services/tc.h +++ b/nx/include/switch/services/tc.h @@ -1,7 +1,7 @@ /** * @file tc.h * @brief Temperature control (tc) service IPC wrapper. - * @author yellows8 + * @author Behemoth * @copyright libnx Authors */ #pragma once @@ -18,8 +18,9 @@ void tcExit(void); Service* tcGetServiceSession(void); Result tcEnableFanControl(void); +/// @warning Disabling your fan can damage your system. Result tcDisableFanControl(void); Result tcIsFanControlEnabled(bool *status); -/// Only available on [5.0.0+] +/// Only available on [5.0.0+]. Result tcGetSkinTemperatureMilliC(s32 *skinTemp); diff --git a/nx/source/services/tc.c b/nx/source/services/tc.c index 06c34364..e5f7b497 100644 --- a/nx/source/services/tc.c +++ b/nx/source/services/tc.c @@ -33,12 +33,9 @@ Result tcDisableFanControl(void) { } Result tcIsFanControlEnabled(bool *status) { - struct { - u8 status; - } out; - - Result rc = serviceDispatchOut(&g_tcSrv, 8, out); - if (R_SUCCEEDED(rc)) *status = out.status; + u8 tmp=0; + Result rc = serviceDispatchOut(&g_tcSrv, 8, tmp); + if (R_SUCCEEDED(rc)) *status = tmp & 1; return rc; } @@ -46,11 +43,5 @@ Result tcGetSkinTemperatureMilliC(s32 *skinTemp) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - struct { - s32 skinTemp; - } out; - - Result rc = serviceDispatchOut(&g_tcSrv, 9, out); - if (R_SUCCEEDED(rc)) *skinTemp = out.skinTemp; - return rc; + return serviceDispatchOut(&g_tcSrv, 9, *skinTemp); }