diff options
Diffstat (limited to 'src/yuzu')
| -rw-r--r-- | src/yuzu/about_dialog.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.ui | 12 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_dialog.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 91 | ||||
| -rw-r--r-- | src/yuzu/debugger/registers.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/game_list.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/game_list_p.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 13 | ||||
| -rw-r--r-- | src/yuzu/util/spinbox.cpp | 2 | 
11 files changed, 80 insertions, 55 deletions
| diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp index 0f1b6cdc6..da3429822 100644 --- a/src/yuzu/about_dialog.cpp +++ b/src/yuzu/about_dialog.cpp @@ -9,7 +9,7 @@  AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {      ui->setupUi(this);      ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg( -Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc)); +        Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));  }  AboutDialog::~AboutDialog() {} diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 923a7c53f..6a40f035c 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -18,10 +18,10 @@ Config::Config() {  }  const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = { -    Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q, Qt::Key_W, -    Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T, Qt::Key_H, Qt::Key_G, -    Qt::Key_Left, Qt::Key_Up, Qt::Key_Right, Qt::Key_Down, Qt::Key_J, Qt::Key_I, Qt::Key_L, -    Qt::Key_K, Qt::Key_D, Qt::Key_C, Qt::Key_B, Qt::Key_V, +    Qt::Key_A, Qt::Key_S, Qt::Key_Z,    Qt::Key_X,  Qt::Key_3,     Qt::Key_4,    Qt::Key_Q, +    Qt::Key_W, Qt::Key_1, Qt::Key_2,    Qt::Key_N,  Qt::Key_M,     Qt::Key_F,    Qt::Key_T, +    Qt::Key_H, Qt::Key_G, Qt::Key_Left, Qt::Key_Up, Qt::Key_Right, Qt::Key_Down, Qt::Key_J, +    Qt::Key_I, Qt::Key_L, Qt::Key_K,    Qt::Key_D,  Qt::Key_C,     Qt::Key_B,    Qt::Key_V,  };  const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{ diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 9eb71c593..a45edd510 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp @@ -6,7 +6,6 @@  #include "ui_configure_debug.h"  #include "yuzu/configuration/configure_debug.h" -  ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {      ui->setupUi(this);      this->setConfiguration(); diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 96638ebdb..a10bea2f4 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui @@ -13,24 +13,24 @@    <property name="windowTitle">     <string>Form</string>    </property> -  <layout class="QVBoxLayout" name="verticalLayout"> +  <layout class="QVBoxLayout" name="verticalLayout_1">     <item> -    <layout class="QVBoxLayout" name="verticalLayout_3"> +    <layout class="QVBoxLayout" name="verticalLayout_2">       <item>        <widget class="QGroupBox" name="groupBox">         <property name="title">          <string>GDB</string>         </property> -       <layout class="QVBoxLayout" name="verticalLayout_2"> +       <layout class="QVBoxLayout" name="verticalLayout_3">          <item> -         <widget class="QLabel"> +         <widget class="QLabel" name="label_1">            <property name="text">             <string>The GDB Stub only works correctly when the CPU JIT is off.</string>            </property>           </widget>          </item>          <item> -         <layout class="QHBoxLayout" name="horizontalLayout_3"> +         <layout class="QHBoxLayout" name="horizontalLayout_1">            <item>             <widget class="QCheckBox" name="toggle_gdbstub">              <property name="text"> @@ -52,7 +52,7 @@             </spacer>            </item>            <item> -           <widget class="QLabel" name="label"> +           <widget class="QLabel" name="label_2">              <property name="text">               <string>Port:</string>              </property> diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 23e5687d0..358f33005 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -7,7 +7,6 @@  #include "yuzu/configuration/config.h"  #include "yuzu/configuration/configure_dialog.h" -  ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) {      ui->setupUi(this);      this->setConfiguration(); diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index cd7520f29..10043e6e8 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp @@ -42,6 +42,52 @@ static void SetAnalogButton(const Common::ParamPackage& input_param,      analog_param.Set(button_name, input_param.Serialize());  } +static QString ButtonToText(const Common::ParamPackage& param) { +    if (!param.Has("engine")) { +        return QObject::tr("[not set]"); +    } else if (param.Get("engine", "") == "keyboard") { +        return getKeyName(param.Get("code", 0)); +    } else if (param.Get("engine", "") == "sdl") { +        QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str()); +        if (param.Has("hat")) { +            text += QString(QObject::tr(" Hat %1 %2")) +                        .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str()); +        } +        if (param.Has("axis")) { +            text += QString(QObject::tr(" Axis %1%2")) +                        .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str()); +        } +        if (param.Has("button")) { +            text += QString(QObject::tr(" Button %1")).arg(param.Get("button", "").c_str()); +        } +        return text; +    } else { +        return QObject::tr("[unknown]"); +    } +}; + +static QString AnalogToText(const Common::ParamPackage& param, const std::string& dir) { +    if (!param.Has("engine")) { +        return QObject::tr("[not set]"); +    } else if (param.Get("engine", "") == "analog_from_button") { +        return ButtonToText(Common::ParamPackage{param.Get(dir, "")}); +    } else if (param.Get("engine", "") == "sdl") { +        if (dir == "modifier") { +            return QString(QObject::tr("[unused]")); +        } + +        QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str()); +        if (dir == "left" || dir == "right") { +            text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_x", "").c_str()); +        } else if (dir == "up" || dir == "down") { +            text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_y", "").c_str()); +        } +        return text; +    } else { +        return QObject::tr("[unknown]"); +    } +}; +  ConfigureInput::ConfigureInput(QWidget* parent)      : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),        timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) { @@ -50,13 +96,13 @@ ConfigureInput::ConfigureInput(QWidget* parent)      setFocusPolicy(Qt::ClickFocus);      button_map = { -        ui->buttonA,          ui->buttonB,         ui->buttonX,           ui->buttonY, -        ui->buttonLStick,     ui->buttonRStick,    ui->buttonL,           ui->buttonR, -        ui->buttonZL,         ui->buttonZR,        ui->buttonPlus,        ui->buttonMinus, -        ui->buttonDpadLeft,   ui->buttonDpadUp,    ui->buttonDpadRight,   ui->buttonDpadDown, -        ui->buttonLStickLeft, ui->buttonLStickUp,  ui->buttonLStickRight, ui->buttonLStickDown, -        ui->buttonRStickLeft, ui->buttonRStickUp,  ui->buttonRStickRight, ui->buttonRStickDown, -        ui->buttonSL,         ui->buttonSR,        ui->buttonHome,        ui->buttonScreenshot, +        ui->buttonA,          ui->buttonB,        ui->buttonX,           ui->buttonY, +        ui->buttonLStick,     ui->buttonRStick,   ui->buttonL,           ui->buttonR, +        ui->buttonZL,         ui->buttonZR,       ui->buttonPlus,        ui->buttonMinus, +        ui->buttonDpadLeft,   ui->buttonDpadUp,   ui->buttonDpadRight,   ui->buttonDpadDown, +        ui->buttonLStickLeft, ui->buttonLStickUp, ui->buttonLStickRight, ui->buttonLStickDown, +        ui->buttonRStickLeft, ui->buttonRStickUp, ui->buttonRStickRight, ui->buttonRStickDown, +        ui->buttonSL,         ui->buttonSR,       ui->buttonHome,        ui->buttonScreenshot,      };      analog_map_buttons = {{ @@ -166,37 +212,18 @@ void ConfigureInput::restoreDefaults() {  }  void ConfigureInput::updateButtonLabels() { -    QString non_keyboard(tr("[non-keyboard]")); - -    auto KeyToText = [&non_keyboard](const Common::ParamPackage& param) { -        if (!param.Has("engine")) { -            return QString("[not set]"); -        } else if (param.Get("engine", "") != "keyboard") { -            return non_keyboard; -        } else { -            return getKeyName(param.Get("code", 0)); -        } -    }; -      for (int button = 0; button < Settings::NativeButton::NumButtons; button++) { -        button_map[button]->setText(KeyToText(buttons_param[button])); +        button_map[button]->setText(ButtonToText(buttons_param[button]));      }      for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) { -        if (analogs_param[analog_id].Get("engine", "") != "analog_from_button") { -            for (QPushButton* button : analog_map_buttons[analog_id]) { -                if (button) -                    button->setText(non_keyboard); -            } -        } else { -            for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) { -                Common::ParamPackage param( -                    analogs_param[analog_id].Get(analog_sub_buttons[sub_button_id], "")); -                if (analog_map_buttons[analog_id][sub_button_id]) -                    analog_map_buttons[analog_id][sub_button_id]->setText(KeyToText(param)); +        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]) { +                analog_map_buttons[analog_id][sub_button_id]->setText( +                    AnalogToText(analogs_param[analog_id], analog_sub_buttons[sub_button_id]));              }          } -        analog_map_stick[analog_id]->setText("Set Analog Stick"); +        analog_map_stick[analog_id]->setText(tr("Set Analog Stick"));      }  } diff --git a/src/yuzu/debugger/registers.cpp b/src/yuzu/debugger/registers.cpp index a52725075..06e2d1647 100644 --- a/src/yuzu/debugger/registers.cpp +++ b/src/yuzu/debugger/registers.cpp @@ -8,7 +8,6 @@  #include "yuzu/debugger/registers.h"  #include "yuzu/util/util.h" -  RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) {      cpu_regs_ui.setupUi(this); diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 532c4ae63..679c89828 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -174,7 +174,7 @@ void GameList::onTextChanged(const QString& newText) {                  child_file->data(GameListItemPath::ProgramIdRole).toString().toLower();              // Only items which filename in combination with its title contains all words -            // that are in the searchfiel will be visible in the gamelist +            // that are in the searchfield will be visible in the gamelist              // The search is case insensitive because of toLower()              // I decided not to use Qt::CaseInsensitive in containsAllWords to prevent              // multiple conversions of edit_filter_text for each game in the gamelist diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index e40cd38b3..a758b77aa 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -9,8 +9,8 @@  #include <QRunnable>  #include <QStandardItem>  #include <QString> -#include "yuzu/util/util.h"  #include "common/string_util.h" +#include "yuzu/util/util.h"  /**   * Gets the default icon (for games without valid SMDH) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 7c711158a..31f2825ee 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -122,8 +122,9 @@ void GMainWindow::InitializeWidgets() {      statusBar()->addPermanentWidget(message_label, 1);      emu_speed_label = new QLabel(); -    emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% " -                                   "indicate emulation is running faster or slower than a Switch.")); +    emu_speed_label->setToolTip( +        tr("Current emulation speed. Values higher or lower than 100% " +           "indicate emulation is running faster or slower than a Switch."));      game_fps_label = new QLabel();      game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "                                    "This will vary from game to game and scene to scene.")); @@ -185,8 +186,8 @@ void GMainWindow::InitializeRecentFileMenuActions() {  void GMainWindow::InitializeHotkeys() {      RegisterHotkey("Main Window", "Load File", QKeySequence::Open);      RegisterHotkey("Main Window", "Start Emulation"); -    RegisterHotkey( "Main Window", "Fullscreen", QKeySequence::FullScreen ); -    RegisterHotkey( "Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut ); +    RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); +    RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut);      LoadHotkeys();      connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, @@ -194,9 +195,9 @@ void GMainWindow::InitializeHotkeys() {      connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this,              SLOT(OnStartGame()));      connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated, -             ui.action_Fullscreen, &QAction::trigger); +            ui.action_Fullscreen, &QAction::trigger);      connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously, -             ui.action_Fullscreen, &QAction::trigger); +            ui.action_Fullscreen, &QAction::trigger);      connect(GetHotkey("Main Window", "Exit Fullscreen", this), &QShortcut::activated, this, [&] {          if (emulation_running) {              ui.action_Fullscreen->setChecked(false); diff --git a/src/yuzu/util/spinbox.cpp b/src/yuzu/util/spinbox.cpp index ede6fe0a8..92753ec1c 100644 --- a/src/yuzu/util/spinbox.cpp +++ b/src/yuzu/util/spinbox.cpp @@ -31,8 +31,8 @@  #include <cstdlib>  #include <QLineEdit>  #include <QRegExpValidator> -#include "yuzu/util/spinbox.h"  #include "common/assert.h" +#include "yuzu/util/spinbox.h"  CSpinBox::CSpinBox(QWidget* parent)      : QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) { | 
