mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 10:32:15 +02:00
fix lbl
This commit is contained in:
parent
40eb93e96d
commit
ab3513c6ae
@ -8,6 +8,13 @@
|
|||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../sf/service.h"
|
#include "../sf/service.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LblBacklightSwitchStatus_Disabled = 0,
|
||||||
|
LblBacklightSwitchStatus_Enabled = 1,
|
||||||
|
LblBacklightSwitchStatus_Enabling = 2,
|
||||||
|
LblBacklightSwitchStatus_Disabling = 3
|
||||||
|
} LblBacklightSwitchStatus;
|
||||||
|
|
||||||
/// Initialize lbl.
|
/// Initialize lbl.
|
||||||
Result lblInitialize(void);
|
Result lblInitialize(void);
|
||||||
|
|
||||||
@ -31,7 +38,7 @@ Result lblGetBrightnessSettingAppliedToBacklight(float *out_value);
|
|||||||
|
|
||||||
Result lblSwitchBacklightOn(u64 fade_time);
|
Result lblSwitchBacklightOn(u64 fade_time);
|
||||||
Result lblSwitchBacklightOff(u64 fade_time);
|
Result lblSwitchBacklightOff(u64 fade_time);
|
||||||
Result lblGetBacklightSwitchStatus(bool *out_value);
|
Result lblGetBacklightSwitchStatus(LblBacklightSwitchStatus *out_value);
|
||||||
|
|
||||||
Result lblEnableDimming(void);
|
Result lblEnableDimming(void);
|
||||||
Result lblDisableDimming(void);
|
Result lblDisableDimming(void);
|
||||||
@ -44,10 +51,35 @@ Result lblIsAutoBrightnessControlEnabled(bool *out_value);
|
|||||||
Result lblSetAmbientLightSensorValue(float value);
|
Result lblSetAmbientLightSensorValue(float value);
|
||||||
Result lblGetAmbientLightSensorValue(bool *over_limit, float *lux);
|
Result lblGetAmbientLightSensorValue(bool *over_limit, float *lux);
|
||||||
|
|
||||||
/* Only available on [3.0.0+] */
|
/**
|
||||||
|
* @note Only available on [3.0.0+].
|
||||||
|
*/
|
||||||
Result lblIsAmbientLightSensorAvailable(bool *out_value);
|
Result lblIsAmbientLightSensorAvailable(bool *out_value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note Only available on [3.0.0+].
|
||||||
|
*/
|
||||||
Result lblSetCurrentBrightnessSettingForVrMode(float brightness);
|
Result lblSetCurrentBrightnessSettingForVrMode(float brightness);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note Only available on [3.0.0+].
|
||||||
|
*/
|
||||||
Result lblGetCurrentBrightnessSettingForVrMode(float *out_value);
|
Result lblGetCurrentBrightnessSettingForVrMode(float *out_value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note Only available on [3.0.0+].
|
||||||
|
* @note Used internally by am SetVrModeEnabled.
|
||||||
|
*/
|
||||||
Result lblEnableVrMode(void);
|
Result lblEnableVrMode(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note Only available on [3.0.0+].
|
||||||
|
* @note Used internally by am SetVrModeEnabled.
|
||||||
|
*/
|
||||||
Result lblDisableVrMode(void);
|
Result lblDisableVrMode(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note Only available on [3.0.0+].
|
||||||
|
* @note Used internally by am IsVrModeEnabled.
|
||||||
|
*/
|
||||||
Result lblIsVrModeEnabled(bool *out_value);
|
Result lblIsVrModeEnabled(bool *out_value);
|
||||||
|
@ -39,10 +39,7 @@ static Result _lblCmdNoInOutBool(bool *out, u32 cmd_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Result _lblCmdNoInOutFloat(float *out, u32 cmd_id) {
|
static Result _lblCmdNoInOutFloat(float *out, u32 cmd_id) {
|
||||||
float tmpout=0;
|
return serviceDispatchOut(&g_lblSrv, cmd_id, *out);
|
||||||
Result rc = serviceDispatchOut(&g_lblSrv, cmd_id, tmpout);
|
|
||||||
if (R_SUCCEEDED(rc) && out) *out = tmpout;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lblSaveCurrentSetting(void) {
|
Result lblSaveCurrentSetting(void) {
|
||||||
@ -77,11 +74,8 @@ Result lblSwitchBacklightOff(u64 fade_time) {
|
|||||||
return _lblCmdInU64NoOut(fade_time, 7);
|
return _lblCmdInU64NoOut(fade_time, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lblGetBacklightSwitchStatus(bool *out_value) {
|
Result lblGetBacklightSwitchStatus(LblBacklightSwitchStatus *out_value) {
|
||||||
u32 tmpout=0;
|
return serviceDispatchOut(&g_lblSrv, 8, *out_value);
|
||||||
Result rc = serviceDispatchOut(&g_lblSrv, 8, tmpout);
|
|
||||||
if (R_SUCCEEDED(rc) && out_value) *out_value = tmpout & 0xff;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result lblEnableDimming(void) {
|
Result lblEnableDimming(void) {
|
||||||
@ -96,7 +90,6 @@ Result lblIsDimmingEnabled(bool *out_value) {
|
|||||||
return _lblCmdNoInOutBool(out_value, 11);
|
return _lblCmdNoInOutBool(out_value, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result lblEnableAutoBrightnessControl(void) {
|
Result lblEnableAutoBrightnessControl(void) {
|
||||||
return _lblCmdNoIO(12);
|
return _lblCmdNoIO(12);
|
||||||
}
|
}
|
||||||
@ -121,7 +114,7 @@ Result lblGetAmbientLightSensorValue(bool *over_limit, float *lux) {
|
|||||||
|
|
||||||
Result rc = serviceDispatchOut(&g_lblSrv, 16, out);
|
Result rc = serviceDispatchOut(&g_lblSrv, 16, out);
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
if (over_limit) *over_limit = out.over_limit & 0xff;
|
if (over_limit) *over_limit = out.over_limit & 1;
|
||||||
if (lux) *lux = out.lux;
|
if (lux) *lux = out.lux;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -130,7 +123,7 @@ Result lblGetAmbientLightSensorValue(bool *over_limit, float *lux) {
|
|||||||
Result lblIsAmbientLightSensorAvailable(bool *out_value) {
|
Result lblIsAmbientLightSensorAvailable(bool *out_value) {
|
||||||
if (hosversionBefore(3,0,0))
|
if (hosversionBefore(3,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
return _lblCmdNoIO(23);
|
return _lblCmdNoInOutBool(out_value, 23);
|
||||||
}
|
}
|
||||||
Result lblSetCurrentBrightnessSettingForVrMode(float brightness) {
|
Result lblSetCurrentBrightnessSettingForVrMode(float brightness) {
|
||||||
if (hosversionBefore(3,0,0))
|
if (hosversionBefore(3,0,0))
|
||||||
|
Loading…
Reference in New Issue
Block a user