mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Artic Base: Add Artic Controller support (#195)
This commit is contained in:
		
							parent
							
								
									9de19ff7a1
								
							
						
					
					
						commit
						55748d7d1a
					
				
					 24 changed files with 741 additions and 158 deletions
				
			
		|  | @ -327,6 +327,8 @@ void Config::ReadCameraValues() { | |||
| void Config::ReadControlValues() { | ||||
|     qt_config->beginGroup(QStringLiteral("Controls")); | ||||
| 
 | ||||
|     ReadBasicSetting(Settings::values.use_artic_base_controller); | ||||
| 
 | ||||
|     int num_touch_from_button_maps = | ||||
|         qt_config->beginReadArray(QStringLiteral("touch_from_button_maps")); | ||||
| 
 | ||||
|  | @ -924,6 +926,8 @@ void Config::SaveCameraValues() { | |||
| void Config::SaveControlValues() { | ||||
|     qt_config->beginGroup(QStringLiteral("Controls")); | ||||
| 
 | ||||
|     WriteBasicSetting(Settings::values.use_artic_base_controller); | ||||
| 
 | ||||
|     WriteSetting(QStringLiteral("profile"), Settings::values.current_input_profile_index, 0); | ||||
|     qt_config->beginWriteArray(QStringLiteral("profiles")); | ||||
|     for (std::size_t p = 0; p < Settings::values.input_profiles.size(); ++p) { | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Cor | |||
|       system{system_}, is_powered_on{system.IsPoweredOn()}, | ||||
|       general_tab{std::make_unique<ConfigureGeneral>(this)}, | ||||
|       system_tab{std::make_unique<ConfigureSystem>(system, this)}, | ||||
|       input_tab{std::make_unique<ConfigureInput>(this)}, | ||||
|       input_tab{std::make_unique<ConfigureInput>(system, this)}, | ||||
|       hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)}, | ||||
|       graphics_tab{ | ||||
|           std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this)}, | ||||
|  |  | |||
|  | @ -16,6 +16,7 @@ | |||
| #include "citra_qt/configuration/configure_input.h" | ||||
| #include "citra_qt/configuration/configure_motion_touch.h" | ||||
| #include "common/param_package.h" | ||||
| #include "core/core.h" | ||||
| #include "ui_configure_input.h" | ||||
| 
 | ||||
| const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM> | ||||
|  | @ -145,8 +146,8 @@ static QString AnalogToText(const Common::ParamPackage& param, const std::string | |||
|     return QObject::tr("[unknown]"); | ||||
| } | ||||
| 
 | ||||
| ConfigureInput::ConfigureInput(QWidget* parent) | ||||
|     : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()), | ||||
| ConfigureInput::ConfigureInput(Core::System& _system, QWidget* parent) | ||||
|     : QWidget(parent), system(_system), ui(std::make_unique<Ui::ConfigureInput>()), | ||||
|       timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) { | ||||
|     ui->setupUi(this); | ||||
|     setFocusPolicy(Qt::ClickFocus); | ||||
|  | @ -400,6 +401,9 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| ConfigureInput::~ConfigureInput() = default; | ||||
| 
 | ||||
| void ConfigureInput::ApplyConfiguration() { | ||||
| 
 | ||||
|     Settings::values.use_artic_base_controller = ui->use_artic_controller->isChecked(); | ||||
| 
 | ||||
|     std::transform(buttons_param.begin(), buttons_param.end(), | ||||
|                    Settings::values.current_input_profile.buttons.begin(), | ||||
|                    [](const Common::ParamPackage& param) { return param.Serialize(); }); | ||||
|  | @ -444,6 +448,10 @@ QList<QKeySequence> ConfigureInput::GetUsedKeyboardKeys() { | |||
| } | ||||
| 
 | ||||
| void ConfigureInput::LoadConfiguration() { | ||||
| 
 | ||||
|     ui->use_artic_controller->setChecked(Settings::values.use_artic_base_controller.GetValue()); | ||||
|     ui->use_artic_controller->setEnabled(!system.IsPoweredOn()); | ||||
| 
 | ||||
|     std::transform(Settings::values.current_input_profile.buttons.begin(), | ||||
|                    Settings::values.current_input_profile.buttons.end(), buttons_param.begin(), | ||||
|                    [](const std::string& str) { return Common::ParamPackage(str); }); | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ class ConfigureInput : public QWidget { | |||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit ConfigureInput(QWidget* parent = nullptr); | ||||
|     explicit ConfigureInput(Core::System& system, QWidget* parent = nullptr); | ||||
|     ~ConfigureInput() override; | ||||
| 
 | ||||
|     /// Save all button configurations to settings file
 | ||||
|  | @ -50,6 +50,7 @@ signals: | |||
|     void InputKeysChanged(QList<QKeySequence> new_key_list); | ||||
| 
 | ||||
| private: | ||||
|     Core::System& system; | ||||
|     std::unique_ptr<Ui::ConfigureInput> ui; | ||||
| 
 | ||||
|     std::unique_ptr<QTimer> timeout_timer; | ||||
|  |  | |||
|  | @ -841,6 +841,13 @@ | |||
|        </item> | ||||
|       </layout> | ||||
|      </item> | ||||
|      <item> | ||||
|        <widget class="QCheckBox" name="use_artic_controller"> | ||||
|          <property name="text"> | ||||
|            <string>Use Artic Controller when connected to Artic Base Server</string> | ||||
|          </property> | ||||
|        </widget> | ||||
|      </item> | ||||
|     </layout> | ||||
|    </item> | ||||
|   </layout> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue