summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/CMakeLists.txt1
-rw-r--r--src/citra_qt/bootmanager.h4
-rw-r--r--src/citra_qt/citra-qt.rc2
-rw-r--r--src/citra_qt/config.cpp2
-rw-r--r--src/citra_qt/configure_graphics.cpp2
-rw-r--r--src/citra_qt/configure_graphics.ui7
-rw-r--r--src/citra_qt/configure_input.cpp169
-rw-r--r--src/citra_qt/configure_input.h47
-rw-r--r--src/citra_qt/debugger/callstack.h4
-rw-r--r--src/citra_qt/debugger/disassembler.h2
-rw-r--r--src/citra_qt/debugger/graphics.cpp16
-rw-r--r--src/citra_qt/debugger/graphics.h2
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.h4
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp42
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.h4
-rw-r--r--src/citra_qt/debugger/graphics_surface.h7
-rw-r--r--src/citra_qt/debugger/graphics_tracing.h4
-rw-r--r--src/citra_qt/debugger/graphics_vertex_shader.h2
-rw-r--r--src/citra_qt/debugger/profiler.h6
-rw-r--r--src/citra_qt/debugger/ramview.h4
-rw-r--r--src/citra_qt/debugger/registers.h4
-rw-r--r--src/citra_qt/debugger/wait_tree.h26
-rw-r--r--src/citra_qt/game_list.cpp18
-rw-r--r--src/citra_qt/game_list.h13
-rw-r--r--src/citra_qt/hotkeys.h2
-rw-r--r--src/citra_qt/util/spinbox.h2
-rw-r--r--src/citra_qt/version.h11
27 files changed, 204 insertions, 203 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 384875450..a9dacd5f1 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -65,7 +65,6 @@ set(HEADERS
hotkeys.h
main.h
ui_settings.h
- version.h
)
set(UIS
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 67228b94f..af52f369b 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#pragma once
+
#include <atomic>
#include <condition_variable>
#include <mutex>
@@ -21,7 +23,7 @@ class EmuThread : public QThread {
Q_OBJECT
public:
- EmuThread(GRenderWindow* render_window);
+ explicit EmuThread(GRenderWindow* render_window);
/**
* Start emulation (on new thread)
diff --git a/src/citra_qt/citra-qt.rc b/src/citra_qt/citra-qt.rc
index 3c7239853..fea603004 100644
--- a/src/citra_qt/citra-qt.rc
+++ b/src/citra_qt/citra-qt.rc
@@ -5,5 +5,5 @@
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_ICON1 ICON "..\\..\\dist\\citra.ico"
+CITRA_ICON ICON "../../dist/citra.ico"
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 3cdfe6443..06a4e9d25 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -47,6 +47,7 @@ void Config::ReadValues() {
Settings::values.use_scaled_resolution =
qt_config->value("use_scaled_resolution", false).toBool();
Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool();
+ Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool();
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
@@ -152,6 +153,7 @@ void Config::SaveValues() {
qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution);
qt_config->setValue("use_vsync", Settings::values.use_vsync);
+ qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit);
// Cast to double because Qt's written float values are not human-readable
qt_config->setValue("bg_red", (double)Settings::values.bg_red);
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp
index 29834e11b..36f10c8d7 100644
--- a/src/citra_qt/configure_graphics.cpp
+++ b/src/citra_qt/configure_graphics.cpp
@@ -23,6 +23,7 @@ void ConfigureGraphics::setConfiguration() {
ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
ui->toggle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution);
ui->toggle_vsync->setChecked(Settings::values.use_vsync);
+ ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit);
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
ui->swap_screen->setChecked(Settings::values.swap_screen);
}
@@ -32,6 +33,7 @@ void ConfigureGraphics::applyConfiguration() {
Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked();
Settings::values.use_vsync = ui->toggle_vsync->isChecked();
+ Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked();
Settings::values.layout_option =
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
Settings::values.swap_screen = ui->swap_screen->isChecked();
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configure_graphics.ui
index af16a4292..964aa0bbd 100644
--- a/src/citra_qt/configure_graphics.ui
+++ b/src/citra_qt/configure_graphics.ui
@@ -50,6 +50,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="toggle_framelimit">
+ <property name="text">
+ <string>Limit framerate</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/citra_qt/configure_input.cpp b/src/citra_qt/configure_input.cpp
index d321db71f..3e6803b8a 100644
--- a/src/citra_qt/configure_input.cpp
+++ b/src/citra_qt/configure_input.cpp
@@ -5,15 +5,33 @@
#include <memory>
#include <utility>
#include <QTimer>
+#include "citra_qt/config.h"
#include "citra_qt/configure_input.h"
+static QString getKeyName(Qt::Key key_code) {
+ switch (key_code) {
+ case Qt::Key_Shift:
+ return QObject::tr("Shift");
+ case Qt::Key_Control:
+ return QObject::tr("Ctrl");
+ case Qt::Key_Alt:
+ return QObject::tr("Alt");
+ case Qt::Key_Meta:
+ case -1:
+ return "";
+ default:
+ return QKeySequence(key_code).toString();
+ }
+}
+
ConfigureInput::ConfigureInput(QWidget* parent)
- : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()) {
+ : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
+ timer(std::make_unique<QTimer>()) {
ui->setupUi(this);
+ setFocusPolicy(Qt::ClickFocus);
- // Initialize mapping of input enum to UI button.
- input_mapping = {
+ button_map = {
{Settings::NativeInput::Values::A, ui->buttonA},
{Settings::NativeInput::Values::B, ui->buttonB},
{Settings::NativeInput::Values::X, ui->buttonX},
@@ -40,114 +58,89 @@ ConfigureInput::ConfigureInput(QWidget* parent)
{Settings::NativeInput::Values::CIRCLE_MODIFIER, ui->buttonCircleMod},
};
- // Attach handle click method to each button click.
- for (const auto& entry : input_mapping) {
- connect(entry.second, SIGNAL(released()), this, SLOT(handleClick()));
+ for (const auto& entry : button_map) {
+ const Settings::NativeInput::Values input_id = entry.first;
+ connect(entry.second, &QPushButton::released,
+ [this, input_id]() { handleClick(input_id); });
}
- connect(ui->buttonRestoreDefaults, SIGNAL(released()), this, SLOT(restoreDefaults()));
- setFocusPolicy(Qt::ClickFocus);
- timer = new QTimer(this);
+
+ connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); });
+
timer->setSingleShot(true);
- connect(timer, &QTimer::timeout, this, [&]() {
- key_pressed = Qt::Key_Escape;
- setKey();
+ connect(timer.get(), &QTimer::timeout, [this]() {
+ releaseKeyboard();
+ releaseMouse();
+ current_input_id = boost::none;
+ updateButtonLabels();
});
- this->setConfiguration();
-}
-void ConfigureInput::handleClick() {
- QPushButton* sender = qobject_cast<QPushButton*>(QObject::sender());
- previous_mapping = sender->text();
- sender->setText(tr("[waiting]"));
- sender->setFocus();
- grabKeyboard();
- grabMouse();
- changing_button = sender;
- timer->start(5000); // Cancel after 5 seconds
+ this->loadConfiguration();
}
void ConfigureInput::applyConfiguration() {
- for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
- int value = getKeyValue(input_mapping[Settings::NativeInput::Values(i)]->text());
- Settings::values.input_mappings[Settings::NativeInput::All[i]] = value;
+ for (const auto& input_id : Settings::NativeInput::All) {
+ const size_t index = static_cast<size_t>(input_id);
+ Settings::values.input_mappings[index] = static_cast<int>(key_map[input_id]);
}
Settings::Apply();
}
-void ConfigureInput::setConfiguration() {
- for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
- QString keyValue = getKeyName(Settings::values.input_mappings[i]);
- input_mapping[Settings::NativeInput::Values(i)]->setText(keyValue);
+void ConfigureInput::loadConfiguration() {
+ for (const auto& input_id : Settings::NativeInput::All) {
+ const size_t index = static_cast<size_t>(input_id);
+ key_map[input_id] = static_cast<Qt::Key>(Settings::values.input_mappings[index]);
}
+ updateButtonLabels();
}
-void ConfigureInput::keyPressEvent(QKeyEvent* event) {
- if (!changing_button)
- return;
- if (!event || event->key() == Qt::Key_unknown)
- return;
- key_pressed = event->key();
- timer->stop();
- setKey();
+void ConfigureInput::restoreDefaults() {
+ for (const auto& input_id : Settings::NativeInput::All) {
+ const size_t index = static_cast<size_t>(input_id);
+ key_map[input_id] = static_cast<Qt::Key>(Config::defaults[index].toInt());
+ }
+ updateButtonLabels();
+ applyConfiguration();
}
-void ConfigureInput::setKey() {
- const QString key_value = getKeyName(key_pressed);
- if (key_pressed == Qt::Key_Escape)
- changing_button->setText(previous_mapping);
- else
- changing_button->setText(key_value);
- removeDuplicates(key_value);
- key_pressed = Qt::Key_unknown;
- releaseKeyboard();
- releaseMouse();
- changing_button = nullptr;
- previous_mapping = nullptr;
+void ConfigureInput::updateButtonLabels() {
+ for (const auto& input_id : Settings::NativeInput::All) {
+ button_map[input_id]->setText(getKeyName(key_map[input_id]));
+ }
}
-QString ConfigureInput::getKeyName(int key_code) const {
- if (key_code == Qt::Key_Shift)
- return tr("Shift");
- if (key_code == Qt::Key_Control)
- return tr("Ctrl");
- if (key_code == Qt::Key_Alt)
- return tr("Alt");
- if (key_code == Qt::Key_Meta)
- return "";
- if (key_code == -1)
- return "";
+void ConfigureInput::handleClick(Settings::NativeInput::Values input_id) {
+ QPushButton* button = button_map[input_id];
+ button->setText(tr("[press key]"));
+ button->setFocus();
- return QKeySequence(key_code).toString();
-}
+ current_input_id = input_id;
-Qt::Key ConfigureInput::getKeyValue(const QString& text) const {
- if (text == "Shift")
- return Qt::Key_Shift;
- if (text == "Ctrl")
- return Qt::Key_Control;
- if (text == "Alt")
- return Qt::Key_Alt;
- if (text == "Meta")
- return Qt::Key_unknown;
- if (text == "")
- return Qt::Key_unknown;
-
- return Qt::Key(QKeySequence(text)[0]);
+ grabKeyboard();
+ grabMouse();
+ timer->start(5000); // Cancel after 5 seconds
}
-void ConfigureInput::removeDuplicates(const QString& newValue) {
- for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
- if (changing_button != input_mapping[Settings::NativeInput::Values(i)]) {
- const QString oldValue = input_mapping[Settings::NativeInput::Values(i)]->text();
- if (newValue == oldValue)
- input_mapping[Settings::NativeInput::Values(i)]->setText("");
- }
- }
+void ConfigureInput::keyPressEvent(QKeyEvent* event) {
+ releaseKeyboard();
+ releaseMouse();
+
+ if (!current_input_id || !event)
+ return;
+
+ if (event->key() != Qt::Key_Escape)
+ setInput(*current_input_id, static_cast<Qt::Key>(event->key()));
+
+ updateButtonLabels();
+ current_input_id = boost::none;
+ timer->stop();
}
-void ConfigureInput::restoreDefaults() {
- for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
- const QString keyValue = getKeyName(Config::defaults[i].toInt());
- input_mapping[Settings::NativeInput::Values(i)]->setText(keyValue);
+void ConfigureInput::setInput(Settings::NativeInput::Values input_id, Qt::Key key_pressed) {
+ // Remove duplicates
+ for (auto& pair : key_map) {
+ if (pair.second == key_pressed)
+ pair.second = Qt::Key_unknown;
}
+
+ key_map[input_id] = key_pressed;
}
diff --git a/src/citra_qt/configure_input.h b/src/citra_qt/configure_input.h
index 5183b904d..bc343db83 100644
--- a/src/citra_qt/configure_input.h
+++ b/src/citra_qt/configure_input.h
@@ -7,7 +7,7 @@
#include <memory>
#include <QKeyEvent>
#include <QWidget>
-#include "citra_qt/config.h"
+#include <boost/optional.hpp>
#include "core/settings.h"
#include "ui_configure_input.h"
@@ -30,35 +30,28 @@ public:
private:
std::unique_ptr<Ui::ConfigureInput> ui;
- std::map<Settings::NativeInput::Values, QPushButton*> input_mapping;
- int key_pressed;
- QPushButton* changing_button = nullptr; ///< button currently waiting for key press.
- QString previous_mapping;
- QTimer* timer;
- /// Load configuration settings into button text
- void setConfiguration();
+ /// This input is currently awaiting configuration.
+ /// (i.e.: its corresponding QPushButton has been pressed.)
+ boost::optional<Settings::NativeInput::Values> current_input_id;
+ std::unique_ptr<QTimer> timer;
- /// Check all inputs for duplicate keys. Clears out any other button with the same value as this
- /// button's new value.
- void removeDuplicates(const QString& newValue);
-
- /// Handle key press event for input tab when a button is 'waiting'.
- void keyPressEvent(QKeyEvent* event) override;
-
- /// Convert key ASCII value to its' letter/name
- QString getKeyName(int key_code) const;
-
- /// Convert letter/name of key to its ASCII value.
- Qt::Key getKeyValue(const QString& text) const;
-
- /// Set button text to name of key pressed.
- void setKey();
-
-private slots:
- /// Event handler for all button released() event.
- void handleClick();
+ /// Each input is represented by a QPushButton.
+ std::map<Settings::NativeInput::Values, QPushButton*> button_map;
+ /// Each input is configured to respond to the press of a Qt::Key.
+ std::map<Settings::NativeInput::Values, Qt::Key> key_map;
+ /// Load configuration settings.
+ void loadConfiguration();
/// Restore all buttons to their default values.
void restoreDefaults();
+ /// Update UI to reflect current configuration.
+ void updateButtonLabels();
+
+ /// Called when the button corresponding to input_id was pressed.
+ void handleClick(Settings::NativeInput::Values input_id);
+ /// Handle key press events.
+ void keyPressEvent(QKeyEvent* event) override;
+ /// Configure input input_id to respond to key key_pressed.
+ void setInput(Settings::NativeInput::Values input_id, Qt::Key key_pressed);
};
diff --git a/src/citra_qt/debugger/callstack.h b/src/citra_qt/debugger/callstack.h
index 765757986..f04ab9c7e 100644
--- a/src/citra_qt/debugger/callstack.h
+++ b/src/citra_qt/debugger/callstack.h
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#pragma once
+
#include <QDockWidget>
#include "ui_callstack.h"
@@ -11,7 +13,7 @@ class CallstackWidget : public QDockWidget {
Q_OBJECT
public:
- CallstackWidget(QWidget* parent = nullptr);
+ explicit CallstackWidget(QWidget* parent = nullptr);
public slots:
void OnDebugModeEntered();
diff --git a/src/citra_qt/debugger/disassembler.h b/src/citra_qt/debugger/disassembler.h
index 2ca6c2bd4..895f6ac89 100644
--- a/src/citra_qt/debugger/disassembler.h
+++ b/src/citra_qt/debugger/disassembler.h
@@ -17,7 +17,7 @@ class DisassemblerModel : public QAbstractListModel {
Q_OBJECT
public:
- DisassemblerModel(QObject* parent);
+ explicit DisassemblerModel(QObject* parent);
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp
index ef6712bfa..ef337827a 100644
--- a/src/citra_qt/debugger/graphics.cpp
+++ b/src/citra_qt/debugger/graphics.cpp
@@ -22,15 +22,15 @@ QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) con
return QVariant();
int command_index = index.row();
- const GSP_GPU::Command& command = GetDebugger()->ReadGXCommandHistory(command_index);
+ const Service::GSP::Command& command = GetDebugger()->ReadGXCommandHistory(command_index);
if (role == Qt::DisplayRole) {
- std::map<GSP_GPU::CommandId, const char*> command_names = {
- {GSP_GPU::CommandId::REQUEST_DMA, "REQUEST_DMA"},
- {GSP_GPU::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST"},
- {GSP_GPU::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL"},
- {GSP_GPU::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER"},
- {GSP_GPU::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY"},
- {GSP_GPU::CommandId::CACHE_FLUSH, "CACHE_FLUSH"},
+ std::map<Service::GSP::CommandId, const char*> command_names = {
+ {Service::GSP::CommandId::REQUEST_DMA, "REQUEST_DMA"},
+ {Service::GSP::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST"},
+ {Service::GSP::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL"},
+ {Service::GSP::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER"},
+ {Service::GSP::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY"},
+ {Service::GSP::CommandId::CACHE_FLUSH, "CACHE_FLUSH"},
};
const u32* command_data = reinterpret_cast<const u32*>(&command);
QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9")
diff --git a/src/citra_qt/debugger/graphics.h b/src/citra_qt/debugger/graphics.h
index bedf3e596..8837fb792 100644
--- a/src/citra_qt/debugger/graphics.h
+++ b/src/citra_qt/debugger/graphics.h
@@ -13,7 +13,7 @@ class GPUCommandStreamItemModel : public QAbstractListModel,
Q_OBJECT
public:
- GPUCommandStreamItemModel(QObject* parent);
+ explicit GPUCommandStreamItemModel(QObject* parent);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
diff --git a/src/citra_qt/debugger/graphics_breakpoints.h b/src/citra_qt/debugger/graphics_breakpoints.h
index 5fc40c916..bec72a2db 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.h
+++ b/src/citra_qt/debugger/graphics_breakpoints.h
@@ -20,8 +20,8 @@ class GraphicsBreakPointsWidget : public QDockWidget, Pica::DebugContext::BreakP
using Event = Pica::DebugContext::Event;
public:
- GraphicsBreakPointsWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
+ explicit GraphicsBreakPointsWidget(std::shared_ptr<Pica::DebugContext> debug_context,
+ QWidget* parent = nullptr);
void OnPicaBreakPointHit(Pica::DebugContext::Event event, void* data) override;
void OnPicaResume() override;
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 8a784d108..98b619dea 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics_cmdlists.cpp
@@ -21,7 +21,8 @@
#include "video_core/pica.h"
#include "video_core/pica_state.h"
-QImage LoadTexture(u8* src, const Pica::DebugUtils::TextureInfo& info) {
+namespace {
+QImage LoadTexture(const u8* src, const Pica::DebugUtils::TextureInfo& info) {
QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
for (int y = 0; y < info.height; ++y) {
for (int x = 0; x < info.width; ++x) {
@@ -35,7 +36,8 @@ QImage LoadTexture(u8* src, const Pica::DebugUtils::TextureInfo& info) {
class TextureInfoWidget : public QWidget {
public:
- TextureInfoWidget(u8* src, const Pica::DebugUtils::TextureInfo& info, QWidget* parent = nullptr)
+ TextureInfoWidget(const u8* src, const Pica::DebugUtils::TextureInfo& info,
+ QWidget* parent = nullptr)
: QWidget(parent) {
QLabel* image_widget = new QLabel;
QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info));
@@ -47,6 +49,7 @@ public:
setLayout(layout);
}
};
+} // Anonymous namespace
GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {}
@@ -65,7 +68,6 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
const auto& write = pica_trace.writes[index.row()];
if (role == Qt::DisplayRole) {
- QString content;
switch (index.column()) {
case 0:
return QString::fromLatin1(Pica::Regs::GetCommandName(write.cmd_id).c_str());
@@ -122,19 +124,21 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) ||
COMMAND_IN_RANGE(command_id, texture2)) {
- unsigned index;
+ unsigned texture_index;
if (COMMAND_IN_RANGE(command_id, texture0)) {
- index = 0;
+ texture_index = 0;
} else if (COMMAND_IN_RANGE(command_id, texture1)) {
- index = 1;
+ texture_index = 1;
} else if (COMMAND_IN_RANGE(command_id, texture2)) {
- index = 2;
+ texture_index = 2;
} else {
UNREACHABLE_MSG("Unknown texture command");
}
- auto config = Pica::g_state.regs.GetTextures()[index].config;
- auto format = Pica::g_state.regs.GetTextures()[index].format;
- auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
+
+ const auto texture = Pica::g_state.regs.GetTextures()[texture_index];
+ const auto config = texture.config;
+ const auto format = texture.format;
+ const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
// TODO: Open a surface debugger
}
@@ -148,19 +152,21 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) ||
COMMAND_IN_RANGE(command_id, texture2)) {
- unsigned index;
+ unsigned texture_index;
if (COMMAND_IN_RANGE(command_id, texture0)) {
- index = 0;
+ texture_index = 0;
} else if (COMMAND_IN_RANGE(command_id, texture1)) {
- index = 1;
+ texture_index = 1;
} else {
- index = 2;
+ texture_index = 2;
}
- auto config = Pica::g_state.regs.GetTextures()[index].config;
- auto format = Pica::g_state.regs.GetTextures()[index].format;
- auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
- u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress());
+ const auto texture = Pica::g_state.regs.GetTextures()[texture_index];
+ const auto config = texture.config;
+ const auto format = texture.format;
+
+ const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
+ const u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress());
new_info_widget = new TextureInfoWidget(src, info);
}
if (command_info_widget) {
diff --git a/src/citra_qt/debugger/graphics_cmdlists.h b/src/citra_qt/debugger/graphics_cmdlists.h
index fa2b9122b..8f40b94c5 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.h
+++ b/src/citra_qt/debugger/graphics_cmdlists.h
@@ -20,7 +20,7 @@ public:
CommandIdRole = Qt::UserRole,
};
- GPUCommandListModel(QObject* parent);
+ explicit GPUCommandListModel(QObject* parent);
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
@@ -39,7 +39,7 @@ class GPUCommandListWidget : public QDockWidget {
Q_OBJECT
public:
- GPUCommandListWidget(QWidget* parent = nullptr);
+ explicit GPUCommandListWidget(QWidget* parent = nullptr);
public slots:
void OnToggleTracing();
diff --git a/src/citra_qt/debugger/graphics_surface.h b/src/citra_qt/debugger/graphics_surface.h
index 21e6b5b8b..19ffb55fb 100644
--- a/src/citra_qt/debugger/graphics_surface.h
+++ b/src/citra_qt/debugger/graphics_surface.h
@@ -18,7 +18,8 @@ class SurfacePicture : public QLabel {
Q_OBJECT
public:
- SurfacePicture(QWidget* parent = 0, GraphicsSurfaceWidget* surface_widget = nullptr);
+ explicit SurfacePicture(QWidget* parent = nullptr,
+ GraphicsSurfaceWidget* surface_widget = nullptr);
~SurfacePicture();
protected slots:
@@ -71,8 +72,8 @@ class GraphicsSurfaceWidget : public BreakPointObserverDock {
static unsigned int NibblesPerPixel(Format format);
public:
- GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
+ explicit GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext> debug_context,
+ QWidget* parent = nullptr);
void Pick(int x, int y);
public slots:
diff --git a/src/citra_qt/debugger/graphics_tracing.h b/src/citra_qt/debugger/graphics_tracing.h
index e04a3dac3..20acc91e7 100644
--- a/src/citra_qt/debugger/graphics_tracing.h
+++ b/src/citra_qt/debugger/graphics_tracing.h
@@ -12,8 +12,8 @@ class GraphicsTracingWidget : public BreakPointObserverDock {
Q_OBJECT
public:
- GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
+ explicit GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
+ QWidget* parent = nullptr);
private slots:
void StartRecording();
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.h b/src/citra_qt/debugger/graphics_vertex_shader.h
index ec42f24bb..6e62fbb9b 100644
--- a/src/citra_qt/debugger/graphics_vertex_shader.h
+++ b/src/citra_qt/debugger/graphics_vertex_shader.h
@@ -19,7 +19,7 @@ class GraphicsVertexShaderModel : public QAbstractTableModel {
Q_OBJECT
public:
- GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent);
+ explicit GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent);
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
diff --git a/src/citra_qt/debugger/profiler.h b/src/citra_qt/debugger/profiler.h
index d8c6487aa..c8912fd5a 100644
--- a/src/citra_qt/debugger/profiler.h
+++ b/src/citra_qt/debugger/profiler.h
@@ -15,7 +15,7 @@ class ProfilerModel : public QAbstractItemModel {
Q_OBJECT
public:
- ProfilerModel(QObject* parent);
+ explicit ProfilerModel(QObject* parent);
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
@@ -37,7 +37,7 @@ class ProfilerWidget : public QDockWidget {
Q_OBJECT
public:
- ProfilerWidget(QWidget* parent = nullptr);
+ explicit ProfilerWidget(QWidget* parent = nullptr);
private slots:
void setProfilingInfoUpdateEnabled(bool enable);
@@ -53,7 +53,7 @@ class MicroProfileDialog : public QWidget {
Q_OBJECT
public:
- MicroProfileDialog(QWidget* parent = nullptr);
+ explicit MicroProfileDialog(QWidget* parent = nullptr);
/// Returns a QAction that can be used to toggle visibility of this dialog.
QAction* toggleViewAction();
diff --git a/src/citra_qt/debugger/ramview.h b/src/citra_qt/debugger/ramview.h
index 8043c59e8..d01cea93b 100644
--- a/src/citra_qt/debugger/ramview.h
+++ b/src/citra_qt/debugger/ramview.h
@@ -2,13 +2,15 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#pragma once
+
#include "qhexedit.h"
class GRamView : public QHexEdit {
Q_OBJECT
public:
- GRamView(QWidget* parent = nullptr);
+ explicit GRamView(QWidget* parent = nullptr);
public slots:
void OnCPUStepped();
diff --git a/src/citra_qt/debugger/registers.h b/src/citra_qt/debugger/registers.h
index 54c9a8155..55bda5b59 100644
--- a/src/citra_qt/debugger/registers.h
+++ b/src/citra_qt/debugger/registers.h
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#pragma once
+
#include <QDockWidget>
#include "ui_registers.h"
@@ -13,7 +15,7 @@ class RegistersWidget : public QDockWidget {
Q_OBJECT
public:
- RegistersWidget(QWidget* parent = nullptr);
+ explicit RegistersWidget(QWidget* parent = nullptr);
public slots:
void OnDebugModeEntered();
diff --git a/src/citra_qt/debugger/wait_tree.h b/src/citra_qt/debugger/wait_tree.h
index 5d1d964d1..ee9708fc1 100644
--- a/src/citra_qt/debugger/wait_tree.h
+++ b/src/citra_qt/debugger/wait_tree.h
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#pragma once
+
#include <boost/container/flat_set.hpp>
#include <QAbstractItemModel>
@@ -49,7 +51,7 @@ private:
class WaitTreeText : public WaitTreeItem {
Q_OBJECT
public:
- WaitTreeText(const QString& text);
+ explicit WaitTreeText(const QString& text);
QString GetText() const override;
private:
@@ -65,7 +67,7 @@ public:
class WaitTreeWaitObject : public WaitTreeExpandableItem {
Q_OBJECT
public:
- WaitTreeWaitObject(const Kernel::WaitObject& object);
+ explicit WaitTreeWaitObject(const Kernel::WaitObject& object);
static std::unique_ptr<WaitTreeWaitObject> make(const Kernel::WaitObject& object);
QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@@ -92,7 +94,7 @@ private:
class WaitTreeThread : public WaitTreeWaitObject {
Q_OBJECT
public:
- WaitTreeThread(const Kernel::Thread& thread);
+ explicit WaitTreeThread(const Kernel::Thread& thread);
QString GetText() const override;
QColor GetColor() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@@ -101,35 +103,37 @@ public:
class WaitTreeEvent : public WaitTreeWaitObject {
Q_OBJECT
public:
- WaitTreeEvent(const Kernel::Event& object);
+ explicit WaitTreeEvent(const Kernel::Event& object);
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
};
class WaitTreeMutex : public WaitTreeWaitObject {
Q_OBJECT
public:
- WaitTreeMutex(const Kernel::Mutex& object);
+ explicit WaitTreeMutex(const Kernel::Mutex& object);
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
};
class WaitTreeSemaphore : public WaitTreeWaitObject {
Q_OBJECT
public:
- WaitTreeSemaphore(const Kernel::Semaphore& object);
+ explicit WaitTreeSemaphore(const Kernel::Semaphore& object);
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
};
class WaitTreeTimer : public WaitTreeWaitObject {
Q_OBJECT
public:
- WaitTreeTimer(const Kernel::Timer& object);
+ explicit WaitTreeTimer(const Kernel::Timer& object);
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
};
class WaitTreeMutexList : public WaitTreeExpandableItem {
Q_OBJECT
public:
- WaitTreeMutexList(const boost::container::flat_set<Kernel::SharedPtr<Kernel::Mutex>>& list);
+ explicit WaitTreeMutexList(
+ const boost::container::flat_set<Kernel::SharedPtr<Kernel::Mutex>>& list);
+
QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@@ -140,7 +144,7 @@ private:
class WaitTreeThreadList : public WaitTreeExpandableItem {
Q_OBJECT
public:
- WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list);
+ explicit WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list);
QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@@ -152,7 +156,7 @@ class WaitTreeModel : public QAbstractItemModel {
Q_OBJECT
public:
- WaitTreeModel(QObject* parent = nullptr);
+ explicit WaitTreeModel(QObject* parent = nullptr);
QVariant data(const QModelIndex& index, int role) const override;
QModelIndex index(int row, int column, const QModelIndex& parent) const override;
@@ -171,7 +175,7 @@ class WaitTreeWidget : public QDockWidget {
Q_OBJECT
public:
- WaitTreeWidget(QWidget* parent = nullptr);
+ explicit WaitTreeWidget(QWidget* parent = nullptr);
public slots:
void OnDebugModeEntered();
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp
index 07bc35308..e536628dd 100644
--- a/src/citra_qt/game_list.cpp
+++ b/src/citra_qt/game_list.cpp
@@ -13,7 +13,7 @@
#include "game_list_p.h"
#include "ui_settings.h"
-GameList::GameList(QWidget* parent) {
+GameList::GameList(QWidget* parent) : QWidget{parent} {
QVBoxLayout* layout = new QVBoxLayout;
tree_view = new QTreeView;
@@ -34,8 +34,7 @@ GameList::GameList(QWidget* parent) {
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, "File type");
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, "Size");
- connect(tree_view, SIGNAL(activated(const QModelIndex&)), this,
- SLOT(ValidateEntry(const QModelIndex&)));
+ connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry);
// We must register all custom types with the Qt Automoc system so that we are able to use it
// with
@@ -50,7 +49,7 @@ GameList::~GameList() {
emit ShouldCancelWorker();
}
-void GameList::AddEntry(QList<QStandardItem*> entry_items) {
+void GameList::AddEntry(const QList<QStandardItem*>& entry_items) {
item_model->invisibleRootItem()->appendRow(entry_items);
}
@@ -86,12 +85,13 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
emit ShouldCancelWorker();
GameListWorker* worker = new GameListWorker(dir_path, deep_scan);
- connect(worker, SIGNAL(EntryReady(QList<QStandardItem*>)), this,
- SLOT(AddEntry(QList<QStandardItem*>)), Qt::QueuedConnection);
- connect(worker, SIGNAL(Finished()), this, SLOT(DonePopulating()), Qt::QueuedConnection);
+ connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
+ connect(worker, &GameListWorker::Finished, this, &GameList::DonePopulating,
+ Qt::QueuedConnection);
// Use DirectConnection here because worker->Cancel() is thread-safe and we want it to cancel
// without delay.
- connect(this, SIGNAL(ShouldCancelWorker()), worker, SLOT(Cancel()), Qt::DirectConnection);
+ connect(this, &GameList::ShouldCancelWorker, worker, &GameListWorker::Cancel,
+ Qt::DirectConnection);
QThreadPool::globalInstance()->start(worker);
current_worker = std::move(worker);
@@ -151,6 +151,6 @@ void GameListWorker::run() {
}
void GameListWorker::Cancel() {
- disconnect(this, 0, 0, 0);
+ disconnect(this, nullptr, nullptr, nullptr);
stop_processing = true;
}
diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h
index a22e9bc60..30b2c79a8 100644
--- a/src/citra_qt/game_list.h
+++ b/src/citra_qt/game_list.h
@@ -25,7 +25,7 @@ public:
COLUMN_COUNT, // Number of columns
};
- GameList(QWidget* parent = nullptr);
+ explicit GameList(QWidget* parent = nullptr);
~GameList() override;
void PopulateAsync(const QString& dir_path, bool deep_scan);
@@ -33,18 +33,15 @@ public:
void SaveInterfaceLayout();
void LoadInterfaceLayout();
-public slots:
- void AddEntry(QList<QStandardItem*> entry_items);
-
-private slots:
- void ValidateEntry(const QModelIndex& item);
- void DonePopulating();
-
signals:
void GameChosen(QString game_path);
void ShouldCancelWorker();
private:
+ void AddEntry(const QList<QStandardItem*>& entry_items);
+ void ValidateEntry(const QModelIndex& item);
+ void DonePopulating();
+
QTreeView* tree_view = nullptr;
QStandardItemModel* item_model = nullptr;
GameListWorker* current_worker = nullptr;
diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h
index 350103c6f..46f48c2d8 100644
--- a/src/citra_qt/hotkeys.h
+++ b/src/citra_qt/hotkeys.h
@@ -55,7 +55,7 @@ class GHotkeysDialog : public QWidget {
Q_OBJECT
public:
- GHotkeysDialog(QWidget* parent = nullptr);
+ explicit GHotkeysDialog(QWidget* parent = nullptr);
private:
Ui::hotkeys ui;
diff --git a/src/citra_qt/util/spinbox.h b/src/citra_qt/util/spinbox.h
index a57355cd6..2fa1db3a4 100644
--- a/src/citra_qt/util/spinbox.h
+++ b/src/citra_qt/util/spinbox.h
@@ -42,7 +42,7 @@ class CSpinBox : public QAbstractSpinBox {
Q_OBJECT
public:
- CSpinBox(QWidget* parent = nullptr);
+ explicit CSpinBox(QWidget* parent = nullptr);
void stepBy(int steps) override;
StepEnabled stepEnabled() const override;
diff --git a/src/citra_qt/version.h b/src/citra_qt/version.h
deleted file mode 100644
index 9d5a2b1a2..000000000
--- a/src/citra_qt/version.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-// TODO: Supposed to be generated...
-// GENERATED - Do not edit!
-#ifndef VERSION_H_
-#define VERSION_H_
-#define __BUILD__ "40"
-#define VERSION __BUILD__
-#endif // VERSION_H_