mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-08 20:58:41 +00:00
Block normal mouse inputs in mouse-to-touchpad mode
shadow sniped my PR. :(
This commit is contained in:
@@ -777,6 +777,9 @@ void ActivateOutputsFromInputs() {
|
||||
it.ResetUpdate();
|
||||
}
|
||||
|
||||
// Check for input blockers
|
||||
ApplyMouseInputBlockers();
|
||||
|
||||
// Iterate over all inputs, and update their respecive outputs accordingly
|
||||
for (auto& it : connections) {
|
||||
it.output->AddUpdate(it.ProcessBinding());
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "common/assert.h"
|
||||
#include "common/types.h"
|
||||
#include "input/controller.h"
|
||||
#include "input/input_handler.h"
|
||||
#include "input_mouse.h"
|
||||
|
||||
#include <common/singleton.h>
|
||||
@@ -16,6 +17,8 @@ extern Frontend::WindowSDL* g_window;
|
||||
|
||||
namespace Input {
|
||||
|
||||
extern std::list<std::pair<InputEvent, bool>> pressed_keys;
|
||||
|
||||
int mouse_joystick_binding = 0;
|
||||
float mouse_deadzone_offset = 0.5, mouse_speed = 1, mouse_speed_offset = 0.1250;
|
||||
bool mouse_gyro_roll_mode = false;
|
||||
@@ -105,6 +108,22 @@ void EmulateTouchpad(GameController* controller, u32 interval) {
|
||||
(mouse_buttons & SDL_BUTTON_RMASK) != 0);
|
||||
}
|
||||
|
||||
void ApplyMouseInputBlockers() {
|
||||
switch (mouse_mode) {
|
||||
case MouseMode::Touchpad:
|
||||
LOG_INFO(Input, "Blocking mouse inputs");
|
||||
for (auto& k : pressed_keys) {
|
||||
if (k.first.input.sdl_id == SDL_BUTTON_LEFT ||
|
||||
k.first.input.sdl_id == SDL_BUTTON_RIGHT) {
|
||||
k.second = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 MousePolling(void* param, Uint32 id, Uint32 interval) {
|
||||
auto* controller = (GameController*)param;
|
||||
switch (mouse_mode) {
|
||||
|
||||
@@ -23,6 +23,8 @@ void SetMouseGyroRollMode(bool mode);
|
||||
void EmulateJoystick(GameController* controller, u32 interval);
|
||||
void EmulateGyro(GameController* controller, u32 interval);
|
||||
|
||||
void ApplyMouseInputBlockers();
|
||||
|
||||
// Polls the mouse for changes
|
||||
Uint32 MousePolling(void* param, Uint32 id, Uint32 interval);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user