mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 19:28:43 +12:00
[Qt/Input] Improve pad_settings_dialog a bit (#3611)
* Input: further work on remapping Xinput and begin work on remapping DS4 * Input: Improve pad_settings_dialog a bit and begin Remapping for XInput * Input: begin evdev remapping and change all handlers to use cfg::string * Input: finish work on remapping evdev and some more crap * Input: finish work on remapping Xinput and DS4 * Input: add DS4 Colors to DS4 config * Input: Improve DS4 deadzone scaling Jarves made some mistakes, so I'll fix them in the follow up commit * Input: fix Jarves fixes on DS4 deadzone and remove unnecessary usage of toUtf8 * Input: add primitive batterychecks to XInput and DS4 * Input: add mmjoystick remapping * Input: Fix evdev and some Vibration issues * Input: adjust capabilities to fix stick input for games like LoS 2 also fix threshold slider minimum also add ps button to all the handlers * Input: Further evdev work based on danilaml code review and own debugging: Fixed path issue, <= 0 issue, some captures, const, axis with same codes. Adds a map to each device that differentiates negative and positive axis mappings. adjusted rest of the file to tabs (ListDevices and beginning of threadProc) * Input: use 20ms vibration update time for xbox one elite controllers. * Input: Fix return type of Clamp() * Input: Evdev Fix * Input: Evdev Optional GetNextButtonPress presumably better than the other * Input: review changes * Input: evdev: fix wrong index in axis handling move bindpadtodevice down to keep consistency between handlers and not get crazy * Input: evdev: fix expensive add_device in GetNextButtonPress * cleanup * Input: mmjoy: fix type * Input: evdev: final fixes * Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4 * Input: add deadzone preview by passing necessary values in callback use 0.5 of max value for threshold in pad dialog * Input: get rid of all-uppercase variables
This commit is contained in:
parent
695b4c1f06
commit
662fe8cc95
33 changed files with 3573 additions and 1796 deletions
|
@ -5,53 +5,87 @@
|
|||
#include <mmsystem.h>
|
||||
#include "Utilities/Config.h"
|
||||
|
||||
struct mm_joystick_config final : cfg::node
|
||||
{
|
||||
const std::string cfg_name = fs::get_config_dir() + "/config_mmjoystick.yml";
|
||||
|
||||
//cfg::int32 left_stick_left{this, "Left Analog Stick Left", static_cast<int>('A')};
|
||||
//cfg::int32 left_stick_down{this, "Left Analog Stick Down", static_cast<int>('S')};
|
||||
//cfg::int32 left_stick_right{this, "Left Analog Stick Right", static_cast<int>('D')};
|
||||
//cfg::int32 left_stick_up{this, "Left Analog Stick Up", static_cast<int>('W')};
|
||||
//cfg::int32 right_stick_left{this, "Right Analog Stick Left", 313};
|
||||
//cfg::int32 right_stick_down{this, "Right Analog Stick Down", 367};
|
||||
//cfg::int32 right_stick_right{this, "Right Analog Stick Right", 312};
|
||||
//cfg::int32 right_stick_up{this, "Right Analog Stick Up", 366};
|
||||
cfg::int32 start{this, "Start", JOY_BUTTON9};
|
||||
cfg::int32 select{this, "Select", JOY_BUTTON10};
|
||||
cfg::int32 square{this, "Square", JOY_BUTTON4};
|
||||
cfg::int32 cross{this, "Cross", JOY_BUTTON3};
|
||||
cfg::int32 circle{this, "Circle", JOY_BUTTON2};
|
||||
cfg::int32 triangle{this, "Triangle", JOY_BUTTON1};
|
||||
//cfg::int32 left{this, "Left", 314};
|
||||
//cfg::int32 down{this, "Down", 317};
|
||||
//cfg::int32 right{this, "Right", 316};
|
||||
//cfg::int32 up{this, "Up", 315};
|
||||
cfg::int32 r1{this, "R1", JOY_BUTTON8};
|
||||
cfg::int32 r2{this, "R2", JOY_BUTTON6};
|
||||
cfg::int32 r3{this, "R3", JOY_BUTTON12};
|
||||
cfg::int32 l1{this, "L1", JOY_BUTTON7};
|
||||
cfg::int32 l2{this, "L2", JOY_BUTTON5};
|
||||
cfg::int32 l3{this, "L3", JOY_BUTTON11};
|
||||
|
||||
bool load()
|
||||
{
|
||||
if (fs::file cfg_file{ cfg_name, fs::read })
|
||||
{
|
||||
return from_string(cfg_file.to_string());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void save()
|
||||
{
|
||||
fs::file(cfg_name, fs::rewrite).write(to_string());
|
||||
}
|
||||
};
|
||||
|
||||
class mm_joystick_handler final : public PadHandlerBase
|
||||
{
|
||||
// Unique names for the config files and our pad settings dialog
|
||||
const std::unordered_map<u64, std::string> button_list =
|
||||
{
|
||||
{ JOY_BUTTON1 , "Button 1" },
|
||||
{ JOY_BUTTON2 , "Button 2" },
|
||||
{ JOY_BUTTON3 , "Button 3" },
|
||||
{ JOY_BUTTON4 , "Button 4" },
|
||||
{ JOY_BUTTON5 , "Button 5" },
|
||||
{ JOY_BUTTON6 , "Button 6" },
|
||||
{ JOY_BUTTON7 , "Button 7" },
|
||||
{ JOY_BUTTON8 , "Button 8" },
|
||||
{ JOY_BUTTON9 , "Button 9" },
|
||||
{ JOY_BUTTON10, "Button 10" },
|
||||
{ JOY_BUTTON11, "Button 11" },
|
||||
{ JOY_BUTTON12, "Button 12" },
|
||||
{ JOY_BUTTON13, "Button 13" },
|
||||
{ JOY_BUTTON14, "Button 14" },
|
||||
{ JOY_BUTTON15, "Button 15" },
|
||||
{ JOY_BUTTON16, "Button 16" },
|
||||
{ JOY_BUTTON17, "Button 17" },
|
||||
{ JOY_BUTTON18, "Button 18" },
|
||||
{ JOY_BUTTON19, "Button 19" },
|
||||
{ JOY_BUTTON20, "Button 20" },
|
||||
{ JOY_BUTTON21, "Button 21" },
|
||||
{ JOY_BUTTON22, "Button 22" },
|
||||
{ JOY_BUTTON23, "Button 23" },
|
||||
{ JOY_BUTTON24, "Button 24" },
|
||||
{ JOY_BUTTON25, "Button 25" },
|
||||
{ JOY_BUTTON26, "Button 26" },
|
||||
{ JOY_BUTTON27, "Button 27" },
|
||||
{ JOY_BUTTON28, "Button 28" },
|
||||
{ JOY_BUTTON29, "Button 29" },
|
||||
{ JOY_BUTTON30, "Button 30" },
|
||||
{ JOY_BUTTON31, "Button 31" },
|
||||
{ JOY_BUTTON32, "Button 32" },
|
||||
};
|
||||
|
||||
// Unique names for the config files and our pad settings dialog
|
||||
const std::unordered_map<u64, std::string> pov_list =
|
||||
{
|
||||
{ JOY_POVFORWARD, "POV Up" },
|
||||
{ JOY_POVRIGHT, "POV Right" },
|
||||
{ JOY_POVBACKWARD, "POV Down" },
|
||||
{ JOY_POVLEFT, "POV Left" },
|
||||
};
|
||||
|
||||
enum mmjoy_axis
|
||||
{
|
||||
joy_x_pos = 9700,
|
||||
joy_x_neg,
|
||||
joy_y_pos,
|
||||
joy_y_neg,
|
||||
joy_z_pos,
|
||||
joy_z_neg,
|
||||
joy_r_pos,
|
||||
joy_r_neg,
|
||||
joy_u_pos,
|
||||
joy_u_neg,
|
||||
joy_v_pos,
|
||||
joy_v_neg,
|
||||
};
|
||||
|
||||
// Unique names for the config files and our pad settings dialog
|
||||
const std::unordered_map<u64, std::string> axis_list =
|
||||
{
|
||||
{ joy_x_pos, "X+" },
|
||||
{ joy_x_neg, "X-" },
|
||||
{ joy_y_pos, "Y+" },
|
||||
{ joy_y_neg, "Y-" },
|
||||
{ joy_z_pos, "Z+" },
|
||||
{ joy_z_neg, "Z-" },
|
||||
{ joy_r_pos, "R+" },
|
||||
{ joy_r_neg, "R-" },
|
||||
{ joy_u_pos, "U+" },
|
||||
{ joy_u_neg, "U-" },
|
||||
{ joy_v_pos, "V+" },
|
||||
{ joy_v_neg, "V-" },
|
||||
};
|
||||
|
||||
public:
|
||||
mm_joystick_handler();
|
||||
~mm_joystick_handler();
|
||||
|
@ -61,14 +95,17 @@ public:
|
|||
std::vector<std::string> ListDevices() override;
|
||||
bool bindPadToDevice(std::shared_ptr<Pad> pad, const std::string& device) override;
|
||||
void ThreadProc() override;
|
||||
void GetNextButtonPress(const std::string& padId, const std::function<void(u16, std::string, int[])>& callback) override;
|
||||
|
||||
private:
|
||||
void TranslateButtonPress(u64 keyCode, bool& pressed, u16& val, bool ignore_threshold = false) override;
|
||||
std::unordered_map<u64, u16> GetButtonValues();
|
||||
|
||||
bool is_init;
|
||||
u32 supportedJoysticks;
|
||||
JOYINFOEX js_info;
|
||||
JOYCAPS js_caps;
|
||||
JOYINFOEX js_info;
|
||||
JOYCAPS js_caps;
|
||||
|
||||
std::vector<std::shared_ptr<Pad>> bindings;
|
||||
std::array<bool, 7> last_connection_status = {};
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue