2018-07-27 13:48:33 -04: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 14:01:17 -04:00
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/kernel/hle_ipc.h"
|
2018-07-27 13:48:33 -04: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:
|
|
|
|
explicit LBL() : ServiceFramework{"lbl"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "Unknown1"},
|
|
|
|
{1, nullptr, "Unknown2"},
|
|
|
|
{2, nullptr, "Unknown3"},
|
2018-10-02 21:15:56 -04:00
|
|
|
{3, nullptr, "GetCurrentBacklightLevel"},
|
|
|
|
{4, nullptr, "Unknown4"},
|
|
|
|
{5, nullptr, "GetAlsComputedBacklightLevel"},
|
2018-07-27 13:48:33 -04:00
|
|
|
{6, nullptr, "TurnOffBacklight"},
|
|
|
|
{7, nullptr, "TurnOnBacklight"},
|
|
|
|
{8, nullptr, "GetBacklightStatus"},
|
2018-10-02 21:15:56 -04:00
|
|
|
{9, nullptr, "Unknown5"},
|
|
|
|
{10, nullptr, "Unknown6"},
|
|
|
|
{11, nullptr, "Unknown7"},
|
|
|
|
{12, nullptr, "Unknown8"},
|
|
|
|
{13, nullptr, "Unknown9"},
|
|
|
|
{14, nullptr, "Unknown10"},
|
|
|
|
{15, nullptr, "GetAutoBrightnessSetting"},
|
2018-07-27 13:48:33 -04:00
|
|
|
{16, nullptr, "ReadRawLightSensor"},
|
2018-10-02 21:15:56 -04:00
|
|
|
{17, nullptr, "Unknown11"},
|
|
|
|
{18, nullptr, "Unknown12"},
|
|
|
|
{19, nullptr, "Unknown13"},
|
|
|
|
{20, nullptr, "Unknown14"},
|
|
|
|
{21, nullptr, "Unknown15"},
|
|
|
|
{22, nullptr, "Unknown16"},
|
|
|
|
{23, nullptr, "Unknown17"},
|
|
|
|
{24, nullptr, "Unknown18"},
|
|
|
|
{25, nullptr, "Unknown19"},
|
2018-07-27 14:01:17 -04:00
|
|
|
{26, &LBL::EnableVrMode, "EnableVrMode"},
|
|
|
|
{27, &LBL::DisableVrMode, "DisableVrMode"},
|
|
|
|
{28, &LBL::GetVrMode, "GetVrMode"},
|
2018-07-27 13:48:33 -04:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
2018-07-27 14:01:17 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void EnableVrMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
vr_mode_enabled = true;
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_LBL, "called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void DisableVrMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
vr_mode_enabled = false;
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_LBL, "called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetVrMode(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(vr_mode_enabled);
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_LBL, "called");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool vr_mode_enabled = false;
|
2018-07-27 13:48:33 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
void InstallInterfaces(SM::ServiceManager& sm) {
|
|
|
|
std::make_shared<LBL>()->InstallAsService(sm);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Service::LBL
|