2018-07-27 17:48:33 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2018-07-27 18:01:17 +00:00
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/kernel/hle_ipc.h"
|
2018-07-27 17:48:33 +00:00
|
|
|
#include "core/hle/service/lbl/lbl.h"
|
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
#include "core/hle/service/sm/sm.h"
|
|
|
|
|
|
|
|
namespace Service::LBL {
|
|
|
|
|
|
|
|
class LBL final : public ServiceFramework<LBL> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} {
|
2018-07-27 17:48:33 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
2018-10-21 20:15:29 +00:00
|
|
|
{0, nullptr, "SaveCurrentSetting"},
|
|
|
|
{1, nullptr, "LoadCurrentSetting"},
|
|
|
|
{2, nullptr, "SetCurrentBrightnessSetting"},
|
|
|
|
{3, nullptr, "GetCurrentBrightnessSetting"},
|
|
|
|
{4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"},
|
|
|
|
{5, nullptr, "GetBrightnessSettingAppliedToBacklight"},
|
|
|
|
{6, nullptr, "SwitchBacklightOn"},
|
|
|
|
{7, nullptr, "SwitchBacklightOff"},
|
|
|
|
{8, nullptr, "GetBacklightSwitchStatus"},
|
|
|
|
{9, nullptr, "EnableDimming"},
|
|
|
|
{10, nullptr, "DisableDimming"},
|
|
|
|
{11, nullptr, "IsDimmingEnabled"},
|
|
|
|
{12, nullptr, "EnableAutoBrightnessControl"},
|
|
|
|
{13, nullptr, "DisableAutoBrightnessControl"},
|
|
|
|
{14, nullptr, "IsAutoBrightnessControlEnabled"},
|
|
|
|
{15, nullptr, "SetAmbientLightSensorValue"},
|
|
|
|
{16, nullptr, "GetAmbientLightSensorValue"},
|
|
|
|
{17, nullptr, "SetBrightnessReflectionDelayLevel"},
|
|
|
|
{18, nullptr, "GetBrightnessReflectionDelayLevel"},
|
|
|
|
{19, nullptr, "SetCurrentBrightnessMapping"},
|
|
|
|
{20, nullptr, "GetCurrentBrightnessMapping"},
|
|
|
|
{21, nullptr, "SetCurrentAmbientLightSensorMapping"},
|
|
|
|
{22, nullptr, "GetCurrentAmbientLightSensorMapping"},
|
|
|
|
{23, nullptr, "IsAmbientLightSensorAvailable"},
|
|
|
|
{24, nullptr, "SetCurrentBrightnessSettingForVrMode"},
|
|
|
|
{25, nullptr, "GetCurrentBrightnessSettingForVrMode"},
|
2018-07-27 18:01:17 +00:00
|
|
|
{26, &LBL::EnableVrMode, "EnableVrMode"},
|
|
|
|
{27, &LBL::DisableVrMode, "DisableVrMode"},
|
2018-10-21 20:15:29 +00:00
|
|
|
{28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"},
|
2020-06-27 10:43:33 +00:00
|
|
|
{29, nullptr, "IsAutoBrightnessControlSupported"},
|
2018-07-27 17:48:33 +00:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
2018-07-27 18:01:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void EnableVrMode(Kernel::HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_LBL, "called");
|
|
|
|
|
2018-07-27 18:01:17 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
vr_mode_enabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DisableVrMode(Kernel::HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_LBL, "called");
|
|
|
|
|
2018-07-27 18:01:17 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
vr_mode_enabled = false;
|
|
|
|
}
|
|
|
|
|
2018-10-21 20:15:29 +00:00
|
|
|
void IsVrModeEnabled(Kernel::HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_LBL, "called");
|
|
|
|
|
2018-07-27 18:01:17 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(vr_mode_enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool vr_mode_enabled = false;
|
2018-07-27 17:48:33 +00:00
|
|
|
};
|
|
|
|
|
2020-11-26 20:19:08 +00:00
|
|
|
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
|
|
|
std::make_shared<LBL>(system)->InstallAsService(sm);
|
2018-07-27 17:48:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Service::LBL
|