mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 18:45:36 +00:00
Added bindable key to hold for switching from looking to the sides to rolling
This commit is contained in:
parent
32edcd4301
commit
add437158b
@ -66,6 +66,7 @@ auto output_array = std::array{
|
|||||||
ControllerOutput(LEFTJOYSTICK_HALFMODE),
|
ControllerOutput(LEFTJOYSTICK_HALFMODE),
|
||||||
ControllerOutput(RIGHTJOYSTICK_HALFMODE),
|
ControllerOutput(RIGHTJOYSTICK_HALFMODE),
|
||||||
ControllerOutput(KEY_TOGGLE),
|
ControllerOutput(KEY_TOGGLE),
|
||||||
|
ControllerOutput(MOUSE_GYRO_ROLL_MODE),
|
||||||
|
|
||||||
// Button mappings
|
// Button mappings
|
||||||
ControllerOutput(SDL_GAMEPAD_BUTTON_NORTH), // Triangle
|
ControllerOutput(SDL_GAMEPAD_BUTTON_NORTH), // Triangle
|
||||||
@ -534,6 +535,9 @@ void ControllerOutput::FinalizeUpdate() {
|
|||||||
// to do it, and it would be inconvenient to force it here, when AddUpdate does the job just
|
// to do it, and it would be inconvenient to force it here, when AddUpdate does the job just
|
||||||
// fine, and a toggle doesn't have to checked against every input that's bound to it, it's
|
// fine, and a toggle doesn't have to checked against every input that's bound to it, it's
|
||||||
// enough that one is pressed
|
// enough that one is pressed
|
||||||
|
case MOUSE_GYRO_ROLL_MODE:
|
||||||
|
SetMouseGyroRollMode(new_button_state);
|
||||||
|
break;
|
||||||
default: // is a normal key (hopefully)
|
default: // is a normal key (hopefully)
|
||||||
controller->CheckButton(0, SDLGamepadToOrbisButton(button), new_button_state);
|
controller->CheckButton(0, SDLGamepadToOrbisButton(button), new_button_state);
|
||||||
break;
|
break;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#define BACK_BUTTON 0x00040000
|
#define BACK_BUTTON 0x00040000
|
||||||
|
|
||||||
#define KEY_TOGGLE 0x00200000
|
#define KEY_TOGGLE 0x00200000
|
||||||
|
#define MOUSE_GYRO_ROLL_MODE 0x00400000
|
||||||
|
|
||||||
#define SDL_UNMAPPED UINT32_MAX - 1
|
#define SDL_UNMAPPED UINT32_MAX - 1
|
||||||
|
|
||||||
@ -114,6 +115,7 @@ const std::map<std::string, u32> string_to_cbutton_map = {
|
|||||||
{"lpaddle_low", SDL_GAMEPAD_BUTTON_LEFT_PADDLE2},
|
{"lpaddle_low", SDL_GAMEPAD_BUTTON_LEFT_PADDLE2},
|
||||||
{"rpaddle_high", SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1},
|
{"rpaddle_high", SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1},
|
||||||
{"rpaddle_low", SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2},
|
{"rpaddle_low", SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2},
|
||||||
|
{"mouse_gyro_roll_mode", MOUSE_GYRO_ROLL_MODE},
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::map<std::string, AxisMapping> string_to_axis_map = {
|
const std::map<std::string, AxisMapping> string_to_axis_map = {
|
||||||
|
@ -14,6 +14,7 @@ namespace Input {
|
|||||||
|
|
||||||
int mouse_joystick_binding = 0;
|
int mouse_joystick_binding = 0;
|
||||||
float mouse_deadzone_offset = 0.5, mouse_speed = 1, mouse_speed_offset = 0.1250;
|
float mouse_deadzone_offset = 0.5, mouse_speed = 1, mouse_speed_offset = 0.1250;
|
||||||
|
bool mouse_gyro_roll_mode = false;
|
||||||
Uint32 mouse_polling_id = 0;
|
Uint32 mouse_polling_id = 0;
|
||||||
MouseMode mouse_mode = MouseMode::Off;
|
MouseMode mouse_mode = MouseMode::Off;
|
||||||
|
|
||||||
@ -38,6 +39,10 @@ void SetMouseParams(float mdo, float ms, float mso) {
|
|||||||
mouse_speed_offset = mso;
|
mouse_speed_offset = mso;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMouseGyroRollMode(bool mode) {
|
||||||
|
mouse_gyro_roll_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
void EmulateJoystick(GameController* controller, u32 interval) {
|
void EmulateJoystick(GameController* controller, u32 interval) {
|
||||||
|
|
||||||
Axis axis_x, axis_y;
|
Axis axis_x, axis_y;
|
||||||
@ -80,6 +85,10 @@ void EmulateGyro(GameController* controller, u32 interval) {
|
|||||||
SDL_GetRelativeMouseState(&d_x, &d_y);
|
SDL_GetRelativeMouseState(&d_x, &d_y);
|
||||||
controller->Acceleration(1, constant_down_accel);
|
controller->Acceleration(1, constant_down_accel);
|
||||||
float gyro_from_mouse[3] = {-d_y / 100, -d_x / 100, 0.0f};
|
float gyro_from_mouse[3] = {-d_y / 100, -d_x / 100, 0.0f};
|
||||||
|
if (mouse_gyro_roll_mode) {
|
||||||
|
gyro_from_mouse[1] = 0.0f;
|
||||||
|
gyro_from_mouse[2] = -d_x / 100;
|
||||||
|
}
|
||||||
controller->Gyro(1, gyro_from_mouse);
|
controller->Gyro(1, gyro_from_mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ enum MouseMode {
|
|||||||
bool ToggleMouseModeTo(MouseMode m);
|
bool ToggleMouseModeTo(MouseMode m);
|
||||||
void SetMouseToJoystick(int joystick);
|
void SetMouseToJoystick(int joystick);
|
||||||
void SetMouseParams(float mouse_deadzone_offset, float mouse_speed, float mouse_speed_offset);
|
void SetMouseParams(float mouse_deadzone_offset, float mouse_speed, float mouse_speed_offset);
|
||||||
|
void SetMouseGyroRollMode(bool mode);
|
||||||
|
|
||||||
void EmulateJoystick(GameController* controller, u32 interval);
|
void EmulateJoystick(GameController* controller, u32 interval);
|
||||||
void EmulateGyro(GameController* controller, u32 interval);
|
void EmulateGyro(GameController* controller, u32 interval);
|
||||||
|
Loading…
Reference in New Issue
Block a user