diff --git a/rpcs3/rpcs3qt/about_dialog.h b/rpcs3/rpcs3qt/about_dialog.h index 82509e51f4..7d25fbd68e 100644 --- a/rpcs3/rpcs3qt/about_dialog.h +++ b/rpcs3/rpcs3qt/about_dialog.h @@ -2,7 +2,8 @@ #include -namespace Ui { +namespace Ui +{ class about_dialog; } diff --git a/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp b/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp index 51b1665fdb..d2eb3b79cc 100644 --- a/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp @@ -42,7 +42,8 @@ auto_pause_settings_dialog::auto_pause_settings_dialog(QWidget *parent) : QDialo connect(pauseList, &QTableWidget::customContextMenuRequested, this, &auto_pause_settings_dialog::ShowContextMenu); connect(clearButton, &QAbstractButton::clicked, [=](){ m_entries.clear(); UpdateList(); }); connect(reloadButton, &QAbstractButton::clicked, [=](){ LoadEntries(); UpdateList(); }); - connect(saveButton, &QAbstractButton::clicked, [=](){ + connect(saveButton, &QAbstractButton::clicked, [=] + { SaveEntries(); LOG_SUCCESS(HLE, "Auto Pause: File pause.bin was updated."); }); @@ -194,7 +195,7 @@ void auto_pause_settings_dialog::keyPressEvent(QKeyEvent *event) } AutoPauseConfigDialog::AutoPauseConfigDialog(QWidget* parent, auto_pause_settings_dialog* apsd, bool newEntry, u32 *entry) - : QDialog(parent), m_presult(entry), b_newEntry(newEntry), apsd_parent(apsd) + : QDialog(parent), m_presult(entry), m_newEntry(newEntry), m_apsd(apsd) { m_entry = *m_presult; setMinimumSize(QSize(300, -1)); @@ -252,9 +253,9 @@ void AutoPauseConfigDialog::OnOk() void AutoPauseConfigDialog::OnCancel() { - if (b_newEntry) + if (m_newEntry) { - apsd_parent->OnRemove(); + m_apsd->OnRemove(); } close(); } diff --git a/rpcs3/rpcs3qt/auto_pause_settings_dialog.h b/rpcs3/rpcs3qt/auto_pause_settings_dialog.h index c133dfbdec..b3a2e394d1 100644 --- a/rpcs3/rpcs3qt/auto_pause_settings_dialog.h +++ b/rpcs3/rpcs3qt/auto_pause_settings_dialog.h @@ -52,10 +52,10 @@ class AutoPauseConfigDialog : public QDialog u32 m_entry; u32* m_presult; - bool b_newEntry; + bool m_newEntry; QLineEdit* m_id; QLabel* m_current_converted; - auto_pause_settings_dialog* apsd_parent; + auto_pause_settings_dialog* m_apsd; public: explicit AutoPauseConfigDialog(QWidget* parent, auto_pause_settings_dialog* apsd, bool newEntry, u32* entry); diff --git a/rpcs3/rpcs3qt/cg_disasm_window.cpp b/rpcs3/rpcs3qt/cg_disasm_window.cpp index c046f0d808..7d17489c71 100644 --- a/rpcs3/rpcs3qt/cg_disasm_window.cpp +++ b/rpcs3/rpcs3qt/cg_disasm_window.cpp @@ -66,9 +66,14 @@ void cg_disasm_window::ShowContextMenu(const QPoint &pos) myMenu.addSeparator(); myMenu.addAction(clear); - auto l_clear = [=]() {m_disasm_text->clear(); m_glsl_text->clear();}; - connect(clear, &QAction::triggered, l_clear); - connect(open, &QAction::triggered, [=] { + connect(clear, &QAction::triggered, [=] + { + m_disasm_text->clear(); + m_glsl_text->clear(); + }); + + connect(open, &QAction::triggered, [=] + { QString filePath = QFileDialog::getOpenFileName(this, tr("Select Cg program object"), m_path_last, tr("Cg program objects (*.fpo;*.vpo);;")); if (filePath == NULL) return; m_path_last = filePath; diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 87584f6cd4..eda94a2104 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -32,9 +32,6 @@ debugger_frame::debugger_frame(std::shared_ptr settings, QWidget * m_choice_units->setEditable(true); m_choice_units->setInsertPolicy(QComboBox::NoInsert); m_choice_units->lineEdit()->setPlaceholderText("Choose a thread"); - connect(m_choice_units->lineEdit(), &QLineEdit::editingFinished, [&] { - m_choice_units->clearFocus(); - }); m_choice_units->completer()->setCompletionMode(QCompleter::PopupCompletion); m_choice_units->completer()->setMaxVisibleItems(30); m_choice_units->completer()->setFilterMode(Qt::MatchContains); @@ -85,9 +82,16 @@ debugger_frame::debugger_frame(std::shared_ptr settings, QWidget * connect(m_go_to_addr, &QAbstractButton::clicked, this, &debugger_frame::Show_Val); connect(m_go_to_pc, &QAbstractButton::clicked, this, &debugger_frame::Show_PC); - connect(m_btn_capture, &QAbstractButton::clicked, [=]() { user_asked_for_frame_capture = true; }); + + connect(m_btn_capture, &QAbstractButton::clicked, [=]() + { + user_asked_for_frame_capture = true; + }); + connect(m_btn_step, &QAbstractButton::clicked, this, &debugger_frame::DoStep); - connect(m_btn_run, &QAbstractButton::clicked, [=](){ + + connect(m_btn_run, &QAbstractButton::clicked, [=]() + { if (const auto cpu = this->cpu.lock()) { if (m_btn_run->text() == Run && cpu->state.test_and_reset(cpu_flag::dbg_pause)) @@ -104,6 +108,12 @@ debugger_frame::debugger_frame(std::shared_ptr settings, QWidget * } UpdateUI(); }); + + connect(m_choice_units->lineEdit(), &QLineEdit::editingFinished, [&] + { + m_choice_units->clearFocus(); + }); + connect(m_choice_units, static_cast(&QComboBox::activated), this, &debugger_frame::UpdateUI); connect(m_choice_units, static_cast(&QComboBox::currentIndexChanged), this, &debugger_frame::OnSelectUnit); connect(this, &QDockWidget::visibilityChanged, this, &debugger_frame::EnableUpdateTimer); diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index fc5cc052e0..89f74149e3 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -62,11 +62,9 @@ namespace } } - // Helper methods to interact with YAML and the config settings. namespace cfg_adapter { - static cfg::_base& get_cfg(cfg::_base& root, const std::string& name) { if (root.get_type() == cfg::type::node) @@ -88,7 +86,6 @@ namespace cfg_adapter return begin == end ? root : get_cfg(get_cfg(root, *begin), begin + 1, end); } - static YAML::Node get_node(const YAML::Node& node, cfg_location::const_iterator begin, cfg_location::const_iterator end) { return begin == end ? node : get_node(node[*begin], begin + 1, end); // TODO @@ -101,7 +98,6 @@ namespace cfg_adapter } }; - /** Returns possible options for values for some particular setting.*/ static QStringList getOptions(cfg_location location) { @@ -142,7 +138,6 @@ Render_Creator::Render_Creator() D3D12Adapters.append(QString::fromWCharArray(desc.Description)); } } - } } } @@ -199,7 +194,7 @@ emu_settings::~emu_settings() } void emu_settings::SaveSettings() - { +{ YAML::Emitter out; emitData(out, currentSettings); @@ -244,7 +239,8 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool combobox->setCurrentIndex(index); } - connect(combobox, static_cast(&QComboBox::currentIndexChanged), [=](int index) { + connect(combobox, static_cast(&QComboBox::currentIndexChanged), [=](int index) + { SetSetting(type, sstr(combobox->itemData(index))); }); } @@ -263,7 +259,9 @@ void emu_settings::EnhanceCheckBox(QCheckBox* checkbox, SettingsType type) { LOG_WARNING(GENERAL, "Passed in an invalid setting for creating enhanced checkbox"); } - connect(checkbox, &QCheckBox::stateChanged, [=](int val) { + + connect(checkbox, &QCheckBox::stateChanged, [=](int val) + { std::string str = val != 0 ? "true" : "false"; SetSetting(type, str); }); diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index 96ed2745e9..5e681d2c88 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -36,7 +36,8 @@ class emu_settings : public QObject */ Q_OBJECT public: - enum SettingsType { + enum SettingsType + { // Core PPUDecoder, SPUDecoder, @@ -134,7 +135,8 @@ public Q_SLOTS: void SaveSettings(); private: /** A helper map that keeps track of where a given setting type is located*/ - const QMap SettingsLoc = { + const QMap SettingsLoc = + { // Core Tab { PPUDecoder, { "Core", "PPU Decoder"}}, { SPUDecoder, { "Core", "SPU Decoder"}}, @@ -202,7 +204,6 @@ private: { dev_hdd1Location, { "VFS", "/dev_hdd1/" }}, { dev_flashLocation, { "VFS", "/dev_flash/"}}, { dev_usb000Location, { "VFS", "/dev_usb000/"}}, - }; YAML::Node currentSettings; // The current settings as a YAML node. diff --git a/rpcs3/rpcs3qt/game_list.h b/rpcs3/rpcs3qt/game_list.h index 5e7bfe37ae..a2632f7fc4 100644 --- a/rpcs3/rpcs3qt/game_list.h +++ b/rpcs3/rpcs3qt/game_list.h @@ -7,7 +7,8 @@ class used in order to get deselection if you know a simpler way, tell @Megamouse */ -class game_list : public QTableWidget { +class game_list : public QTableWidget +{ private: void mousePressEvent(QMouseEvent *event) { diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index f65dfd2736..b0860c2731 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -108,7 +108,9 @@ game_list_frame::game_list_frame(std::shared_ptr settings, const R m_Search_Bar->setPlaceholderText(tr("Search games ...")); m_Search_Bar->setMinimumWidth(m_Tool_Bar->height() * 5); m_Search_Bar->setFrame(false); - connect(m_Search_Bar, &QLineEdit::textChanged, [this](const QString& text) { + + connect(m_Search_Bar, &QLineEdit::textChanged, [this](const QString& text) + { m_searchText = text; Refresh(); }); @@ -217,20 +219,23 @@ game_list_frame::game_list_frame(std::shared_ptr settings, const R connect(m_Slider_Size, &QSlider::valueChanged, this, &game_list_frame::RequestIconSizeActSet); connect(m_Slider_Size, &QSlider::sliderReleased, this, [&]{ xgui_settings->SetValue(GUI::gl_iconSize, m_Slider_Size->value()); }); - connect(m_Slider_Size, &QSlider::actionTriggered, [&](int action){ + connect(m_Slider_Size, &QSlider::actionTriggered, [&](int action) + { if (action != QAbstractSlider::SliderNoAction && action != QAbstractSlider::SliderMove) { // we only want to save on mouseclicks or slider release (the other connect handles this) Q_EMIT RequestSaveSliderPos(true); // actionTriggered happens before the value was changed } }); - connect(m_modeActs, &QActionGroup::triggered, [=](QAction* act) { + connect(m_modeActs, &QActionGroup::triggered, [=](QAction* act) + { Q_EMIT RequestListModeActSet(act == m_modeActList.action); m_modeActList.action->setIcon(m_isListLayout ? m_modeActList.colored : m_modeActList.gray); m_modeActGrid.action->setIcon(m_isListLayout ? m_modeActGrid.gray : m_modeActGrid.colored); }); - connect(m_categoryActs, &QActionGroup::triggered, [=](QAction* act) { + connect(m_categoryActs, &QActionGroup::triggered, [=](QAction* act) + { Q_EMIT RequestCategoryActSet(m_categoryActs->actions().indexOf(act)); }); @@ -455,7 +460,8 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) m_game_data.push_back({ game, img, pxmap, true, bootable, hasCustomConfig }); } - auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2) { + auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2) + { return game1.info.name < game2.info.name; }; @@ -503,8 +509,18 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) void game_list_frame::ToggleCategoryFilter(const QStringList& categories, bool show) { - if (show) { m_categoryFilters.append(categories); } - else { for (const auto& cat : categories) m_categoryFilters.removeAll(cat); } + if (show) + { + m_categoryFilters.append(categories); + } + else + { + for (const auto& cat : categories) + { + m_categoryFilters.removeAll(cat); + } + } + Refresh(); } @@ -624,17 +640,19 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row) myMenu.addSeparator(); QAction* checkCompat = myMenu.addAction(tr("&Check Game Compatibility")); - connect(boot, &QAction::triggered, [=]() { + connect(boot, &QAction::triggered, [=] + { if (Boot(m_game_data[row].info)) { LOG_SUCCESS(LOADER, "Boot from gamelist per Boot: done"); } }); - connect(configure, &QAction::triggered, [=]() { + connect(configure, &QAction::triggered, [=] + { settings_dialog (xgui_settings, m_Render_Creator, 0, this, &currGame).exec(); Refresh(true, false); }); - connect(removeGame, &QAction::triggered, [=]() + connect(removeGame, &QAction::triggered, [=] { if (QMessageBox::question(this, tr("Confirm Delete"), tr("Permanently delete files?")) == QMessageBox::Yes) { @@ -648,7 +666,8 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row) connect(deleteShadersCache, &QAction::triggered, [=]() { DeleteShadersCache(row); }); connect(openGameFolder, &QAction::triggered, [=]() {open_dir(currGame.path); }); connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); }); - connect(checkCompat, &QAction::triggered, [=]() { + connect(checkCompat, &QAction::triggered, [=] + { QString link = "https://rpcs3.net/compatibility?g=" + qstr(currGame.serial); QDesktopServices::openUrl(QUrl(link)); }); @@ -1039,7 +1058,10 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co m_xgrid->addItem(m_game_data[i].pxmap, title, i, r, c); - if (selected_item == m_game_data[i].info.icon_path) m_xgrid->setCurrentItem(m_xgrid->item(r, c));; + if (selected_item == m_game_data[i].info.icon_path) + { + m_xgrid->setCurrentItem(m_xgrid->item(r, c)); + } if (++c >= maxCols) { diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 4b142fdcea..3468fbe702 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -168,7 +168,8 @@ struct Tool_Bar_Button bool isActive; }; -enum { +enum +{ DROP_ERROR, DROP_PKG, DROP_PUP, @@ -177,7 +178,8 @@ enum { DROP_GAME }; -class game_list_frame : public QDockWidget { +class game_list_frame : public QDockWidget +{ Q_OBJECT public: diff --git a/rpcs3/rpcs3qt/game_list_grid.cpp b/rpcs3/rpcs3qt/game_list_grid.cpp index 3d60f87ed3..c66695ad3e 100644 --- a/rpcs3/rpcs3qt/game_list_grid.cpp +++ b/rpcs3/rpcs3qt/game_list_grid.cpp @@ -92,7 +92,12 @@ void game_list_grid::addItem(const QPixmap& img, const QString& name, const int& item->setData(Qt::ItemDataRole::DecorationRole, QPixmap::fromImage(exp_img)); item->setData(Qt::ItemDataRole::UserRole, idx); item->setData(Qt::ItemDataRole::ToolTipRole, name); - if (m_text_enabled) { item->setData(Qt::ItemDataRole::DisplayRole, name); } + + if (m_text_enabled) + { + item->setData(Qt::ItemDataRole::DisplayRole, name); + } + setItem(row, col, item); } diff --git a/rpcs3/rpcs3qt/game_list_grid_delegate.cpp b/rpcs3/rpcs3qt/game_list_grid_delegate.cpp index 28e17322f7..72190d9ed3 100644 --- a/rpcs3/rpcs3qt/game_list_grid_delegate.cpp +++ b/rpcs3/rpcs3qt/game_list_grid_delegate.cpp @@ -51,3 +51,8 @@ QSize game_list_grid_delegate::sizeHint(const QStyleOptionViewItem & option, con Q_UNUSED(index); return m_size; } + +void game_list_grid_delegate::setItemSize(const QSize & size) +{ + m_size = size; +} diff --git a/rpcs3/rpcs3qt/game_list_grid_delegate.h b/rpcs3/rpcs3qt/game_list_grid_delegate.h index d32d938e93..017ce83043 100644 --- a/rpcs3/rpcs3qt/game_list_grid_delegate.h +++ b/rpcs3/rpcs3qt/game_list_grid_delegate.h @@ -10,7 +10,7 @@ public: void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const; QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const; - void setItemSize(const QSize& size) { m_size = size; }; + void setItemSize(const QSize& size); virtual ~game_list_grid_delegate(); private: QSize m_size; diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index d2be73c747..d411c736e9 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -115,7 +115,8 @@ void gs_frame::hide() void gs_frame::show() { - Emu.CallAfter([=]() { + Emu.CallAfter([=]() + { QWindow::show(); if (g_cfg.misc.start_fullscreen) { diff --git a/rpcs3/rpcs3qt/gs_frame.h b/rpcs3/rpcs3qt/gs_frame.h index cbe36b0c74..32094b5d14 100644 --- a/rpcs3/rpcs3qt/gs_frame.h +++ b/rpcs3/rpcs3qt/gs_frame.h @@ -29,8 +29,6 @@ protected: void show() override; void mouseDoubleClickEvent(QMouseEvent* ev) override; - //void SetSize(int width, int height); - void* handle() const override; void* make_context() override; diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index f3f6eedeb7..f28046706e 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -16,12 +16,15 @@ struct GUI_SAVE QString name; QVariant def; - GUI_SAVE() { + GUI_SAVE() + { key = ""; name = ""; def = QVariant(); }; - GUI_SAVE(const QString& k, const QString& n, const QVariant& d) { + + GUI_SAVE(const QString& k, const QString& n, const QVariant& d) + { key = k; name = n; def = d; diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp index 3d987adb96..3077bb42de 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp @@ -66,7 +66,8 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, c setModal(true); // Events - connect(button_ok, &QAbstractButton::pressed, [=]() { + connect(button_ok, &QAbstractButton::pressed, [=]() + { bool ok; ulong opcode = t2_instr->text().toULong(&ok, 16); if (!ok) diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 27d1c24d1d..8728c65b76 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -562,7 +562,8 @@ void main_window::InstallPup(const QString& dropPath) self_dec.DecryptData(); auto dev_flash_tar_f = self_dec.MakeFile(); - if (dev_flash_tar_f.size() < 3) { + if (dev_flash_tar_f.size() < 3) + { LOG_ERROR(GENERAL, "Error while installing firmware: PUP contents are invalid."); QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: PUP contents are invalid.")); progress = -1; @@ -1101,7 +1102,9 @@ void main_window::CreateConnects() { connect(ui->bootElfAct, &QAction::triggered, this, &main_window::BootElf); connect(ui->bootGameAct, &QAction::triggered, this, &main_window::BootGame); - connect(ui->bootRecentMenu, &QMenu::aboutToShow, [=]() { + + connect(ui->bootRecentMenu, &QMenu::aboutToShow, [=] + { // Enable/Disable Recent Games List const bool stopped = Emu.IsStopped(); for (auto act : ui->bootRecentMenu->actions()) @@ -1112,7 +1115,9 @@ void main_window::CreateConnects() } } }); - connect(ui->clearRecentAct, &QAction::triggered, [this](){ + + connect(ui->clearRecentAct, &QAction::triggered, [this] + { if (ui->freezeRecentAct->isChecked()) { return; } m_rg_entries.clear(); for (auto act : m_recentGameActs) @@ -1122,21 +1127,28 @@ void main_window::CreateConnects() m_recentGameActs.clear(); guiSettings->SetValue(GUI::rg_entries, guiSettings->List2Var(q_pair_list())); }); - connect(ui->freezeRecentAct, &QAction::triggered, [=](bool checked) { + + connect(ui->freezeRecentAct, &QAction::triggered, [=](bool checked) + { guiSettings->SetValue(GUI::rg_freeze, checked); }); + connect(ui->bootInstallPkgAct, &QAction::triggered, [this] {InstallPkg(); }); connect(ui->bootInstallPupAct, &QAction::triggered, [this] {InstallPup(); }); connect(ui->exitAct, &QAction::triggered, this, &QWidget::close); connect(ui->sysPauseAct, &QAction::triggered, Pause); connect(ui->sysStopAct, &QAction::triggered, [=]() { Emu.Stop(); }); connect(ui->sysRebootAct, &QAction::triggered, [=]() { Emu.Stop(); Emu.Load(); }); - connect(ui->sysSendOpenMenuAct, &QAction::triggered, [=](){ + + connect(ui->sysSendOpenMenuAct, &QAction::triggered, [=] + { sysutil_send_system_cmd(m_sys_menu_opened ? 0x0132 /* CELL_SYSUTIL_SYSTEM_MENU_CLOSE */ : 0x0131 /* CELL_SYSUTIL_SYSTEM_MENU_OPEN */, 0); m_sys_menu_opened = !m_sys_menu_opened; ui->sysSendOpenMenuAct->setText(tr("Send &%0 system menu cmd").arg(m_sys_menu_opened ? tr("close") : tr("open"))); }); - connect(ui->sysSendExitAct, &QAction::triggered, [=](){ + + connect(ui->sysSendExitAct, &QAction::triggered, [=] + { sysutil_send_system_cmd(0x0101 /* CELL_SYSUTIL_REQUEST_EXITGAME */, 0); }); @@ -1149,50 +1161,68 @@ void main_window::CreateConnects() connect(&dlg, &settings_dialog::GuiRepaintRequest, this, &main_window::RepaintGui); dlg.exec(); }; + connect(ui->confCPUAct, &QAction::triggered, [=]() { openSettings(0); }); connect(ui->confGPUAct, &QAction::triggered, [=]() { openSettings(1); }); connect(ui->confAudioAct, &QAction::triggered, [=]() { openSettings(2); }); connect(ui->confIOAct, &QAction::triggered, [=]() { openSettings(3); }); connect(ui->confSystemAct, &QAction::triggered, [=]() { openSettings(4); }); - connect(ui->confPadAct, &QAction::triggered, this, [=](){ + connect(ui->confPadAct, &QAction::triggered, this, [=] + { pad_settings_dialog dlg(guiSettings, this); dlg.exec(); }); - connect(ui->confAutopauseManagerAct, &QAction::triggered, [=](){ + + connect(ui->confAutopauseManagerAct, &QAction::triggered, [=] + { auto_pause_settings_dialog dlg(this); dlg.exec(); }); - connect(ui->confVFSDialogAct, &QAction::triggered, [=]() { + + connect(ui->confVFSDialogAct, &QAction::triggered, [=] + { vfs_dialog dlg(this); dlg.exec(); gameListFrame->Refresh(true); // dev-hdd0 may have changed. Refresh just in case. }); - connect(ui->confSavedataManagerAct, &QAction::triggered, [=](){ + connect(ui->confSavedataManagerAct, &QAction::triggered, [=] + { save_manager_dialog* sdid = new save_manager_dialog(); sdid->show(); }); - connect(ui->toolsCgDisasmAct, &QAction::triggered, [=](){ + + connect(ui->toolsCgDisasmAct, &QAction::triggered, [=] + { cg_disasm_window* cgdw = new cg_disasm_window(guiSettings); cgdw->show(); }); - connect(ui->toolskernel_explorerAct, &QAction::triggered, [=](){ + + connect(ui->toolskernel_explorerAct, &QAction::triggered, [=] + { kernel_explorer* kernelExplorer = new kernel_explorer(this); kernelExplorer->show(); }); - connect(ui->toolsmemory_viewerAct, &QAction::triggered, [=](){ + + connect(ui->toolsmemory_viewerAct, &QAction::triggered, [=] + { memory_viewer_panel* mvp = new memory_viewer_panel(this); mvp->show(); }); - connect(ui->toolsRsxDebuggerAct, &QAction::triggered, [=](){ + + connect(ui->toolsRsxDebuggerAct, &QAction::triggered, [=] + { rsx_debugger* rsx = new rsx_debugger(this); rsx->show(); }); - connect(ui->toolsStringSearchAct, &QAction::triggered, [=](){ + + connect(ui->toolsStringSearchAct, &QAction::triggered, [=] + { memory_string_searcher* mss = new memory_string_searcher(this); mss->show(); }); + connect(ui->toolsDecryptSprxLibsAct, &QAction::triggered, this, &main_window::DecryptSPRXLibraries); connect(ui->showDebuggerAct, &QAction::triggered, [=](bool checked){ checked ? debuggerFrame->show() : debuggerFrame->hide(); @@ -1206,7 +1236,9 @@ void main_window::CreateConnects() checked ? gameListFrame->show() : gameListFrame->hide(); guiSettings->SetValue(GUI::mw_gamelist, checked); }); - connect(ui->showToolBarAct, &QAction::triggered, [=](bool checked) { + + connect(ui->showToolBarAct, &QAction::triggered, [=](bool checked) + { ui->toolBar->setVisible(checked); guiSettings->SetValue(GUI::mw_toolBarVisible, checked); }); @@ -1235,12 +1267,17 @@ void main_window::CreateConnects() gameListFrame->ToggleCategoryFilter(categories, checked); guiSettings->SetCategoryVisibility(id, checked); }); - connect(ui->aboutAct, &QAction::triggered, [this]() { + + connect(ui->aboutAct, &QAction::triggered, [this] + { about_dialog dlg(this); dlg.exec(); }); + connect(ui->aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt); - auto resizeIcons = [=](const int& index){ + + auto resizeIcons = [=](const int& index) + { int val = ui->sizeSlider->value(); if (val != index) { @@ -1291,12 +1328,14 @@ void main_window::CreateConnects() gameListFrame->SetListMode(isList); categoryVisibleActGroup->setEnabled(isList); }); + connect(ui->toolbar_disc, &QAction::triggered, this, &main_window::BootGame); connect(ui->toolbar_refresh, &QAction::triggered, [=]() { gameListFrame->Refresh(true); }); connect(ui->toolbar_stop, &QAction::triggered, [=]() { Emu.Stop(); }); connect(ui->toolbar_start, &QAction::triggered, Pause); - //connect(ui->toolbar_snap, &QAction::triggered, [=]() {}); - connect(ui->toolbar_fullscreen, &QAction::triggered, [=]() { + + connect(ui->toolbar_fullscreen, &QAction::triggered, [=] + { if (isFullScreen()) { showNormal(); @@ -1312,10 +1351,11 @@ void main_window::CreateConnects() connect(ui->toolbar_config, &QAction::triggered, [=]() { openSettings(0); }); connect(ui->toolbar_list, &QAction::triggered, [=]() { ui->setlistModeListAct->trigger(); }); connect(ui->toolbar_grid, &QAction::triggered, [=]() { ui->setlistModeGridAct->trigger(); }); - //connect(ui->toolbar_sort, &QAction::triggered, gameListFrame, sort); connect(ui->sizeSlider, &QSlider::valueChanged, resizeIcons); connect(ui->sizeSlider, &QSlider::sliderReleased, this, [&] { guiSettings->SetValue(GUI::gl_iconSize, ui->sizeSlider->value()); }); - connect(ui->sizeSlider, &QSlider::actionTriggered, [&](int action) { + + connect(ui->sizeSlider, &QSlider::actionTriggered, [&](int action) + { if (action != QAbstractSlider::SliderNoAction && action != QAbstractSlider::SliderMove) { // we only want to save on mouseclicks or slider release (the other connect handles this) m_save_slider_pos = true; // actionTriggered happens before the value was changed diff --git a/rpcs3/rpcs3qt/main_window.h b/rpcs3/rpcs3qt/main_window.h index fca919b29c..057d746716 100644 --- a/rpcs3/rpcs3qt/main_window.h +++ b/rpcs3/rpcs3qt/main_window.h @@ -18,7 +18,8 @@ #include -namespace Ui { +namespace Ui +{ class main_window; } diff --git a/rpcs3/rpcs3qt/memory_string_searcher.cpp b/rpcs3/rpcs3qt/memory_string_searcher.cpp index 8fc1ee02e4..5275924835 100644 --- a/rpcs3/rpcs3qt/memory_string_searcher.cpp +++ b/rpcs3/rpcs3qt/memory_string_searcher.cpp @@ -36,15 +36,19 @@ void memory_string_searcher::OnSearch() u32 strIndex = 0; u32 numFound = 0; const auto area = vm::get(vm::main); - for (u32 addr = area->addr; addr < area->addr + area->size; addr++) { - if (!vm::check_addr(addr)) { + for (u32 addr = area->addr; addr < area->addr + area->size; addr++) + { + if (!vm::check_addr(addr)) + { strIndex = 0; continue; } u8 byte = vm::read8(addr); - if (byte == str[strIndex]) { - if (strIndex == len) { + if (byte == str[strIndex]) + { + if (strIndex == len) + { // Found it LOG_NOTICE(GENERAL, "Found @ %04x", addr - len); numFound++; @@ -55,9 +59,12 @@ void memory_string_searcher::OnSearch() strIndex++; } else + { strIndex = 0; + } - if (addr % (1024 * 1024 * 64) == 0) { // Log every 64mb + if (addr % (1024 * 1024 * 64) == 0) // Log every 64mb + { LOG_NOTICE(GENERAL, "Searching %04x ...", addr); } } diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index d296dbafb7..385a13ee72 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -218,7 +218,8 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent) connect(b_next, &QAbstractButton::clicked, [=]() { m_addr += m_colcount; ShowMemory(); }); connect(b_fprev, &QAbstractButton::clicked, [=]() { m_addr -= m_rowcount * m_colcount; ShowMemory(); }); connect(b_fnext, &QAbstractButton::clicked, [=]() { m_addr += m_rowcount * m_colcount; ShowMemory(); }); - connect(b_img, &QAbstractButton::clicked, [=]() { + connect(b_img, &QAbstractButton::clicked, [=] + { int mode = cbox_img_mode->currentIndex(); int sizex = sb_img_size_x->value(); int sizey = sb_img_size_y->value(); @@ -228,7 +229,12 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent) //Fill the QTextEdits ShowMemory(); setFixedSize(sizeHint()); -}; +} + +memory_viewer_panel::~memory_viewer_panel() +{ + exit = true; +} void memory_viewer_panel::wheelEvent(QWheelEvent *event) { @@ -298,6 +304,11 @@ void memory_viewer_panel::ShowMemory() t_mem_ascii->setFixedSize(textSize.width() + 10, textSize.height() + 10); } +void memory_viewer_panel::SetPC(const uint pc) +{ + m_addr = pc; +} + void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 width, u32 height, bool flipv) { unsigned char* originalBuffer = (unsigned char*)vm::base(addr); @@ -305,8 +316,10 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid switch(mode) { case(0): // RGB - for (u32 y = 0; y < height; y++) { - for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 3) { + for (u32 y = 0; y < height; y++) + { + for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 3) + { convertedBuffer[i + 0 + y * width * 4] = originalBuffer[j + 2 + y * width * 3]; convertedBuffer[i + 1 + y * width * 4] = originalBuffer[j + 1 + y * width * 3]; convertedBuffer[i + 2 + y * width * 4] = originalBuffer[j + 0 + y * width * 3]; @@ -316,8 +329,10 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid break; case(1): // ARGB - for (u32 y = 0; y < height; y++) { - for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4) { + for (u32 y = 0; y < height; y++) + { + for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4) + { convertedBuffer[i + 0 + y * width * 4] = originalBuffer[j + 3 + y * width * 4]; convertedBuffer[i + 1 + y * width * 4] = originalBuffer[j + 2 + y * width * 4]; convertedBuffer[i + 2 + y * width * 4] = originalBuffer[j + 1 + y * width * 4]; @@ -327,8 +342,10 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid break; case(2): // RGBA - for (u32 y = 0; y < height; y++) { - for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4) { + for (u32 y = 0; y < height; y++) + { + for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4) + { convertedBuffer[i + 0 + y * width * 4] = originalBuffer[j + 2 + y * width * 4]; convertedBuffer[i + 1 + y * width * 4] = originalBuffer[j + 1 + y * width * 4]; convertedBuffer[i + 2 + y * width * 4] = originalBuffer[j + 0 + y * width * 4]; @@ -338,8 +355,10 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid break; case(3): // ABGR - for (u32 y = 0; y < height; y++) { - for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4) { + for (u32 y = 0; y < height; y++) + { + for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4) + { convertedBuffer[i + 0 + y * width * 4] = originalBuffer[j + 1 + y * width * 4]; convertedBuffer[i + 1 + y * width * 4] = originalBuffer[j + 2 + y * width * 4]; convertedBuffer[i + 2 + y * width * 4] = originalBuffer[j + 3 + y * width * 4]; @@ -350,9 +369,12 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid } // Flip vertically - if (flipv) { - for (u32 y = 0; y < height / 2; y++) { - for (u32 x = 0; x < width * 4; x++) { + if (flipv) + { + for (u32 y = 0; y < height / 2; y++) + { + for (u32 x = 0; x < width * 4; x++) + { const u8 t = convertedBuffer[x + y * width * 4]; convertedBuffer[x + y * width * 4] = convertedBuffer[x + (height - y - 1) * width * 4]; convertedBuffer[x + (height - y - 1) * width * 4] = t; diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.h b/rpcs3/rpcs3qt/memory_viewer_panel.h index 7252e4eef0..160f15ef9c 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.h +++ b/rpcs3/rpcs3qt/memory_viewer_panel.h @@ -41,15 +41,12 @@ class memory_viewer_panel : public QDialog public: bool exit; memory_viewer_panel(QWidget* parent); - ~memory_viewer_panel() - { - exit = true; - } + ~memory_viewer_panel(); virtual void wheelEvent(QWheelEvent *event); virtual void ShowMemory(); - void SetPC(const uint pc) { m_addr = pc; } + void SetPC(const uint pc); //Static methods static void ShowImage(QWidget* parent, u32 addr, int mode, u32 sizex, u32 sizey, bool flipv); diff --git a/rpcs3/rpcs3qt/msg_dialog_frame.h b/rpcs3/rpcs3qt/msg_dialog_frame.h index 95f62a6b92..14b6dc9f06 100644 --- a/rpcs3/rpcs3qt/msg_dialog_frame.h +++ b/rpcs3/rpcs3qt/msg_dialog_frame.h @@ -47,6 +47,7 @@ class msg_dialog_frame : public QObject, public MsgDialogBase custom_dialog* osk_dialog = nullptr; char16_t* osk_text_return; + QWindow* m_taskbarTarget; // Window which will be targeted by custom taskbars. const int m_gauge_max = 100; @@ -58,8 +59,6 @@ public: virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override; virtual void ProgressBarReset(u32 progressBarIndex) override; virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) override; -private: - QWindow* m_taskbarTarget; // Window which will be targeted by custom taskbars. }; class custom_dialog : public QDialog diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index ea7849d405..60756b7c1f 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -169,7 +169,8 @@ void pad_settings_dialog::UpdateLabel() void pad_settings_dialog::UpdateTimerLabel(const u32 id) { // Lambda used to update label. The 47 is magical. - auto UpdateLabel = [=](QPushButton* target) { + auto UpdateLabel = [=](QPushButton* target) + { target->setText(QString::number(m_seconds + 47)); }; diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.h b/rpcs3/rpcs3qt/pad_settings_dialog.h index 8f5527dfc5..fa864846d7 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.h +++ b/rpcs3/rpcs3qt/pad_settings_dialog.h @@ -49,7 +49,8 @@ enum button_ids id_cancel }; -namespace Ui { +namespace Ui +{ class pad_settings_dialog; } diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index d2242898a5..5a157ad5ab 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -81,7 +81,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const } // Various connects - connect(ui->okButton, &QAbstractButton::clicked, [=]() { + connect(ui->okButton, &QAbstractButton::clicked, [=] + { std::set selectedlle; for (int i = 0; illeList->count(); ++i) { @@ -289,7 +290,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const } // sort items: checked items first then alphabetical order - std::sort(items.begin(), items.end(), [](QListWidgetItem *i1, QListWidgetItem *i2) { + std::sort(items.begin(), items.end(), [](QListWidgetItem *i1, QListWidgetItem *i2) + { return (i1->checkState() != i2->checkState()) ? (i1->checkState() > i2->checkState()) : (i1->text() < i2->text()); }); @@ -310,7 +312,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const connect(ui->searchBox, &QLineEdit::textChanged, l_OnSearchBoxTextChanged); // enable multiselection (there must be a better way) - connect(ui->lleList, &QListWidget::itemChanged, [&](QListWidgetItem* item){ + connect(ui->lleList, &QListWidget::itemChanged, [&](QListWidgetItem* item) + { for (auto cb : ui->lleList->selectedItems()) { cb->setCheckState(item->checkState()); @@ -541,7 +544,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const connect(ui->graphicsAdapterBox, &QComboBox::currentTextChanged, setAdapter); connect(ui->renderBox, static_cast(&QComboBox::currentIndexChanged), switchGraphicsAdapter); - auto fixGLLegacy = [=](const QString& text) { + auto fixGLLegacy = [=](const QString& text) + { ui->glLegacyBuffers->setEnabled(text == r_OpenGL); }; @@ -671,7 +675,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const else { // colorize preview icons - auto addColoredIcon = [&](QPushButton *button, const QColor& color, const QIcon& icon = QIcon(), const QColor& iconColor = QColor()) { + auto addColoredIcon = [&](QPushButton *button, const QColor& color, const QIcon& icon = QIcon(), const QColor& iconColor = QColor()) + { QLabel* text = new QLabel(button->text()); text->setObjectName("color_button"); text->setAlignment(Qt::AlignCenter); @@ -694,7 +699,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const button->layout()->addWidget(text); }; - auto AddColoredIcons = [=]() { + auto AddColoredIcons = [=]() + { addColoredIcon(ui->pb_gl_icon_color, xgui_settings->GetValue(GUI::gl_iconColor).value()); addColoredIcon(ui->pb_tool_bar_color, xgui_settings->GetValue(GUI::mw_toolBarColor).value()); addColoredIcon(ui->pb_gl_tool_icon_color, xgui_settings->GetValue(GUI::gl_toolIconColor).value(), QIcon(":/Icons/home_blue.png"), GUI::gl_tool_icon_color); @@ -711,7 +717,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const ui->pb_tool_bar_color->setEnabled(enableUIColors); ui->pb_tool_icon_color->setEnabled(enableUIColors); - auto ApplyGuiOptions = [&](bool reset = false) { + auto ApplyGuiOptions = [&](bool reset = false) + { if (reset) { m_currentConfig = GUI::Default; @@ -731,7 +738,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const }; connect(ui->okButton, &QAbstractButton::clicked, [=]() { ApplyGuiOptions(); }); - connect(ui->pb_reset_default, &QAbstractButton::clicked, [=]() { + connect(ui->pb_reset_default, &QAbstractButton::clicked, [=] + { if (QMessageBox::question(this, tr("Reset GUI to default?"), tr("This will include your stylesheet as well. Do you wish to proceed?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) { @@ -751,7 +759,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const connect(ui->pb_apply_stylesheet, &QAbstractButton::clicked, this, &settings_dialog::OnApplyStylesheet); connect(ui->pb_open_folder, &QAbstractButton::clicked, [=]() {QDesktopServices::openUrl(xgui_settings->GetSettingsDir()); }); connect(ui->cb_show_welcome, &QCheckBox::clicked, [=](bool val) {xgui_settings->SetValue(GUI::ib_show_welcome, val); }); - connect(ui->cb_custom_colors, &QCheckBox::clicked, [=](bool val) { + connect(ui->cb_custom_colors, &QCheckBox::clicked, [=](bool val) + { xgui_settings->SetValue(GUI::m_enableUIColors, val); ui->pb_gl_icon_color->setEnabled(val); ui->pb_gl_tool_icon_color->setEnabled(val); @@ -759,7 +768,8 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const ui->pb_tool_icon_color->setEnabled(val); Q_EMIT GuiRepaintRequest(); }); - auto colorDialog = [&](const GUI_SAVE& color, const QString& title, QPushButton *button){ + auto colorDialog = [&](const GUI_SAVE& color, const QString& title, QPushButton *button) + { QColor oldColor = xgui_settings->GetValue(color).value(); QColorDialog dlg(oldColor, this); dlg.setWindowTitle(title); @@ -800,18 +810,21 @@ settings_dialog::settings_dialog(std::shared_ptr xSettings, const ui->gs_width->setValue(width < max_width ? width : max_width); ui->gs_height->setValue(height < max_height ? height : max_height); - connect(ui->gs_resizeOnBoot, &QCheckBox::clicked, [=](bool val) { + connect(ui->gs_resizeOnBoot, &QCheckBox::clicked, [=](bool val) + { xgui_settings->SetValue(GUI::gs_resize, val); ui->gs_width->setEnabled(val); ui->gs_height->setEnabled(val); }); - connect(ui->gs_width, static_cast(&QSpinBox::valueChanged), [=](int w) { + connect(ui->gs_width, static_cast(&QSpinBox::valueChanged), [=](int w) + { int width = QApplication::desktop()->screenGeometry().width(); w = w > width ? width : w; ui->gs_width->setValue(w); xgui_settings->SetValue(GUI::gs_width, w); }); - connect(ui->gs_height, static_cast(&QSpinBox::valueChanged), [=](int h) { + connect(ui->gs_height, static_cast(&QSpinBox::valueChanged), [=](int h) + { int height = QApplication::desktop()->screenGeometry().height(); h = h > height ? height : h; ui->gs_height->setValue(h); diff --git a/rpcs3/rpcs3qt/settings_dialog.h b/rpcs3/rpcs3qt/settings_dialog.h index 11cdf391d9..0e940bc5a6 100644 --- a/rpcs3/rpcs3qt/settings_dialog.h +++ b/rpcs3/rpcs3qt/settings_dialog.h @@ -10,7 +10,8 @@ #include -namespace Ui { +namespace Ui +{ class settings_dialog; } diff --git a/rpcs3/rpcs3qt/welcome_dialog.h b/rpcs3/rpcs3qt/welcome_dialog.h index 0ce0fe143a..fff3c166cd 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.h +++ b/rpcs3/rpcs3qt/welcome_dialog.h @@ -4,7 +4,8 @@ #include #include -namespace Ui { +namespace Ui +{ class welcome_dialog; }