mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	fixes
This commit is contained in:
		
							parent
							
								
									90965525ac
								
							
						
					
					
						commit
						bf93b94658
					
				
					 6 changed files with 148 additions and 148 deletions
				
			
		|  | @ -51,7 +51,7 @@ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config: | ||||||
| void Config::ReadValues() { | void Config::ReadValues() { | ||||||
|     qt_config->beginGroup("Controls"); |     qt_config->beginGroup("Controls"); | ||||||
| 
 | 
 | ||||||
|     Settings::values.profile = ReadSetting("profile", 0).toInt(); |     Settings::values.current_input_profile = ReadSetting("profile", 0).toInt(); | ||||||
| 
 | 
 | ||||||
|     const auto append_profile = [this] { |     const auto append_profile = [this] { | ||||||
|         Settings::InputProfile profile; |         Settings::InputProfile profile; | ||||||
|  | @ -95,22 +95,23 @@ void Config::ReadValues() { | ||||||
| 
 | 
 | ||||||
|     const int num_input_profiles = qt_config->beginReadArray("profiles"); |     const int num_input_profiles = qt_config->beginReadArray("profiles"); | ||||||
| 
 | 
 | ||||||
|     for (int i = 0; i < size; ++i) { |     for (int i = 0; i < num_input_profiles; ++i) { | ||||||
|         qt_config->setArrayIndex(i); |         qt_config->setArrayIndex(i); | ||||||
|         append_profile(); |         append_profile(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     qt_config->endArray(); |     qt_config->endArray(); | ||||||
| 
 | 
 | ||||||
|     if (Settings::values.profile <= size) { |     if (Settings::values.current_input_profile <= num_input_profiles) { | ||||||
|         Settings::values.profile = 0; |         Settings::values.current_input_profile = 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (size == 0) { |     // create a input profile if no input profiles exist, with the default or old settings
 | ||||||
|  |     if (num_input_profiles == 0) { | ||||||
|         append_profile(); |         append_profile(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Settings::LoadProfile(Settings::values.profile); |     Settings::LoadProfile(Settings::values.current_input_profile); | ||||||
| 
 | 
 | ||||||
|     qt_config->endArray(); |     qt_config->endArray(); | ||||||
| 
 | 
 | ||||||
|  | @ -281,7 +282,7 @@ void Config::ReadValues() { | ||||||
|     UISettings::values.game_dir_deprecated = ReadSetting("gameListRootDir", ".").toString(); |     UISettings::values.game_dir_deprecated = ReadSetting("gameListRootDir", ".").toString(); | ||||||
|     UISettings::values.game_dir_deprecated_deepscan = |     UISettings::values.game_dir_deprecated_deepscan = | ||||||
|         ReadSetting("gameListDeepScan", false).toBool(); |         ReadSetting("gameListDeepScan", false).toBool(); | ||||||
|     size = qt_config->beginReadArray("gamedirs"); |     int size = qt_config->beginReadArray("gamedirs"); | ||||||
|     for (int i = 0; i < size; ++i) { |     for (int i = 0; i < size; ++i) { | ||||||
|         qt_config->setArrayIndex(i); |         qt_config->setArrayIndex(i); | ||||||
|         UISettings::GameDir game_dir; |         UISettings::GameDir game_dir; | ||||||
|  | @ -376,10 +377,10 @@ void Config::ReadValues() { | ||||||
| 
 | 
 | ||||||
| void Config::SaveValues() { | void Config::SaveValues() { | ||||||
|     qt_config->beginGroup("Controls"); |     qt_config->beginGroup("Controls"); | ||||||
|     WriteSetting("profile", Settings::values.profile, 0); |     WriteSetting("profile", Settings::values.current_input_profile, 0); | ||||||
|     qt_config->beginWriteArray("profiles"); |     qt_config->beginWriteArray("profiles"); | ||||||
|     for (int p = 0; p < Settings::values.profiles.size(); ++p) { |     for (std::size_t p = 0; p < Settings::values.inprofiles.size(); ++p) { | ||||||
|         qt_config->setArrayIndex(p); |         qt_config->setArrayIndex(static_cast<int>(p)); | ||||||
|         const auto& profile = Settings::values.profiles[p]; |         const auto& profile = Settings::values.profiles[p]; | ||||||
|         for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { |         for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { | ||||||
|             std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); |             std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); | ||||||
|  |  | ||||||
|  | @ -104,17 +104,17 @@ ConfigureInput::ConfigureInput(QWidget* parent) | ||||||
|         ui->profile->addItem(QString::fromStdString(profile.name)); |         ui->profile->addItem(QString::fromStdString(profile.name)); | ||||||
|     } |     } | ||||||
|     ui->profile->addItem(QString::fromStdString(Settings::values.profiles[i].name)); |     ui->profile->addItem(QString::fromStdString(Settings::values.profiles[i].name)); | ||||||
|     } | } | ||||||
| 
 | 
 | ||||||
|     ui->profile->setCurrentIndex(Settings::values.profile); | ui->profile->setCurrentIndex(Settings::values.current_input_profile); | ||||||
| 
 | 
 | ||||||
|     button_map = { | button_map = { | ||||||
|     ui->buttonA,        ui->buttonB,        ui->buttonX,         ui->buttonY,  ui->buttonDpadUp, |     ui->buttonA,        ui->buttonB,        ui->buttonX,         ui->buttonY,  ui->buttonDpadUp, | ||||||
|     ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonL,  ui->buttonR, |     ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonL,  ui->buttonR, | ||||||
|     ui->buttonStart,    ui->buttonSelect,   ui->buttonZL,        ui->buttonZR, ui->buttonHome, |     ui->buttonStart,    ui->buttonSelect,   ui->buttonZL,        ui->buttonZR, ui->buttonHome, | ||||||
|     }; | }; | ||||||
| 
 | 
 | ||||||
|     analog_map_buttons = {{ | analog_map_buttons = {{ | ||||||
|     { |     { | ||||||
|         ui->buttonCircleUp, |         ui->buttonCircleUp, | ||||||
|         ui->buttonCircleDown, |         ui->buttonCircleDown, | ||||||
|  | @ -129,11 +129,11 @@ ConfigureInput::ConfigureInput(QWidget* parent) | ||||||
|         ui->buttonCStickRight, |         ui->buttonCStickRight, | ||||||
|         nullptr, |         nullptr, | ||||||
|     }, |     }, | ||||||
|     }}; | }}; | ||||||
| 
 | 
 | ||||||
|     analog_map_stick = {ui->buttonCircleAnalog, ui->buttonCStickAnalog}; | analog_map_stick = {ui->buttonCircleAnalog, ui->buttonCStickAnalog}; | ||||||
| 
 | 
 | ||||||
|     for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) { | for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) { | ||||||
|     if (!button_map[button_id]) |     if (!button_map[button_id]) | ||||||
|         continue; |         continue; | ||||||
|     button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu); |     button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu); | ||||||
|  | @ -165,14 +165,13 @@ ConfigureInput::ConfigureInput(QWidget* parent) | ||||||
|                 }); |                 }); | ||||||
|                 context_menu.exec(button_map[button_id]->mapToGlobal(menu_location)); |                 context_menu.exec(button_map[button_id]->mapToGlobal(menu_location)); | ||||||
|             }); |             }); | ||||||
|     } | } | ||||||
| 
 | 
 | ||||||
|     for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) { | for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) { | ||||||
|     for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) { |     for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) { | ||||||
|         if (!analog_map_buttons[analog_id][sub_button_id]) |         if (!analog_map_buttons[analog_id][sub_button_id]) | ||||||
|             continue; |             continue; | ||||||
|             analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy( |         analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy(Qt::CustomContextMenu); | ||||||
|                 Qt::CustomContextMenu); |  | ||||||
|         connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::released, [=]() { |         connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::released, [=]() { | ||||||
|             handleClick( |             handleClick( | ||||||
|                 analog_map_buttons[analog_id][sub_button_id], |                 analog_map_buttons[analog_id][sub_button_id], | ||||||
|  | @ -203,8 +202,8 @@ ConfigureInput::ConfigureInput(QWidget* parent) | ||||||
|                         applyConfiguration(); |                         applyConfiguration(); | ||||||
|                         Settings::SaveProfile(ui->profile->currentIndex()); |                         Settings::SaveProfile(ui->profile->currentIndex()); | ||||||
|                     }); |                     }); | ||||||
|                         context_menu.exec(analog_map_buttons[analog_id][sub_button_id]->mapToGlobal( |                     context_menu.exec( | ||||||
|                             menu_location)); |                         analog_map_buttons[analog_id][sub_button_id]->mapToGlobal(menu_location)); | ||||||
|                 }); |                 }); | ||||||
|     } |     } | ||||||
|     connect(analog_map_stick[analog_id], &QPushButton::released, [=]() { |     connect(analog_map_stick[analog_id], &QPushButton::released, [=]() { | ||||||
|  | @ -220,30 +219,30 @@ ConfigureInput::ConfigureInput(QWidget* parent) | ||||||
|             }, |             }, | ||||||
|             InputCommon::Polling::DeviceType::Analog); |             InputCommon::Polling::DeviceType::Analog); | ||||||
|     }); |     }); | ||||||
|     } | } | ||||||
| 
 | 
 | ||||||
|     connect(ui->buttonMotionTouch, &QPushButton::released, [this] { | connect(ui->buttonMotionTouch, &QPushButton::released, [this] { | ||||||
|     QDialog* motion_touch_dialog = new ConfigureMotionTouch(this); |     QDialog* motion_touch_dialog = new ConfigureMotionTouch(this); | ||||||
|     return motion_touch_dialog->exec(); |     return motion_touch_dialog->exec(); | ||||||
|     }); | }); | ||||||
|     connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); | connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); | ||||||
|     connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); }); | connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); }); | ||||||
|     connect(ui->buttonNew, &QPushButton::released, [this] { newProfile(); }); | connect(ui->buttonNew, &QPushButton::released, [this] { newProfile(); }); | ||||||
|     connect(ui->buttonDelete, &QPushButton::released, [this] { deleteProfile(); }); | connect(ui->buttonDelete, &QPushButton::released, [this] { deleteProfile(); }); | ||||||
|     connect(ui->buttonRename, &QPushButton::released, [this] { renameProfile(); }); | connect(ui->buttonRename, &QPushButton::released, [this] { renameProfile(); }); | ||||||
| 
 | 
 | ||||||
|     connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), | connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), | ||||||
|         [this](int i) { |         [this](int i) { | ||||||
|             applyConfiguration(); |             applyConfiguration(); | ||||||
|                 Settings::SaveProfile(Settings::values.profile); |             Settings::SaveProfile(Settings::values.current_input_profile); | ||||||
|             Settings::LoadProfile(i); |             Settings::LoadProfile(i); | ||||||
|             loadConfiguration(); |             loadConfiguration(); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|     timeout_timer->setSingleShot(true); | timeout_timer->setSingleShot(true); | ||||||
|     connect(timeout_timer.get(), &QTimer::timeout, [this]() { setPollingResult({}, true); }); | connect(timeout_timer.get(), &QTimer::timeout, [this]() { setPollingResult({}, true); }); | ||||||
| 
 | 
 | ||||||
|     connect(poll_timer.get(), &QTimer::timeout, [this]() { | connect(poll_timer.get(), &QTimer::timeout, [this]() { | ||||||
|     Common::ParamPackage params; |     Common::ParamPackage params; | ||||||
|     for (auto& poller : device_pollers) { |     for (auto& poller : device_pollers) { | ||||||
|         params = poller->GetNextInput(); |         params = poller->GetNextInput(); | ||||||
|  | @ -252,12 +251,12 @@ ConfigureInput::ConfigureInput(QWidget* parent) | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     }); | }); | ||||||
| 
 | 
 | ||||||
|     this->loadConfiguration(); | this->loadConfiguration(); | ||||||
| 
 | 
 | ||||||
|     // TODO(wwylele): enable this when we actually emulate it
 | // TODO(wwylele): enable this when we actually emulate it
 | ||||||
|     ui->buttonHome->setEnabled(false); | ui->buttonHome->setEnabled(false); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ConfigureInput::~ConfigureInput() = default; | ConfigureInput::~ConfigureInput() = default; | ||||||
|  | @ -270,7 +269,7 @@ void ConfigureInput::applyConfiguration() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfigureInput::applyProfile() { | void ConfigureInput::applyProfile() { | ||||||
|     Settings::values.profile = ui->profile->currentIndex(); |     Settings::values.current_input_profile = ui->profile->currentIndex(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfigureInput::loadConfiguration() { | void ConfigureInput::loadConfiguration() { | ||||||
|  | @ -400,7 +399,7 @@ void ConfigureInput::newProfile() { | ||||||
|     Settings::SaveProfile(ui->profile->currentIndex()); |     Settings::SaveProfile(ui->profile->currentIndex()); | ||||||
|     Settings::CreateProfile(name.toStdString()); |     Settings::CreateProfile(name.toStdString()); | ||||||
|     ui->profile->addItem(name); |     ui->profile->addItem(name); | ||||||
|     ui->profile->setCurrentIndex(Settings::values.profile); |     ui->profile->setCurrentIndex(Settings::values.current_input_profile); | ||||||
|     loadConfiguration(); |     loadConfiguration(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -270,7 +270,7 @@ void ConfigureMotionTouch::applyConfiguration() { | ||||||
|     Settings::values.udp_input_address = ui->udp_server->text().toStdString(); |     Settings::values.udp_input_address = ui->udp_server->text().toStdString(); | ||||||
|     Settings::values.udp_input_port = static_cast<u16>(ui->udp_port->text().toInt()); |     Settings::values.udp_input_port = static_cast<u16>(ui->udp_port->text().toInt()); | ||||||
|     Settings::values.udp_pad_index = static_cast<u8>(ui->udp_pad_index->currentIndex()); |     Settings::values.udp_pad_index = static_cast<u8>(ui->udp_pad_index->currentIndex()); | ||||||
|     Settings::SaveProfile(Settings::values.profile); |     Settings::SaveProfile(Settings::values.current_input_profile); | ||||||
|     InputCommon::ReloadInputDevices(); |     InputCommon::ReloadInputDevices(); | ||||||
| 
 | 
 | ||||||
|     accept(); |     accept(); | ||||||
|  |  | ||||||
|  | @ -1326,8 +1326,8 @@ void GMainWindow::OnConfigure() { | ||||||
|     connect(&configureDialog, &ConfigureDialog::languageChanged, this, |     connect(&configureDialog, &ConfigureDialog::languageChanged, this, | ||||||
|             &GMainWindow::OnLanguageChanged); |             &GMainWindow::OnLanguageChanged); | ||||||
|     auto old_theme = UISettings::values.theme; |     auto old_theme = UISettings::values.theme; | ||||||
|     const int old_profile = Settings::values.profile; |     const int old_input_profile = Settings::values.current_input_profile; | ||||||
|     const auto old_profiles = Settings::values.profiles; |     const auto old_input_profiles = Settings::values.input_profiles; | ||||||
|     const bool old_discord_presence = UISettings::values.enable_discord_presence; |     const bool old_discord_presence = UISettings::values.enable_discord_presence; | ||||||
|     auto result = configureDialog.exec(); |     auto result = configureDialog.exec(); | ||||||
|     if (result == QDialog::Accepted) { |     if (result == QDialog::Accepted) { | ||||||
|  | @ -1341,8 +1341,8 @@ void GMainWindow::OnConfigure() { | ||||||
|         game_list->RefreshGameDirectory(); |         game_list->RefreshGameDirectory(); | ||||||
|         config->Save(); |         config->Save(); | ||||||
|     } else { |     } else { | ||||||
|         Settings::values.profiles = old_profiles; |         Settings::values.input_profiles = old_input_profiles; | ||||||
|         Settings::LoadProfile(old_profile); |         Settings::LoadProfile(old_input_profile); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -102,7 +102,7 @@ void LogSettings() { | ||||||
| 
 | 
 | ||||||
| void LoadProfile(int index) { | void LoadProfile(int index) { | ||||||
|     const auto& profile = values.profiles[index]; |     const auto& profile = values.profiles[index]; | ||||||
|     values.profile = index; |     values.current_input_profile = index; | ||||||
|     values.analogs = profile.analogs; |     values.analogs = profile.analogs; | ||||||
|     values.buttons = profile.buttons; |     values.buttons = profile.buttons; | ||||||
|     values.motion_device = profile.motion_device; |     values.motion_device = profile.motion_device; | ||||||
|  | @ -134,8 +134,8 @@ void CreateProfile(std::string name) { | ||||||
|     profile.udp_input_port = values.udp_input_port; |     profile.udp_input_port = values.udp_input_port; | ||||||
|     profile.udp_pad_index = values.udp_pad_index; |     profile.udp_pad_index = values.udp_pad_index; | ||||||
|     values.profiles.push_back(std::move(profile)); |     values.profiles.push_back(std::move(profile)); | ||||||
|     values.profile = static_cast<int>(values.profiles.size()) - 1; |     values.current_input_profile = static_cast<int>(values.profiles.size()) - 1; | ||||||
|     LoadProfile(values.profile); |     LoadProfile(values.current_input_profile); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DeleteProfile(int index) { | void DeleteProfile(int index) { | ||||||
|  | @ -144,7 +144,7 @@ void DeleteProfile(int index) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void RenameCurrentProfile(std::string new_name) { | void RenameCurrentProfile(std::string new_name) { | ||||||
|     values.profiles[values.profile].name = std::move(new_name); |     values.profiles[values.current_input_profile].name = std::move(new_name); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } // namespace Settings
 | } // namespace Settings
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue