add warning to tc, cleanup

This commit is contained in:
HookedBehemoth 2020-02-23 16:23:30 +01:00
parent 9c69fde167
commit be6cd3955a
2 changed files with 7 additions and 15 deletions

View File

@ -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);

View File

@ -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);
}