mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-12 20:55:56 +00:00
Controller Remapping GUI v2 (#3144)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / linux-qt-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / linux-qt-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
* Remapping GUI V2 - initial commit * Unmap button with escape key * Allow combination inputs * Use separate class for SDL event signals so that i can work with the SDL window event loop * Automatically pause game when GUI open to better manage event queue * Move sd;_gamepad_added event from remap object to GUI object to avoid conflicts with sdl window * Use signals on button/trigger to release to make GUI more responsive * pause game while KBM window is open for consistency * don't check gamepad when game is running to avoid conflicts * Block all other sdl events instead of pausing game, automatic parse inputs after saving * Don't block window restored or window exposed cases * Properly exit event loop thread on exit
This commit is contained in:
parent
09b584b23f
commit
fa32537f40
11 changed files with 1194 additions and 601 deletions
|
@ -1068,6 +1068,8 @@ set(QT_GUI src/qt_gui/about_dialog.cpp
|
||||||
src/qt_gui/gui_settings.h
|
src/qt_gui/gui_settings.h
|
||||||
src/qt_gui/settings.cpp
|
src/qt_gui/settings.cpp
|
||||||
src/qt_gui/settings.h
|
src/qt_gui/settings.h
|
||||||
|
src/qt_gui/sdl_event_wrapper.cpp
|
||||||
|
src/qt_gui/sdl_event_wrapper.h
|
||||||
${EMULATOR}
|
${EMULATOR}
|
||||||
${RESOURCE_FILES}
|
${RESOURCE_FILES}
|
||||||
${TRANSLATIONS}
|
${TRANSLATIONS}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,10 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_gamepad.h>
|
||||||
#include "game_info.h"
|
#include "game_info.h"
|
||||||
|
#include "sdl_event_wrapper.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ControlSettings;
|
class ControlSettings;
|
||||||
|
@ -11,22 +14,56 @@ class ControlSettings;
|
||||||
class ControlSettings : public QDialog {
|
class ControlSettings : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ControlSettings(std::shared_ptr<GameInfoClass> game_info_get,
|
explicit ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, bool GameRunning,
|
||||||
QWidget* parent = nullptr);
|
std::string GameRunningSerial, QWidget* parent = nullptr);
|
||||||
~ControlSettings();
|
~ControlSettings();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void PushGamepadEvent();
|
||||||
|
void AxisChanged();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void SaveControllerConfig(bool CloseOnSave);
|
void SaveControllerConfig(bool CloseOnSave);
|
||||||
void SetDefault();
|
void SetDefault();
|
||||||
void UpdateLightbarColor();
|
void UpdateLightbarColor();
|
||||||
|
void CheckMapping(QPushButton*& button);
|
||||||
|
void StartTimer(QPushButton*& button, bool isButton);
|
||||||
|
void ConnectAxisInputs(QPushButton*& button);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ControlSettings> ui;
|
std::unique_ptr<Ui::ControlSettings> ui;
|
||||||
std::shared_ptr<GameInfoClass> m_game_info;
|
std::shared_ptr<GameInfoClass> m_game_info;
|
||||||
|
|
||||||
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
void AddBoxItems();
|
void AddBoxItems();
|
||||||
void SetUIValuestoMappings();
|
void SetUIValuestoMappings();
|
||||||
void GetGameTitle();
|
void GetGameTitle();
|
||||||
|
void CheckGamePad();
|
||||||
|
void processSDLEvents(int Type, int Input, int Value);
|
||||||
|
void pollSDLEvents();
|
||||||
|
void SetMapping(QString input);
|
||||||
|
void DisableMappingButtons();
|
||||||
|
void EnableMappingButtons();
|
||||||
|
void Cleanup();
|
||||||
|
|
||||||
|
QList<QPushButton*> ButtonsList;
|
||||||
|
QList<QPushButton*> AxisList;
|
||||||
|
QSet<QString> pressedButtons;
|
||||||
|
|
||||||
|
std::string RunningGameSerial;
|
||||||
|
bool GameRunning;
|
||||||
|
bool L2Pressed = false;
|
||||||
|
bool R2Pressed = false;
|
||||||
|
bool EnableButtonMapping = false;
|
||||||
|
bool EnableAxisMapping = false;
|
||||||
|
bool MappingCompleted = false;
|
||||||
|
QString mapping;
|
||||||
|
int MappingTimer;
|
||||||
|
QTimer* timer;
|
||||||
|
QPushButton* MappingButton;
|
||||||
|
SDL_Gamepad* gamepad = nullptr;
|
||||||
|
SdlEventWrapper::Wrapper* RemapWrapper;
|
||||||
|
QFuture<void> Polling;
|
||||||
|
|
||||||
const std::vector<std::string> ControllerInputs = {
|
const std::vector<std::string> ControllerInputs = {
|
||||||
"cross", "circle", "square", "triangle", "l1",
|
"cross", "circle", "square", "triangle", "l1",
|
||||||
|
@ -39,29 +76,8 @@ private:
|
||||||
"pad_left", "pad_right", "axis_left_x", "axis_left_y", "axis_right_x",
|
"pad_left", "pad_right", "axis_left_x", "axis_left_y", "axis_right_x",
|
||||||
"axis_right_y", "back"};
|
"axis_right_y", "back"};
|
||||||
|
|
||||||
const QStringList ButtonOutputs = {"cross",
|
protected:
|
||||||
"circle",
|
void closeEvent(QCloseEvent* event) override {
|
||||||
"square",
|
Cleanup();
|
||||||
"triangle",
|
}
|
||||||
"l1",
|
|
||||||
"r1",
|
|
||||||
"l2",
|
|
||||||
"r2",
|
|
||||||
"l3",
|
|
||||||
|
|
||||||
"r3",
|
|
||||||
"options",
|
|
||||||
"pad_up",
|
|
||||||
|
|
||||||
"pad_down",
|
|
||||||
|
|
||||||
"pad_left",
|
|
||||||
"pad_right",
|
|
||||||
"touchpad_left",
|
|
||||||
"touchpad_center",
|
|
||||||
"touchpad_right",
|
|
||||||
"unmapped"};
|
|
||||||
|
|
||||||
const QStringList StickOutputs = {"axis_left_x", "axis_left_y", "axis_right_x", "axis_right_y",
|
|
||||||
"unmapped"};
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1043</width>
|
<width>1114</width>
|
||||||
<height>792</height>
|
<height>794</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -33,8 +33,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1019</width>
|
<width>1094</width>
|
||||||
<height>732</height>
|
<height>744</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
@ -42,8 +42,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1021</width>
|
<width>1091</width>
|
||||||
<height>731</height>
|
<height>741</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="RemapLayout">
|
<layout class="QHBoxLayout" name="RemapLayout">
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
<widget class="QGroupBox" name="gb_dpad_up">
|
<widget class="QGroupBox" name="gb_dpad_up">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -125,12 +125,9 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="DpadUpBox">
|
<widget class="QPushButton" name="DpadUpButton">
|
||||||
<property name="editable">
|
<property name="text">
|
||||||
<bool>false</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QComboBox::SizeAdjustPolicy::AdjustToContents</enum>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -161,7 +158,11 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="DpadLeftBox"/>
|
<widget class="QPushButton" name="DpadLeftButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -185,9 +186,9 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="DpadRightBox">
|
<widget class="QPushButton" name="DpadRightButton">
|
||||||
<property name="editable">
|
<property name="text">
|
||||||
<bool>false</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -213,6 +214,12 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_dpad_down">
|
<widget class="QGroupBox" name="gb_dpad_down">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>152</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>124</width>
|
||||||
|
@ -224,21 +231,9 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="DpadDownBox">
|
<widget class="QPushButton" name="DpadDownButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -378,7 +373,7 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -387,9 +382,9 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="LStickUpBox">
|
<widget class="QPushButton" name="LStickUpButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -420,9 +415,9 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="LStickLeftBox">
|
<widget class="QPushButton" name="LStickLeftButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -454,9 +449,9 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="LStickRightBox">
|
<widget class="QPushButton" name="LStickRightButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -484,7 +479,7 @@
|
||||||
<widget class="QGroupBox" name="gb_left_stick_down">
|
<widget class="QGroupBox" name="gb_left_stick_down">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -499,15 +494,9 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="LStickDownBox">
|
<widget class="QPushButton" name="LStickDownButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="frame">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -618,11 +607,21 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="layout_l1_l2">
|
<layout class="QVBoxLayout" name="layout_system_buttons">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_l1">
|
<widget class="QGroupBox" name="gb_l1">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>L1 / LB</string>
|
<string>L1</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="gb_l1_layout">
|
<layout class="QVBoxLayout" name="gb_l1_layout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -638,82 +637,41 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="LBBox"/>
|
<widget class="QPushButton" name="L1Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_l2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="title">
|
|
||||||
<string>L2 / LT</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="gb_l2_layout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="LTBox"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_system_buttons">
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Policy::Preferred</enum>
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>133</width>
|
||||||
<height>40</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Back</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="BackBox"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_r1_r2">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_r1">
|
<widget class="QGroupBox" name="gb_r1">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>R1 / RB</string>
|
<string>R1</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="gb_r1_layout">
|
<layout class="QVBoxLayout" name="gb_r1_layout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -729,7 +687,71 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RBBox"/>
|
<widget class="QPushButton" name="R1Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_l2">
|
||||||
|
<property name="title">
|
||||||
|
<string>L2</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="gb_l2_layout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="L2Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_start">
|
||||||
|
<property name="title">
|
||||||
|
<string>Options</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="gb_start_layout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="OptionsButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -737,7 +759,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_r2">
|
<widget class="QGroupBox" name="gb_r2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>R2 / RT</string>
|
<string>R2</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="gb_r2_layout">
|
<layout class="QVBoxLayout" name="gb_r2_layout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -753,7 +775,11 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RTBox"/>
|
<widget class="QPushButton" name="R2Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -762,6 +788,10 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_controller" native="true">
|
<widget class="QWidget" name="widget_controller" native="true">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
@ -806,15 +836,23 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_middle_bottom">
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
|
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_l3">
|
<widget class="QGroupBox" name="gb_l3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>L3</string>
|
<string>L3</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -832,37 +870,39 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="LClickBox"/>
|
<widget class="QPushButton" name="L3Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_start">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="title">
|
<property name="orientation">
|
||||||
<string>Options / Start</string>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="gb_start_layout">
|
<property name="sizeType">
|
||||||
<property name="leftMargin">
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
<number>5</number>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="sizeHint" stdset="0">
|
||||||
<number>5</number>
|
<size>
|
||||||
|
<width>133</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
</spacer>
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="StartBox"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_r3">
|
<widget class="QGroupBox" name="gb_r3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>R3</string>
|
<string>R3</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -880,13 +920,71 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RClickBox"/>
|
<widget class="QPushButton" name="R3Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_touchleft">
|
||||||
|
<property name="title">
|
||||||
|
<string>Touchpad Left</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="TouchpadLeftButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_touchcenter">
|
||||||
|
<property name="title">
|
||||||
|
<string>Touchpad Center</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="TouchpadCenterButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_touchright">
|
||||||
|
<property name="title">
|
||||||
|
<string>Touchpad Right</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="TouchpadRightButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
<item>
|
<item>
|
||||||
|
@ -1104,7 +1202,7 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1115,19 +1213,13 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Triangle / Y</string>
|
<string>Triangle</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="YBox">
|
<widget class="QPushButton" name="TriangleButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1142,7 +1234,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_square">
|
<widget class="QGroupBox" name="gb_square">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Square / X</string>
|
<string>Square</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="gb_square_layout">
|
<layout class="QVBoxLayout" name="gb_square_layout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -1158,7 +1250,11 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="XBox"/>
|
<widget class="QPushButton" name="SquareButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1166,7 +1262,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_circle">
|
<widget class="QGroupBox" name="gb_circle">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Circle / B</string>
|
<string>Circle</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="gb_circle_layout">
|
<layout class="QVBoxLayout" name="gb_circle_layout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -1182,7 +1278,11 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="BBox"/>
|
<widget class="QPushButton" name="CircleButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1208,7 +1308,7 @@
|
||||||
<widget class="QGroupBox" name="gb_cross">
|
<widget class="QGroupBox" name="gb_cross">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1219,11 +1319,15 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Cross / A</string>
|
<string>Cross</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="ABox"/>
|
<widget class="QPushButton" name="CrossButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1361,7 +1465,7 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>1231321</height>
|
<height>1231321</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1370,9 +1474,9 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RStickUpBox">
|
<widget class="QPushButton" name="RStickUpButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1403,9 +1507,9 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RStickLeftBox">
|
<widget class="QPushButton" name="RStickLeftButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1431,7 +1535,11 @@
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RStickRightBox"/>
|
<widget class="QPushButton" name="RStickRightButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>unmapped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1457,7 +1565,7 @@
|
||||||
<widget class="QGroupBox" name="gb_right_stick_down">
|
<widget class="QGroupBox" name="gb_right_stick_down">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>124</width>
|
<width>152</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1472,9 +1580,9 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="RStickDownBox">
|
<widget class="QPushButton" name="RStickDownButton">
|
||||||
<property name="enabled">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>unmapped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -7,16 +7,20 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <SDL3/SDL_events.h>
|
||||||
|
|
||||||
#include "common/path_util.h"
|
#include "common/path_util.h"
|
||||||
|
#include "input/input_handler.h"
|
||||||
#include "kbm_config_dialog.h"
|
#include "kbm_config_dialog.h"
|
||||||
#include "kbm_gui.h"
|
#include "kbm_gui.h"
|
||||||
#include "kbm_help_dialog.h"
|
#include "kbm_help_dialog.h"
|
||||||
#include "ui_kbm_gui.h"
|
#include "ui_kbm_gui.h"
|
||||||
|
|
||||||
HelpDialog* HelpWindow;
|
HelpDialog* HelpWindow;
|
||||||
KBMSettings::KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
KBMSettings::KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, bool isGameRunning,
|
||||||
: QDialog(parent), m_game_info(game_info_get), ui(new Ui::KBMSettings) {
|
std::string GameRunningSerial, QWidget* parent)
|
||||||
|
: QDialog(parent), m_game_info(game_info_get), GameRunning(isGameRunning),
|
||||||
|
RunningGameSerial(GameRunningSerial), ui(new Ui::KBMSettings) {
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->PerGameCheckBox->setChecked(!Config::GetUseUnifiedInputConfig());
|
ui->PerGameCheckBox->setChecked(!Config::GetUseUnifiedInputConfig());
|
||||||
|
@ -271,9 +275,17 @@ void KBMSettings::SaveKBMConfig(bool close_on_save) {
|
||||||
output_string = line.substr(0, equal_pos - 1);
|
output_string = line.substr(0, equal_pos - 1);
|
||||||
input_string = line.substr(equal_pos + 2);
|
input_string = line.substr(equal_pos + 2);
|
||||||
|
|
||||||
if (std::find(ControllerInputs.begin(), ControllerInputs.end(), input_string) !=
|
bool controllerInputdetected = false;
|
||||||
ControllerInputs.end() ||
|
for (std::string input : ControllerInputs) {
|
||||||
output_string == "analog_deadzone" || output_string == "override_controller_color") {
|
// Needed to avoid detecting backspace while detecting back
|
||||||
|
if (input_string.contains(input) && !input_string.contains("backspace")) {
|
||||||
|
controllerInputdetected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controllerInputdetected || output_string == "analog_deadzone" ||
|
||||||
|
output_string == "override_controller_color") {
|
||||||
lines.push_back(line);
|
lines.push_back(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +336,11 @@ QString(tr("Cannot bind any unique input more than once. Duplicate inputs mapped
|
||||||
Config::SetUseUnifiedInputConfig(!ui->PerGameCheckBox->isChecked());
|
Config::SetUseUnifiedInputConfig(!ui->PerGameCheckBox->isChecked());
|
||||||
Config::save(Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml");
|
Config::save(Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml");
|
||||||
|
|
||||||
|
if (GameRunning) {
|
||||||
|
Config::GetUseUnifiedInputConfig() ? Input::ParseInputConfig("default")
|
||||||
|
: Input::ParseInputConfig(RunningGameSerial);
|
||||||
|
}
|
||||||
|
|
||||||
if (close_on_save)
|
if (close_on_save)
|
||||||
QWidget::close();
|
QWidget::close();
|
||||||
}
|
}
|
||||||
|
@ -390,8 +407,16 @@ void KBMSettings::SetUIValuestoMappings(std::string config_id) {
|
||||||
std::string output_string = line.substr(0, equal_pos - 1);
|
std::string output_string = line.substr(0, equal_pos - 1);
|
||||||
std::string input_string = line.substr(equal_pos + 2);
|
std::string input_string = line.substr(equal_pos + 2);
|
||||||
|
|
||||||
if (std::find(ControllerInputs.begin(), ControllerInputs.end(), input_string) ==
|
bool controllerInputdetected = false;
|
||||||
ControllerInputs.end()) {
|
for (std::string input : ControllerInputs) {
|
||||||
|
// Needed to avoid detecting backspace while detecting back
|
||||||
|
if (input_string.contains(input) && !input_string.contains("backspace")) {
|
||||||
|
controllerInputdetected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!controllerInputdetected) {
|
||||||
if (output_string == "cross") {
|
if (output_string == "cross") {
|
||||||
ui->CrossButton->setText(QString::fromStdString(input_string));
|
ui->CrossButton->setText(QString::fromStdString(input_string));
|
||||||
} else if (output_string == "circle") {
|
} else if (output_string == "circle") {
|
||||||
|
@ -1000,7 +1025,6 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
if (event->type() == QEvent::KeyRelease || event->type() == QEvent::MouseButtonRelease)
|
if (event->type() == QEvent::KeyRelease || event->type() == QEvent::MouseButtonRelease)
|
||||||
emit PushKBMEvent();
|
emit PushKBMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,8 @@ class KBMSettings;
|
||||||
class KBMSettings : public QDialog {
|
class KBMSettings : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent = nullptr);
|
explicit KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, bool GameRunning,
|
||||||
|
std::string GameRunningSerial, QWidget* parent = nullptr);
|
||||||
~KBMSettings();
|
~KBMSettings();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -47,8 +48,11 @@ private:
|
||||||
void DisableMappingButtons();
|
void DisableMappingButtons();
|
||||||
void EnableMappingButtons();
|
void EnableMappingButtons();
|
||||||
void SetMapping(QString input);
|
void SetMapping(QString input);
|
||||||
|
void Cleanup();
|
||||||
|
|
||||||
|
std::string RunningGameSerial;
|
||||||
QSet<QString> pressedKeys;
|
QSet<QString> pressedKeys;
|
||||||
|
bool GameRunning;
|
||||||
bool EnableMapping = false;
|
bool EnableMapping = false;
|
||||||
bool MappingCompleted = false;
|
bool MappingCompleted = false;
|
||||||
bool HelpWindowOpen = false;
|
bool HelpWindowOpen = false;
|
||||||
|
|
|
@ -473,12 +473,13 @@ void MainWindow::CreateConnects() {
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->controllerButton, &QPushButton::clicked, this, [this]() {
|
connect(ui->controllerButton, &QPushButton::clicked, this, [this]() {
|
||||||
auto configWindow = new ControlSettings(m_game_info, this);
|
ControlSettings* remapWindow =
|
||||||
configWindow->exec();
|
new ControlSettings(m_game_info, isGameRunning, runningGameSerial, this);
|
||||||
|
remapWindow->exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->keyboardButton, &QPushButton::clicked, this, [this]() {
|
connect(ui->keyboardButton, &QPushButton::clicked, this, [this]() {
|
||||||
auto kbmWindow = new KBMSettings(m_game_info, this);
|
auto kbmWindow = new KBMSettings(m_game_info, isGameRunning, runningGameSerial, this);
|
||||||
kbmWindow->exec();
|
kbmWindow->exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -846,12 +847,14 @@ void MainWindow::StartGame() {
|
||||||
if (m_game_list_frame->currentItem()) {
|
if (m_game_list_frame->currentItem()) {
|
||||||
int itemID = m_game_list_frame->currentItem()->row();
|
int itemID = m_game_list_frame->currentItem()->row();
|
||||||
Common::FS::PathToQString(gamePath, m_game_info->m_games[itemID].path / "eboot.bin");
|
Common::FS::PathToQString(gamePath, m_game_info->m_games[itemID].path / "eboot.bin");
|
||||||
|
runningGameSerial = m_game_info->m_games[itemID].serial;
|
||||||
}
|
}
|
||||||
} else if (table_mode == 1) {
|
} else if (table_mode == 1) {
|
||||||
if (m_game_grid_frame->cellClicked) {
|
if (m_game_grid_frame->cellClicked) {
|
||||||
int itemID = (m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt) +
|
int itemID = (m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt) +
|
||||||
m_game_grid_frame->crtColumn;
|
m_game_grid_frame->crtColumn;
|
||||||
Common::FS::PathToQString(gamePath, m_game_info->m_games[itemID].path / "eboot.bin");
|
Common::FS::PathToQString(gamePath, m_game_info->m_games[itemID].path / "eboot.bin");
|
||||||
|
runningGameSerial = m_game_info->m_games[itemID].serial;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_elf_viewer->currentItem()) {
|
if (m_elf_viewer->currentItem()) {
|
||||||
|
|
|
@ -75,11 +75,13 @@ private:
|
||||||
void PlayBackgroundMusic();
|
void PlayBackgroundMusic();
|
||||||
QIcon RecolorIcon(const QIcon& icon, bool isWhite);
|
QIcon RecolorIcon(const QIcon& icon, bool isWhite);
|
||||||
void StartEmulator(std::filesystem::path);
|
void StartEmulator(std::filesystem::path);
|
||||||
|
|
||||||
bool isIconBlack = false;
|
bool isIconBlack = false;
|
||||||
bool isTableList = true;
|
bool isTableList = true;
|
||||||
bool isGameRunning = false;
|
bool isGameRunning = false;
|
||||||
bool isWhite = false;
|
bool isWhite = false;
|
||||||
bool is_paused = false;
|
bool is_paused = false;
|
||||||
|
std::string runningGameSerial = "";
|
||||||
|
|
||||||
QActionGroup* m_icon_size_act_group = nullptr;
|
QActionGroup* m_icon_size_act_group = nullptr;
|
||||||
QActionGroup* m_list_mode_act_group = nullptr;
|
QActionGroup* m_list_mode_act_group = nullptr;
|
||||||
|
|
47
src/qt_gui/sdl_event_wrapper.cpp
Normal file
47
src/qt_gui/sdl_event_wrapper.cpp
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "sdl_event_wrapper.h"
|
||||||
|
|
||||||
|
using namespace SdlEventWrapper;
|
||||||
|
|
||||||
|
Wrapper* Wrapper::WrapperInstance = nullptr;
|
||||||
|
bool Wrapper::wrapperActive = false;
|
||||||
|
|
||||||
|
Wrapper::Wrapper(QObject* parent) : QObject(parent) {}
|
||||||
|
|
||||||
|
Wrapper* Wrapper::GetInstance() {
|
||||||
|
if (WrapperInstance == nullptr) {
|
||||||
|
WrapperInstance = new Wrapper();
|
||||||
|
}
|
||||||
|
return WrapperInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Wrapper::ProcessEvent(SDL_Event* event) {
|
||||||
|
switch (event->type) {
|
||||||
|
case SDL_EVENT_WINDOW_RESTORED:
|
||||||
|
return false;
|
||||||
|
case SDL_EVENT_WINDOW_EXPOSED:
|
||||||
|
return false;
|
||||||
|
case SDL_EVENT_GAMEPAD_ADDED:
|
||||||
|
return false;
|
||||||
|
case SDL_EVENT_GAMEPAD_REMOVED:
|
||||||
|
return false;
|
||||||
|
case SDL_EVENT_QUIT:
|
||||||
|
emit SDLEvent(SDL_EVENT_QUIT, 0, 0);
|
||||||
|
return true;
|
||||||
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
|
emit SDLEvent(SDL_EVENT_GAMEPAD_BUTTON_DOWN, event->gbutton.button, 0);
|
||||||
|
return true;
|
||||||
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
|
emit SDLEvent(SDL_EVENT_GAMEPAD_BUTTON_UP, event->gbutton.button, 0);
|
||||||
|
return true;
|
||||||
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
|
emit SDLEvent(SDL_EVENT_GAMEPAD_AXIS_MOTION, event->gaxis.axis, event->gaxis.value);
|
||||||
|
return true;
|
||||||
|
// block all other SDL events while wrapper is active
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Wrapper::~Wrapper() {}
|
25
src/qt_gui/sdl_event_wrapper.h
Normal file
25
src/qt_gui/sdl_event_wrapper.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
#include <SDL3/SDL_events.h>
|
||||||
|
|
||||||
|
namespace SdlEventWrapper {
|
||||||
|
|
||||||
|
class Wrapper : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Wrapper(QObject* parent = nullptr);
|
||||||
|
~Wrapper();
|
||||||
|
bool ProcessEvent(SDL_Event* event);
|
||||||
|
static Wrapper* GetInstance();
|
||||||
|
static bool wrapperActive;
|
||||||
|
static Wrapper* WrapperInstance;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void SDLEvent(int Type, int Input, int Value);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace SdlEventWrapper
|
|
@ -20,6 +20,10 @@
|
||||||
#include "sdl_window.h"
|
#include "sdl_window.h"
|
||||||
#include "video_core/renderdoc.h"
|
#include "video_core/renderdoc.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_QT_GUI
|
||||||
|
#include "qt_gui/sdl_event_wrapper.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "SDL3/SDL_metal.h"
|
#include "SDL3/SDL_metal.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -340,6 +344,13 @@ void WindowSDL::WaitEvent() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_QT_GUI
|
||||||
|
if (SdlEventWrapper::Wrapper::wrapperActive) {
|
||||||
|
if (SdlEventWrapper::Wrapper::GetInstance()->ProcessEvent(&event))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ImGui::Core::ProcessEvent(&event)) {
|
if (ImGui::Core::ProcessEvent(&event)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue