mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-12-02 22:39:14 +00:00
Added BeginPermitVibrationSession and EndPermitVibrationSession
Used by Mario Party
This commit is contained in:
parent
3d75c9cd7a
commit
9e924f2ef2
3 changed files with 26 additions and 2 deletions
|
@ -316,6 +316,9 @@ void Controller_NPad::SetNpadMode(u32 npad_id, NPadAssignments assignment_mode)
|
||||||
|
|
||||||
void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids,
|
void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids,
|
||||||
const std::vector<Vibration>& vibrations) {
|
const std::vector<Vibration>& vibrations) {
|
||||||
|
if (!can_controllers_vibrate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (std::size_t i = 0; i < controller_ids.size(); i++) {
|
for (std::size_t i = 0; i < controller_ids.size(); i++) {
|
||||||
if (i >= controller_count) {
|
if (i >= controller_count) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -386,4 +389,7 @@ Controller_NPad::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) {
|
||||||
return LedPattern{0, 0, 0, 0};
|
return LedPattern{0, 0, 0, 0};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
void Controller_NPad::SetVibrationEnabled(bool can_vibrate) {
|
||||||
|
can_controllers_vibrate = can_vibrate;
|
||||||
|
}
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
|
@ -111,6 +111,7 @@ public:
|
||||||
void ConnectNPad(u32 npad_id);
|
void ConnectNPad(u32 npad_id);
|
||||||
void DisconnectNPad(u32 npad_id);
|
void DisconnectNPad(u32 npad_id);
|
||||||
LedPattern GetLedPattern(u32 npad_id);
|
LedPattern GetLedPattern(u32 npad_id);
|
||||||
|
void SetVibrationEnabled(bool can_vibrate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CommonHeader {
|
struct CommonHeader {
|
||||||
|
@ -275,6 +276,7 @@ private:
|
||||||
std::size_t controller_count{};
|
std::size_t controller_count{};
|
||||||
static constexpr std::array<u32, 10> npad_id_list{0, 1, 2, 3, 4, 5, 6, 7, 32, 16};
|
static constexpr std::array<u32, 10> npad_id_list{0, 1, 2, 3, 4, 5, 6, 7, 32, 16};
|
||||||
std::array<ControllerHolder, 10> connected_controllers{};
|
std::array<ControllerHolder, 10> connected_controllers{};
|
||||||
|
bool can_controllers_vibrate{true};
|
||||||
|
|
||||||
void InitNewlyAddedControler(std::size_t controller_idx);
|
void InitNewlyAddedControler(std::size_t controller_idx);
|
||||||
};
|
};
|
||||||
|
|
|
@ -240,8 +240,8 @@ public:
|
||||||
{206, &Hid::SendVibrationValues, "SendVibrationValues"},
|
{206, &Hid::SendVibrationValues, "SendVibrationValues"},
|
||||||
{207, nullptr, "SendVibrationGcErmCommand"},
|
{207, nullptr, "SendVibrationGcErmCommand"},
|
||||||
{208, nullptr, "GetActualVibrationGcErmCommand"},
|
{208, nullptr, "GetActualVibrationGcErmCommand"},
|
||||||
{209, nullptr, "BeginPermitVibrationSession"},
|
{209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
|
||||||
{210, nullptr, "EndPermitVibrationSession"},
|
{210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"},
|
||||||
{300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
|
{300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
|
||||||
{301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
|
{301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
|
||||||
{302, nullptr, "StopConsoleSixAxisSensor"},
|
{302, nullptr, "StopConsoleSixAxisSensor"},
|
||||||
|
@ -457,6 +457,22 @@ private:
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called");
|
LOG_WARNING(Service_HID, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BeginPermitVibrationSession(Kernel::HLERequestContext& ctx) {
|
||||||
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
|
.SetVibrationEnabled(true);
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
LOG_DEBUG(Service_HID, "called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void EndPermitVibrationSession(Kernel::HLERequestContext& ctx) {
|
||||||
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
|
.SetVibrationEnabled(false);
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
LOG_DEBUG(Service_HID, "called");
|
||||||
|
}
|
||||||
|
|
||||||
void SendVibrationValue(Kernel::HLERequestContext& ctx) {
|
void SendVibrationValue(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto controller_id = rp.PopRaw<u32>();
|
const auto controller_id = rp.PopRaw<u32>();
|
||||||
|
|
Loading…
Reference in a new issue