diff options
Diffstat (limited to 'src/yuzu')
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/yuzu/applets/controller.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_filesystem.cpp | 10 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_filesystem.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_filesystem.ui | 35 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 106 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.h | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player_widget.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 10 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 8 | ||||
| -rw-r--r-- | src/yuzu/yuzu.qrc | 5 | 
13 files changed, 135 insertions, 70 deletions
| diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index fb9967c8f..b025ced1c 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -151,6 +151,7 @@ add_executable(yuzu      util/util.h      compatdb.cpp      compatdb.h +    yuzu.qrc      yuzu.rc  ) diff --git a/src/yuzu/applets/controller.cpp b/src/yuzu/applets/controller.cpp index c680fd2c2..b92cd6886 100644 --- a/src/yuzu/applets/controller.cpp +++ b/src/yuzu/applets/controller.cpp @@ -67,6 +67,8 @@ bool IsControllerCompatible(Settings::ControllerType controller_type,          return parameters.allow_right_joycon;      case Settings::ControllerType::Handheld:          return parameters.enable_single_mode && parameters.allow_handheld; +    case Settings::ControllerType::GameCube: +        return parameters.allow_gamecube_controller;      default:          return false;      } @@ -370,7 +372,7 @@ void QtControllerSelectorDialog::SetSupportedControllers() {              QStringLiteral("image: url(:/controller/applet_joycon_right%0_disabled); ").arg(theme));      } -    if (parameters.allow_pro_controller) { +    if (parameters.allow_pro_controller || parameters.allow_gamecube_controller) {          ui->controllerSupported5->setStyleSheet(              QStringLiteral("image: url(:/controller/applet_pro_controller%0); ").arg(theme));      } else { @@ -420,6 +422,10 @@ void QtControllerSelectorDialog::SetEmulatedControllers(std::size_t player_index                             Settings::ControllerType::Handheld);          emulated_controllers[player_index]->addItem(tr("Handheld"));      } + +    pairs.emplace_back(emulated_controllers[player_index]->count(), +                       Settings::ControllerType::GameCube); +    emulated_controllers[player_index]->addItem(tr("GameCube Controller"));  }  Settings::ControllerType QtControllerSelectorDialog::GetControllerTypeFromIndex( @@ -461,6 +467,7 @@ void QtControllerSelectorDialog::UpdateControllerIcon(std::size_t player_index)          switch (GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(),                                             player_index)) {          case Settings::ControllerType::ProController: +        case Settings::ControllerType::GameCube:              return QStringLiteral("image: url(:/controller/applet_pro_controller%0); ");          case Settings::ControllerType::DualJoyconDetached:              return QStringLiteral("image: url(:/controller/applet_dual_joycon%0); "); diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 0635d13d0..3d6f64300 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -614,12 +614,6 @@ void Config::ReadDataStorageValues() {                                  QString::fromStdString(FS::GetUserPath(FS::UserPath::DumpDir)))                          .toString()                          .toStdString()); -    FS::GetUserPath(FS::UserPath::CacheDir, -                    qt_config -                        ->value(QStringLiteral("cache_directory"), -                                QString::fromStdString(FS::GetUserPath(FS::UserPath::CacheDir))) -                        .toString() -                        .toStdString());      Settings::values.gamecard_inserted =          ReadSetting(QStringLiteral("gamecard_inserted"), false).toBool();      Settings::values.gamecard_current_game = @@ -1218,9 +1212,6 @@ void Config::SaveDataStorageValues() {      WriteSetting(QStringLiteral("dump_directory"),                   QString::fromStdString(FS::GetUserPath(FS::UserPath::DumpDir)),                   QString::fromStdString(FS::GetUserPath(FS::UserPath::DumpDir))); -    WriteSetting(QStringLiteral("cache_directory"), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::CacheDir)), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::CacheDir)));      WriteSetting(QStringLiteral("gamecard_inserted"), Settings::values.gamecard_inserted, false);      WriteSetting(QStringLiteral("gamecard_current_game"), Settings::values.gamecard_current_game,                   false); diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index 7ab4a80f7..bde2d4620 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp @@ -26,8 +26,6 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)              [this] { SetDirectory(DirectoryTarget::Dump, ui->dump_path_edit); });      connect(ui->load_path_button, &QToolButton::pressed, this,              [this] { SetDirectory(DirectoryTarget::Load, ui->load_path_edit); }); -    connect(ui->cache_directory_button, &QToolButton::pressed, this, -            [this] { SetDirectory(DirectoryTarget::Cache, ui->cache_directory_edit); });      connect(ui->reset_game_list_cache, &QPushButton::pressed, this,              &ConfigureFilesystem::ResetMetadata); @@ -50,8 +48,6 @@ void ConfigureFilesystem::setConfiguration() {          QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::DumpDir)));      ui->load_path_edit->setText(          QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::LoadDir))); -    ui->cache_directory_edit->setText( -        QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::CacheDir)));      ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted);      ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game); @@ -72,9 +68,6 @@ void ConfigureFilesystem::applyConfiguration() {                              ui->dump_path_edit->text().toStdString());      Common::FS::GetUserPath(Common::FS::UserPath::LoadDir,                              ui->load_path_edit->text().toStdString()); -    Common::FS::GetUserPath(Common::FS::UserPath::CacheDir, -                            ui->cache_directory_edit->text().toStdString()); -    Settings::values.gamecard_path = ui->gamecard_path_edit->text().toStdString();      Settings::values.gamecard_inserted = ui->gamecard_inserted->isChecked();      Settings::values.gamecard_current_game = ui->gamecard_current_game->isChecked(); @@ -103,9 +96,6 @@ void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit)      case DirectoryTarget::Load:          caption = tr("Select Mod Load Directory...");          break; -    case DirectoryTarget::Cache: -        caption = tr("Select Cache Directory..."); -        break;      }      QString str; diff --git a/src/yuzu/configuration/configure_filesystem.h b/src/yuzu/configuration/configure_filesystem.h index a79303760..2147cd405 100644 --- a/src/yuzu/configuration/configure_filesystem.h +++ b/src/yuzu/configuration/configure_filesystem.h @@ -32,7 +32,6 @@ private:          Gamecard,          Dump,          Load, -        Cache,      };      void SetDirectory(DirectoryTarget target, QLineEdit* edit); diff --git a/src/yuzu/configuration/configure_filesystem.ui b/src/yuzu/configuration/configure_filesystem.ui index 84bea0600..62b9abc7a 100644 --- a/src/yuzu/configuration/configure_filesystem.ui +++ b/src/yuzu/configuration/configure_filesystem.ui @@ -198,40 +198,7 @@          <string>Caching</string>         </property>         <layout class="QGridLayout" name="gridLayout_5"> -        <item row="0" column="0"> -         <widget class="QLabel" name="label_10"> -          <property name="text"> -           <string>Cache Directory</string> -          </property> -         </widget> -        </item> -        <item row="0" column="1"> -         <spacer name="horizontalSpacer_3"> -          <property name="orientation"> -           <enum>Qt::Horizontal</enum> -          </property> -          <property name="sizeType"> -           <enum>QSizePolicy::Fixed</enum> -          </property> -          <property name="sizeHint" stdset="0"> -           <size> -            <width>40</width> -            <height>20</height> -           </size> -          </property> -         </spacer> -        </item> -        <item row="0" column="2"> -         <widget class="QLineEdit" name="cache_directory_edit"/> -        </item> -        <item row="0" column="3"> -         <widget class="QToolButton" name="cache_directory_button"> -          <property name="text"> -           <string>...</string> -          </property> -         </widget> -        </item> -        <item row="1" column="0" colspan="4"> +        <item row="0" column="0" colspan="2">           <layout class="QHBoxLayout" name="horizontalLayout_2">            <item>             <widget class="QCheckBox" name="cache_game_list"> diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index c9d19c948..21d0d3449 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -467,10 +467,14 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i      UpdateControllerIcon();      UpdateControllerAvailableButtons(); +    UpdateControllerEnabledButtons(); +    UpdateControllerButtonNames();      UpdateMotionButtons();      connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) {          UpdateControllerIcon();          UpdateControllerAvailableButtons(); +        UpdateControllerEnabledButtons(); +        UpdateControllerButtonNames();          UpdateMotionButtons();      }); @@ -558,9 +562,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i              &ConfigureInputPlayer::SaveProfile);      LoadConfiguration(); - -    // TODO(wwylele): enable this when we actually emulate it -    ui->buttonHome->setEnabled(false);      ui->controllerFrame->SetPlayerInput(player_index, buttons_param, analogs_param);      ui->controllerFrame->SetConnectedStatus(ui->groupConnectedController->isChecked());  } @@ -924,6 +925,12 @@ void ConfigureInputPlayer::SetConnectableControllers() {                                                       Settings::ControllerType::Handheld);              ui->comboControllerType->addItem(tr("Handheld"));          } + +        if (enable_all || npad_style_set.gamecube == 1) { +            index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), +                                                     Settings::ControllerType::GameCube); +            ui->comboControllerType->addItem(tr("GameCube Controller")); +        }      };      Core::System& system{Core::System::GetInstance()}; @@ -1014,7 +1021,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {      // List of all the widgets that will be hidden by any of the following layouts that need      // "unhidden" after the controller type changes -    const std::array<QWidget*, 9> layout_show = { +    const std::array<QWidget*, 11> layout_show = {          ui->buttonShoulderButtonsSLSR,          ui->horizontalSpacerShoulderButtonsWidget,          ui->horizontalSpacerShoulderButtonsWidget2, @@ -1024,6 +1031,8 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {          ui->buttonShoulderButtonsRight,          ui->buttonMiscButtonsPlusHome,          ui->bottomRight, +        ui->buttonMiscButtonsMinusGroup, +        ui->buttonMiscButtonsScreenshotGroup,      };      for (auto* widget : layout_show) { @@ -1056,6 +1065,14 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {              ui->bottomLeft,          };          break; +    case Settings::ControllerType::GameCube: +        layout_hidden = { +            ui->buttonShoulderButtonsSLSR, +            ui->horizontalSpacerShoulderButtonsWidget2, +            ui->buttonMiscButtonsMinusGroup, +            ui->buttonMiscButtonsScreenshotGroup, +        }; +        break;      }      for (auto* widget : layout_hidden) { @@ -1063,6 +1080,52 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {      }  } +void ConfigureInputPlayer::UpdateControllerEnabledButtons() { +    auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); +    if (debug) { +        layout = Settings::ControllerType::ProController; +    } + +    // List of all the widgets that will be disabled by any of the following layouts that need +    // "enabled" after the controller type changes +    const std::array<QWidget*, 4> layout_enable = { +        ui->buttonHome, +        ui->buttonLStickPressedGroup, +        ui->groupRStickPressed, +        ui->buttonShoulderButtonsButtonLGroup, +    }; + +    for (auto* widget : layout_enable) { +        widget->setEnabled(true); +    } + +    std::vector<QWidget*> layout_disable; +    switch (layout) { +    case Settings::ControllerType::ProController: +    case Settings::ControllerType::DualJoyconDetached: +    case Settings::ControllerType::Handheld: +    case Settings::ControllerType::LeftJoycon: +    case Settings::ControllerType::RightJoycon: +        // TODO(wwylele): enable this when we actually emulate it +        layout_disable = { +            ui->buttonHome, +        }; +        break; +    case Settings::ControllerType::GameCube: +        layout_disable = { +            ui->buttonHome, +            ui->buttonLStickPressedGroup, +            ui->groupRStickPressed, +            ui->buttonShoulderButtonsButtonLGroup, +        }; +        break; +    } + +    for (auto* widget : layout_disable) { +        widget->setEnabled(false); +    } +} +  void ConfigureInputPlayer::UpdateMotionButtons() {      if (debug) {          // Motion isn't used with the debug controller, hide both groupboxes. @@ -1085,6 +1148,11 @@ void ConfigureInputPlayer::UpdateMotionButtons() {          ui->buttonMotionLeftGroup->hide();          ui->buttonMotionRightGroup->show();          break; +    case Settings::ControllerType::GameCube: +        // Hide both "Motion 1/2". +        ui->buttonMotionLeftGroup->hide(); +        ui->buttonMotionRightGroup->hide(); +        break;      case Settings::ControllerType::DualJoyconDetached:      default:          // Show both "Motion 1/2". @@ -1094,6 +1162,36 @@ void ConfigureInputPlayer::UpdateMotionButtons() {      }  } +void ConfigureInputPlayer::UpdateControllerButtonNames() { +    auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); +    if (debug) { +        layout = Settings::ControllerType::ProController; +    } + +    switch (layout) { +    case Settings::ControllerType::ProController: +    case Settings::ControllerType::DualJoyconDetached: +    case Settings::ControllerType::Handheld: +    case Settings::ControllerType::LeftJoycon: +    case Settings::ControllerType::RightJoycon: +        ui->buttonMiscButtonsPlusGroup->setTitle(tr("Plus")); +        ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("ZL")); +        ui->buttonShoulderButtonsZRGroup->setTitle(tr("ZR")); +        ui->buttonShoulderButtonsRGroup->setTitle(tr("R")); +        ui->LStick->setTitle(tr("Left Stick")); +        ui->RStick->setTitle(tr("Right Stick")); +        break; +    case Settings::ControllerType::GameCube: +        ui->buttonMiscButtonsPlusGroup->setTitle(tr("Start / Pause")); +        ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("L")); +        ui->buttonShoulderButtonsZRGroup->setTitle(tr("R")); +        ui->buttonShoulderButtonsRGroup->setTitle(tr("Z")); +        ui->LStick->setTitle(tr("Control Stick")); +        ui->RStick->setTitle(tr("C-Stick")); +        break; +    } +} +  void ConfigureInputPlayer::UpdateMappingWithDefaults() {      if (ui->comboDevices->currentIndex() == 0) {          return; diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index da2b89136..efe953fbc 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h @@ -143,9 +143,15 @@ private:      /// Hides and disables controller settings based on the current controller type.      void UpdateControllerAvailableButtons(); +    /// Disables controller settings based on the current controller type. +    void UpdateControllerEnabledButtons(); +      /// Shows or hides motion groupboxes based on the current controller type.      void UpdateMotionButtons(); +    /// Alters the button names based on the current controller type. +    void UpdateControllerButtonNames(); +      /// Gets the default controller mapping for this device and auto configures the input to match.      void UpdateMappingWithDefaults(); diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index 0e8a964d2..61ba91cef 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp @@ -227,6 +227,9 @@ void PlayerControlPreview::paintEvent(QPaintEvent* event) {      case Settings::ControllerType::RightJoycon:          DrawRightController(p, center);          break; +    case Settings::ControllerType::GameCube: +        DrawGCController(p, center); +        break;      case Settings::ControllerType::ProController:      default:          DrawProController(p, center); diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index 85724a8f3..2731d948d 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp @@ -42,7 +42,7 @@ void ControllerDialog::refreshConfiguration() {  QAction* ControllerDialog::toggleViewAction() {      if (toggle_view_action == nullptr) { -        toggle_view_action = new QAction(windowTitle(), this); +        toggle_view_action = new QAction(tr("&Controller P1"), this);          toggle_view_action->setCheckable(true);          toggle_view_action->setChecked(isVisible());          connect(toggle_view_action, &QAction::toggled, this, &ControllerDialog::setVisible); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 28a52a56c..0ba7c07cc 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2770,7 +2770,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {                      .arg(errors));          } -        QProgressDialog prog; +        QProgressDialog prog(this);          prog.setRange(0, 0);          prog.setLabelText(tr("Deriving keys...\nThis may take up to a minute depending \non your "                               "system's performance.")); @@ -2952,7 +2952,7 @@ void GMainWindow::filterBarSetChecked(bool state) {  }  void GMainWindow::UpdateUITheme() { -    const QString default_icons = QStringLiteral(":/icons/default"); +    const QString default_icons = QStringLiteral("default");      const QString& current_theme = UISettings::values.theme;      const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second);      QStringList theme_paths(default_theme_paths); @@ -2968,7 +2968,6 @@ void GMainWindow::UpdateUITheme() {              qApp->setStyleSheet({});              setStyleSheet({});          } -        theme_paths.append(default_icons);          QIcon::setThemeName(default_icons);      } else {          const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss")); @@ -2980,10 +2979,7 @@ void GMainWindow::UpdateUITheme() {          } else {              LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");          } - -        const QString theme_name = QStringLiteral(":/icons/") + current_theme; -        theme_paths.append({default_icons, theme_name}); -        QIcon::setThemeName(theme_name); +        QIcon::setThemeName(current_theme);      }      QIcon::setThemeSearchPaths(theme_paths); diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index e2ad5baf6..048870687 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -14,8 +14,8 @@     <string>yuzu</string>    </property>    <property name="windowIcon"> -   <iconset> -    <normaloff>../dist/yuzu.ico</normaloff>../dist/yuzu.ico</iconset> +   <iconset resource="yuzu.qrc"> +    <normaloff>:/img/yuzu.ico</normaloff>:/img/yuzu.ico</iconset>    </property>    <property name="tabShape">     <enum>QTabWidget::Rounded</enum> @@ -303,6 +303,8 @@     </property>    </action>   </widget> - <resources/> + <resources> +  <include location="yuzu.qrc"/> + </resources>   <connections/>  </ui> diff --git a/src/yuzu/yuzu.qrc b/src/yuzu/yuzu.qrc new file mode 100644 index 000000000..5733cac98 --- /dev/null +++ b/src/yuzu/yuzu.qrc @@ -0,0 +1,5 @@ +<RCC> +    <qresource prefix="/img"> +        <file alias="yuzu.ico">../../dist/yuzu.ico</file> +    </qresource> +</RCC> | 
