diff options
Diffstat (limited to 'src/citra_qt')
21 files changed, 426 insertions, 187 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index c2d1ad240..47aaeca24 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -12,6 +12,7 @@ set(SRCS | |||
| 12 | debugger/graphics_breakpoints.cpp | 12 | debugger/graphics_breakpoints.cpp |
| 13 | debugger/graphics_cmdlists.cpp | 13 | debugger/graphics_cmdlists.cpp |
| 14 | debugger/graphics_framebuffer.cpp | 14 | debugger/graphics_framebuffer.cpp |
| 15 | debugger/graphics_tracing.cpp | ||
| 15 | debugger/graphics_vertex_shader.cpp | 16 | debugger/graphics_vertex_shader.cpp |
| 16 | debugger/profiler.cpp | 17 | debugger/profiler.cpp |
| 17 | debugger/ramview.cpp | 18 | debugger/ramview.cpp |
| @@ -35,6 +36,7 @@ set(HEADERS | |||
| 35 | debugger/graphics_breakpoints_p.h | 36 | debugger/graphics_breakpoints_p.h |
| 36 | debugger/graphics_cmdlists.h | 37 | debugger/graphics_cmdlists.h |
| 37 | debugger/graphics_framebuffer.h | 38 | debugger/graphics_framebuffer.h |
| 39 | debugger/graphics_tracing.h | ||
| 38 | debugger/graphics_vertex_shader.h | 40 | debugger/graphics_vertex_shader.h |
| 39 | debugger/profiler.h | 41 | debugger/profiler.h |
| 40 | debugger/ramview.h | 42 | debugger/ramview.h |
| @@ -73,7 +75,9 @@ target_link_libraries(citra-qt core common video_core qhexedit) | |||
| 73 | target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) | 75 | target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) |
| 74 | target_link_libraries(citra-qt ${PLATFORM_LIBRARIES}) | 76 | target_link_libraries(citra-qt ${PLATFORM_LIBRARIES}) |
| 75 | 77 | ||
| 76 | #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) | 78 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") |
| 79 | install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | ||
| 80 | endif() | ||
| 77 | 81 | ||
| 78 | if (Qt5_FOUND AND MSVC) | 82 | if (Qt5_FOUND AND MSVC) |
| 79 | set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin") | 83 | set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin") |
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 3db09c65b..b12bd858b 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -11,6 +11,10 @@ | |||
| 11 | #include "bootmanager.h" | 11 | #include "bootmanager.h" |
| 12 | #include "main.h" | 12 | #include "main.h" |
| 13 | 13 | ||
| 14 | #include "common/string_util.h" | ||
| 15 | #include "common/scm_rev.h" | ||
| 16 | #include "common/key_map.h" | ||
| 17 | |||
| 14 | #include "core/core.h" | 18 | #include "core/core.h" |
| 15 | #include "core/settings.h" | 19 | #include "core/settings.h" |
| 16 | #include "core/system.h" | 20 | #include "core/system.h" |
| @@ -61,7 +65,7 @@ void EmuThread::run() { | |||
| 61 | was_active = false; | 65 | was_active = false; |
| 62 | } else { | 66 | } else { |
| 63 | std::unique_lock<std::mutex> lock(running_mutex); | 67 | std::unique_lock<std::mutex> lock(running_mutex); |
| 64 | running_cv.wait(lock, [this]{ return IsRunning() || stop_run; }); | 68 | running_cv.wait(lock, [this]{ return IsRunning() || exec_step || stop_run; }); |
| 65 | } | 69 | } |
| 66 | } | 70 | } |
| 67 | 71 | ||
| @@ -244,32 +248,9 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) | |||
| 244 | 248 | ||
| 245 | void GRenderWindow::ReloadSetKeymaps() | 249 | void GRenderWindow::ReloadSetKeymaps() |
| 246 | { | 250 | { |
| 247 | KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, Service::HID::PAD_A); | 251 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 248 | KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, Service::HID::PAD_B); | 252 | KeyMap::SetKeyMapping({Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, Service::HID::pad_mapping[i]); |
| 249 | KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, Service::HID::PAD_SELECT); | 253 | } |
| 250 | KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, Service::HID::PAD_START); | ||
| 251 | KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, Service::HID::PAD_RIGHT); | ||
| 252 | KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, Service::HID::PAD_LEFT); | ||
| 253 | KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, Service::HID::PAD_UP); | ||
| 254 | KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, Service::HID::PAD_DOWN); | ||
| 255 | KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, Service::HID::PAD_R); | ||
| 256 | KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, Service::HID::PAD_L); | ||
| 257 | KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, Service::HID::PAD_X); | ||
| 258 | KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, Service::HID::PAD_Y); | ||
| 259 | |||
| 260 | KeyMap::SetKeyMapping({Settings::values.pad_zl_key, keyboard_id}, Service::HID::PAD_ZL); | ||
| 261 | KeyMap::SetKeyMapping({Settings::values.pad_zr_key, keyboard_id}, Service::HID::PAD_ZR); | ||
| 262 | |||
| 263 | // KeyMap::SetKeyMapping({Settings::values.pad_touch_key, keyboard_id}, Service::HID::PAD_TOUCH); | ||
| 264 | |||
| 265 | KeyMap::SetKeyMapping({Settings::values.pad_cright_key, keyboard_id}, Service::HID::PAD_C_RIGHT); | ||
| 266 | KeyMap::SetKeyMapping({Settings::values.pad_cleft_key, keyboard_id}, Service::HID::PAD_C_LEFT); | ||
| 267 | KeyMap::SetKeyMapping({Settings::values.pad_cup_key, keyboard_id}, Service::HID::PAD_C_UP); | ||
| 268 | KeyMap::SetKeyMapping({Settings::values.pad_cdown_key, keyboard_id}, Service::HID::PAD_C_DOWN); | ||
| 269 | KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, Service::HID::PAD_CIRCLE_RIGHT); | ||
| 270 | KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, Service::HID::PAD_CIRCLE_LEFT); | ||
| 271 | KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, Service::HID::PAD_CIRCLE_UP); | ||
| 272 | KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, Service::HID::PAD_CIRCLE_DOWN); | ||
| 273 | } | 254 | } |
| 274 | 255 | ||
| 275 | void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) | 256 | void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) |
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 475124319..1a1e0e6a5 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h | |||
| @@ -35,7 +35,10 @@ public: | |||
| 35 | * Steps the emulation thread by a single CPU instruction (if the CPU is not already running) | 35 | * Steps the emulation thread by a single CPU instruction (if the CPU is not already running) |
| 36 | * @note This function is thread-safe | 36 | * @note This function is thread-safe |
| 37 | */ | 37 | */ |
| 38 | void ExecStep() { exec_step = true; } | 38 | void ExecStep() { |
| 39 | exec_step = true; | ||
| 40 | running_cv.notify_all(); | ||
| 41 | } | ||
| 39 | 42 | ||
| 40 | /** | 43 | /** |
| 41 | * Sets whether the emulation thread is running or not | 44 | * Sets whether the emulation thread is running or not |
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 2a9af1f38..5716634ee 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -2,11 +2,11 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QSettings> | ||
| 5 | #include <QString> | 6 | #include <QString> |
| 6 | #include <QStringList> | 7 | #include <QStringList> |
| 7 | 8 | ||
| 8 | #include "core/settings.h" | 9 | #include "core/settings.h" |
| 9 | #include "core/core.h" | ||
| 10 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 11 | 11 | ||
| 12 | #include "config.h" | 12 | #include "config.h" |
| @@ -21,31 +21,21 @@ Config::Config() { | |||
| 21 | Reload(); | 21 | Reload(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | static const std::array<QVariant, Settings::NativeInput::NUM_INPUTS> defaults = { | ||
| 25 | Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, | ||
| 26 | Qt::Key_Q, Qt::Key_W, Qt::Key_1, Qt::Key_2, | ||
| 27 | Qt::Key_M, Qt::Key_N, Qt::Key_B, | ||
| 28 | Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H, | ||
| 29 | Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, | ||
| 30 | Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L | ||
| 31 | }; | ||
| 32 | |||
| 24 | void Config::ReadValues() { | 33 | void Config::ReadValues() { |
| 25 | qt_config->beginGroup("Controls"); | 34 | qt_config->beginGroup("Controls"); |
| 26 | Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt(); | 35 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 27 | Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt(); | 36 | Settings::values.input_mappings[Settings::NativeInput::All[i]] = |
| 28 | Settings::values.pad_x_key = qt_config->value("pad_x", Qt::Key_Z).toInt(); | 37 | qt_config->value(QString::fromStdString(Settings::NativeInput::Mapping[i]), defaults[i]).toInt(); |
| 29 | Settings::values.pad_y_key = qt_config->value("pad_y", Qt::Key_X).toInt(); | 38 | } |
| 30 | Settings::values.pad_l_key = qt_config->value("pad_l", Qt::Key_Q).toInt(); | ||
| 31 | Settings::values.pad_r_key = qt_config->value("pad_r", Qt::Key_W).toInt(); | ||
| 32 | Settings::values.pad_zl_key = qt_config->value("pad_zl", Qt::Key_1).toInt(); | ||
| 33 | Settings::values.pad_zr_key = qt_config->value("pad_zr", Qt::Key_2).toInt(); | ||
| 34 | Settings::values.pad_start_key = qt_config->value("pad_start", Qt::Key_M).toInt(); | ||
| 35 | Settings::values.pad_select_key = qt_config->value("pad_select", Qt::Key_N).toInt(); | ||
| 36 | Settings::values.pad_home_key = qt_config->value("pad_home", Qt::Key_B).toInt(); | ||
| 37 | Settings::values.pad_dup_key = qt_config->value("pad_dup", Qt::Key_T).toInt(); | ||
| 38 | Settings::values.pad_ddown_key = qt_config->value("pad_ddown", Qt::Key_G).toInt(); | ||
| 39 | Settings::values.pad_dleft_key = qt_config->value("pad_dleft", Qt::Key_F).toInt(); | ||
| 40 | Settings::values.pad_dright_key = qt_config->value("pad_dright", Qt::Key_H).toInt(); | ||
| 41 | Settings::values.pad_sup_key = qt_config->value("pad_sup", Qt::Key_Up).toInt(); | ||
| 42 | Settings::values.pad_sdown_key = qt_config->value("pad_sdown", Qt::Key_Down).toInt(); | ||
| 43 | Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt(); | ||
| 44 | Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt(); | ||
| 45 | Settings::values.pad_cup_key = qt_config->value("pad_cup", Qt::Key_I).toInt(); | ||
| 46 | Settings::values.pad_cdown_key = qt_config->value("pad_cdown", Qt::Key_K).toInt(); | ||
| 47 | Settings::values.pad_cleft_key = qt_config->value("pad_cleft", Qt::Key_J).toInt(); | ||
| 48 | Settings::values.pad_cright_key = qt_config->value("pad_cright", Qt::Key_L).toInt(); | ||
| 49 | qt_config->endGroup(); | 39 | qt_config->endGroup(); |
| 50 | 40 | ||
| 51 | qt_config->beginGroup("Core"); | 41 | qt_config->beginGroup("Core"); |
| @@ -75,29 +65,10 @@ void Config::ReadValues() { | |||
| 75 | 65 | ||
| 76 | void Config::SaveValues() { | 66 | void Config::SaveValues() { |
| 77 | qt_config->beginGroup("Controls"); | 67 | qt_config->beginGroup("Controls"); |
| 78 | qt_config->setValue("pad_a", Settings::values.pad_a_key); | 68 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 79 | qt_config->setValue("pad_b", Settings::values.pad_b_key); | 69 | qt_config->setValue(QString::fromStdString(Settings::NativeInput::Mapping[i]), |
| 80 | qt_config->setValue("pad_x", Settings::values.pad_x_key); | 70 | Settings::values.input_mappings[Settings::NativeInput::All[i]]); |
| 81 | qt_config->setValue("pad_y", Settings::values.pad_y_key); | 71 | } |
| 82 | qt_config->setValue("pad_l", Settings::values.pad_l_key); | ||
| 83 | qt_config->setValue("pad_r", Settings::values.pad_r_key); | ||
| 84 | qt_config->setValue("pad_zl", Settings::values.pad_zl_key); | ||
| 85 | qt_config->setValue("pad_zr", Settings::values.pad_zr_key); | ||
| 86 | qt_config->setValue("pad_start", Settings::values.pad_start_key); | ||
| 87 | qt_config->setValue("pad_select", Settings::values.pad_select_key); | ||
| 88 | qt_config->setValue("pad_home", Settings::values.pad_home_key); | ||
| 89 | qt_config->setValue("pad_dup", Settings::values.pad_dup_key); | ||
| 90 | qt_config->setValue("pad_ddown", Settings::values.pad_ddown_key); | ||
| 91 | qt_config->setValue("pad_dleft", Settings::values.pad_dleft_key); | ||
| 92 | qt_config->setValue("pad_dright", Settings::values.pad_dright_key); | ||
| 93 | qt_config->setValue("pad_sup", Settings::values.pad_sup_key); | ||
| 94 | qt_config->setValue("pad_sdown", Settings::values.pad_sdown_key); | ||
| 95 | qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key); | ||
| 96 | qt_config->setValue("pad_sright", Settings::values.pad_sright_key); | ||
| 97 | qt_config->setValue("pad_cup", Settings::values.pad_cup_key); | ||
| 98 | qt_config->setValue("pad_cdown", Settings::values.pad_cdown_key); | ||
| 99 | qt_config->setValue("pad_cleft", Settings::values.pad_cleft_key); | ||
| 100 | qt_config->setValue("pad_cright", Settings::values.pad_cright_key); | ||
| 101 | qt_config->endGroup(); | 72 | qt_config->endGroup(); |
| 102 | 73 | ||
| 103 | qt_config->beginGroup("Core"); | 74 | qt_config->beginGroup("Core"); |
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h index 4485cae73..dd0b2ef0b 100644 --- a/src/citra_qt/config.h +++ b/src/citra_qt/config.h | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <QSettings> | 7 | #include <string> |
| 8 | 8 | ||
| 9 | #include "common/common_types.h" | 9 | class QSettings; |
| 10 | 10 | ||
| 11 | class Config { | 11 | class Config { |
| 12 | QSettings* qt_config; | 12 | QSettings* qt_config; |
diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index e99ec1b30..1e5ef5299 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QShortcut> | ||
| 6 | |||
| 5 | #include "disassembler.h" | 7 | #include "disassembler.h" |
| 6 | 8 | ||
| 7 | #include "../bootmanager.h" | 9 | #include "../bootmanager.h" |
| @@ -13,7 +15,6 @@ | |||
| 13 | #include "common/break_points.h" | 15 | #include "common/break_points.h" |
| 14 | #include "common/symbols.h" | 16 | #include "common/symbols.h" |
| 15 | #include "core/arm/arm_interface.h" | 17 | #include "core/arm/arm_interface.h" |
| 16 | #include "core/arm/skyeye_common/armdefs.h" | ||
| 17 | #include "core/arm/disassembler/arm_disasm.h" | 18 | #include "core/arm/disassembler/arm_disasm.h" |
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -217,7 +218,7 @@ void DisassemblerWidget::OnToggleStartStop() { | |||
| 217 | } | 218 | } |
| 218 | 219 | ||
| 219 | void DisassemblerWidget::OnDebugModeEntered() { | 220 | void DisassemblerWidget::OnDebugModeEntered() { |
| 220 | ARMword next_instr = Core::g_app_core->GetPC(); | 221 | u32 next_instr = Core::g_app_core->GetPC(); |
| 221 | 222 | ||
| 222 | if (model->GetBreakPoints().IsAddressBreakPoint(next_instr)) | 223 | if (model->GetBreakPoints().IsAddressBreakPoint(next_instr)) |
| 223 | emu_thread->SetRunning(false); | 224 | emu_thread->SetRunning(false); |
diff --git a/src/citra_qt/debugger/graphics_breakpoint_observer.h b/src/citra_qt/debugger/graphics_breakpoint_observer.h index f0d3361f8..02a0f4f4f 100644 --- a/src/citra_qt/debugger/graphics_breakpoint_observer.h +++ b/src/citra_qt/debugger/graphics_breakpoint_observer.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | * This is because the Pica breakpoint callbacks are called from a non-GUI thread, while | 13 | * This is because the Pica breakpoint callbacks are called from a non-GUI thread, while |
| 14 | * the widget usually wants to perform reactions in the GUI thread. | 14 | * the widget usually wants to perform reactions in the GUI thread. |
| 15 | */ | 15 | */ |
| 16 | class BreakPointObserverDock : public QDockWidget, private Pica::DebugContext::BreakPointObserver { | 16 | class BreakPointObserverDock : public QDockWidget, protected Pica::DebugContext::BreakPointObserver { |
| 17 | Q_OBJECT | 17 | Q_OBJECT |
| 18 | 18 | ||
| 19 | public: | 19 | public: |
diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index 1da64f616..5202c168c 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <QMetaType> | 5 | #include <QMetaType> |
| 6 | #include <QPushButton> | 6 | #include <QPushButton> |
| 7 | #include <QTreeWidget> | 7 | #include <QTreeView> |
| 8 | #include <QVBoxLayout> | 8 | #include <QVBoxLayout> |
| 9 | #include <QLabel> | 9 | #include <QLabel> |
| 10 | 10 | ||
| @@ -23,7 +23,7 @@ BreakPointModel::BreakPointModel(std::shared_ptr<Pica::DebugContext> debug_conte | |||
| 23 | 23 | ||
| 24 | int BreakPointModel::columnCount(const QModelIndex& parent) const | 24 | int BreakPointModel::columnCount(const QModelIndex& parent) const |
| 25 | { | 25 | { |
| 26 | return 2; | 26 | return 1; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | int BreakPointModel::rowCount(const QModelIndex& parent) const | 29 | int BreakPointModel::rowCount(const QModelIndex& parent) const |
| @@ -38,29 +38,29 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const | |||
| 38 | switch (role) { | 38 | switch (role) { |
| 39 | case Qt::DisplayRole: | 39 | case Qt::DisplayRole: |
| 40 | { | 40 | { |
| 41 | switch (index.column()) { | 41 | if (index.column() == 0) { |
| 42 | case 0: | ||
| 43 | { | ||
| 44 | static const std::map<Pica::DebugContext::Event, QString> map = { | 42 | static const std::map<Pica::DebugContext::Event, QString> map = { |
| 45 | { Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded") }, | 43 | { Pica::DebugContext::Event::PicaCommandLoaded, tr("Pica command loaded") }, |
| 46 | { Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed") }, | 44 | { Pica::DebugContext::Event::PicaCommandProcessed, tr("Pica command processed") }, |
| 47 | { Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch") }, | 45 | { Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch") }, |
| 48 | { Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch") }, | 46 | { Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch") }, |
| 49 | { Pica::DebugContext::Event::VertexLoaded, tr("Vertex loaded") } | 47 | { Pica::DebugContext::Event::VertexLoaded, tr("Vertex loaded") }, |
| 48 | { Pica::DebugContext::Event::IncomingDisplayTransfer, tr("Incoming display transfer") }, | ||
| 49 | { Pica::DebugContext::Event::GSPCommandProcessed, tr("GSP command processed") }, | ||
| 50 | { Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped") } | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | DEBUG_ASSERT(map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents)); | 53 | DEBUG_ASSERT(map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents)); |
| 53 | |||
| 54 | return (map.find(event) != map.end()) ? map.at(event) : QString(); | 54 | return (map.find(event) != map.end()) ? map.at(event) : QString(); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | case 1: | 57 | break; |
| 58 | return data(index, Role_IsEnabled).toBool() ? tr("Enabled") : tr("Disabled"); | 58 | } |
| 59 | |||
| 60 | default: | ||
| 61 | break; | ||
| 62 | } | ||
| 63 | 59 | ||
| 60 | case Qt::CheckStateRole: | ||
| 61 | { | ||
| 62 | if (index.column() == 0) | ||
| 63 | return data(index, Role_IsEnabled).toBool() ? Qt::Checked : Qt::Unchecked; | ||
| 64 | break; | 64 | break; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| @@ -84,37 +84,34 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const | |||
| 84 | return QVariant(); | 84 | return QVariant(); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | QVariant BreakPointModel::headerData(int section, Qt::Orientation orientation, int role) const | 87 | Qt::ItemFlags BreakPointModel::flags(const QModelIndex &index) const |
| 88 | { | 88 | { |
| 89 | switch(role) { | 89 | if (!index.isValid()) |
| 90 | case Qt::DisplayRole: | 90 | return 0; |
| 91 | { | ||
| 92 | if (section == 0) { | ||
| 93 | return tr("Event"); | ||
| 94 | } else if (section == 1) { | ||
| 95 | return tr("Status"); | ||
| 96 | } | ||
| 97 | |||
| 98 | break; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | 91 | ||
| 102 | return QVariant(); | 92 | Qt::ItemFlags flags = Qt::ItemIsEnabled; |
| 93 | if (index.column() == 0) | ||
| 94 | flags |= Qt::ItemIsUserCheckable; | ||
| 95 | return flags; | ||
| 103 | } | 96 | } |
| 104 | 97 | ||
| 98 | |||
| 105 | bool BreakPointModel::setData(const QModelIndex& index, const QVariant& value, int role) | 99 | bool BreakPointModel::setData(const QModelIndex& index, const QVariant& value, int role) |
| 106 | { | 100 | { |
| 107 | const auto event = static_cast<Pica::DebugContext::Event>(index.row()); | 101 | const auto event = static_cast<Pica::DebugContext::Event>(index.row()); |
| 108 | 102 | ||
| 109 | switch (role) { | 103 | switch (role) { |
| 110 | case Role_IsEnabled: | 104 | case Qt::CheckStateRole: |
| 111 | { | 105 | { |
| 106 | if (index.column() != 0) | ||
| 107 | return false; | ||
| 108 | |||
| 112 | auto context = context_weak.lock(); | 109 | auto context = context_weak.lock(); |
| 113 | if (!context) | 110 | if (!context) |
| 114 | return false; | 111 | return false; |
| 115 | 112 | ||
| 116 | context->breakpoints[event].enabled = value.toBool(); | 113 | context->breakpoints[event].enabled = value == Qt::Checked; |
| 117 | QModelIndex changed_index = createIndex(index.row(), 1); | 114 | QModelIndex changed_index = createIndex(index.row(), 0); |
| 118 | emit dataChanged(changed_index, changed_index); | 115 | emit dataChanged(changed_index, changed_index); |
| 119 | return true; | 116 | return true; |
| 120 | } | 117 | } |
| @@ -133,7 +130,7 @@ void BreakPointModel::OnBreakPointHit(Pica::DebugContext::Event event) | |||
| 133 | active_breakpoint = context->active_breakpoint; | 130 | active_breakpoint = context->active_breakpoint; |
| 134 | at_breakpoint = context->at_breakpoint; | 131 | at_breakpoint = context->at_breakpoint; |
| 135 | emit dataChanged(createIndex(static_cast<int>(event), 0), | 132 | emit dataChanged(createIndex(static_cast<int>(event), 0), |
| 136 | createIndex(static_cast<int>(event), 1)); | 133 | createIndex(static_cast<int>(event), 0)); |
| 137 | } | 134 | } |
| 138 | 135 | ||
| 139 | void BreakPointModel::OnResumed() | 136 | void BreakPointModel::OnResumed() |
| @@ -144,7 +141,7 @@ void BreakPointModel::OnResumed() | |||
| 144 | 141 | ||
| 145 | at_breakpoint = context->at_breakpoint; | 142 | at_breakpoint = context->at_breakpoint; |
| 146 | emit dataChanged(createIndex(static_cast<int>(active_breakpoint), 0), | 143 | emit dataChanged(createIndex(static_cast<int>(active_breakpoint), 0), |
| 147 | createIndex(static_cast<int>(active_breakpoint), 1)); | 144 | createIndex(static_cast<int>(active_breakpoint), 0)); |
| 148 | active_breakpoint = context->active_breakpoint; | 145 | active_breakpoint = context->active_breakpoint; |
| 149 | } | 146 | } |
| 150 | 147 | ||
| @@ -162,13 +159,15 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(std::shared_ptr<Pica::Debug | |||
| 162 | 159 | ||
| 163 | breakpoint_model = new BreakPointModel(debug_context, this); | 160 | breakpoint_model = new BreakPointModel(debug_context, this); |
| 164 | breakpoint_list = new QTreeView; | 161 | breakpoint_list = new QTreeView; |
| 162 | breakpoint_list->setRootIsDecorated(false); | ||
| 163 | breakpoint_list->setHeaderHidden(true); | ||
| 165 | breakpoint_list->setModel(breakpoint_model); | 164 | breakpoint_list->setModel(breakpoint_model); |
| 166 | 165 | ||
| 167 | toggle_breakpoint_button = new QPushButton(tr("Enable")); | ||
| 168 | toggle_breakpoint_button->setEnabled(false); | ||
| 169 | |||
| 170 | qRegisterMetaType<Pica::DebugContext::Event>("Pica::DebugContext::Event"); | 166 | qRegisterMetaType<Pica::DebugContext::Event>("Pica::DebugContext::Event"); |
| 171 | 167 | ||
| 168 | connect(breakpoint_list, SIGNAL(doubleClicked(const QModelIndex&)), | ||
| 169 | this, SLOT(OnItemDoubleClicked(const QModelIndex&))); | ||
| 170 | |||
| 172 | connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested())); | 171 | connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested())); |
| 173 | 172 | ||
| 174 | connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event,void*)), | 173 | connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event,void*)), |
| @@ -184,11 +183,6 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(std::shared_ptr<Pica::Debug | |||
| 184 | connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&,const QModelIndex&)), | 183 | connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&,const QModelIndex&)), |
| 185 | breakpoint_model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&))); | 184 | breakpoint_model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&))); |
| 186 | 185 | ||
| 187 | connect(breakpoint_list->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), | ||
| 188 | this, SLOT(OnBreakpointSelectionChanged(QModelIndex))); | ||
| 189 | |||
| 190 | connect(toggle_breakpoint_button, SIGNAL(clicked()), this, SLOT(OnToggleBreakpointEnabled())); | ||
| 191 | |||
| 192 | QWidget* main_widget = new QWidget; | 186 | QWidget* main_widget = new QWidget; |
| 193 | auto main_layout = new QVBoxLayout; | 187 | auto main_layout = new QVBoxLayout; |
| 194 | { | 188 | { |
| @@ -198,7 +192,6 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(std::shared_ptr<Pica::Debug | |||
| 198 | main_layout->addLayout(sub_layout); | 192 | main_layout->addLayout(sub_layout); |
| 199 | } | 193 | } |
| 200 | main_layout->addWidget(breakpoint_list); | 194 | main_layout->addWidget(breakpoint_list); |
| 201 | main_layout->addWidget(toggle_breakpoint_button); | ||
| 202 | main_widget->setLayout(main_layout); | 195 | main_widget->setLayout(main_layout); |
| 203 | 196 | ||
| 204 | setWidget(main_widget); | 197 | setWidget(main_widget); |
| @@ -234,32 +227,15 @@ void GraphicsBreakPointsWidget::OnResumeRequested() | |||
| 234 | context->Resume(); | 227 | context->Resume(); |
| 235 | } | 228 | } |
| 236 | 229 | ||
| 237 | void GraphicsBreakPointsWidget::OnBreakpointSelectionChanged(const QModelIndex& index) | 230 | void GraphicsBreakPointsWidget::OnItemDoubleClicked(const QModelIndex& index) |
| 238 | { | 231 | { |
| 239 | if (!index.isValid()) { | 232 | if (!index.isValid()) |
| 240 | toggle_breakpoint_button->setEnabled(false); | ||
| 241 | return; | 233 | return; |
| 242 | } | ||
| 243 | 234 | ||
| 244 | toggle_breakpoint_button->setEnabled(true); | 235 | QModelIndex check_index = breakpoint_list->model()->index(index.row(), 0); |
| 245 | UpdateToggleBreakpointButton(index); | 236 | QVariant enabled = breakpoint_list->model()->data(check_index, Qt::CheckStateRole); |
| 246 | } | 237 | QVariant new_state = Qt::Unchecked; |
| 247 | 238 | if (enabled == Qt::Unchecked) | |
| 248 | void GraphicsBreakPointsWidget::OnToggleBreakpointEnabled() | 239 | new_state = Qt::Checked; |
| 249 | { | 240 | breakpoint_list->model()->setData(check_index, new_state, Qt::CheckStateRole); |
| 250 | QModelIndex index = breakpoint_list->selectionModel()->currentIndex(); | ||
| 251 | bool new_state = !(breakpoint_model->data(index, BreakPointModel::Role_IsEnabled).toBool()); | ||
| 252 | |||
| 253 | breakpoint_model->setData(index, new_state, | ||
| 254 | BreakPointModel::Role_IsEnabled); | ||
| 255 | UpdateToggleBreakpointButton(index); | ||
| 256 | } | ||
| 257 | |||
| 258 | void GraphicsBreakPointsWidget::UpdateToggleBreakpointButton(const QModelIndex& index) | ||
| 259 | { | ||
| 260 | if (true == breakpoint_model->data(index, BreakPointModel::Role_IsEnabled).toBool()) { | ||
| 261 | toggle_breakpoint_button->setText(tr("Disable")); | ||
| 262 | } else { | ||
| 263 | toggle_breakpoint_button->setText(tr("Enable")); | ||
| 264 | } | ||
| 265 | } | 241 | } |
diff --git a/src/citra_qt/debugger/graphics_breakpoints.h b/src/citra_qt/debugger/graphics_breakpoints.h index 5b9ba324e..d900729da 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.h +++ b/src/citra_qt/debugger/graphics_breakpoints.h | |||
| @@ -31,10 +31,9 @@ public: | |||
| 31 | 31 | ||
| 32 | public slots: | 32 | public slots: |
| 33 | void OnBreakPointHit(Pica::DebugContext::Event event, void* data); | 33 | void OnBreakPointHit(Pica::DebugContext::Event event, void* data); |
| 34 | void OnItemDoubleClicked(const QModelIndex&); | ||
| 34 | void OnResumeRequested(); | 35 | void OnResumeRequested(); |
| 35 | void OnResumed(); | 36 | void OnResumed(); |
| 36 | void OnBreakpointSelectionChanged(const QModelIndex&); | ||
| 37 | void OnToggleBreakpointEnabled(); | ||
| 38 | 37 | ||
| 39 | signals: | 38 | signals: |
| 40 | void Resumed(); | 39 | void Resumed(); |
| @@ -42,11 +41,8 @@ signals: | |||
| 42 | void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); | 41 | void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); |
| 43 | 42 | ||
| 44 | private: | 43 | private: |
| 45 | void UpdateToggleBreakpointButton(const QModelIndex& index); | ||
| 46 | |||
| 47 | QLabel* status_text; | 44 | QLabel* status_text; |
| 48 | QPushButton* resume_button; | 45 | QPushButton* resume_button; |
| 49 | QPushButton* toggle_breakpoint_button; | ||
| 50 | 46 | ||
| 51 | BreakPointModel* breakpoint_model; | 47 | BreakPointModel* breakpoint_model; |
| 52 | QTreeView* breakpoint_list; | 48 | QTreeView* breakpoint_list; |
diff --git a/src/citra_qt/debugger/graphics_breakpoints_p.h b/src/citra_qt/debugger/graphics_breakpoints_p.h index 34e72e859..00d8d5101 100644 --- a/src/citra_qt/debugger/graphics_breakpoints_p.h +++ b/src/citra_qt/debugger/graphics_breakpoints_p.h | |||
| @@ -23,7 +23,7 @@ public: | |||
| 23 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; | 23 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; |
| 24 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | 24 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
| 25 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | 25 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
| 26 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; | 26 | Qt::ItemFlags flags(const QModelIndex &index) const; |
| 27 | 27 | ||
| 28 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; | 28 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; |
| 29 | 29 | ||
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index cabf5fe07..7ac3ea542 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -2,12 +2,15 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QApplication> | ||
| 6 | #include <QClipboard> | ||
| 5 | #include <QLabel> | 7 | #include <QLabel> |
| 6 | #include <QListView> | 8 | #include <QListView> |
| 7 | #include <QMainWindow> | 9 | #include <QMainWindow> |
| 8 | #include <QPushButton> | 10 | #include <QPushButton> |
| 9 | #include <QVBoxLayout> | 11 | #include <QVBoxLayout> |
| 10 | #include <QTreeView> | 12 | #include <QTreeView> |
| 13 | #include <QHeaderView> | ||
| 11 | #include <QSpinBox> | 14 | #include <QSpinBox> |
| 12 | #include <QComboBox> | 15 | #include <QComboBox> |
| 13 | 16 | ||
| @@ -74,7 +77,7 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo | |||
| 74 | format_choice->addItem(tr("I8")); | 77 | format_choice->addItem(tr("I8")); |
| 75 | format_choice->addItem(tr("A8")); | 78 | format_choice->addItem(tr("A8")); |
| 76 | format_choice->addItem(tr("IA4")); | 79 | format_choice->addItem(tr("IA4")); |
| 77 | format_choice->addItem(tr("UNK10")); | 80 | format_choice->addItem(tr("I4")); |
| 78 | format_choice->addItem(tr("A4")); | 81 | format_choice->addItem(tr("A4")); |
| 79 | format_choice->addItem(tr("ETC1")); | 82 | format_choice->addItem(tr("ETC1")); |
| 80 | format_choice->addItem(tr("ETC1A4")); | 83 | format_choice->addItem(tr("ETC1A4")); |
| @@ -168,11 +171,11 @@ GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(p | |||
| 168 | } | 171 | } |
| 169 | 172 | ||
| 170 | int GPUCommandListModel::rowCount(const QModelIndex& parent) const { | 173 | int GPUCommandListModel::rowCount(const QModelIndex& parent) const { |
| 171 | return pica_trace.writes.size(); | 174 | return static_cast<int>(pica_trace.writes.size()); |
| 172 | } | 175 | } |
| 173 | 176 | ||
| 174 | int GPUCommandListModel::columnCount(const QModelIndex& parent) const { | 177 | int GPUCommandListModel::columnCount(const QModelIndex& parent) const { |
| 175 | return 2; | 178 | return 3; |
| 176 | } | 179 | } |
| 177 | 180 | ||
| 178 | QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { | 181 | QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { |
| @@ -185,14 +188,13 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { | |||
| 185 | 188 | ||
| 186 | if (role == Qt::DisplayRole) { | 189 | if (role == Qt::DisplayRole) { |
| 187 | QString content; | 190 | QString content; |
| 188 | if (index.column() == 0) { | 191 | switch ( index.column() ) { |
| 189 | QString content = QString::fromLatin1(Pica::Regs::GetCommandName(cmd.cmd_id).c_str()); | 192 | case 0: |
| 190 | content.append(" "); | 193 | return QString::fromLatin1(Pica::Regs::GetCommandName(cmd.cmd_id).c_str()); |
| 191 | return content; | 194 | case 1: |
| 192 | } else if (index.column() == 1) { | 195 | return QString("%1").arg(cmd.cmd_id, 3, 16, QLatin1Char('0')); |
| 193 | QString content = QString("%1 ").arg(cmd.hex, 8, 16, QLatin1Char('0')); | 196 | case 2: |
| 194 | content.append(QString("%1 ").arg(val, 8, 16, QLatin1Char('0'))); | 197 | return QString("%1").arg(val, 8, 16, QLatin1Char('0')); |
| 195 | return content; | ||
| 196 | } | 198 | } |
| 197 | } else if (role == CommandIdRole) { | 199 | } else if (role == CommandIdRole) { |
| 198 | return QVariant::fromValue<int>(cmd.cmd_id.Value()); | 200 | return QVariant::fromValue<int>(cmd.cmd_id.Value()); |
| @@ -205,10 +207,13 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio | |||
| 205 | switch(role) { | 207 | switch(role) { |
| 206 | case Qt::DisplayRole: | 208 | case Qt::DisplayRole: |
| 207 | { | 209 | { |
| 208 | if (section == 0) { | 210 | switch (section) { |
| 211 | case 0: | ||
| 209 | return tr("Command Name"); | 212 | return tr("Command Name"); |
| 210 | } else if (section == 1) { | 213 | case 1: |
| 211 | return tr("Data"); | 214 | return tr("Register"); |
| 215 | case 2: | ||
| 216 | return tr("New Value"); | ||
| 212 | } | 217 | } |
| 213 | 218 | ||
| 214 | break; | 219 | break; |
| @@ -297,6 +302,13 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 297 | list_widget->setModel(model); | 302 | list_widget->setModel(model); |
| 298 | list_widget->setFont(QFont("monospace")); | 303 | list_widget->setFont(QFont("monospace")); |
| 299 | list_widget->setRootIsDecorated(false); | 304 | list_widget->setRootIsDecorated(false); |
| 305 | list_widget->setUniformRowHeights(true); | ||
| 306 | |||
| 307 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) | ||
| 308 | list_widget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); | ||
| 309 | #else | ||
| 310 | list_widget->header()->setResizeMode(QHeaderView::ResizeToContents); | ||
| 311 | #endif | ||
| 300 | 312 | ||
| 301 | connect(list_widget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), | 313 | connect(list_widget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), |
| 302 | this, SLOT(SetCommandInfo(const QModelIndex&))); | 314 | this, SLOT(SetCommandInfo(const QModelIndex&))); |
| @@ -304,16 +316,24 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 304 | this, SLOT(OnCommandDoubleClicked(const QModelIndex&))); | 316 | this, SLOT(OnCommandDoubleClicked(const QModelIndex&))); |
| 305 | 317 | ||
| 306 | toggle_tracing = new QPushButton(tr("Start Tracing")); | 318 | toggle_tracing = new QPushButton(tr("Start Tracing")); |
| 319 | QPushButton* copy_all = new QPushButton(tr("Copy All")); | ||
| 307 | 320 | ||
| 308 | connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing())); | 321 | connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing())); |
| 309 | connect(this, SIGNAL(TracingFinished(const Pica::DebugUtils::PicaTrace&)), | 322 | connect(this, SIGNAL(TracingFinished(const Pica::DebugUtils::PicaTrace&)), |
| 310 | model, SLOT(OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&))); | 323 | model, SLOT(OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&))); |
| 311 | 324 | ||
| 325 | connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); | ||
| 326 | |||
| 312 | command_info_widget = new QWidget; | 327 | command_info_widget = new QWidget; |
| 313 | 328 | ||
| 314 | QVBoxLayout* main_layout = new QVBoxLayout; | 329 | QVBoxLayout* main_layout = new QVBoxLayout; |
| 315 | main_layout->addWidget(list_widget); | 330 | main_layout->addWidget(list_widget); |
| 316 | main_layout->addWidget(toggle_tracing); | 331 | { |
| 332 | QHBoxLayout* sub_layout = new QHBoxLayout; | ||
| 333 | sub_layout->addWidget(toggle_tracing); | ||
| 334 | sub_layout->addWidget(copy_all); | ||
| 335 | main_layout->addLayout(sub_layout); | ||
| 336 | } | ||
| 317 | main_layout->addWidget(command_info_widget); | 337 | main_layout->addWidget(command_info_widget); |
| 318 | main_widget->setLayout(main_layout); | 338 | main_widget->setLayout(main_layout); |
| 319 | 339 | ||
| @@ -330,3 +350,21 @@ void GPUCommandListWidget::OnToggleTracing() { | |||
| 330 | toggle_tracing->setText(tr("Start Tracing")); | 350 | toggle_tracing->setText(tr("Start Tracing")); |
| 331 | } | 351 | } |
| 332 | } | 352 | } |
| 353 | |||
| 354 | void GPUCommandListWidget::CopyAllToClipboard() { | ||
| 355 | QClipboard* clipboard = QApplication::clipboard(); | ||
| 356 | QString text; | ||
| 357 | |||
| 358 | QAbstractItemModel* model = static_cast<QAbstractListModel*>(list_widget->model()); | ||
| 359 | |||
| 360 | for (int row = 0; row < model->rowCount({}); ++row) { | ||
| 361 | for (int col = 0; col < model->columnCount({}); ++col) { | ||
| 362 | QModelIndex index = model->index(row, col); | ||
| 363 | text += model->data(index).value<QString>(); | ||
| 364 | text += '\t'; | ||
| 365 | } | ||
| 366 | text += '\n'; | ||
| 367 | } | ||
| 368 | |||
| 369 | clipboard->setText(text); | ||
| 370 | } | ||
diff --git a/src/citra_qt/debugger/graphics_cmdlists.h b/src/citra_qt/debugger/graphics_cmdlists.h index a465d044c..4859b6ec8 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.h +++ b/src/citra_qt/debugger/graphics_cmdlists.h | |||
| @@ -49,6 +49,8 @@ public slots: | |||
| 49 | 49 | ||
| 50 | void SetCommandInfo(const QModelIndex&); | 50 | void SetCommandInfo(const QModelIndex&); |
| 51 | 51 | ||
| 52 | void CopyAllToClipboard(); | ||
| 53 | |||
| 52 | signals: | 54 | signals: |
| 53 | void TracingFinished(const Pica::DebugUtils::PicaTrace&); | 55 | void TracingFinished(const Pica::DebugUtils::PicaTrace&); |
| 54 | 56 | ||
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp index 6bbe7572c..39eefbf75 100644 --- a/src/citra_qt/debugger/graphics_framebuffer.cpp +++ b/src/citra_qt/debugger/graphics_framebuffer.cpp | |||
| @@ -55,7 +55,9 @@ GraphicsFramebufferWidget::GraphicsFramebufferWidget(std::shared_ptr<Pica::Debug | |||
| 55 | framebuffer_format_control->addItem(tr("RGBA4")); | 55 | framebuffer_format_control->addItem(tr("RGBA4")); |
| 56 | framebuffer_format_control->addItem(tr("D16")); | 56 | framebuffer_format_control->addItem(tr("D16")); |
| 57 | framebuffer_format_control->addItem(tr("D24")); | 57 | framebuffer_format_control->addItem(tr("D24")); |
| 58 | framebuffer_format_control->addItem(tr("D24S8")); | 58 | framebuffer_format_control->addItem(tr("D24X8")); |
| 59 | framebuffer_format_control->addItem(tr("X24S8")); | ||
| 60 | framebuffer_format_control->addItem(tr("(unknown)")); | ||
| 59 | 61 | ||
| 60 | // TODO: This QLabel should shrink the image to the available space rather than just expanding... | 62 | // TODO: This QLabel should shrink the image to the available space rather than just expanding... |
| 61 | framebuffer_picture_label = new QLabel; | 63 | framebuffer_picture_label = new QLabel; |
| @@ -184,8 +186,32 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 184 | framebuffer_address = framebuffer.GetColorBufferPhysicalAddress(); | 186 | framebuffer_address = framebuffer.GetColorBufferPhysicalAddress(); |
| 185 | framebuffer_width = framebuffer.GetWidth(); | 187 | framebuffer_width = framebuffer.GetWidth(); |
| 186 | framebuffer_height = framebuffer.GetHeight(); | 188 | framebuffer_height = framebuffer.GetHeight(); |
| 187 | // TODO: It's unknown how this format is actually specified | 189 | |
| 188 | framebuffer_format = Format::RGBA8; | 190 | switch (framebuffer.color_format) { |
| 191 | case Pica::Regs::ColorFormat::RGBA8: | ||
| 192 | framebuffer_format = Format::RGBA8; | ||
| 193 | break; | ||
| 194 | |||
| 195 | case Pica::Regs::ColorFormat::RGB8: | ||
| 196 | framebuffer_format = Format::RGB8; | ||
| 197 | break; | ||
| 198 | |||
| 199 | case Pica::Regs::ColorFormat::RGB5A1: | ||
| 200 | framebuffer_format = Format::RGB5A1; | ||
| 201 | break; | ||
| 202 | |||
| 203 | case Pica::Regs::ColorFormat::RGB565: | ||
| 204 | framebuffer_format = Format::RGB565; | ||
| 205 | break; | ||
| 206 | |||
| 207 | case Pica::Regs::ColorFormat::RGBA4: | ||
| 208 | framebuffer_format = Format::RGBA4; | ||
| 209 | break; | ||
| 210 | |||
| 211 | default: | ||
| 212 | framebuffer_format = Format::Unknown; | ||
| 213 | break; | ||
| 214 | } | ||
| 189 | 215 | ||
| 190 | break; | 216 | break; |
| 191 | } | 217 | } |
| @@ -197,7 +223,24 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 197 | framebuffer_address = framebuffer.GetDepthBufferPhysicalAddress(); | 223 | framebuffer_address = framebuffer.GetDepthBufferPhysicalAddress(); |
| 198 | framebuffer_width = framebuffer.GetWidth(); | 224 | framebuffer_width = framebuffer.GetWidth(); |
| 199 | framebuffer_height = framebuffer.GetHeight(); | 225 | framebuffer_height = framebuffer.GetHeight(); |
| 200 | framebuffer_format = Format::D16; | 226 | |
| 227 | switch (framebuffer.depth_format) { | ||
| 228 | case Pica::Regs::DepthFormat::D16: | ||
| 229 | framebuffer_format = Format::D16; | ||
| 230 | break; | ||
| 231 | |||
| 232 | case Pica::Regs::DepthFormat::D24: | ||
| 233 | framebuffer_format = Format::D24; | ||
| 234 | break; | ||
| 235 | |||
| 236 | case Pica::Regs::DepthFormat::D24S8: | ||
| 237 | framebuffer_format = Format::D24X8; | ||
| 238 | break; | ||
| 239 | |||
| 240 | default: | ||
| 241 | framebuffer_format = Format::Unknown; | ||
| 242 | break; | ||
| 243 | } | ||
| 201 | 244 | ||
| 202 | break; | 245 | break; |
| 203 | } | 246 | } |
| @@ -258,7 +301,7 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 258 | color.b() = (data >> 16) & 0xFF; | 301 | color.b() = (data >> 16) & 0xFF; |
| 259 | break; | 302 | break; |
| 260 | } | 303 | } |
| 261 | case Format::D24S8: | 304 | case Format::D24X8: |
| 262 | { | 305 | { |
| 263 | Math::Vec2<u32> data = Color::DecodeD24S8(pixel); | 306 | Math::Vec2<u32> data = Color::DecodeD24S8(pixel); |
| 264 | color.r() = data.x & 0xFF; | 307 | color.r() = data.x & 0xFF; |
| @@ -266,6 +309,12 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 266 | color.b() = (data.x >> 16) & 0xFF; | 309 | color.b() = (data.x >> 16) & 0xFF; |
| 267 | break; | 310 | break; |
| 268 | } | 311 | } |
| 312 | case Format::X24S8: | ||
| 313 | { | ||
| 314 | Math::Vec2<u32> data = Color::DecodeD24S8(pixel); | ||
| 315 | color.r() = color.g() = color.b() = data.y; | ||
| 316 | break; | ||
| 317 | } | ||
| 269 | default: | 318 | default: |
| 270 | qDebug() << "Unknown fb color format " << static_cast<int>(framebuffer_format); | 319 | qDebug() << "Unknown fb color format " << static_cast<int>(framebuffer_format); |
| 271 | break; | 320 | break; |
| @@ -286,7 +335,8 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 286 | u32 GraphicsFramebufferWidget::BytesPerPixel(GraphicsFramebufferWidget::Format format) { | 335 | u32 GraphicsFramebufferWidget::BytesPerPixel(GraphicsFramebufferWidget::Format format) { |
| 287 | switch (format) { | 336 | switch (format) { |
| 288 | case Format::RGBA8: | 337 | case Format::RGBA8: |
| 289 | case Format::D24S8: | 338 | case Format::D24X8: |
| 339 | case Format::X24S8: | ||
| 290 | return 4; | 340 | return 4; |
| 291 | case Format::RGB8: | 341 | case Format::RGB8: |
| 292 | case Format::D24: | 342 | case Format::D24: |
diff --git a/src/citra_qt/debugger/graphics_framebuffer.h b/src/citra_qt/debugger/graphics_framebuffer.h index 4cb396ffe..e9eae679f 100644 --- a/src/citra_qt/debugger/graphics_framebuffer.h +++ b/src/citra_qt/debugger/graphics_framebuffer.h | |||
| @@ -35,7 +35,9 @@ class GraphicsFramebufferWidget : public BreakPointObserverDock { | |||
| 35 | RGBA4 = 4, | 35 | RGBA4 = 4, |
| 36 | D16 = 5, | 36 | D16 = 5, |
| 37 | D24 = 6, | 37 | D24 = 6, |
| 38 | D24S8 = 7 | 38 | D24X8 = 7, |
| 39 | X24S8 = 8, | ||
| 40 | Unknown = 9 | ||
| 39 | }; | 41 | }; |
| 40 | 42 | ||
| 41 | static u32 BytesPerPixel(Format format); | 43 | static u32 BytesPerPixel(Format format); |
diff --git a/src/citra_qt/debugger/graphics_tracing.cpp b/src/citra_qt/debugger/graphics_tracing.cpp new file mode 100644 index 000000000..3f20f149d --- /dev/null +++ b/src/citra_qt/debugger/graphics_tracing.cpp | |||
| @@ -0,0 +1,170 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <memory> | ||
| 6 | |||
| 7 | #include <QBoxLayout> | ||
| 8 | #include <QComboBox> | ||
| 9 | #include <QFileDialog> | ||
| 10 | #include <QLabel> | ||
| 11 | #include <QMessageBox> | ||
| 12 | #include <QPushButton> | ||
| 13 | #include <QSpinBox> | ||
| 14 | |||
| 15 | #include <boost/range/algorithm/copy.hpp> | ||
| 16 | |||
| 17 | #include "core/hw/gpu.h" | ||
| 18 | #include "core/hw/lcd.h" | ||
| 19 | |||
| 20 | #include "video_core/pica.h" | ||
| 21 | |||
| 22 | #include "nihstro/float24.h" | ||
| 23 | |||
| 24 | #include "graphics_tracing.h" | ||
| 25 | |||
| 26 | GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context, | ||
| 27 | QWidget* parent) | ||
| 28 | : BreakPointObserverDock(debug_context, tr("CiTrace Recorder"), parent) { | ||
| 29 | |||
| 30 | setObjectName("CiTracing"); | ||
| 31 | |||
| 32 | QPushButton* start_recording = new QPushButton(tr("Start Recording")); | ||
| 33 | QPushButton* stop_recording = new QPushButton(QIcon::fromTheme("document-save"), tr("Stop and Save")); | ||
| 34 | QPushButton* abort_recording = new QPushButton(tr("Abort Recording")); | ||
| 35 | |||
| 36 | connect(this, SIGNAL(SetStartTracingButtonEnabled(bool)), start_recording, SLOT(setVisible(bool))); | ||
| 37 | connect(this, SIGNAL(SetStopTracingButtonEnabled(bool)), stop_recording, SLOT(setVisible(bool))); | ||
| 38 | connect(this, SIGNAL(SetAbortTracingButtonEnabled(bool)), abort_recording, SLOT(setVisible(bool))); | ||
| 39 | connect(start_recording, SIGNAL(clicked()), this, SLOT(StartRecording())); | ||
| 40 | connect(stop_recording, SIGNAL(clicked()), this, SLOT(StopRecording())); | ||
| 41 | connect(abort_recording, SIGNAL(clicked()), this, SLOT(AbortRecording())); | ||
| 42 | |||
| 43 | stop_recording->setVisible(false); | ||
| 44 | abort_recording->setVisible(false); | ||
| 45 | |||
| 46 | auto main_widget = new QWidget; | ||
| 47 | auto main_layout = new QVBoxLayout; | ||
| 48 | { | ||
| 49 | auto sub_layout = new QHBoxLayout; | ||
| 50 | sub_layout->addWidget(start_recording); | ||
| 51 | sub_layout->addWidget(stop_recording); | ||
| 52 | sub_layout->addWidget(abort_recording); | ||
| 53 | main_layout->addLayout(sub_layout); | ||
| 54 | } | ||
| 55 | main_widget->setLayout(main_layout); | ||
| 56 | setWidget(main_widget); | ||
| 57 | } | ||
| 58 | |||
| 59 | void GraphicsTracingWidget::StartRecording() { | ||
| 60 | auto context = context_weak.lock(); | ||
| 61 | if (!context) | ||
| 62 | return; | ||
| 63 | |||
| 64 | auto shader_binary = Pica::g_state.vs.program_code; | ||
| 65 | auto swizzle_data = Pica::g_state.vs.swizzle_data; | ||
| 66 | |||
| 67 | // Encode floating point numbers to 24-bit values | ||
| 68 | // TODO: Drop this explicit conversion once we store float24 values bit-correctly internally. | ||
| 69 | std::array<uint32_t, 4 * 16> default_attributes; | ||
| 70 | for (unsigned i = 0; i < 16; ++i) { | ||
| 71 | for (unsigned comp = 0; comp < 3; ++comp) { | ||
| 72 | default_attributes[4 * i + comp] = nihstro::to_float24(Pica::g_state.vs.default_attributes[i][comp].ToFloat32()); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | std::array<uint32_t, 4 * 96> vs_float_uniforms; | ||
| 77 | for (unsigned i = 0; i < 96; ++i) | ||
| 78 | for (unsigned comp = 0; comp < 3; ++comp) | ||
| 79 | vs_float_uniforms[4 * i + comp] = nihstro::to_float24(Pica::g_state.vs.uniforms.f[i][comp].ToFloat32()); | ||
| 80 | |||
| 81 | CiTrace::Recorder::InitialState state; | ||
| 82 | std::copy_n((u32*)&GPU::g_regs, sizeof(GPU::g_regs) / sizeof(u32), std::back_inserter(state.gpu_registers)); | ||
| 83 | std::copy_n((u32*)&LCD::g_regs, sizeof(LCD::g_regs) / sizeof(u32), std::back_inserter(state.lcd_registers)); | ||
| 84 | std::copy_n((u32*)&Pica::g_state.regs, sizeof(Pica::g_state.regs) / sizeof(u32), std::back_inserter(state.pica_registers)); | ||
| 85 | boost::copy(default_attributes, std::back_inserter(state.default_attributes)); | ||
| 86 | boost::copy(shader_binary, std::back_inserter(state.vs_program_binary)); | ||
| 87 | boost::copy(swizzle_data, std::back_inserter(state.vs_swizzle_data)); | ||
| 88 | boost::copy(vs_float_uniforms, std::back_inserter(state.vs_float_uniforms)); | ||
| 89 | //boost::copy(TODO: Not implemented, std::back_inserter(state.gs_program_binary)); | ||
| 90 | //boost::copy(TODO: Not implemented, std::back_inserter(state.gs_swizzle_data)); | ||
| 91 | //boost::copy(TODO: Not implemented, std::back_inserter(state.gs_float_uniforms)); | ||
| 92 | |||
| 93 | auto recorder = new CiTrace::Recorder(state); | ||
| 94 | context->recorder = std::shared_ptr<CiTrace::Recorder>(recorder); | ||
| 95 | |||
| 96 | emit SetStartTracingButtonEnabled(false); | ||
| 97 | emit SetStopTracingButtonEnabled(true); | ||
| 98 | emit SetAbortTracingButtonEnabled(true); | ||
| 99 | } | ||
| 100 | |||
| 101 | void GraphicsTracingWidget::StopRecording() { | ||
| 102 | auto context = context_weak.lock(); | ||
| 103 | if (!context) | ||
| 104 | return; | ||
| 105 | |||
| 106 | QString filename = QFileDialog::getSaveFileName(this, tr("Save CiTrace"), "citrace.ctf", | ||
| 107 | tr("CiTrace File (*.ctf)")); | ||
| 108 | |||
| 109 | if (filename.isEmpty()) { | ||
| 110 | // If the user canceled the dialog, keep recording | ||
| 111 | return; | ||
| 112 | } | ||
| 113 | |||
| 114 | context->recorder->Finish(filename.toStdString()); | ||
| 115 | context->recorder = nullptr; | ||
| 116 | |||
| 117 | emit SetStopTracingButtonEnabled(false); | ||
| 118 | emit SetAbortTracingButtonEnabled(false); | ||
| 119 | emit SetStartTracingButtonEnabled(true); | ||
| 120 | } | ||
| 121 | |||
| 122 | void GraphicsTracingWidget::AbortRecording() { | ||
| 123 | auto context = context_weak.lock(); | ||
| 124 | if (!context) | ||
| 125 | return; | ||
| 126 | |||
| 127 | context->recorder = nullptr; | ||
| 128 | |||
| 129 | emit SetStopTracingButtonEnabled(false); | ||
| 130 | emit SetAbortTracingButtonEnabled(false); | ||
| 131 | emit SetStartTracingButtonEnabled(true); | ||
| 132 | } | ||
| 133 | |||
| 134 | void GraphicsTracingWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) { | ||
| 135 | widget()->setEnabled(true); | ||
| 136 | } | ||
| 137 | |||
| 138 | void GraphicsTracingWidget::OnResumed() { | ||
| 139 | widget()->setEnabled(false); | ||
| 140 | } | ||
| 141 | |||
| 142 | void GraphicsTracingWidget::OnEmulationStarting(EmuThread* emu_thread) { | ||
| 143 | // Disable tracing starting/stopping until a GPU breakpoint is reached | ||
| 144 | widget()->setEnabled(false); | ||
| 145 | } | ||
| 146 | |||
| 147 | void GraphicsTracingWidget::OnEmulationStopping() { | ||
| 148 | // TODO: Is it safe to access the context here? | ||
| 149 | |||
| 150 | auto context = context_weak.lock(); | ||
| 151 | if (!context) | ||
| 152 | return; | ||
| 153 | |||
| 154 | |||
| 155 | if (context->recorder) { | ||
| 156 | auto reply = QMessageBox::question(this, tr("CiTracing still active"), | ||
| 157 | tr("A CiTrace is still being recorded. Do you want to save it? If not, all recorded data will be discarded."), | ||
| 158 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); | ||
| 159 | |||
| 160 | if (reply == QMessageBox::Yes) { | ||
| 161 | StopRecording(); | ||
| 162 | } else { | ||
| 163 | AbortRecording(); | ||
| 164 | } | ||
| 165 | } | ||
| 166 | |||
| 167 | // If the widget was disabled before, enable it now to allow starting | ||
| 168 | // tracing before starting the next emulation session | ||
| 169 | widget()->setEnabled(true); | ||
| 170 | } | ||
diff --git a/src/citra_qt/debugger/graphics_tracing.h b/src/citra_qt/debugger/graphics_tracing.h new file mode 100644 index 000000000..2a0e4819b --- /dev/null +++ b/src/citra_qt/debugger/graphics_tracing.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "graphics_breakpoint_observer.h" | ||
| 8 | |||
| 9 | class EmuThread; | ||
| 10 | |||
| 11 | class GraphicsTracingWidget : public BreakPointObserverDock { | ||
| 12 | Q_OBJECT | ||
| 13 | |||
| 14 | public: | ||
| 15 | GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent = nullptr); | ||
| 16 | |||
| 17 | private slots: | ||
| 18 | void StartRecording(); | ||
| 19 | void StopRecording(); | ||
| 20 | void AbortRecording(); | ||
| 21 | |||
| 22 | void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override; | ||
| 23 | void OnResumed() override; | ||
| 24 | |||
| 25 | void OnEmulationStarting(EmuThread* emu_thread); | ||
| 26 | void OnEmulationStopping(); | ||
| 27 | |||
| 28 | signals: | ||
| 29 | void SetStartTracingButtonEnabled(bool enable); | ||
| 30 | void SetStopTracingButtonEnabled(bool enable); | ||
| 31 | void SetAbortTracingButtonEnabled(bool enable); | ||
| 32 | }; | ||
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index 14d3f8f39..f42a2f4ce 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp | |||
| @@ -34,7 +34,7 @@ int GraphicsVertexShaderModel::columnCount(const QModelIndex& parent) const { | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | int GraphicsVertexShaderModel::rowCount(const QModelIndex& parent) const { | 36 | int GraphicsVertexShaderModel::rowCount(const QModelIndex& parent) const { |
| 37 | return info.code.size(); | 37 | return static_cast<int>(info.code.size()); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | QVariant GraphicsVertexShaderModel::headerData(int section, Qt::Orientation orientation, int role) const { | 40 | QVariant GraphicsVertexShaderModel::headerData(int section, Qt::Orientation orientation, int role) const { |
| @@ -259,7 +259,7 @@ void GraphicsVertexShaderModel::OnUpdate() | |||
| 259 | for (auto pattern : Pica::g_state.vs.swizzle_data) | 259 | for (auto pattern : Pica::g_state.vs.swizzle_data) |
| 260 | info.swizzle_info.push_back({pattern}); | 260 | info.swizzle_info.push_back({pattern}); |
| 261 | 261 | ||
| 262 | info.labels.insert({ Pica::g_state.regs.vs_main_offset, "main" }); | 262 | info.labels.insert({ Pica::g_state.regs.vs.main_offset, "main" }); |
| 263 | 263 | ||
| 264 | endResetModel(); | 264 | endResetModel(); |
| 265 | } | 265 | } |
diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index 2ac1748b7..89b28c2f4 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp | |||
| @@ -74,7 +74,7 @@ int ProfilerModel::rowCount(const QModelIndex& parent) const | |||
| 74 | if (parent.isValid()) { | 74 | if (parent.isValid()) { |
| 75 | return 0; | 75 | return 0; |
| 76 | } else { | 76 | } else { |
| 77 | return results.time_per_category.size() + 2; | 77 | return static_cast<int>(results.time_per_category.size() + 2); |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 322c25c9e..5ed6cf0b1 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp | |||
| @@ -2,10 +2,13 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <map> | ||
| 6 | |||
| 5 | #include <QKeySequence> | 7 | #include <QKeySequence> |
| 6 | #include <QSettings> | 8 | #include <QSettings> |
| 9 | #include <QShortcut> | ||
| 10 | |||
| 7 | #include "hotkeys.h" | 11 | #include "hotkeys.h" |
| 8 | #include <map> | ||
| 9 | 12 | ||
| 10 | struct Hotkey | 13 | struct Hotkey |
| 11 | { | 14 | { |
diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h index 75c7cc625..2317f8188 100644 --- a/src/citra_qt/hotkeys.h +++ b/src/citra_qt/hotkeys.h | |||
| @@ -2,12 +2,12 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QShortcut> | ||
| 6 | #include <QDialog> | ||
| 7 | #include "ui_hotkeys.h" | 5 | #include "ui_hotkeys.h" |
| 8 | 6 | ||
| 7 | class QDialog; | ||
| 9 | class QKeySequence; | 8 | class QKeySequence; |
| 10 | class QSettings; | 9 | class QSettings; |
| 10 | class QShortcut; | ||
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | * Register a hotkey. | 13 | * Register a hotkey. |
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 8041816a0..34831f2ec 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -10,18 +10,16 @@ | |||
| 10 | #include "qhexedit.h" | 10 | #include "qhexedit.h" |
| 11 | #include "main.h" | 11 | #include "main.h" |
| 12 | 12 | ||
| 13 | #include "common/string_util.h" | ||
| 13 | #include "common/logging/text_formatter.h" | 14 | #include "common/logging/text_formatter.h" |
| 14 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 15 | #include "common/logging/backend.h" | 16 | #include "common/logging/backend.h" |
| 16 | #include "common/logging/filter.h" | 17 | #include "common/logging/filter.h" |
| 17 | #include "common/make_unique.h" | 18 | #include "common/make_unique.h" |
| 18 | #include "common/platform.h" | 19 | #include "common/platform.h" |
| 20 | #include "common/scm_rev.h" | ||
| 19 | #include "common/scope_exit.h" | 21 | #include "common/scope_exit.h" |
| 20 | 22 | ||
| 21 | #if EMU_PLATFORM == PLATFORM_LINUX | ||
| 22 | #include <unistd.h> | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #include "bootmanager.h" | 23 | #include "bootmanager.h" |
| 26 | #include "hotkeys.h" | 24 | #include "hotkeys.h" |
| 27 | 25 | ||
| @@ -34,6 +32,7 @@ | |||
| 34 | #include "debugger/graphics_breakpoints.h" | 32 | #include "debugger/graphics_breakpoints.h" |
| 35 | #include "debugger/graphics_cmdlists.h" | 33 | #include "debugger/graphics_cmdlists.h" |
| 36 | #include "debugger/graphics_framebuffer.h" | 34 | #include "debugger/graphics_framebuffer.h" |
| 35 | #include "debugger/graphics_tracing.h" | ||
| 37 | #include "debugger/graphics_vertex_shader.h" | 36 | #include "debugger/graphics_vertex_shader.h" |
| 38 | #include "debugger/profiler.h" | 37 | #include "debugger/profiler.h" |
| 39 | 38 | ||
| @@ -96,6 +95,10 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 96 | addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget); | 95 | addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget); |
| 97 | graphicsVertexShaderWidget->hide(); | 96 | graphicsVertexShaderWidget->hide(); |
| 98 | 97 | ||
| 98 | auto graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this); | ||
| 99 | addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget); | ||
| 100 | graphicsTracingWidget->hide(); | ||
| 101 | |||
| 99 | QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); | 102 | QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); |
| 100 | debug_menu->addAction(profilerWidget->toggleViewAction()); | 103 | debug_menu->addAction(profilerWidget->toggleViewAction()); |
| 101 | debug_menu->addAction(disasmWidget->toggleViewAction()); | 104 | debug_menu->addAction(disasmWidget->toggleViewAction()); |
| @@ -106,6 +109,7 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 106 | debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); | 109 | debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); |
| 107 | debug_menu->addAction(graphicsFramebufferWidget->toggleViewAction()); | 110 | debug_menu->addAction(graphicsFramebufferWidget->toggleViewAction()); |
| 108 | debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction()); | 111 | debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction()); |
| 112 | debug_menu->addAction(graphicsTracingWidget->toggleViewAction()); | ||
| 109 | 113 | ||
| 110 | // Set default UI state | 114 | // Set default UI state |
| 111 | // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half | 115 | // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half |
| @@ -150,6 +154,9 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 150 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); | 154 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); |
| 151 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); | 155 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); |
| 152 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); | 156 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); |
| 157 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*))); | ||
| 158 | connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); | ||
| 159 | |||
| 153 | 160 | ||
| 154 | // Setup hotkeys | 161 | // Setup hotkeys |
| 155 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 162 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |
| @@ -256,6 +263,7 @@ void GMainWindow::ShutdownGame() { | |||
| 256 | 263 | ||
| 257 | // Update the GUI | 264 | // Update the GUI |
| 258 | ui.action_Start->setEnabled(false); | 265 | ui.action_Start->setEnabled(false); |
| 266 | ui.action_Start->setText(tr("Start")); | ||
| 259 | ui.action_Pause->setEnabled(false); | 267 | ui.action_Pause->setEnabled(false); |
| 260 | ui.action_Stop->setEnabled(false); | 268 | ui.action_Stop->setEnabled(false); |
| 261 | render_window->hide(); | 269 | render_window->hide(); |
| @@ -284,6 +292,8 @@ void GMainWindow::OnStartGame() | |||
| 284 | emu_thread->SetRunning(true); | 292 | emu_thread->SetRunning(true); |
| 285 | 293 | ||
| 286 | ui.action_Start->setEnabled(false); | 294 | ui.action_Start->setEnabled(false); |
| 295 | ui.action_Start->setText(tr("Continue")); | ||
| 296 | |||
| 287 | ui.action_Pause->setEnabled(true); | 297 | ui.action_Pause->setEnabled(true); |
| 288 | ui.action_Stop->setEnabled(true); | 298 | ui.action_Stop->setEnabled(true); |
| 289 | } | 299 | } |