summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2018-01-12 03:21:20 +0100
committerJames Rowe <jroweboy@gmail.com>2018-01-13 03:11:03 +0100
commitebf9a784a9f7f4148a669dbb39e7cd50df779a14 (patch)
treed585685a1c0a34b903af1d086d62560bf56bb29f /src/citra_qt
parentconfig: Default CPU core to Unicorn. (diff)
downloadyuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.gz
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.bz2
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.lz
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.xz
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.zst
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.zip
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/CMakeLists.txt116
-rw-r--r--src/citra_qt/Info.plist40
-rw-r--r--src/citra_qt/bootmanager.cpp310
-rw-r--r--src/citra_qt/bootmanager.h162
-rw-r--r--src/citra_qt/citra-qt.rc19
-rw-r--r--src/citra_qt/configuration/config.cpp326
-rw-r--r--src/citra_qt/configuration/config.h30
-rw-r--r--src/citra_qt/configuration/configure.ui147
-rw-r--r--src/citra_qt/configuration/configure_audio.cpp77
-rw-r--r--src/citra_qt/configuration/configure_audio.h30
-rw-r--r--src/citra_qt/configuration/configure_audio.ui73
-rw-r--r--src/citra_qt/configuration/configure_debug.cpp26
-rw-r--r--src/citra_qt/configuration/configure_debug.h28
-rw-r--r--src/citra_qt/configuration/configure_debug.ui109
-rw-r--r--src/citra_qt/configuration/configure_dialog.cpp28
-rw-r--r--src/citra_qt/configuration/configure_dialog.h28
-rw-r--r--src/citra_qt/configuration/configure_general.cpp47
-rw-r--r--src/citra_qt/configuration/configure_general.h28
-rw-r--r--src/citra_qt/configuration/configure_general.ui199
-rw-r--r--src/citra_qt/configuration/configure_graphics.cpp115
-rw-r--r--src/citra_qt/configuration/configure_graphics.h28
-rw-r--r--src/citra_qt/configuration/configure_graphics.ui207
-rw-r--r--src/citra_qt/configuration/configure_input.cpp199
-rw-r--r--src/citra_qt/configuration/configure_input.h69
-rw-r--r--src/citra_qt/configuration/configure_input.ui592
-rw-r--r--src/citra_qt/configuration/configure_system.cpp77
-rw-r--r--src/citra_qt/configuration/configure_system.h38
-rw-r--r--src/citra_qt/configuration/configure_system.ui278
-rw-r--r--src/citra_qt/configuration/configure_web.cpp102
-rw-r--r--src/citra_qt/configuration/configure_web.h40
-rw-r--r--src/citra_qt/configuration/configure_web.ui190
-rw-r--r--src/citra_qt/debugger/graphics/graphics.cpp77
-rw-r--r--src/citra_qt/debugger/graphics/graphics.h41
-rw-r--r--src/citra_qt/debugger/graphics/graphics_breakpoint_observer.cpp27
-rw-r--r--src/citra_qt/debugger/graphics/graphics_breakpoint_observer.h33
-rw-r--r--src/citra_qt/debugger/graphics/graphics_breakpoints.cpp213
-rw-r--r--src/citra_qt/debugger/graphics/graphics_breakpoints.h46
-rw-r--r--src/citra_qt/debugger/graphics/graphics_breakpoints_p.h36
-rw-r--r--src/citra_qt/debugger/graphics/graphics_cmdlists.cpp259
-rw-r--r--src/citra_qt/debugger/graphics/graphics_cmdlists.h61
-rw-r--r--src/citra_qt/debugger/graphics/graphics_surface.cpp713
-rw-r--r--src/citra_qt/debugger/graphics/graphics_surface.h118
-rw-r--r--src/citra_qt/debugger/graphics/graphics_tracing.cpp177
-rw-r--r--src/citra_qt/debugger/graphics/graphics_tracing.h33
-rw-r--r--src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp622
-rw-r--r--src/citra_qt/debugger/graphics/graphics_vertex_shader.h88
-rw-r--r--src/citra_qt/debugger/profiler.cpp224
-rw-r--r--src/citra_qt/debugger/profiler.h27
-rw-r--r--src/citra_qt/debugger/registers.cpp190
-rw-r--r--src/citra_qt/debugger/registers.h42
-rw-r--r--src/citra_qt/debugger/registers.ui40
-rw-r--r--src/citra_qt/debugger/wait_tree.cpp417
-rw-r--r--src/citra_qt/debugger/wait_tree.h187
-rw-r--r--src/citra_qt/game_list.cpp422
-rw-r--r--src/citra_qt/game_list.h101
-rw-r--r--src/citra_qt/game_list_p.h143
-rw-r--r--src/citra_qt/hotkeys.cpp90
-rw-r--r--src/citra_qt/hotkeys.h64
-rw-r--r--src/citra_qt/hotkeys.ui46
-rw-r--r--src/citra_qt/main.cpp877
-rw-r--r--src/citra_qt/main.h174
-rw-r--r--src/citra_qt/main.ui201
-rw-r--r--src/citra_qt/ui_settings.cpp10
-rw-r--r--src/citra_qt/ui_settings.h56
-rw-r--r--src/citra_qt/util/spinbox.cpp278
-rw-r--r--src/citra_qt/util/spinbox.h86
-rw-r--r--src/citra_qt/util/util.cpp26
-rw-r--r--src/citra_qt/util/util.h14
68 files changed, 0 insertions, 10017 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
deleted file mode 100644
index e2fa33081..000000000
--- a/src/citra_qt/CMakeLists.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
-
-set(SRCS
- configuration/config.cpp
- configuration/configure_audio.cpp
- configuration/configure_debug.cpp
- configuration/configure_dialog.cpp
- configuration/configure_general.cpp
- configuration/configure_graphics.cpp
- configuration/configure_input.cpp
- configuration/configure_system.cpp
- configuration/configure_web.cpp
- debugger/graphics/graphics.cpp
- debugger/graphics/graphics_breakpoint_observer.cpp
- debugger/graphics/graphics_breakpoints.cpp
- debugger/graphics/graphics_cmdlists.cpp
- debugger/graphics/graphics_surface.cpp
- debugger/graphics/graphics_tracing.cpp
- debugger/graphics/graphics_vertex_shader.cpp
- debugger/profiler.cpp
- debugger/registers.cpp
- debugger/wait_tree.cpp
- util/spinbox.cpp
- util/util.cpp
- bootmanager.cpp
- game_list.cpp
- hotkeys.cpp
- main.cpp
- ui_settings.cpp
- citra-qt.rc
- Info.plist
- )
-
-set(HEADERS
- configuration/config.h
- configuration/configure_audio.h
- configuration/configure_debug.h
- configuration/configure_dialog.h
- configuration/configure_general.h
- configuration/configure_graphics.h
- configuration/configure_input.h
- configuration/configure_system.h
- configuration/configure_web.h
- debugger/graphics/graphics.h
- debugger/graphics/graphics_breakpoint_observer.h
- debugger/graphics/graphics_breakpoints.h
- debugger/graphics/graphics_breakpoints_p.h
- debugger/graphics/graphics_cmdlists.h
- debugger/graphics/graphics_surface.h
- debugger/graphics/graphics_tracing.h
- debugger/graphics/graphics_vertex_shader.h
- debugger/profiler.h
- debugger/registers.h
- debugger/wait_tree.h
- util/spinbox.h
- util/util.h
- bootmanager.h
- game_list.h
- game_list_p.h
- hotkeys.h
- main.h
- ui_settings.h
- )
-
-set(UIS
- configuration/configure.ui
- configuration/configure_audio.ui
- configuration/configure_debug.ui
- configuration/configure_general.ui
- configuration/configure_graphics.ui
- configuration/configure_input.ui
- configuration/configure_system.ui
- configuration/configure_web.ui
- debugger/registers.ui
- hotkeys.ui
- main.ui
- )
-
-file(GLOB_RECURSE ICONS ${CMAKE_SOURCE_DIR}/dist/icons/*)
-file(GLOB_RECURSE THEMES ${CMAKE_SOURCE_DIR}/dist/qt_themes/*)
-
-create_directory_groups(${SRCS} ${HEADERS} ${UIS})
-
-if (Qt5_FOUND)
- qt5_wrap_ui(UI_HDRS ${UIS})
-else()
- qt4_wrap_ui(UI_HDRS ${UIS})
-endif()
-
-if (APPLE)
- set(MACOSX_ICON "../../dist/citra.icns")
- set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
- add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${ICONS} ${THEMES} ${MACOSX_ICON})
- set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
-else()
- add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS} ${ICONS} ${THEMES})
-endif()
-target_link_libraries(citra-qt PRIVATE audio_core common core input_common network video_core)
-target_link_libraries(citra-qt PRIVATE Boost::boost glad nihstro-headers Qt5::OpenGL Qt5::Widgets)
-target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
-
-if(UNIX AND NOT APPLE)
- install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
-endif()
-
-if (MSVC)
- include(CopyCitraQt5Deps)
- include(CopyCitraSDLDeps)
- include(CopyYuzuUnicornDeps)
- copy_citra_Qt5_deps(citra-qt)
- copy_citra_SDL_deps(citra-qt)
- copy_yuzu_unicorn_deps(citra-qt)
-endif()
diff --git a/src/citra_qt/Info.plist b/src/citra_qt/Info.plist
deleted file mode 100644
index 7d46b39d1..000000000
--- a/src/citra_qt/Info.plist
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleGetInfoString</key>
- <string></string>
- <key>CFBundleIconFile</key>
- <string>citra.icns</string>
- <key>CFBundleIdentifier</key>
- <string>com.citra-emu.citra</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleLongVersionString</key>
- <string></string>
- <key>CFBundleName</key>
- <string>Citra</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string></string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string></string>
- <key>CSResourcesFileMapped</key>
- <true/>
- <key>LSRequiresCarbon</key>
- <true/>
- <key>NSHumanReadableCopyright</key>
- <string></string>
- <key>NSPrincipalClass</key>
- <string>NSApplication</string>
- <key>NSHighResolutionCapable</key>
- <string>True</string>
-</dict>
-</plist>
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
deleted file mode 100644
index eb542ad4e..000000000
--- a/src/citra_qt/bootmanager.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-#include <QApplication>
-#include <QHBoxLayout>
-#include <QKeyEvent>
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-// Required for screen DPI information
-#include <QScreen>
-#include <QWindow>
-#endif
-
-#include "citra_qt/bootmanager.h"
-#include "common/microprofile.h"
-#include "common/scm_rev.h"
-#include "common/string_util.h"
-#include "core/core.h"
-#include "core/frontend/framebuffer_layout.h"
-#include "core/settings.h"
-#include "input_common/keyboard.h"
-#include "input_common/main.h"
-#include "input_common/motion_emu.h"
-#include "network/network.h"
-
-EmuThread::EmuThread(GRenderWindow* render_window)
- : exec_step(false), running(false), stop_run(false), render_window(render_window) {}
-
-void EmuThread::run() {
- render_window->MakeCurrent();
-
- MicroProfileOnThreadCreate("EmuThread");
-
- stop_run = false;
-
- // holds whether the cpu was running during the last iteration,
- // so that the DebugModeLeft signal can be emitted before the
- // next execution step
- bool was_active = false;
- while (!stop_run) {
- if (running) {
- if (!was_active)
- emit DebugModeLeft();
-
- Core::System::ResultStatus result = Core::System::GetInstance().RunLoop();
- if (result != Core::System::ResultStatus::Success) {
- emit ErrorThrown(result, Core::System::GetInstance().GetStatusDetails());
- }
-
- was_active = running || exec_step;
- if (!was_active && !stop_run)
- emit DebugModeEntered();
- } else if (exec_step) {
- if (!was_active)
- emit DebugModeLeft();
-
- exec_step = false;
- Core::System::GetInstance().SingleStep();
- emit DebugModeEntered();
- yieldCurrentThread();
-
- was_active = false;
- } else {
- std::unique_lock<std::mutex> lock(running_mutex);
- running_cv.wait(lock, [this] { return IsRunning() || exec_step || stop_run; });
- }
- }
-
- // Shutdown the core emulation
- Core::System::GetInstance().Shutdown();
-
-#if MICROPROFILE_ENABLED
- MicroProfileOnThreadExit();
-#endif
-
- render_window->moveContext();
-}
-
-// This class overrides paintEvent and resizeEvent to prevent the GUI thread from stealing GL
-// context.
-// The corresponding functionality is handled in EmuThread instead
-class GGLWidgetInternal : public QGLWidget {
-public:
- GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent)
- : QGLWidget(fmt, parent), parent(parent) {}
-
- void paintEvent(QPaintEvent* ev) override {
- if (do_painting) {
- QPainter painter(this);
- }
- }
-
- void resizeEvent(QResizeEvent* ev) override {
- parent->OnClientAreaResized(ev->size().width(), ev->size().height());
- parent->OnFramebufferSizeChanged();
- }
-
- void DisablePainting() {
- do_painting = false;
- }
- void EnablePainting() {
- do_painting = true;
- }
-
-private:
- GRenderWindow* parent;
- bool do_painting;
-};
-
-GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread)
- : QWidget(parent), child(nullptr), emu_thread(emu_thread) {
-
- std::string window_title = Common::StringFromFormat("Citra %s| %s-%s", Common::g_build_name,
- Common::g_scm_branch, Common::g_scm_desc);
- setWindowTitle(QString::fromStdString(window_title));
-
- InputCommon::Init();
- Network::Init();
-}
-
-GRenderWindow::~GRenderWindow() {
- InputCommon::Shutdown();
- Network::Shutdown();
-}
-
-void GRenderWindow::moveContext() {
- DoneCurrent();
-// We need to move GL context to the swapping thread in Qt5
-#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
- // If the thread started running, move the GL Context to the new thread. Otherwise, move it
- // back.
- auto thread = (QThread::currentThread() == qApp->thread() && emu_thread != nullptr)
- ? emu_thread
- : qApp->thread();
- child->context()->moveToThread(thread);
-#endif
-}
-
-void GRenderWindow::SwapBuffers() {
-#if !defined(QT_NO_DEBUG)
- // Qt debug runtime prints a bogus warning on the console if you haven't called makeCurrent
- // since the last time you called swapBuffers. This presumably means something if you're using
- // QGLWidget the "regular" way, but in our multi-threaded use case is harmless since we never
- // call doneCurrent in this thread.
- child->makeCurrent();
-#endif
- child->swapBuffers();
-}
-
-void GRenderWindow::MakeCurrent() {
- child->makeCurrent();
-}
-
-void GRenderWindow::DoneCurrent() {
- child->doneCurrent();
-}
-
-void GRenderWindow::PollEvents() {}
-
-// On Qt 5.0+, this correctly gets the size of the framebuffer (pixels).
-//
-// Older versions get the window size (density independent pixels),
-// and hence, do not support DPI scaling ("retina" displays).
-// The result will be a viewport that is smaller than the extent of the window.
-void GRenderWindow::OnFramebufferSizeChanged() {
- // Screen changes potentially incur a change in screen DPI, hence we should update the
- // framebuffer size
- qreal pixelRatio = windowPixelRatio();
- unsigned width = child->QPaintDevice::width() * pixelRatio;
- unsigned height = child->QPaintDevice::height() * pixelRatio;
- UpdateCurrentFramebufferLayout(width, height);
-}
-
-void GRenderWindow::BackupGeometry() {
- geometry = ((QGLWidget*)this)->saveGeometry();
-}
-
-void GRenderWindow::RestoreGeometry() {
- // We don't want to back up the geometry here (obviously)
- QWidget::restoreGeometry(geometry);
-}
-
-void GRenderWindow::restoreGeometry(const QByteArray& geometry) {
- // Make sure users of this class don't need to deal with backing up the geometry themselves
- QWidget::restoreGeometry(geometry);
- BackupGeometry();
-}
-
-QByteArray GRenderWindow::saveGeometry() {
- // If we are a top-level widget, store the current geometry
- // otherwise, store the last backup
- if (parent() == nullptr)
- return ((QGLWidget*)this)->saveGeometry();
- else
- return geometry;
-}
-
-qreal GRenderWindow::windowPixelRatio() {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
- // windowHandle() might not be accessible until the window is displayed to screen.
- return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f;
-#else
- return 1.0f;
-#endif
-}
-
-void GRenderWindow::closeEvent(QCloseEvent* event) {
- emit Closed();
- QWidget::closeEvent(event);
-}
-
-void GRenderWindow::keyPressEvent(QKeyEvent* event) {
- InputCommon::GetKeyboard()->PressKey(event->key());
-}
-
-void GRenderWindow::keyReleaseEvent(QKeyEvent* event) {
- InputCommon::GetKeyboard()->ReleaseKey(event->key());
-}
-
-void GRenderWindow::mousePressEvent(QMouseEvent* event) {
- auto pos = event->pos();
- if (event->button() == Qt::LeftButton) {
- qreal pixelRatio = windowPixelRatio();
- this->TouchPressed(static_cast<unsigned>(pos.x() * pixelRatio),
- static_cast<unsigned>(pos.y() * pixelRatio));
- } else if (event->button() == Qt::RightButton) {
- InputCommon::GetMotionEmu()->BeginTilt(pos.x(), pos.y());
- }
-}
-
-void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
- auto pos = event->pos();
- qreal pixelRatio = windowPixelRatio();
- this->TouchMoved(std::max(static_cast<unsigned>(pos.x() * pixelRatio), 0u),
- std::max(static_cast<unsigned>(pos.y() * pixelRatio), 0u));
- InputCommon::GetMotionEmu()->Tilt(pos.x(), pos.y());
-}
-
-void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
- if (event->button() == Qt::LeftButton)
- this->TouchReleased();
- else if (event->button() == Qt::RightButton)
- InputCommon::GetMotionEmu()->EndTilt();
-}
-
-void GRenderWindow::focusOutEvent(QFocusEvent* event) {
- QWidget::focusOutEvent(event);
- InputCommon::GetKeyboard()->ReleaseAllKeys();
-}
-
-void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
- NotifyClientAreaSizeChanged(std::make_pair(width, height));
-}
-
-void GRenderWindow::InitRenderTarget() {
- if (child) {
- delete child;
- }
-
- if (layout()) {
- delete layout();
- }
-
- // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground,
- // WA_DontShowOnScreen, WA_DeleteOnClose
- QGLFormat fmt;
- fmt.setVersion(3, 3);
- fmt.setProfile(QGLFormat::CoreProfile);
- fmt.setSwapInterval(Settings::values.use_vsync);
-
- // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
- fmt.setOption(QGL::NoDeprecatedFunctions);
-
- child = new GGLWidgetInternal(fmt, this);
- QBoxLayout* layout = new QHBoxLayout(this);
-
- resize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
- layout->addWidget(child);
- layout->setMargin(0);
- setLayout(layout);
-
- OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
-
- OnFramebufferSizeChanged();
- NotifyClientAreaSizeChanged(std::pair<unsigned, unsigned>(child->width(), child->height()));
-
- BackupGeometry();
-}
-
-void GRenderWindow::OnMinimalClientAreaChangeRequest(
- const std::pair<unsigned, unsigned>& minimal_size) {
- setMinimumSize(minimal_size.first, minimal_size.second);
-}
-
-void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) {
- this->emu_thread = emu_thread;
- child->DisablePainting();
-}
-
-void GRenderWindow::OnEmulationStopping() {
- emu_thread = nullptr;
- child->EnablePainting();
-}
-
-void GRenderWindow::showEvent(QShowEvent* event) {
- QWidget::showEvent(event);
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
- // windowHandle() is not initialized until the Window is shown, so we connect it here.
- connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this,
- SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection);
-#endif
-}
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
deleted file mode 100644
index 6974edcbb..000000000
--- a/src/citra_qt/bootmanager.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <atomic>
-#include <condition_variable>
-#include <mutex>
-#include <QGLWidget>
-#include <QThread>
-#include "common/thread.h"
-#include "core/core.h"
-#include "core/frontend/emu_window.h"
-
-class QKeyEvent;
-class QScreen;
-
-class GGLWidgetInternal;
-class GMainWindow;
-class GRenderWindow;
-
-class EmuThread : public QThread {
- Q_OBJECT
-
-public:
- explicit EmuThread(GRenderWindow* render_window);
-
- /**
- * Start emulation (on new thread)
- * @warning Only call when not running!
- */
- void run() override;
-
- /**
- * Steps the emulation thread by a single CPU instruction (if the CPU is not already running)
- * @note This function is thread-safe
- */
- void ExecStep() {
- exec_step = true;
- running_cv.notify_all();
- }
-
- /**
- * Sets whether the emulation thread is running or not
- * @param running Boolean value, set the emulation thread to running if true
- * @note This function is thread-safe
- */
- void SetRunning(bool running) {
- std::unique_lock<std::mutex> lock(running_mutex);
- this->running = running;
- lock.unlock();
- running_cv.notify_all();
- }
-
- /**
- * Check if the emulation thread is running or not
- * @return True if the emulation thread is running, otherwise false
- * @note This function is thread-safe
- */
- bool IsRunning() {
- return running;
- }
-
- /**
- * Requests for the emulation thread to stop running
- */
- void RequestStop() {
- stop_run = true;
- SetRunning(false);
- };
-
-private:
- bool exec_step;
- bool running;
- std::atomic<bool> stop_run;
- std::mutex running_mutex;
- std::condition_variable running_cv;
-
- GRenderWindow* render_window;
-
-signals:
- /**
- * Emitted when the CPU has halted execution
- *
- * @warning When connecting to this signal from other threads, make sure to specify either
- * Qt::QueuedConnection (invoke slot within the destination object's message thread) or even
- * Qt::BlockingQueuedConnection (additionally block source thread until slot returns)
- */
- void DebugModeEntered();
-
- /**
- * Emitted right before the CPU continues execution
- *
- * @warning When connecting to this signal from other threads, make sure to specify either
- * Qt::QueuedConnection (invoke slot within the destination object's message thread) or even
- * Qt::BlockingQueuedConnection (additionally block source thread until slot returns)
- */
- void DebugModeLeft();
-
- void ErrorThrown(Core::System::ResultStatus, std::string);
-};
-
-class GRenderWindow : public QWidget, public EmuWindow {
- Q_OBJECT
-
-public:
- GRenderWindow(QWidget* parent, EmuThread* emu_thread);
- ~GRenderWindow();
-
- // EmuWindow implementation
- void SwapBuffers() override;
- void MakeCurrent() override;
- void DoneCurrent() override;
- void PollEvents() override;
-
- void BackupGeometry();
- void RestoreGeometry();
- void restoreGeometry(const QByteArray& geometry); // overridden
- QByteArray saveGeometry(); // overridden
-
- qreal windowPixelRatio();
-
- void closeEvent(QCloseEvent* event) override;
-
- void keyPressEvent(QKeyEvent* event) override;
- void keyReleaseEvent(QKeyEvent* event) override;
-
- void mousePressEvent(QMouseEvent* event) override;
- void mouseMoveEvent(QMouseEvent* event) override;
- void mouseReleaseEvent(QMouseEvent* event) override;
-
- void focusOutEvent(QFocusEvent* event) override;
-
- void OnClientAreaResized(unsigned width, unsigned height);
-
- void InitRenderTarget();
-
-public slots:
- void moveContext(); // overridden
-
- void OnEmulationStarting(EmuThread* emu_thread);
- void OnEmulationStopping();
- void OnFramebufferSizeChanged();
-
-signals:
- /// Emitted when the window is closed
- void Closed();
-
-private:
- void OnMinimalClientAreaChangeRequest(
- const std::pair<unsigned, unsigned>& minimal_size) override;
-
- GGLWidgetInternal* child;
-
- QByteArray geometry;
-
- EmuThread* emu_thread;
-
-protected:
- void showEvent(QShowEvent* event) override;
-};
diff --git a/src/citra_qt/citra-qt.rc b/src/citra_qt/citra-qt.rc
deleted file mode 100644
index a48a9440d..000000000
--- a/src/citra_qt/citra-qt.rc
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "winresrc.h"
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-// QT requires that the default application icon is named IDI_ICON1
-
-IDI_ICON1 ICON "../../dist/citra.ico"
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// RT_MANIFEST
-//
-
-1 RT_MANIFEST "../../dist/citra.manifest"
diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp
deleted file mode 100644
index fd884db7a..000000000
--- a/src/citra_qt/configuration/config.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QSettings>
-#include "citra_qt/configuration/config.h"
-#include "citra_qt/ui_settings.h"
-#include "common/file_util.h"
-#include "input_common/main.h"
-
-Config::Config() {
- // TODO: Don't hardcode the path; let the frontend decide where to put the config files.
- qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini";
- FileUtil::CreateFullPath(qt_config_loc);
- qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat);
-
- Reload();
-}
-
-const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = {
- Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H,
- Qt::Key_Q, Qt::Key_W, Qt::Key_M, Qt::Key_N, Qt::Key_1, Qt::Key_2, Qt::Key_B,
-};
-
-const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{
- {
- Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, Qt::Key_D,
- },
- {
- Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L, Qt::Key_D,
- },
-}};
-
-void Config::ReadValues() {
- qt_config->beginGroup("Controls");
- for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
- std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
- Settings::values.buttons[i] =
- qt_config
- ->value(Settings::NativeButton::mapping[i], QString::fromStdString(default_param))
- .toString()
- .toStdString();
- if (Settings::values.buttons[i].empty())
- Settings::values.buttons[i] = default_param;
- }
-
- for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
- std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
- default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
- default_analogs[i][3], default_analogs[i][4], 0.5f);
- Settings::values.analogs[i] =
- qt_config
- ->value(Settings::NativeAnalog::mapping[i], QString::fromStdString(default_param))
- .toString()
- .toStdString();
- if (Settings::values.analogs[i].empty())
- Settings::values.analogs[i] = default_param;
- }
-
- Settings::values.motion_device =
- qt_config->value("motion_device", "engine:motion_emu,update_period:100,sensitivity:0.01")
- .toString()
- .toStdString();
- Settings::values.touch_device =
- qt_config->value("touch_device", "engine:emu_window").toString().toStdString();
-
- qt_config->endGroup();
-
- qt_config->beginGroup("Core");
- Settings::values.cpu_core =
- static_cast<Settings::CpuCore>(qt_config->value("cpu_core", 0).toInt());
- qt_config->endGroup();
-
- qt_config->beginGroup("Renderer");
- Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool();
- Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
- Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
- 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", 0.0).toFloat();
- Settings::values.bg_green = qt_config->value("bg_green", 0.0).toFloat();
- Settings::values.bg_blue = qt_config->value("bg_blue", 0.0).toFloat();
- qt_config->endGroup();
-
- qt_config->beginGroup("Layout");
- Settings::values.layout_option =
- static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
- Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
- Settings::values.custom_layout = qt_config->value("custom_layout", false).toBool();
- Settings::values.custom_top_left = qt_config->value("custom_top_left", 0).toInt();
- Settings::values.custom_top_top = qt_config->value("custom_top_top", 0).toInt();
- Settings::values.custom_top_right = qt_config->value("custom_top_right", 400).toInt();
- Settings::values.custom_top_bottom = qt_config->value("custom_top_bottom", 240).toInt();
- Settings::values.custom_bottom_left = qt_config->value("custom_bottom_left", 40).toInt();
- Settings::values.custom_bottom_top = qt_config->value("custom_bottom_top", 240).toInt();
- Settings::values.custom_bottom_right = qt_config->value("custom_bottom_right", 360).toInt();
- Settings::values.custom_bottom_bottom = qt_config->value("custom_bottom_bottom", 480).toInt();
- qt_config->endGroup();
-
- qt_config->beginGroup("Audio");
- Settings::values.sink_id = qt_config->value("output_engine", "auto").toString().toStdString();
- Settings::values.enable_audio_stretching =
- qt_config->value("enable_audio_stretching", true).toBool();
- Settings::values.audio_device_id =
- qt_config->value("output_device", "auto").toString().toStdString();
- qt_config->endGroup();
-
- qt_config->beginGroup("Data Storage");
- Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
- qt_config->endGroup();
-
- qt_config->beginGroup("System");
- Settings::values.is_new_3ds = qt_config->value("is_new_3ds", false).toBool();
- Settings::values.region_value =
- qt_config->value("region_value", Settings::REGION_VALUE_AUTO_SELECT).toInt();
- qt_config->endGroup();
-
- qt_config->beginGroup("Miscellaneous");
- Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString();
- qt_config->endGroup();
-
- qt_config->beginGroup("Debugging");
- Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool();
- Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt();
- qt_config->endGroup();
-
- qt_config->beginGroup("WebService");
- Settings::values.enable_telemetry = qt_config->value("enable_telemetry", true).toBool();
- Settings::values.telemetry_endpoint_url =
- qt_config->value("telemetry_endpoint_url", "https://services.citra-emu.org/api/telemetry")
- .toString()
- .toStdString();
- Settings::values.verify_endpoint_url =
- qt_config->value("verify_endpoint_url", "https://services.citra-emu.org/api/profile")
- .toString()
- .toStdString();
- Settings::values.citra_username = qt_config->value("citra_username").toString().toStdString();
- Settings::values.citra_token = qt_config->value("citra_token").toString().toStdString();
- qt_config->endGroup();
-
- qt_config->beginGroup("UI");
- UISettings::values.theme = qt_config->value("theme", UISettings::themes[0].second).toString();
-
- qt_config->beginGroup("UILayout");
- UISettings::values.geometry = qt_config->value("geometry").toByteArray();
- UISettings::values.state = qt_config->value("state").toByteArray();
- UISettings::values.renderwindow_geometry =
- qt_config->value("geometryRenderWindow").toByteArray();
- UISettings::values.gamelist_header_state =
- qt_config->value("gameListHeaderState").toByteArray();
- UISettings::values.microprofile_geometry =
- qt_config->value("microProfileDialogGeometry").toByteArray();
- UISettings::values.microprofile_visible =
- qt_config->value("microProfileDialogVisible", false).toBool();
- qt_config->endGroup();
-
- qt_config->beginGroup("Paths");
- UISettings::values.roms_path = qt_config->value("romsPath").toString();
- UISettings::values.symbols_path = qt_config->value("symbolsPath").toString();
- UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString();
- UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool();
- UISettings::values.recent_files = qt_config->value("recentFiles").toStringList();
- qt_config->endGroup();
-
- qt_config->beginGroup("Shortcuts");
- QStringList groups = qt_config->childGroups();
- for (auto group : groups) {
- qt_config->beginGroup(group);
-
- QStringList hotkeys = qt_config->childGroups();
- for (auto hotkey : hotkeys) {
- qt_config->beginGroup(hotkey);
- UISettings::values.shortcuts.emplace_back(UISettings::Shortcut(
- group + "/" + hotkey,
- UISettings::ContextualShortcut(qt_config->value("KeySeq").toString(),
- qt_config->value("Context").toInt())));
- qt_config->endGroup();
- }
-
- qt_config->endGroup();
- }
- qt_config->endGroup();
-
- UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
- UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool();
- UISettings::values.show_filter_bar = qt_config->value("showFilterBar", true).toBool();
- UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool();
- UISettings::values.confirm_before_closing = qt_config->value("confirmClose", true).toBool();
- UISettings::values.first_start = qt_config->value("firstStart", true).toBool();
- UISettings::values.callout_flags = qt_config->value("calloutFlags", 0).toUInt();
-
- qt_config->endGroup();
-}
-
-void Config::SaveValues() {
- qt_config->beginGroup("Controls");
- for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
- qt_config->setValue(QString::fromStdString(Settings::NativeButton::mapping[i]),
- QString::fromStdString(Settings::values.buttons[i]));
- }
- for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
- qt_config->setValue(QString::fromStdString(Settings::NativeAnalog::mapping[i]),
- QString::fromStdString(Settings::values.analogs[i]));
- }
- qt_config->setValue("motion_device", QString::fromStdString(Settings::values.motion_device));
- qt_config->setValue("touch_device", QString::fromStdString(Settings::values.touch_device));
- qt_config->endGroup();
-
- qt_config->beginGroup("Core");
- qt_config->setValue("cpu_core", static_cast<int>(Settings::values.cpu_core));
- qt_config->endGroup();
-
- qt_config->beginGroup("Renderer");
- qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
- qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
- qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor);
- 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);
- qt_config->setValue("bg_green", (double)Settings::values.bg_green);
- qt_config->setValue("bg_blue", (double)Settings::values.bg_blue);
- qt_config->endGroup();
-
- qt_config->beginGroup("Layout");
- qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
- qt_config->setValue("swap_screen", Settings::values.swap_screen);
- qt_config->setValue("custom_layout", Settings::values.custom_layout);
- qt_config->setValue("custom_top_left", Settings::values.custom_top_left);
- qt_config->setValue("custom_top_top", Settings::values.custom_top_top);
- qt_config->setValue("custom_top_right", Settings::values.custom_top_right);
- qt_config->setValue("custom_top_bottom", Settings::values.custom_top_bottom);
- qt_config->setValue("custom_bottom_left", Settings::values.custom_bottom_left);
- qt_config->setValue("custom_bottom_top", Settings::values.custom_bottom_top);
- qt_config->setValue("custom_bottom_right", Settings::values.custom_bottom_right);
- qt_config->setValue("custom_bottom_bottom", Settings::values.custom_bottom_bottom);
- qt_config->endGroup();
-
- qt_config->beginGroup("Audio");
- qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id));
- qt_config->setValue("enable_audio_stretching", Settings::values.enable_audio_stretching);
- qt_config->setValue("output_device", QString::fromStdString(Settings::values.audio_device_id));
- qt_config->endGroup();
-
- qt_config->beginGroup("Data Storage");
- qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
- qt_config->endGroup();
-
- qt_config->beginGroup("System");
- qt_config->setValue("is_new_3ds", Settings::values.is_new_3ds);
- qt_config->setValue("region_value", Settings::values.region_value);
- qt_config->endGroup();
-
- qt_config->beginGroup("Miscellaneous");
- qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter));
- qt_config->endGroup();
-
- qt_config->beginGroup("Debugging");
- qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub);
- qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port);
- qt_config->endGroup();
-
- qt_config->beginGroup("WebService");
- qt_config->setValue("enable_telemetry", Settings::values.enable_telemetry);
- qt_config->setValue("telemetry_endpoint_url",
- QString::fromStdString(Settings::values.telemetry_endpoint_url));
- qt_config->setValue("verify_endpoint_url",
- QString::fromStdString(Settings::values.verify_endpoint_url));
- qt_config->setValue("citra_username", QString::fromStdString(Settings::values.citra_username));
- qt_config->setValue("citra_token", QString::fromStdString(Settings::values.citra_token));
- qt_config->endGroup();
-
- qt_config->beginGroup("UI");
- qt_config->setValue("theme", UISettings::values.theme);
-
- qt_config->beginGroup("UILayout");
- qt_config->setValue("geometry", UISettings::values.geometry);
- qt_config->setValue("state", UISettings::values.state);
- qt_config->setValue("geometryRenderWindow", UISettings::values.renderwindow_geometry);
- qt_config->setValue("gameListHeaderState", UISettings::values.gamelist_header_state);
- qt_config->setValue("microProfileDialogGeometry", UISettings::values.microprofile_geometry);
- qt_config->setValue("microProfileDialogVisible", UISettings::values.microprofile_visible);
- qt_config->endGroup();
-
- qt_config->beginGroup("Paths");
- qt_config->setValue("romsPath", UISettings::values.roms_path);
- qt_config->setValue("symbolsPath", UISettings::values.symbols_path);
- qt_config->setValue("gameListRootDir", UISettings::values.gamedir);
- qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan);
- qt_config->setValue("recentFiles", UISettings::values.recent_files);
- qt_config->endGroup();
-
- qt_config->beginGroup("Shortcuts");
- for (auto shortcut : UISettings::values.shortcuts) {
- qt_config->setValue(shortcut.first + "/KeySeq", shortcut.second.first);
- qt_config->setValue(shortcut.first + "/Context", shortcut.second.second);
- }
- qt_config->endGroup();
-
- qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode);
- qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar);
- qt_config->setValue("showFilterBar", UISettings::values.show_filter_bar);
- qt_config->setValue("showStatusBar", UISettings::values.show_status_bar);
- qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing);
- qt_config->setValue("firstStart", UISettings::values.first_start);
- qt_config->setValue("calloutFlags", UISettings::values.callout_flags);
-
- qt_config->endGroup();
-}
-
-void Config::Reload() {
- ReadValues();
- Settings::Apply();
-}
-
-void Config::Save() {
- SaveValues();
-}
-
-Config::~Config() {
- Save();
-
- delete qt_config;
-}
diff --git a/src/citra_qt/configuration/config.h b/src/citra_qt/configuration/config.h
deleted file mode 100644
index cbf745ea2..000000000
--- a/src/citra_qt/configuration/config.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <array>
-#include <string>
-#include <QVariant>
-#include "core/settings.h"
-
-class QSettings;
-
-class Config {
- QSettings* qt_config;
- std::string qt_config_loc;
-
- void ReadValues();
- void SaveValues();
-
-public:
- Config();
- ~Config();
-
- void Reload();
- void Save();
-
- static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
- static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs;
-};
diff --git a/src/citra_qt/configuration/configure.ui b/src/citra_qt/configuration/configure.ui
deleted file mode 100644
index 6abd1917e..000000000
--- a/src/citra_qt/configuration/configure.ui
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureDialog</class>
- <widget class="QDialog" name="ConfigureDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>740</width>
- <height>500</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Citra Configuration</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="ConfigureGeneral" name="generalTab">
- <attribute name="title">
- <string>General</string>
- </attribute>
- </widget>
- <widget class="ConfigureSystem" name="systemTab">
- <attribute name="title">
- <string>System</string>
- </attribute>
- </widget>
- <widget class="ConfigureInput" name="inputTab">
- <attribute name="title">
- <string>Input</string>
- </attribute>
- </widget>
- <widget class="ConfigureGraphics" name="graphicsTab">
- <attribute name="title">
- <string>Graphics</string>
- </attribute>
- </widget>
- <widget class="ConfigureAudio" name="audioTab">
- <attribute name="title">
- <string>Audio</string>
- </attribute>
- </widget>
- <widget class="ConfigureDebug" name="debugTab">
- <attribute name="title">
- <string>Debug</string>
- </attribute>
- </widget>
- <widget class="ConfigureWeb" name="webTab">
- <attribute name="title">
- <string>Web</string>
- </attribute>
- </widget>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>ConfigureGeneral</class>
- <extends>QWidget</extends>
- <header>configuration/configure_general.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureSystem</class>
- <extends>QWidget</extends>
- <header>configuration/configure_system.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureAudio</class>
- <extends>QWidget</extends>
- <header>configuration/configure_audio.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureDebug</class>
- <extends>QWidget</extends>
- <header>configuration/configure_debug.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureInput</class>
- <extends>QWidget</extends>
- <header>configuration/configure_input.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureGraphics</class>
- <extends>QWidget</extends>
- <header>configuration/configure_graphics.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>ConfigureWeb</class>
- <extends>QWidget</extends>
- <header>configuration/configure_web.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>ConfigureDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>220</x>
- <y>380</y>
- </hint>
- <hint type="destinationlabel">
- <x>220</x>
- <y>200</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ConfigureDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>220</x>
- <y>380</y>
- </hint>
- <hint type="destinationlabel">
- <x>220</x>
- <y>200</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/src/citra_qt/configuration/configure_audio.cpp b/src/citra_qt/configuration/configure_audio.cpp
deleted file mode 100644
index 3fd1d127a..000000000
--- a/src/citra_qt/configuration/configure_audio.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <memory>
-#include "audio_core/audio_core.h"
-#include "audio_core/sink.h"
-#include "audio_core/sink_details.h"
-#include "citra_qt/configuration/configure_audio.h"
-#include "core/settings.h"
-#include "ui_configure_audio.h"
-
-ConfigureAudio::ConfigureAudio(QWidget* parent)
- : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) {
- ui->setupUi(this);
-
- ui->output_sink_combo_box->clear();
- ui->output_sink_combo_box->addItem("auto");
- for (const auto& sink_detail : AudioCore::g_sink_details) {
- ui->output_sink_combo_box->addItem(sink_detail.id);
- }
-
- this->setConfiguration();
- connect(ui->output_sink_combo_box, SIGNAL(currentIndexChanged(int)), this,
- SLOT(updateAudioDevices(int)));
-}
-
-ConfigureAudio::~ConfigureAudio() {}
-
-void ConfigureAudio::setConfiguration() {
- int new_sink_index = 0;
- for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
- if (ui->output_sink_combo_box->itemText(index).toStdString() == Settings::values.sink_id) {
- new_sink_index = index;
- break;
- }
- }
- ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
-
- ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
-
- // The device list cannot be pre-populated (nor listed) until the output sink is known.
- updateAudioDevices(new_sink_index);
-
- int new_device_index = -1;
- for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
- if (ui->audio_device_combo_box->itemText(index).toStdString() ==
- Settings::values.audio_device_id) {
- new_device_index = index;
- break;
- }
- }
- ui->audio_device_combo_box->setCurrentIndex(new_device_index);
-}
-
-void ConfigureAudio::applyConfiguration() {
- Settings::values.sink_id =
- ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
- .toStdString();
- Settings::values.enable_audio_stretching = ui->toggle_audio_stretching->isChecked();
- Settings::values.audio_device_id =
- ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex())
- .toStdString();
- Settings::Apply();
-}
-
-void ConfigureAudio::updateAudioDevices(int sink_index) {
- ui->audio_device_combo_box->clear();
- ui->audio_device_combo_box->addItem("auto");
-
- std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
- std::vector<std::string> device_list =
- AudioCore::GetSinkDetails(sink_id).factory()->GetDeviceList();
- for (const auto& device : device_list) {
- ui->audio_device_combo_box->addItem(device.c_str());
- }
-}
diff --git a/src/citra_qt/configuration/configure_audio.h b/src/citra_qt/configuration/configure_audio.h
deleted file mode 100644
index 8190e694f..000000000
--- a/src/citra_qt/configuration/configure_audio.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QWidget>
-
-namespace Ui {
-class ConfigureAudio;
-}
-
-class ConfigureAudio : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureAudio(QWidget* parent = nullptr);
- ~ConfigureAudio();
-
- void applyConfiguration();
-
-public slots:
- void updateAudioDevices(int sink_index);
-
-private:
- void setConfiguration();
-
- std::unique_ptr<Ui::ConfigureAudio> ui;
-};
diff --git a/src/citra_qt/configuration/configure_audio.ui b/src/citra_qt/configuration/configure_audio.ui
deleted file mode 100644
index dd870eb61..000000000
--- a/src/citra_qt/configuration/configure_audio.ui
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<ui version="4.0">
- <class>ConfigureAudio</class>
- <widget class="QWidget" name="ConfigureAudio">
- <layout class="QVBoxLayout">
- <item>
- <widget class="QGroupBox">
- <property name="title">
- <string>Audio</string>
- </property>
- <layout class="QVBoxLayout">
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel">
- <property name="text">
- <string>Output Engine:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="output_sink_combo_box">
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="toggle_audio_stretching">
- <property name="text">
- <string>Enable audio stretching</string>
- </property>
- <property name="toolTip">
- <string>This post-processing effect adjusts audio speed to match emulation speed and helps prevent audio stutter. This however increases audio latency.</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel">
- <property name="text">
- <string>Audio Device:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="audio_device_combo_box">
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources />
- <connections />
-</ui>
diff --git a/src/citra_qt/configuration/configure_debug.cpp b/src/citra_qt/configuration/configure_debug.cpp
deleted file mode 100644
index 263f73f38..000000000
--- a/src/citra_qt/configuration/configure_debug.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "citra_qt/configuration/configure_debug.h"
-#include "core/settings.h"
-#include "ui_configure_debug.h"
-
-ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
- ui->setupUi(this);
- this->setConfiguration();
-}
-
-ConfigureDebug::~ConfigureDebug() {}
-
-void ConfigureDebug::setConfiguration() {
- ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);
- ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub);
- ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port);
-}
-
-void ConfigureDebug::applyConfiguration() {
- Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked();
- Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
- Settings::Apply();
-}
diff --git a/src/citra_qt/configuration/configure_debug.h b/src/citra_qt/configuration/configure_debug.h
deleted file mode 100644
index d167eb996..000000000
--- a/src/citra_qt/configuration/configure_debug.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QWidget>
-
-namespace Ui {
-class ConfigureDebug;
-}
-
-class ConfigureDebug : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureDebug(QWidget* parent = nullptr);
- ~ConfigureDebug();
-
- void applyConfiguration();
-
-private:
- void setConfiguration();
-
-private:
- std::unique_ptr<Ui::ConfigureDebug> ui;
-};
diff --git a/src/citra_qt/configuration/configure_debug.ui b/src/citra_qt/configuration/configure_debug.ui
deleted file mode 100644
index 96638ebdb..000000000
--- a/src/citra_qt/configuration/configure_debug.ui
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureDebug</class>
- <widget class="QWidget" name="ConfigureDebug">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>GDB</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel">
- <property name="text">
- <string>The GDB Stub only works correctly when the CPU JIT is off.</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QCheckBox" name="toggle_gdbstub">
- <property name="text">
- <string>Enable GDB Stub</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Port:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="gdbport_spinbox">
- <property name="maximum">
- <number>65536</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>toggle_gdbstub</sender>
- <signal>toggled(bool)</signal>
- <receiver>gdbport_spinbox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>84</x>
- <y>157</y>
- </hint>
- <hint type="destinationlabel">
- <x>342</x>
- <y>158</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp
deleted file mode 100644
index b87dc0e6c..000000000
--- a/src/citra_qt/configuration/configure_dialog.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "citra_qt/configuration/config.h"
-#include "citra_qt/configuration/configure_dialog.h"
-#include "core/settings.h"
-#include "ui_configure.h"
-
-ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) {
- ui->setupUi(this);
- this->setConfiguration();
-}
-
-ConfigureDialog::~ConfigureDialog() {}
-
-void ConfigureDialog::setConfiguration() {}
-
-void ConfigureDialog::applyConfiguration() {
- ui->generalTab->applyConfiguration();
- ui->systemTab->applyConfiguration();
- ui->inputTab->applyConfiguration();
- ui->graphicsTab->applyConfiguration();
- ui->audioTab->applyConfiguration();
- ui->debugTab->applyConfiguration();
- ui->webTab->applyConfiguration();
- Settings::Apply();
-}
diff --git a/src/citra_qt/configuration/configure_dialog.h b/src/citra_qt/configuration/configure_dialog.h
deleted file mode 100644
index 21fa1f501..000000000
--- a/src/citra_qt/configuration/configure_dialog.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QDialog>
-
-namespace Ui {
-class ConfigureDialog;
-}
-
-class ConfigureDialog : public QDialog {
- Q_OBJECT
-
-public:
- explicit ConfigureDialog(QWidget* parent);
- ~ConfigureDialog();
-
- void applyConfiguration();
-
-private:
- void setConfiguration();
-
-private:
- std::unique_ptr<Ui::ConfigureDialog> ui;
-};
diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp
deleted file mode 100644
index 0de27aa8b..000000000
--- a/src/citra_qt/configuration/configure_general.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "citra_qt/configuration/configure_general.h"
-#include "citra_qt/ui_settings.h"
-#include "core/core.h"
-#include "core/settings.h"
-#include "ui_configure_general.h"
-
-ConfigureGeneral::ConfigureGeneral(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureGeneral) {
-
- ui->setupUi(this);
-
- for (auto theme : UISettings::themes) {
- ui->theme_combobox->addItem(theme.first, theme.second);
- }
-
- this->setConfiguration();
-
- ui->cpu_core_combobox->setEnabled(!Core::System::GetInstance().IsPoweredOn());
-}
-
-ConfigureGeneral::~ConfigureGeneral() {}
-
-void ConfigureGeneral::setConfiguration() {
- ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
- ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
-
- // The first item is "auto-select" with actual value -1, so plus one here will do the trick
- ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
-
- ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
- ui->cpu_core_combobox->setCurrentIndex(static_cast<int>(Settings::values.cpu_core));
-}
-
-void ConfigureGeneral::applyConfiguration() {
- UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
- UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
- UISettings::values.theme =
- ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
- Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
- Settings::values.cpu_core =
- static_cast<Settings::CpuCore>(ui->cpu_core_combobox->currentIndex());
- Settings::Apply();
-}
diff --git a/src/citra_qt/configuration/configure_general.h b/src/citra_qt/configuration/configure_general.h
deleted file mode 100644
index 447552d8c..000000000
--- a/src/citra_qt/configuration/configure_general.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QWidget>
-
-namespace Ui {
-class ConfigureGeneral;
-}
-
-class ConfigureGeneral : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureGeneral(QWidget* parent = nullptr);
- ~ConfigureGeneral();
-
- void applyConfiguration();
-
-private:
- void setConfiguration();
-
-private:
- std::unique_ptr<Ui::ConfigureGeneral> ui;
-};
diff --git a/src/citra_qt/configuration/configure_general.ui b/src/citra_qt/configuration/configure_general.ui
deleted file mode 100644
index e88c37936..000000000
--- a/src/citra_qt/configuration/configure_general.ui
+++ /dev/null
@@ -1,199 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureGeneral</class>
- <widget class="QWidget" name="ConfigureGeneral">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>300</width>
- <height>377</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>General</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="toggle_deepscan">
- <property name="text">
- <string>Search sub-directories for games</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="toggle_check_exit">
- <property name="text">
- <string>Confirm exit while emulation is running</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>CPU Core</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QComboBox" name="cpu_core_combobox">
- <item>
- <property name="text">
- <string>Unicorn</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Dynarmic</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Emulation</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Region:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="region_combobox">
- <item>
- <property name="text">
- <string>Auto-select</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">JPN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">USA</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">EUR</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">AUS</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">CHN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">KOR</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string notr="true">TWN</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="theme_group_box">
- <property name="title">
- <string>Theme</string>
- </property>
- <layout class="QHBoxLayout" name="theme_qhbox_layout">
- <item>
- <layout class="QVBoxLayout" name="theme_qvbox_layout">
- <item>
- <layout class="QHBoxLayout" name="theme_qhbox_layout_2">
- <item>
- <widget class="QLabel" name="theme_label">
- <property name="text">
- <string>Theme:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="theme_combobox">
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Hotkeys</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="GHotkeysDialog" name="widget" native="true"/>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>GHotkeysDialog</class>
- <extends>QWidget</extends>
- <header>hotkeys.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/citra_qt/configuration/configure_graphics.cpp b/src/citra_qt/configuration/configure_graphics.cpp
deleted file mode 100644
index b5a5ab1e1..000000000
--- a/src/citra_qt/configuration/configure_graphics.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "citra_qt/configuration/configure_graphics.h"
-#include "core/core.h"
-#include "core/settings.h"
-#include "ui_configure_graphics.h"
-
-ConfigureGraphics::ConfigureGraphics(QWidget* parent)
- : QWidget(parent), ui(new Ui::ConfigureGraphics) {
-
- ui->setupUi(this);
- this->setConfiguration();
-
- ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
-
- ui->layoutBox->setEnabled(!Settings::values.custom_layout);
-}
-
-ConfigureGraphics::~ConfigureGraphics() {}
-
-enum class Resolution : int {
- Auto,
- Scale1x,
- Scale2x,
- Scale3x,
- Scale4x,
- Scale5x,
- Scale6x,
- Scale7x,
- Scale8x,
- Scale9x,
- Scale10x,
-};
-
-float ToResolutionFactor(Resolution option) {
- switch (option) {
- case Resolution::Auto:
- return 0.f;
- case Resolution::Scale1x:
- return 1.f;
- case Resolution::Scale2x:
- return 2.f;
- case Resolution::Scale3x:
- return 3.f;
- case Resolution::Scale4x:
- return 4.f;
- case Resolution::Scale5x:
- return 5.f;
- case Resolution::Scale6x:
- return 6.f;
- case Resolution::Scale7x:
- return 7.f;
- case Resolution::Scale8x:
- return 8.f;
- case Resolution::Scale9x:
- return 9.f;
- case Resolution::Scale10x:
- return 10.f;
- }
- return 0.f;
-}
-
-Resolution FromResolutionFactor(float factor) {
- if (factor == 0.f) {
- return Resolution::Auto;
- } else if (factor == 1.f) {
- return Resolution::Scale1x;
- } else if (factor == 2.f) {
- return Resolution::Scale2x;
- } else if (factor == 3.f) {
- return Resolution::Scale3x;
- } else if (factor == 4.f) {
- return Resolution::Scale4x;
- } else if (factor == 5.f) {
- return Resolution::Scale5x;
- } else if (factor == 6.f) {
- return Resolution::Scale6x;
- } else if (factor == 7.f) {
- return Resolution::Scale7x;
- } else if (factor == 8.f) {
- return Resolution::Scale8x;
- } else if (factor == 9.f) {
- return Resolution::Scale9x;
- } else if (factor == 10.f) {
- return Resolution::Scale10x;
- }
- return Resolution::Auto;
-}
-
-void ConfigureGraphics::setConfiguration() {
- ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
- ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer);
- ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
- ui->resolution_factor_combobox->setCurrentIndex(
- static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
- 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);
-}
-
-void ConfigureGraphics::applyConfiguration() {
- Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
- Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
- Settings::values.resolution_factor =
- ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
- 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();
- Settings::Apply();
-}
diff --git a/src/citra_qt/configuration/configure_graphics.h b/src/citra_qt/configuration/configure_graphics.h
deleted file mode 100644
index 5497a55f7..000000000
--- a/src/citra_qt/configuration/configure_graphics.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QWidget>
-
-namespace Ui {
-class ConfigureGraphics;
-}
-
-class ConfigureGraphics : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureGraphics(QWidget* parent = nullptr);
- ~ConfigureGraphics();
-
- void applyConfiguration();
-
-private:
- void setConfiguration();
-
-private:
- std::unique_ptr<Ui::ConfigureGraphics> ui;
-};
diff --git a/src/citra_qt/configuration/configure_graphics.ui b/src/citra_qt/configuration/configure_graphics.ui
deleted file mode 100644
index 5667b14b6..000000000
--- a/src/citra_qt/configuration/configure_graphics.ui
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureGraphics</class>
- <widget class="QWidget" name="ConfigureGraphics">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Graphics</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="toggle_hw_renderer">
- <property name="text">
- <string>Enable hardware renderer</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="toggle_shader_jit">
- <property name="text">
- <string>Enable shader JIT</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="toggle_vsync">
- <property name="text">
- <string>Enable V-Sync</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="toggle_framelimit">
- <property name="text">
- <string>Limit framerate</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Internal Resolution:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="resolution_factor_combobox">
- <item>
- <property name="text">
- <string>Auto (Window Size)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Native (400x240)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2x Native (800x480)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>3x Native (1200x720)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>4x Native (1600x960)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>5x Native (2000x1200)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>6x Native (2400x1440)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>7x Native (2800x1680)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>8x Native (3200x1920)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>9x Native (3600x2160)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>10x Native (4000x2400)</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGroupBox" name="layoutBox">
- <property name="title">
- <string>Layout</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLabel" name="label1">
- <property name="text">
- <string>Screen Layout:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="layout_combobox">
- <item>
- <property name="text">
- <string>Default</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Single Screen</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Large Screen</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Side by Side</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="swap_screen">
- <property name="text">
- <string>Swap Screens</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>toggle_hw_renderer</sender>
- <signal>toggled(bool)</signal>
- <receiver>resolution_factor_combobox</receiver>
- <slot>setEnabled(bool)</slot>
- </connection>
- </connections>
-</ui>
diff --git a/src/citra_qt/configuration/configure_input.cpp b/src/citra_qt/configuration/configure_input.cpp
deleted file mode 100644
index 116a6330f..000000000
--- a/src/citra_qt/configuration/configure_input.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-#include <QTimer>
-#include "citra_qt/configuration/config.h"
-#include "citra_qt/configuration/configure_input.h"
-#include "common/param_package.h"
-#include "input_common/main.h"
-
-const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM>
- ConfigureInput::analog_sub_buttons{{
- "up", "down", "left", "right", "modifier",
- }};
-
-static QString getKeyName(int 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:
- return "";
- default:
- return QKeySequence(key_code).toString();
- }
-}
-
-static void SetButtonKey(int key, Common::ParamPackage& button_param) {
- button_param = Common::ParamPackage{InputCommon::GenerateKeyboardParam(key)};
-}
-
-static void SetAnalogKey(int key, Common::ParamPackage& analog_param,
- const std::string& button_name) {
- if (analog_param.Get("engine", "") != "analog_from_button") {
- analog_param = {
- {"engine", "analog_from_button"}, {"modifier_scale", "0.5"},
- };
- }
- analog_param.Set(button_name, InputCommon::GenerateKeyboardParam(key));
-}
-
-ConfigureInput::ConfigureInput(QWidget* parent)
- : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
- timer(std::make_unique<QTimer>()) {
-
- ui->setupUi(this);
- setFocusPolicy(Qt::ClickFocus);
-
- button_map = {
- ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY, ui->buttonDpadUp,
- ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonL, ui->buttonR,
- ui->buttonStart, ui->buttonSelect, ui->buttonZL, ui->buttonZR, ui->buttonHome,
- };
-
- analog_map = {{
- {
- ui->buttonCircleUp, ui->buttonCircleDown, ui->buttonCircleLeft, ui->buttonCircleRight,
- ui->buttonCircleMod,
- },
- {
- ui->buttonCStickUp, ui->buttonCStickDown, ui->buttonCStickLeft, ui->buttonCStickRight,
- nullptr,
- },
- }};
-
- for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
- if (button_map[button_id])
- connect(button_map[button_id], &QPushButton::released, [=]() {
- handleClick(button_map[button_id],
- [=](int key) { SetButtonKey(key, buttons_param[button_id]); });
- });
- }
-
- for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
- for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
- if (analog_map[analog_id][sub_button_id] != nullptr) {
- connect(analog_map[analog_id][sub_button_id], &QPushButton::released, [=]() {
- handleClick(analog_map[analog_id][sub_button_id], [=](int key) {
- SetAnalogKey(key, analogs_param[analog_id],
- analog_sub_buttons[sub_button_id]);
- });
- });
- }
- }
- }
-
- connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); });
-
- timer->setSingleShot(true);
- connect(timer.get(), &QTimer::timeout, [this]() {
- releaseKeyboard();
- releaseMouse();
- key_setter = boost::none;
- updateButtonLabels();
- });
-
- this->loadConfiguration();
-
- // TODO(wwylele): enable this when we actually emulate it
- ui->buttonHome->setEnabled(false);
-}
-
-void ConfigureInput::applyConfiguration() {
- std::transform(buttons_param.begin(), buttons_param.end(), Settings::values.buttons.begin(),
- [](const Common::ParamPackage& param) { return param.Serialize(); });
- std::transform(analogs_param.begin(), analogs_param.end(), Settings::values.analogs.begin(),
- [](const Common::ParamPackage& param) { return param.Serialize(); });
-
- Settings::Apply();
-}
-
-void ConfigureInput::loadConfiguration() {
- std::transform(Settings::values.buttons.begin(), Settings::values.buttons.end(),
- buttons_param.begin(),
- [](const std::string& str) { return Common::ParamPackage(str); });
- std::transform(Settings::values.analogs.begin(), Settings::values.analogs.end(),
- analogs_param.begin(),
- [](const std::string& str) { return Common::ParamPackage(str); });
- updateButtonLabels();
-}
-
-void ConfigureInput::restoreDefaults() {
- for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
- SetButtonKey(Config::default_buttons[button_id], buttons_param[button_id]);
- }
-
- for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
- for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
- SetAnalogKey(Config::default_analogs[analog_id][sub_button_id],
- analogs_param[analog_id], analog_sub_buttons[sub_button_id]);
- }
- }
- updateButtonLabels();
- applyConfiguration();
-}
-
-void ConfigureInput::updateButtonLabels() {
- QString non_keyboard(tr("[non-keyboard]"));
-
- auto KeyToText = [&non_keyboard](const Common::ParamPackage& param) {
- if (param.Get("engine", "") != "keyboard") {
- return non_keyboard;
- } else {
- return getKeyName(param.Get("code", 0));
- }
- };
-
- for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
- button_map[button]->setText(KeyToText(buttons_param[button]));
- }
-
- for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
- if (analogs_param[analog_id].Get("engine", "") != "analog_from_button") {
- for (QPushButton* button : analog_map[analog_id]) {
- if (button)
- button->setText(non_keyboard);
- }
- } else {
- for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
- Common::ParamPackage param(
- analogs_param[analog_id].Get(analog_sub_buttons[sub_button_id], ""));
- if (analog_map[analog_id][sub_button_id])
- analog_map[analog_id][sub_button_id]->setText(KeyToText(param));
- }
- }
- }
-}
-
-void ConfigureInput::handleClick(QPushButton* button, std::function<void(int)> new_key_setter) {
- button->setText(tr("[press key]"));
- button->setFocus();
-
- key_setter = new_key_setter;
-
- grabKeyboard();
- grabMouse();
- timer->start(5000); // Cancel after 5 seconds
-}
-
-void ConfigureInput::keyPressEvent(QKeyEvent* event) {
- releaseKeyboard();
- releaseMouse();
-
- if (!key_setter || !event)
- return;
-
- if (event->key() != Qt::Key_Escape)
- (*key_setter)(event->key());
-
- updateButtonLabels();
- key_setter = boost::none;
- timer->stop();
-}
diff --git a/src/citra_qt/configuration/configure_input.h b/src/citra_qt/configuration/configure_input.h
deleted file mode 100644
index c950fbcb4..000000000
--- a/src/citra_qt/configuration/configure_input.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <array>
-#include <functional>
-#include <memory>
-#include <string>
-#include <QKeyEvent>
-#include <QWidget>
-#include <boost/optional.hpp>
-#include "common/param_package.h"
-#include "core/settings.h"
-#include "ui_configure_input.h"
-
-class QPushButton;
-class QString;
-class QTimer;
-
-namespace Ui {
-class ConfigureInput;
-}
-
-class ConfigureInput : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureInput(QWidget* parent = nullptr);
-
- /// Save all button configurations to settings file
- void applyConfiguration();
-
-private:
- std::unique_ptr<Ui::ConfigureInput> ui;
-
- std::unique_ptr<QTimer> timer;
-
- /// This will be the the setting function when an input is awaiting configuration.
- boost::optional<std::function<void(int)>> key_setter;
-
- std::array<Common::ParamPackage, Settings::NativeButton::NumButtons> buttons_param;
- std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs> analogs_param;
-
- static constexpr int ANALOG_SUB_BUTTONS_NUM = 5;
-
- /// Each button input is represented by a QPushButton.
- std::array<QPushButton*, Settings::NativeButton::NumButtons> button_map;
-
- /// Each analog input is represented by five QPushButtons which represents up, down, left, right
- /// and modifier
- std::array<std::array<QPushButton*, ANALOG_SUB_BUTTONS_NUM>, Settings::NativeAnalog::NumAnalogs>
- analog_map;
-
- static const std::array<std::string, ANALOG_SUB_BUTTONS_NUM> analog_sub_buttons;
-
- /// 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 was pressed.
- void handleClick(QPushButton* button, std::function<void(int)> new_key_setter);
- /// Handle key press events.
- void keyPressEvent(QKeyEvent* event) override;
-};
diff --git a/src/citra_qt/configuration/configure_input.ui b/src/citra_qt/configuration/configure_input.ui
deleted file mode 100644
index 2760787e5..000000000
--- a/src/citra_qt/configuration/configure_input.ui
+++ /dev/null
@@ -1,592 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureInput</class>
- <widget class="QWidget" name="ConfigureInput">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>370</width>
- <height>534</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>ConfigureInput</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <layout class="QGridLayout" name="gridLayout_7">
- <item row="0" column="0">
- <widget class="QGroupBox" name="faceButtons">
- <property name="title">
- <string>Face Buttons</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>A:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonA">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>B:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonB">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>X:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonX">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Y:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonY">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QGroupBox" name="faceButtons_2">
- <property name="title">
- <string>Directional Pad</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_12">
- <item>
- <widget class="QLabel" name="label_34">
- <property name="text">
- <string>Up:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonDpadUp">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_9">
- <item>
- <widget class="QLabel" name="label_35">
- <property name="text">
- <string>Down:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonDpadDown">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_10">
- <item>
- <widget class="QLabel" name="label_32">
- <property name="text">
- <string>Left:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonDpadLeft">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_11">
- <item>
- <widget class="QLabel" name="label_33">
- <property name="text">
- <string>Right:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonDpadRight">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QGroupBox" name="faceButtons_3">
- <property name="title">
- <string>Shoulder Buttons</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_13">
- <item>
- <widget class="QLabel" name="label_17">
- <property name="text">
- <string>L:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonL">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_14">
- <item>
- <widget class="QLabel" name="label_19">
- <property name="text">
- <string>R:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonR">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_15">
- <item>
- <widget class="QLabel" name="label_20">
- <property name="text">
- <string>ZL:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonZL">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_16">
- <item>
- <widget class="QLabel" name="label_18">
- <property name="text">
- <string>ZR:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonZR">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QGroupBox" name="faceButtons_4">
- <property name="title">
- <string>Circle Pad</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_17">
- <item>
- <widget class="QLabel" name="label_21">
- <property name="text">
- <string>Left:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCircleLeft">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_18">
- <item>
- <widget class="QLabel" name="label_23">
- <property name="text">
- <string>Right:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCircleRight">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_19">
- <item>
- <widget class="QLabel" name="label_24">
- <property name="text">
- <string>Up:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCircleUp">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_20">
- <item>
- <widget class="QLabel" name="label_22">
- <property name="text">
- <string>Down:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCircleDown">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QGroupBox" name="faceButtons_5">
- <property name="title">
- <string>C-Stick</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_21">
- <item>
- <widget class="QLabel" name="label_25">
- <property name="text">
- <string>Left:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCStickLeft">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_22">
- <item>
- <widget class="QLabel" name="label_27">
- <property name="text">
- <string>Right:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCStickRight">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_23">
- <item>
- <widget class="QLabel" name="label_28">
- <property name="text">
- <string>Up:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCStickUp">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_24">
- <item>
- <widget class="QLabel" name="label_26">
- <property name="text">
- <string>Down:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCStickDown">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QGroupBox" name="faceButtons_6">
- <property name="title">
- <string>Misc.</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_6">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_25">
- <item>
- <widget class="QLabel" name="label_29">
- <property name="text">
- <string>Start:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonStart">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_26">
- <item>
- <widget class="QLabel" name="label_30">
- <property name="text">
- <string>Select:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonSelect">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_27">
- <item>
- <widget class="QLabel" name="label_31">
- <property name="text">
- <string>Home:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonHome">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_28">
- <item>
- <widget class="QLabel" name="label_36">
- <property name="text">
- <string>Circle Mod:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCircleMod">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="buttonRestoreDefaults">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="sizeIncrement">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="baseSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string>Restore Defaults</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp
deleted file mode 100644
index d83c2db23..000000000
--- a/src/citra_qt/configuration/configure_system.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QMessageBox>
-#include "citra_qt/configuration/configure_system.h"
-#include "citra_qt/ui_settings.h"
-#include "core/core.h"
-#include "ui_configure_system.h"
-
-static const std::array<int, 12> days_in_month = {{
- 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
-}};
-
-ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {
- ui->setupUi(this);
- connect(ui->combo_birthmonth,
- static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
- &ConfigureSystem::updateBirthdayComboBox);
- connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
- &ConfigureSystem::refreshConsoleID);
-
- this->setConfiguration();
-}
-
-ConfigureSystem::~ConfigureSystem() {}
-
-void ConfigureSystem::setConfiguration() {
- enabled = !Core::System::GetInstance().IsPoweredOn();
-}
-
-void ConfigureSystem::ReadSystemSettings() {
-}
-
-void ConfigureSystem::applyConfiguration() {
- if (!enabled)
- return;
-}
-
-void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) {
- if (birthmonth_index < 0 || birthmonth_index >= 12)
- return;
-
- // store current day selection
- int birthday_index = ui->combo_birthday->currentIndex();
-
- // get number of days in the new selected month
- int days = days_in_month[birthmonth_index];
-
- // if the selected day is out of range,
- // reset it to 1st
- if (birthday_index < 0 || birthday_index >= days)
- birthday_index = 0;
-
- // update the day combo box
- ui->combo_birthday->clear();
- for (int i = 1; i <= days; ++i) {
- ui->combo_birthday->addItem(QString::number(i));
- }
-
- // restore the day selection
- ui->combo_birthday->setCurrentIndex(birthday_index);
-}
-
-void ConfigureSystem::refreshConsoleID() {
- QMessageBox::StandardButton reply;
- QString warning_text = tr("This will replace your current virtual 3DS with a new one. "
- "Your current virtual 3DS will not be recoverable. "
- "This might have unexpected effects in games. This might fail, "
- "if you use an outdated config savegame. Continue?");
- reply = QMessageBox::critical(this, tr("Warning"), warning_text,
- QMessageBox::No | QMessageBox::Yes);
- if (reply == QMessageBox::No)
- return;
- u64 console_id{};
- ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper());
-}
diff --git a/src/citra_qt/configuration/configure_system.h b/src/citra_qt/configuration/configure_system.h
deleted file mode 100644
index f13de17d4..000000000
--- a/src/citra_qt/configuration/configure_system.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QWidget>
-
-namespace Ui {
-class ConfigureSystem;
-}
-
-class ConfigureSystem : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureSystem(QWidget* parent = nullptr);
- ~ConfigureSystem();
-
- void applyConfiguration();
- void setConfiguration();
-
-public slots:
- void updateBirthdayComboBox(int birthmonth_index);
- void refreshConsoleID();
-
-private:
- void ReadSystemSettings();
-
- std::unique_ptr<Ui::ConfigureSystem> ui;
- bool enabled;
-
- std::u16string username;
- int birthmonth, birthday;
- int language_index;
- int sound_index;
-};
diff --git a/src/citra_qt/configuration/configure_system.ui b/src/citra_qt/configuration/configure_system.ui
deleted file mode 100644
index 8caf49623..000000000
--- a/src/citra_qt/configuration/configure_system.ui
+++ /dev/null
@@ -1,278 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureSystem</class>
- <widget class="QWidget" name="ConfigureSystem">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>360</width>
- <height>377</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="group_system_settings">
- <property name="title">
- <string>System Settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_username">
- <property name="text">
- <string>Username</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="edit_username">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maxLength">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_birthday">
- <property name="text">
- <string>Birthday</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_birthday2">
- <item>
- <widget class="QComboBox" name="combo_birthmonth">
- <item>
- <property name="text">
- <string>January</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>February</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>March</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>April</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>May</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>June</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>July</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>August</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>September</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>October</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>November</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>December</string>
- </property>
- </item>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="combo_birthday"/>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_language">
- <property name="text">
- <string>Language</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="combo_language">
- <property name="toolTip">
- <string>Note: this can be overridden when region setting is auto-select</string>
- </property>
- <item>
- <property name="text">
- <string>Japanese (日本語)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>English</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>French (français)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>German (Deutsch)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Italian (italiano)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Spanish (español)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Simplified Chinese (简体中文)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Korean (한국어)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Dutch (Nederlands)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Portuguese (português)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Russian (Русский)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Traditional Chinese (正體中文)</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_sound">
- <property name="text">
- <string>Sound output mode</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="combo_sound">
- <item>
- <property name="text">
- <string>Mono</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Stereo</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Surround</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_console_id">
- <property name="text">
- <string>Console ID:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QPushButton" name="button_regenerate_console_id">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="text">
- <string>Regenerate</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_disable_info">
- <property name="text">
- <string>System settings are available only when game is not running.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/citra_qt/configuration/configure_web.cpp b/src/citra_qt/configuration/configure_web.cpp
deleted file mode 100644
index bf8c21ac7..000000000
--- a/src/citra_qt/configuration/configure_web.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2017 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QMessageBox>
-#include "citra_qt/configuration/configure_web.h"
-#include "core/settings.h"
-#include "core/telemetry_session.h"
-#include "ui_configure_web.h"
-
-ConfigureWeb::ConfigureWeb(QWidget* parent)
- : QWidget(parent), ui(std::make_unique<Ui::ConfigureWeb>()) {
- ui->setupUi(this);
- connect(ui->button_regenerate_telemetry_id, &QPushButton::clicked, this,
- &ConfigureWeb::RefreshTelemetryID);
- connect(ui->button_verify_login, &QPushButton::clicked, this, &ConfigureWeb::VerifyLogin);
- connect(this, &ConfigureWeb::LoginVerified, this, &ConfigureWeb::OnLoginVerified);
-
- this->setConfiguration();
-}
-
-ConfigureWeb::~ConfigureWeb() {}
-
-void ConfigureWeb::setConfiguration() {
- ui->web_credentials_disclaimer->setWordWrap(true);
- ui->telemetry_learn_more->setOpenExternalLinks(true);
- ui->telemetry_learn_more->setText(tr("<a "
- "href='https://citra-emu.org/entry/"
- "telemetry-and-why-thats-a-good-thing/'>Learn more</a>"));
-
- ui->web_signup_link->setOpenExternalLinks(true);
- ui->web_signup_link->setText(tr("<a href='https://services.citra-emu.org/'>Sign up</a>"));
- ui->web_token_info_link->setOpenExternalLinks(true);
- ui->web_token_info_link->setText(
- tr("<a href='https://citra-emu.org/wiki/citra-web-service/'>What is my token?</a>"));
-
- ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry);
- ui->edit_username->setText(QString::fromStdString(Settings::values.citra_username));
- ui->edit_token->setText(QString::fromStdString(Settings::values.citra_token));
- // Connect after setting the values, to avoid calling OnLoginChanged now
- connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged);
- connect(ui->edit_username, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged);
- ui->label_telemetry_id->setText(
- tr("Telemetry ID: 0x%1").arg(QString::number(Core::GetTelemetryId(), 16).toUpper()));
- user_verified = true;
-}
-
-void ConfigureWeb::applyConfiguration() {
- Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked();
- if (user_verified) {
- Settings::values.citra_username = ui->edit_username->text().toStdString();
- Settings::values.citra_token = ui->edit_token->text().toStdString();
- } else {
- QMessageBox::warning(this, tr("Username and token not verfied"),
- tr("Username and token were not verified. The changes to your "
- "username and/or token have not been saved."));
- }
- Settings::Apply();
-}
-
-void ConfigureWeb::RefreshTelemetryID() {
- const u64 new_telemetry_id{Core::RegenerateTelemetryId()};
- ui->label_telemetry_id->setText(
- tr("Telemetry ID: 0x%1").arg(QString::number(new_telemetry_id, 16).toUpper()));
-}
-
-void ConfigureWeb::OnLoginChanged() {
- if (ui->edit_username->text().isEmpty() && ui->edit_token->text().isEmpty()) {
- user_verified = true;
- ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png"));
- ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png"));
- } else {
- user_verified = false;
- ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png"));
- ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png"));
- }
-}
-
-void ConfigureWeb::VerifyLogin() {
- verified =
- Core::VerifyLogin(ui->edit_username->text().toStdString(),
- ui->edit_token->text().toStdString(), [&]() { emit LoginVerified(); });
- ui->button_verify_login->setDisabled(true);
- ui->button_verify_login->setText(tr("Verifying"));
-}
-
-void ConfigureWeb::OnLoginVerified() {
- ui->button_verify_login->setEnabled(true);
- ui->button_verify_login->setText(tr("Verify"));
- if (verified.get()) {
- user_verified = true;
- ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png"));
- ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png"));
- } else {
- ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png"));
- ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png"));
- QMessageBox::critical(
- this, tr("Verification failed"),
- tr("Verification failed. Check that you have entered your username and token "
- "correctly, and that your internet connection is working."));
- }
-}
diff --git a/src/citra_qt/configuration/configure_web.h b/src/citra_qt/configuration/configure_web.h
deleted file mode 100644
index ad2d58f6e..000000000
--- a/src/citra_qt/configuration/configure_web.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2017 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <future>
-#include <memory>
-#include <QWidget>
-
-namespace Ui {
-class ConfigureWeb;
-}
-
-class ConfigureWeb : public QWidget {
- Q_OBJECT
-
-public:
- explicit ConfigureWeb(QWidget* parent = nullptr);
- ~ConfigureWeb();
-
- void applyConfiguration();
-
-public slots:
- void RefreshTelemetryID();
- void OnLoginChanged();
- void VerifyLogin();
- void OnLoginVerified();
-
-signals:
- void LoginVerified();
-
-private:
- void setConfiguration();
-
- bool user_verified = true;
- std::future<bool> verified;
-
- std::unique_ptr<Ui::ConfigureWeb> ui;
-};
diff --git a/src/citra_qt/configuration/configure_web.ui b/src/citra_qt/configuration/configure_web.ui
deleted file mode 100644
index dd996ab62..000000000
--- a/src/citra_qt/configuration/configure_web.ui
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ConfigureWeb</class>
- <widget class="QWidget" name="ConfigureWeb">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>926</width>
- <height>561</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="groupBoxWebConfig">
- <property name="title">
- <string>Citra Web Service</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayoutCitraWebService">
- <item>
- <widget class="QLabel" name="web_credentials_disclaimer">
- <property name="text">
- <string>By providing your username and token, you agree to allow Citra to collect additional usage data, which may include user identifying information.</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayoutCitraUsername">
- <item row="2" column="3">
- <widget class="QPushButton" name="button_verify_login">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="text">
- <string>Verify</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="web_signup_link">
- <property name="text">
- <string>Sign up</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="3">
- <widget class="QLineEdit" name="edit_username">
- <property name="maxLength">
- <number>36</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_token">
- <property name="text">
- <string>Token: </string>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QLabel" name="label_token_verified">
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_username">
- <property name="text">
- <string>Username: </string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="label_username_verified">
- </widget>
- </item>
- <item row="1" column="1" colspan="3">
- <widget class="QLineEdit" name="edit_token">
- <property name="maxLength">
- <number>36</number>
- </property>
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="web_token_info_link">
- <property name="text">
- <string>What is my token?</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Telemetry</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="toggle_telemetry">
- <property name="text">
- <string>Share anonymous usage data with the Citra team</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="telemetry_learn_more">
- <property name="text">
- <string>Learn more</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayoutTelemetryId">
- <item row="0" column="0">
- <widget class="QLabel" name="label_telemetry_id">
- <property name="text">
- <string>Telemetry ID:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QPushButton" name="button_regenerate_telemetry_id">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="text">
- <string>Regenerate</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/citra_qt/debugger/graphics/graphics.cpp b/src/citra_qt/debugger/graphics/graphics.cpp
deleted file mode 100644
index 8154363a2..000000000
--- a/src/citra_qt/debugger/graphics/graphics.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QListView>
-#include "citra_qt/debugger/graphics/graphics.h"
-#include "citra_qt/util/util.h"
-
-GraphicsDebugger g_debugger;
-
-GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent)
- : QAbstractListModel(parent), command_count(0) {
- connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int)));
-}
-
-int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const {
- return command_count;
-}
-
-QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const {
- if (!index.isValid())
- return QVariant();
-
- int command_index = index.row();
- const Service::GSP::Command& command = GetDebugger()->ReadGXCommandHistory(command_index);
- if (role == Qt::DisplayRole) {
- 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")
- .arg(command_names[command.id])
- .arg(command_data[0], 8, 16, QLatin1Char('0'))
- .arg(command_data[1], 8, 16, QLatin1Char('0'))
- .arg(command_data[2], 8, 16, QLatin1Char('0'))
- .arg(command_data[3], 8, 16, QLatin1Char('0'))
- .arg(command_data[4], 8, 16, QLatin1Char('0'))
- .arg(command_data[5], 8, 16, QLatin1Char('0'))
- .arg(command_data[6], 8, 16, QLatin1Char('0'))
- .arg(command_data[7], 8, 16, QLatin1Char('0'));
- return QVariant(str);
- } else {
- return QVariant();
- }
-}
-
-void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count) {
- emit GXCommandFinished(total_command_count);
-}
-
-void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count) {
- if (total_command_count == 0)
- return;
-
- int prev_command_count = command_count;
- command_count = total_command_count;
- emit dataChanged(index(prev_command_count, 0), index(total_command_count - 1, 0));
-}
-
-GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent)
- : QDockWidget(tr("Graphics Debugger"), parent) {
- setObjectName("GraphicsDebugger");
-
- GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this);
- g_debugger.RegisterObserver(command_model);
-
- QListView* command_list = new QListView;
- command_list->setModel(command_model);
- command_list->setFont(GetMonospaceFont());
-
- setWidget(command_list);
-}
diff --git a/src/citra_qt/debugger/graphics/graphics.h b/src/citra_qt/debugger/graphics/graphics.h
deleted file mode 100644
index 8837fb792..000000000
--- a/src/citra_qt/debugger/graphics/graphics.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QAbstractListModel>
-#include <QDockWidget>
-#include "video_core/gpu_debugger.h"
-
-class GPUCommandStreamItemModel : public QAbstractListModel,
- public GraphicsDebugger::DebuggerObserver {
- Q_OBJECT
-
-public:
- explicit GPUCommandStreamItemModel(QObject* parent);
-
- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
-
-public:
- void GXCommandProcessed(int total_command_count) override;
-
-public slots:
- void OnGXCommandFinishedInternal(int total_command_count);
-
-signals:
- void GXCommandFinished(int total_command_count);
-
-private:
- int command_count;
-};
-
-class GPUCommandStreamWidget : public QDockWidget {
- Q_OBJECT
-
-public:
- GPUCommandStreamWidget(QWidget* parent = nullptr);
-
-private:
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoint_observer.cpp b/src/citra_qt/debugger/graphics/graphics_breakpoint_observer.cpp
deleted file mode 100644
index dc6070dea..000000000
--- a/src/citra_qt/debugger/graphics/graphics_breakpoint_observer.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QMetaType>
-#include "citra_qt/debugger/graphics/graphics_breakpoint_observer.h"
-
-BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr<Pica::DebugContext> debug_context,
- const QString& title, QWidget* parent)
- : QDockWidget(title, parent), BreakPointObserver(debug_context) {
- qRegisterMetaType<Pica::DebugContext::Event>("Pica::DebugContext::Event");
-
- connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed()));
-
- // NOTE: This signal is emitted from a non-GUI thread, but connect() takes
- // care of delaying its handling to the GUI thread.
- connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event, void*)), this,
- SLOT(OnBreakPointHit(Pica::DebugContext::Event, void*)), Qt::BlockingQueuedConnection);
-}
-
-void BreakPointObserverDock::OnPicaBreakPointHit(Pica::DebugContext::Event event, void* data) {
- emit BreakPointHit(event, data);
-}
-
-void BreakPointObserverDock::OnPicaResume() {
- emit Resumed();
-}
diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoint_observer.h b/src/citra_qt/debugger/graphics/graphics_breakpoint_observer.h
deleted file mode 100644
index e77df4f5b..000000000
--- a/src/citra_qt/debugger/graphics/graphics_breakpoint_observer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QDockWidget>
-#include "video_core/debug_utils/debug_utils.h"
-
-/**
- * Utility class which forwards calls to OnPicaBreakPointHit and OnPicaResume to public slots.
- * This is because the Pica breakpoint callbacks are called from a non-GUI thread, while
- * the widget usually wants to perform reactions in the GUI thread.
- */
-class BreakPointObserverDock : public QDockWidget,
- protected Pica::DebugContext::BreakPointObserver {
- Q_OBJECT
-
-public:
- BreakPointObserverDock(std::shared_ptr<Pica::DebugContext> debug_context, const QString& title,
- QWidget* parent = nullptr);
-
- void OnPicaBreakPointHit(Pica::DebugContext::Event event, void* data) override;
- void OnPicaResume() override;
-
-private slots:
- virtual void OnBreakPointHit(Pica::DebugContext::Event event, void* data) = 0;
- virtual void OnResumed() = 0;
-
-signals:
- void Resumed();
- void BreakPointHit(Pica::DebugContext::Event event, void* data);
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp
deleted file mode 100644
index 030828ba8..000000000
--- a/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QLabel>
-#include <QMetaType>
-#include <QPushButton>
-#include <QTreeView>
-#include <QVBoxLayout>
-#include "citra_qt/debugger/graphics/graphics_breakpoints.h"
-#include "citra_qt/debugger/graphics/graphics_breakpoints_p.h"
-#include "common/assert.h"
-
-BreakPointModel::BreakPointModel(std::shared_ptr<Pica::DebugContext> debug_context, QObject* parent)
- : QAbstractListModel(parent), context_weak(debug_context),
- at_breakpoint(debug_context->at_breakpoint),
- active_breakpoint(debug_context->active_breakpoint) {}
-
-int BreakPointModel::columnCount(const QModelIndex& parent) const {
- return 1;
-}
-
-int BreakPointModel::rowCount(const QModelIndex& parent) const {
- return static_cast<int>(Pica::DebugContext::Event::NumEvents);
-}
-
-QVariant BreakPointModel::data(const QModelIndex& index, int role) const {
- const auto event = static_cast<Pica::DebugContext::Event>(index.row());
-
- switch (role) {
- case Qt::DisplayRole: {
- if (index.column() == 0) {
- static const std::map<Pica::DebugContext::Event, QString> map = {
- {Pica::DebugContext::Event::PicaCommandLoaded, tr("Pica command loaded")},
- {Pica::DebugContext::Event::PicaCommandProcessed, tr("Pica command processed")},
- {Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")},
- {Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")},
- {Pica::DebugContext::Event::VertexShaderInvocation, tr("Vertex shader invocation")},
- {Pica::DebugContext::Event::IncomingDisplayTransfer,
- tr("Incoming display transfer")},
- {Pica::DebugContext::Event::GSPCommandProcessed, tr("GSP command processed")},
- {Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped")},
- };
-
- DEBUG_ASSERT(map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));
- return (map.find(event) != map.end()) ? map.at(event) : QString();
- }
-
- break;
- }
-
- case Qt::CheckStateRole: {
- if (index.column() == 0)
- return data(index, Role_IsEnabled).toBool() ? Qt::Checked : Qt::Unchecked;
- break;
- }
-
- case Qt::BackgroundRole: {
- if (at_breakpoint && index.row() == static_cast<int>(active_breakpoint)) {
- return QBrush(QColor(0xE0, 0xE0, 0x10));
- }
- break;
- }
-
- case Role_IsEnabled: {
- auto context = context_weak.lock();
- return context && context->breakpoints[(int)event].enabled;
- }
-
- default:
- break;
- }
- return QVariant();
-}
-
-Qt::ItemFlags BreakPointModel::flags(const QModelIndex& index) const {
- if (!index.isValid())
- return 0;
-
- Qt::ItemFlags flags = Qt::ItemIsEnabled;
- if (index.column() == 0)
- flags |= Qt::ItemIsUserCheckable;
- return flags;
-}
-
-bool BreakPointModel::setData(const QModelIndex& index, const QVariant& value, int role) {
- const auto event = static_cast<Pica::DebugContext::Event>(index.row());
-
- switch (role) {
- case Qt::CheckStateRole: {
- if (index.column() != 0)
- return false;
-
- auto context = context_weak.lock();
- if (!context)
- return false;
-
- context->breakpoints[(int)event].enabled = value == Qt::Checked;
- QModelIndex changed_index = createIndex(index.row(), 0);
- emit dataChanged(changed_index, changed_index);
- return true;
- }
- }
-
- return false;
-}
-
-void BreakPointModel::OnBreakPointHit(Pica::DebugContext::Event event) {
- auto context = context_weak.lock();
- if (!context)
- return;
-
- active_breakpoint = context->active_breakpoint;
- at_breakpoint = context->at_breakpoint;
- emit dataChanged(createIndex(static_cast<int>(event), 0),
- createIndex(static_cast<int>(event), 0));
-}
-
-void BreakPointModel::OnResumed() {
- auto context = context_weak.lock();
- if (!context)
- return;
-
- at_breakpoint = context->at_breakpoint;
- emit dataChanged(createIndex(static_cast<int>(active_breakpoint), 0),
- createIndex(static_cast<int>(active_breakpoint), 0));
- active_breakpoint = context->active_breakpoint;
-}
-
-GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
- std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent)
- : QDockWidget(tr("Pica Breakpoints"), parent),
- Pica::DebugContext::BreakPointObserver(debug_context) {
- setObjectName("PicaBreakPointsWidget");
-
- status_text = new QLabel(tr("Emulation running"));
- resume_button = new QPushButton(tr("Resume"));
- resume_button->setEnabled(false);
-
- breakpoint_model = new BreakPointModel(debug_context, this);
- breakpoint_list = new QTreeView;
- breakpoint_list->setRootIsDecorated(false);
- breakpoint_list->setHeaderHidden(true);
- breakpoint_list->setModel(breakpoint_model);
-
- qRegisterMetaType<Pica::DebugContext::Event>("Pica::DebugContext::Event");
-
- connect(breakpoint_list, SIGNAL(doubleClicked(const QModelIndex&)), this,
- SLOT(OnItemDoubleClicked(const QModelIndex&)));
-
- connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested()));
-
- connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event, void*)), this,
- SLOT(OnBreakPointHit(Pica::DebugContext::Event, void*)), Qt::BlockingQueuedConnection);
- connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed()));
-
- connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event, void*)), breakpoint_model,
- SLOT(OnBreakPointHit(Pica::DebugContext::Event)), Qt::BlockingQueuedConnection);
- connect(this, SIGNAL(Resumed()), breakpoint_model, SLOT(OnResumed()));
-
- connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&, const QModelIndex&)),
- breakpoint_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
-
- QWidget* main_widget = new QWidget;
- auto main_layout = new QVBoxLayout;
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(status_text);
- sub_layout->addWidget(resume_button);
- main_layout->addLayout(sub_layout);
- }
- main_layout->addWidget(breakpoint_list);
- main_widget->setLayout(main_layout);
-
- setWidget(main_widget);
-}
-
-void GraphicsBreakPointsWidget::OnPicaBreakPointHit(Event event, void* data) {
- // Process in GUI thread
- emit BreakPointHit(event, data);
-}
-
-void GraphicsBreakPointsWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) {
- status_text->setText(tr("Emulation halted at breakpoint"));
- resume_button->setEnabled(true);
-}
-
-void GraphicsBreakPointsWidget::OnPicaResume() {
- // Process in GUI thread
- emit Resumed();
-}
-
-void GraphicsBreakPointsWidget::OnResumed() {
- status_text->setText(tr("Emulation running"));
- resume_button->setEnabled(false);
-}
-
-void GraphicsBreakPointsWidget::OnResumeRequested() {
- if (auto context = context_weak.lock())
- context->Resume();
-}
-
-void GraphicsBreakPointsWidget::OnItemDoubleClicked(const QModelIndex& index) {
- if (!index.isValid())
- return;
-
- QModelIndex check_index = breakpoint_list->model()->index(index.row(), 0);
- QVariant enabled = breakpoint_list->model()->data(check_index, Qt::CheckStateRole);
- QVariant new_state = Qt::Unchecked;
- if (enabled == Qt::Unchecked)
- new_state = Qt::Checked;
- breakpoint_list->model()->setData(check_index, new_state, Qt::CheckStateRole);
-}
diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoints.h b/src/citra_qt/debugger/graphics/graphics_breakpoints.h
deleted file mode 100644
index bec72a2db..000000000
--- a/src/citra_qt/debugger/graphics/graphics_breakpoints.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QDockWidget>
-#include "video_core/debug_utils/debug_utils.h"
-
-class QLabel;
-class QPushButton;
-class QTreeView;
-
-class BreakPointModel;
-
-class GraphicsBreakPointsWidget : public QDockWidget, Pica::DebugContext::BreakPointObserver {
- Q_OBJECT
-
- using Event = Pica::DebugContext::Event;
-
-public:
- explicit GraphicsBreakPointsWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
-
- void OnPicaBreakPointHit(Pica::DebugContext::Event event, void* data) override;
- void OnPicaResume() override;
-
-public slots:
- void OnBreakPointHit(Pica::DebugContext::Event event, void* data);
- void OnItemDoubleClicked(const QModelIndex&);
- void OnResumeRequested();
- void OnResumed();
-
-signals:
- void Resumed();
- void BreakPointHit(Pica::DebugContext::Event event, void* data);
- void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
-
-private:
- QLabel* status_text;
- QPushButton* resume_button;
-
- BreakPointModel* breakpoint_model;
- QTreeView* breakpoint_list;
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h b/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h
deleted file mode 100644
index dc64706bd..000000000
--- a/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <memory>
-#include <QAbstractListModel>
-#include "video_core/debug_utils/debug_utils.h"
-
-class BreakPointModel : public QAbstractListModel {
- Q_OBJECT
-
-public:
- enum {
- Role_IsEnabled = Qt::UserRole,
- };
-
- BreakPointModel(std::shared_ptr<Pica::DebugContext> context, QObject* parent);
-
- int columnCount(const QModelIndex& parent = QModelIndex()) const override;
- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
- Qt::ItemFlags flags(const QModelIndex& index) const override;
-
- bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
-
-public slots:
- void OnBreakPointHit(Pica::DebugContext::Event event);
- void OnResumed();
-
-private:
- std::weak_ptr<Pica::DebugContext> context_weak;
- bool at_breakpoint;
- Pica::DebugContext::Event active_breakpoint;
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
deleted file mode 100644
index ce2b9fa50..000000000
--- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QApplication>
-#include <QClipboard>
-#include <QComboBox>
-#include <QHeaderView>
-#include <QLabel>
-#include <QListView>
-#include <QMainWindow>
-#include <QPushButton>
-#include <QSpinBox>
-#include <QTreeView>
-#include <QVBoxLayout>
-#include "citra_qt/debugger/graphics/graphics_cmdlists.h"
-#include "citra_qt/util/spinbox.h"
-#include "citra_qt/util/util.h"
-#include "common/vector_math.h"
-#include "core/memory.h"
-#include "video_core/debug_utils/debug_utils.h"
-#include "video_core/pica_state.h"
-#include "video_core/regs.h"
-#include "video_core/texture/texture_decode.h"
-
-namespace {
-QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) {
- QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
- for (u32 y = 0; y < info.height; ++y) {
- for (u32 x = 0; x < info.width; ++x) {
- Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true);
- decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
- }
- }
-
- return decoded_image;
-}
-
-class TextureInfoWidget : public QWidget {
-public:
- TextureInfoWidget(const u8* src, const Pica::Texture::TextureInfo& info,
- QWidget* parent = nullptr)
- : QWidget(parent) {
-
- QLabel* image_widget = new QLabel;
- QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info));
- image_pixmap = image_pixmap.scaled(200, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- image_widget->setPixmap(image_pixmap);
-
- QVBoxLayout* layout = new QVBoxLayout;
- layout->addWidget(image_widget);
- setLayout(layout);
- }
-};
-} // Anonymous namespace
-
-GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {}
-
-int GPUCommandListModel::rowCount(const QModelIndex& parent) const {
- return static_cast<int>(pica_trace.writes.size());
-}
-
-int GPUCommandListModel::columnCount(const QModelIndex& parent) const {
- return 4;
-}
-
-QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
- if (!index.isValid())
- return QVariant();
-
- const auto& write = pica_trace.writes[index.row()];
-
- if (role == Qt::DisplayRole) {
- switch (index.column()) {
- case 0:
- return QString::fromLatin1(Pica::Regs::GetRegisterName(write.cmd_id));
- case 1:
- return QString("%1").arg(write.cmd_id, 3, 16, QLatin1Char('0'));
- case 2:
- return QString("%1").arg(write.mask, 4, 2, QLatin1Char('0'));
- case 3:
- return QString("%1").arg(write.value, 8, 16, QLatin1Char('0'));
- }
- } else if (role == CommandIdRole) {
- return QVariant::fromValue<int>(write.cmd_id);
- }
-
- return QVariant();
-}
-
-QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const {
- switch (role) {
- case Qt::DisplayRole: {
- switch (section) {
- case 0:
- return tr("Command Name");
- case 1:
- return tr("Register");
- case 2:
- return tr("Mask");
- case 3:
- return tr("New Value");
- }
-
- break;
- }
- }
-
- return QVariant();
-}
-
-void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace) {
- beginResetModel();
-
- pica_trace = trace;
-
- endResetModel();
-}
-
-#define COMMAND_IN_RANGE(cmd_id, reg_name) \
- (cmd_id >= PICA_REG_INDEX(reg_name) && \
- cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::g_state.regs.reg_name)) / 4)
-
-void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
- const unsigned int command_id =
- list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt();
- if (COMMAND_IN_RANGE(command_id, texturing.texture0) ||
- COMMAND_IN_RANGE(command_id, texturing.texture1) ||
- COMMAND_IN_RANGE(command_id, texturing.texture2)) {
-
- unsigned texture_index;
- if (COMMAND_IN_RANGE(command_id, texturing.texture0)) {
- texture_index = 0;
- } else if (COMMAND_IN_RANGE(command_id, texturing.texture1)) {
- texture_index = 1;
- } else if (COMMAND_IN_RANGE(command_id, texturing.texture2)) {
- texture_index = 2;
- } else {
- UNREACHABLE_MSG("Unknown texture command");
- }
-
- // TODO: Open a surface debugger
- }
-}
-
-void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
- QWidget* new_info_widget = nullptr;
-
- const unsigned int command_id =
- list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt();
- if (COMMAND_IN_RANGE(command_id, texturing.texture0) ||
- COMMAND_IN_RANGE(command_id, texturing.texture1) ||
- COMMAND_IN_RANGE(command_id, texturing.texture2)) {
-
- unsigned texture_index;
- if (COMMAND_IN_RANGE(command_id, texturing.texture0)) {
- texture_index = 0;
- } else if (COMMAND_IN_RANGE(command_id, texturing.texture1)) {
- texture_index = 1;
- } else {
- texture_index = 2;
- }
-
- const auto texture = Pica::g_state.regs.texturing.GetTextures()[texture_index];
- const auto config = texture.config;
- const auto format = texture.format;
-
- const auto info = Pica::Texture::TextureInfo::FromPicaRegister(config, format);
- const u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress());
- new_info_widget = new TextureInfoWidget(src, info);
- }
- if (command_info_widget) {
- delete command_info_widget;
- command_info_widget = nullptr;
- }
- if (new_info_widget) {
- widget()->layout()->addWidget(new_info_widget);
- command_info_widget = new_info_widget;
- }
-}
-#undef COMMAND_IN_RANGE
-
-GPUCommandListWidget::GPUCommandListWidget(QWidget* parent)
- : QDockWidget(tr("Pica Command List"), parent) {
- setObjectName("Pica Command List");
- GPUCommandListModel* model = new GPUCommandListModel(this);
-
- QWidget* main_widget = new QWidget;
-
- list_widget = new QTreeView;
- list_widget->setModel(model);
- list_widget->setFont(GetMonospaceFont());
- list_widget->setRootIsDecorated(false);
- list_widget->setUniformRowHeights(true);
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
- list_widget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
-#else
- list_widget->header()->setResizeMode(QHeaderView::ResizeToContents);
-#endif
-
- connect(list_widget->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this,
- SLOT(SetCommandInfo(const QModelIndex&)));
- connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)), this,
- SLOT(OnCommandDoubleClicked(const QModelIndex&)));
-
- toggle_tracing = new QPushButton(tr("Start Tracing"));
- QPushButton* copy_all = new QPushButton(tr("Copy All"));
-
- connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing()));
- connect(this, SIGNAL(TracingFinished(const Pica::DebugUtils::PicaTrace&)), model,
- SLOT(OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&)));
-
- connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard()));
-
- command_info_widget = nullptr;
-
- QVBoxLayout* main_layout = new QVBoxLayout;
- main_layout->addWidget(list_widget);
- {
- QHBoxLayout* sub_layout = new QHBoxLayout;
- sub_layout->addWidget(toggle_tracing);
- sub_layout->addWidget(copy_all);
- main_layout->addLayout(sub_layout);
- }
- main_widget->setLayout(main_layout);
-
- setWidget(main_widget);
-}
-
-void GPUCommandListWidget::OnToggleTracing() {
- if (!Pica::DebugUtils::IsPicaTracing()) {
- Pica::DebugUtils::StartPicaTracing();
- toggle_tracing->setText(tr("Finish Tracing"));
- } else {
- pica_trace = Pica::DebugUtils::FinishPicaTracing();
- emit TracingFinished(*pica_trace);
- toggle_tracing->setText(tr("Start Tracing"));
- }
-}
-
-void GPUCommandListWidget::CopyAllToClipboard() {
- QClipboard* clipboard = QApplication::clipboard();
- QString text;
-
- QAbstractItemModel* model = static_cast<QAbstractItemModel*>(list_widget->model());
-
- for (int row = 0; row < model->rowCount({}); ++row) {
- for (int col = 0; col < model->columnCount({}); ++col) {
- QModelIndex index = model->index(row, col);
- text += model->data(index).value<QString>();
- text += '\t';
- }
- text += '\n';
- }
-
- clipboard->setText(text);
-}
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.h b/src/citra_qt/debugger/graphics/graphics_cmdlists.h
deleted file mode 100644
index 8f40b94c5..000000000
--- a/src/citra_qt/debugger/graphics/graphics_cmdlists.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QAbstractListModel>
-#include <QDockWidget>
-#include "video_core/debug_utils/debug_utils.h"
-#include "video_core/gpu_debugger.h"
-
-class QPushButton;
-class QTreeView;
-
-class GPUCommandListModel : public QAbstractListModel {
- Q_OBJECT
-
-public:
- enum {
- CommandIdRole = Qt::UserRole,
- };
-
- explicit GPUCommandListModel(QObject* parent);
-
- int columnCount(const QModelIndex& parent = QModelIndex()) const override;
- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const override;
-
-public slots:
- void OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace);
-
-private:
- Pica::DebugUtils::PicaTrace pica_trace;
-};
-
-class GPUCommandListWidget : public QDockWidget {
- Q_OBJECT
-
-public:
- explicit GPUCommandListWidget(QWidget* parent = nullptr);
-
-public slots:
- void OnToggleTracing();
- void OnCommandDoubleClicked(const QModelIndex&);
-
- void SetCommandInfo(const QModelIndex&);
-
- void CopyAllToClipboard();
-
-signals:
- void TracingFinished(const Pica::DebugUtils::PicaTrace&);
-
-private:
- std::unique_ptr<Pica::DebugUtils::PicaTrace> pica_trace;
-
- QTreeView* list_widget;
- QWidget* command_info_widget;
- QPushButton* toggle_tracing;
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp
deleted file mode 100644
index c974545ef..000000000
--- a/src/citra_qt/debugger/graphics/graphics_surface.cpp
+++ /dev/null
@@ -1,713 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QBoxLayout>
-#include <QComboBox>
-#include <QDebug>
-#include <QFileDialog>
-#include <QLabel>
-#include <QMouseEvent>
-#include <QPushButton>
-#include <QScrollArea>
-#include <QSpinBox>
-#include "citra_qt/debugger/graphics/graphics_surface.h"
-#include "citra_qt/util/spinbox.h"
-#include "common/color.h"
-#include "core/hw/gpu.h"
-#include "core/memory.h"
-#include "video_core/pica_state.h"
-#include "video_core/regs_framebuffer.h"
-#include "video_core/regs_texturing.h"
-#include "video_core/texture/texture_decode.h"
-#include "video_core/utils.h"
-
-SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_)
- : QLabel(parent), surface_widget(surface_widget_) {}
-SurfacePicture::~SurfacePicture() {}
-
-void SurfacePicture::mousePressEvent(QMouseEvent* event) {
- // Only do something while the left mouse button is held down
- if (!(event->buttons() & Qt::LeftButton))
- return;
-
- if (pixmap() == nullptr)
- return;
-
- if (surface_widget)
- surface_widget->Pick(event->x() * pixmap()->width() / width(),
- event->y() * pixmap()->height() / height());
-}
-
-void SurfacePicture::mouseMoveEvent(QMouseEvent* event) {
- // We also want to handle the event if the user moves the mouse while holding down the LMB
- mousePressEvent(event);
-}
-
-GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent)
- : BreakPointObserverDock(debug_context, tr("Pica Surface Viewer"), parent),
- surface_source(Source::ColorBuffer) {
- setObjectName("PicaSurface");
-
- surface_source_list = new QComboBox;
- surface_source_list->addItem(tr("Color Buffer"));
- surface_source_list->addItem(tr("Depth Buffer"));
- surface_source_list->addItem(tr("Stencil Buffer"));
- surface_source_list->addItem(tr("Texture 0"));
- surface_source_list->addItem(tr("Texture 1"));
- surface_source_list->addItem(tr("Texture 2"));
- surface_source_list->addItem(tr("Custom"));
- surface_source_list->setCurrentIndex(static_cast<int>(surface_source));
-
- surface_address_control = new CSpinBox;
- surface_address_control->SetBase(16);
- surface_address_control->SetRange(0, 0xFFFFFFFF);
- surface_address_control->SetPrefix("0x");
-
- unsigned max_dimension = 16384; // TODO: Find actual maximum
-
- surface_width_control = new QSpinBox;
- surface_width_control->setRange(0, max_dimension);
-
- surface_height_control = new QSpinBox;
- surface_height_control->setRange(0, max_dimension);
-
- surface_picker_x_control = new QSpinBox;
- surface_picker_x_control->setRange(0, max_dimension - 1);
-
- surface_picker_y_control = new QSpinBox;
- surface_picker_y_control->setRange(0, max_dimension - 1);
-
- surface_format_control = new QComboBox;
-
- // Color formats sorted by Pica texture format index
- surface_format_control->addItem(tr("RGBA8"));
- surface_format_control->addItem(tr("RGB8"));
- surface_format_control->addItem(tr("RGB5A1"));
- surface_format_control->addItem(tr("RGB565"));
- surface_format_control->addItem(tr("RGBA4"));
- surface_format_control->addItem(tr("IA8"));
- surface_format_control->addItem(tr("RG8"));
- surface_format_control->addItem(tr("I8"));
- surface_format_control->addItem(tr("A8"));
- surface_format_control->addItem(tr("IA4"));
- surface_format_control->addItem(tr("I4"));
- surface_format_control->addItem(tr("A4"));
- surface_format_control->addItem(tr("ETC1"));
- surface_format_control->addItem(tr("ETC1A4"));
- surface_format_control->addItem(tr("D16"));
- surface_format_control->addItem(tr("D24"));
- surface_format_control->addItem(tr("D24X8"));
- surface_format_control->addItem(tr("X24S8"));
- surface_format_control->addItem(tr("Unknown"));
-
- surface_info_label = new QLabel();
- surface_info_label->setWordWrap(true);
-
- surface_picture_label = new SurfacePicture(0, this);
- surface_picture_label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- surface_picture_label->setAlignment(Qt::AlignLeft | Qt::AlignTop);
- surface_picture_label->setScaledContents(false);
-
- auto scroll_area = new QScrollArea();
- scroll_area->setBackgroundRole(QPalette::Dark);
- scroll_area->setWidgetResizable(false);
- scroll_area->setWidget(surface_picture_label);
-
- save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save"));
-
- // Connections
- connect(this, SIGNAL(Update()), this, SLOT(OnUpdate()));
- connect(surface_source_list, SIGNAL(currentIndexChanged(int)), this,
- SLOT(OnSurfaceSourceChanged(int)));
- connect(surface_address_control, SIGNAL(ValueChanged(qint64)), this,
- SLOT(OnSurfaceAddressChanged(qint64)));
- connect(surface_width_control, SIGNAL(valueChanged(int)), this,
- SLOT(OnSurfaceWidthChanged(int)));
- connect(surface_height_control, SIGNAL(valueChanged(int)), this,
- SLOT(OnSurfaceHeightChanged(int)));
- connect(surface_format_control, SIGNAL(currentIndexChanged(int)), this,
- SLOT(OnSurfaceFormatChanged(int)));
- connect(surface_picker_x_control, SIGNAL(valueChanged(int)), this,
- SLOT(OnSurfacePickerXChanged(int)));
- connect(surface_picker_y_control, SIGNAL(valueChanged(int)), this,
- SLOT(OnSurfacePickerYChanged(int)));
- connect(save_surface, SIGNAL(clicked()), this, SLOT(SaveSurface()));
-
- auto main_widget = new QWidget;
- auto main_layout = new QVBoxLayout;
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("Source:")));
- sub_layout->addWidget(surface_source_list);
- main_layout->addLayout(sub_layout);
- }
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("Physical Address:")));
- sub_layout->addWidget(surface_address_control);
- main_layout->addLayout(sub_layout);
- }
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("Width:")));
- sub_layout->addWidget(surface_width_control);
- main_layout->addLayout(sub_layout);
- }
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("Height:")));
- sub_layout->addWidget(surface_height_control);
- main_layout->addLayout(sub_layout);
- }
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("Format:")));
- sub_layout->addWidget(surface_format_control);
- main_layout->addLayout(sub_layout);
- }
- main_layout->addWidget(scroll_area);
-
- auto info_layout = new QHBoxLayout;
- {
- auto xy_layout = new QVBoxLayout;
- {
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("X:")));
- sub_layout->addWidget(surface_picker_x_control);
- xy_layout->addLayout(sub_layout);
- }
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(new QLabel(tr("Y:")));
- sub_layout->addWidget(surface_picker_y_control);
- xy_layout->addLayout(sub_layout);
- }
- }
- info_layout->addLayout(xy_layout);
- surface_info_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
- info_layout->addWidget(surface_info_label);
- }
- main_layout->addLayout(info_layout);
-
- main_layout->addWidget(save_surface);
- main_widget->setLayout(main_layout);
- setWidget(main_widget);
-
- // Load current data - TODO: Make sure this works when emulation is not running
- if (debug_context && debug_context->at_breakpoint) {
- emit Update();
- widget()->setEnabled(debug_context->at_breakpoint);
- } else {
- widget()->setEnabled(false);
- }
-}
-
-void GraphicsSurfaceWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) {
- emit Update();
- widget()->setEnabled(true);
-}
-
-void GraphicsSurfaceWidget::OnResumed() {
- widget()->setEnabled(false);
-}
-
-void GraphicsSurfaceWidget::OnSurfaceSourceChanged(int new_value) {
- surface_source = static_cast<Source>(new_value);
- emit Update();
-}
-
-void GraphicsSurfaceWidget::OnSurfaceAddressChanged(qint64 new_value) {
- if (surface_address != new_value) {
- surface_address = static_cast<unsigned>(new_value);
-
- surface_source_list->setCurrentIndex(static_cast<int>(Source::Custom));
- emit Update();
- }
-}
-
-void GraphicsSurfaceWidget::OnSurfaceWidthChanged(int new_value) {
- if (surface_width != static_cast<unsigned>(new_value)) {
- surface_width = static_cast<unsigned>(new_value);
-
- surface_source_list->setCurrentIndex(static_cast<int>(Source::Custom));
- emit Update();
- }
-}
-
-void GraphicsSurfaceWidget::OnSurfaceHeightChanged(int new_value) {
- if (surface_height != static_cast<unsigned>(new_value)) {
- surface_height = static_cast<unsigned>(new_value);
-
- surface_source_list->setCurrentIndex(static_cast<int>(Source::Custom));
- emit Update();
- }
-}
-
-void GraphicsSurfaceWidget::OnSurfaceFormatChanged(int new_value) {
- if (surface_format != static_cast<Format>(new_value)) {
- surface_format = static_cast<Format>(new_value);
-
- surface_source_list->setCurrentIndex(static_cast<int>(Source::Custom));
- emit Update();
- }
-}
-
-void GraphicsSurfaceWidget::OnSurfacePickerXChanged(int new_value) {
- if (surface_picker_x != new_value) {
- surface_picker_x = new_value;
- Pick(surface_picker_x, surface_picker_y);
- }
-}
-
-void GraphicsSurfaceWidget::OnSurfacePickerYChanged(int new_value) {
- if (surface_picker_y != new_value) {
- surface_picker_y = new_value;
- Pick(surface_picker_x, surface_picker_y);
- }
-}
-
-void GraphicsSurfaceWidget::Pick(int x, int y) {
- surface_picker_x_control->setValue(x);
- surface_picker_y_control->setValue(y);
-
- if (x < 0 || x >= static_cast<int>(surface_width) || y < 0 ||
- y >= static_cast<int>(surface_height)) {
- surface_info_label->setText(tr("Pixel out of bounds"));
- surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
- return;
- }
-
- u8* buffer = Memory::GetPhysicalPointer(surface_address);
- if (buffer == nullptr) {
- surface_info_label->setText(tr("(unable to access pixel data)"));
- surface_info_label->setAlignment(Qt::AlignCenter);
- return;
- }
-
- unsigned nibbles_per_pixel = GraphicsSurfaceWidget::NibblesPerPixel(surface_format);
- unsigned stride = nibbles_per_pixel * surface_width / 2;
-
- unsigned bytes_per_pixel;
- bool nibble_mode = (nibbles_per_pixel == 1);
- if (nibble_mode) {
- // As nibbles are contained in a byte we still need to access one byte per nibble
- bytes_per_pixel = 1;
- } else {
- bytes_per_pixel = nibbles_per_pixel / 2;
- }
-
- const u32 coarse_y = y & ~7;
- u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * stride;
- const u8* pixel = buffer + (nibble_mode ? (offset / 2) : offset);
-
- auto GetText = [offset](Format format, const u8* pixel) {
- switch (format) {
- case Format::RGBA8: {
- auto value = Color::DecodeRGBA8(pixel) / 255.0f;
- return QString("Red: %1, Green: %2, Blue: %3, Alpha: %4")
- .arg(QString::number(value.r(), 'f', 2))
- .arg(QString::number(value.g(), 'f', 2))
- .arg(QString::number(value.b(), 'f', 2))
- .arg(QString::number(value.a(), 'f', 2));
- }
- case Format::RGB8: {
- auto value = Color::DecodeRGB8(pixel) / 255.0f;
- return QString("Red: %1, Green: %2, Blue: %3")
- .arg(QString::number(value.r(), 'f', 2))
- .arg(QString::number(value.g(), 'f', 2))
- .arg(QString::number(value.b(), 'f', 2));
- }
- case Format::RGB5A1: {
- auto value = Color::DecodeRGB5A1(pixel) / 255.0f;
- return QString("Red: %1, Green: %2, Blue: %3, Alpha: %4")
- .arg(QString::number(value.r(), 'f', 2))
- .arg(QString::number(value.g(), 'f', 2))
- .arg(QString::number(value.b(), 'f', 2))
- .arg(QString::number(value.a(), 'f', 2));
- }
- case Format::RGB565: {
- auto value = Color::DecodeRGB565(pixel) / 255.0f;
- return QString("Red: %1, Green: %2, Blue: %3")
- .arg(QString::number(value.r(), 'f', 2))
- .arg(QString::number(value.g(), 'f', 2))
- .arg(QString::number(value.b(), 'f', 2));
- }
- case Format::RGBA4: {
- auto value = Color::DecodeRGBA4(pixel) / 255.0f;
- return QString("Red: %1, Green: %2, Blue: %3, Alpha: %4")
- .arg(QString::number(value.r(), 'f', 2))
- .arg(QString::number(value.g(), 'f', 2))
- .arg(QString::number(value.b(), 'f', 2))
- .arg(QString::number(value.a(), 'f', 2));
- }
- case Format::IA8:
- return QString("Index: %1, Alpha: %2").arg(pixel[0]).arg(pixel[1]);
- case Format::RG8: {
- auto value = Color::DecodeRG8(pixel) / 255.0f;
- return QString("Red: %1, Green: %2")
- .arg(QString::number(value.r(), 'f', 2))
- .arg(QString::number(value.g(), 'f', 2));
- }
- case Format::I8:
- return QString("Index: %1").arg(*pixel);
- case Format::A8:
- return QString("Alpha: %1").arg(QString::number(*pixel / 255.0f, 'f', 2));
- case Format::IA4:
- return QString("Index: %1, Alpha: %2").arg(*pixel & 0xF).arg((*pixel & 0xF0) >> 4);
- case Format::I4: {
- u8 i = (*pixel >> ((offset % 2) ? 4 : 0)) & 0xF;
- return QString("Index: %1").arg(i);
- }
- case Format::A4: {
- u8 a = (*pixel >> ((offset % 2) ? 4 : 0)) & 0xF;
- return QString("Alpha: %1").arg(QString::number(a / 15.0f, 'f', 2));
- }
- case Format::ETC1:
- case Format::ETC1A4:
- // TODO: Display block information or channel values?
- return QString("Compressed data");
- case Format::D16: {
- auto value = Color::DecodeD16(pixel);
- return QString("Depth: %1").arg(QString::number(value / (float)0xFFFF, 'f', 4));
- }
- case Format::D24: {
- auto value = Color::DecodeD24(pixel);
- return QString("Depth: %1").arg(QString::number(value / (float)0xFFFFFF, 'f', 4));
- }
- case Format::D24X8:
- case Format::X24S8: {
- auto values = Color::DecodeD24S8(pixel);
- return QString("Depth: %1, Stencil: %2")
- .arg(QString::number(values[0] / (float)0xFFFFFF, 'f', 4))
- .arg(values[1]);
- }
- case Format::Unknown:
- return QString("Unknown format");
- default:
- return QString("Unhandled format");
- }
- return QString("");
- };
-
- QString nibbles = "";
- for (unsigned i = 0; i < nibbles_per_pixel; i++) {
- unsigned nibble_index = i;
- if (nibble_mode) {
- nibble_index += (offset % 2) ? 0 : 1;
- }
- u8 byte = pixel[nibble_index / 2];
- u8 nibble = (byte >> ((nibble_index % 2) ? 0 : 4)) & 0xF;
- nibbles.append(QString::number(nibble, 16).toUpper());
- }
-
- surface_info_label->setText(
- QString("Raw: 0x%3\n(%4)").arg(nibbles).arg(GetText(surface_format, pixel)));
- surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
-}
-
-void GraphicsSurfaceWidget::OnUpdate() {
- QPixmap pixmap;
-
- switch (surface_source) {
- case Source::ColorBuffer: {
- // TODO: Store a reference to the registers in the debug context instead of accessing them
- // directly...
-
- const auto& framebuffer = Pica::g_state.regs.framebuffer.framebuffer;
-
- surface_address = framebuffer.GetColorBufferPhysicalAddress();
- surface_width = framebuffer.GetWidth();
- surface_height = framebuffer.GetHeight();
-
- switch (framebuffer.color_format) {
- case Pica::FramebufferRegs::ColorFormat::RGBA8:
- surface_format = Format::RGBA8;
- break;
-
- case Pica::FramebufferRegs::ColorFormat::RGB8:
- surface_format = Format::RGB8;
- break;
-
- case Pica::FramebufferRegs::ColorFormat::RGB5A1:
- surface_format = Format::RGB5A1;
- break;
-
- case Pica::FramebufferRegs::ColorFormat::RGB565:
- surface_format = Format::RGB565;
- break;
-
- case Pica::FramebufferRegs::ColorFormat::RGBA4:
- surface_format = Format::RGBA4;
- break;
-
- default:
- surface_format = Format::Unknown;
- break;
- }
-
- break;
- }
-
- case Source::DepthBuffer: {
- const auto& framebuffer = Pica::g_state.regs.framebuffer.framebuffer;
-
- surface_address = framebuffer.GetDepthBufferPhysicalAddress();
- surface_width = framebuffer.GetWidth();
- surface_height = framebuffer.GetHeight();
-
- switch (framebuffer.depth_format) {
- case Pica::FramebufferRegs::DepthFormat::D16:
- surface_format = Format::D16;
- break;
-
- case Pica::FramebufferRegs::DepthFormat::D24:
- surface_format = Format::D24;
- break;
-
- case Pica::FramebufferRegs::DepthFormat::D24S8:
- surface_format = Format::D24X8;
- break;
-
- default:
- surface_format = Format::Unknown;
- break;
- }
-
- break;
- }
-
- case Source::StencilBuffer: {
- const auto& framebuffer = Pica::g_state.regs.framebuffer.framebuffer;
-
- surface_address = framebuffer.GetDepthBufferPhysicalAddress();
- surface_width = framebuffer.GetWidth();
- surface_height = framebuffer.GetHeight();
-
- switch (framebuffer.depth_format) {
- case Pica::FramebufferRegs::DepthFormat::D24S8:
- surface_format = Format::X24S8;
- break;
-
- default:
- surface_format = Format::Unknown;
- break;
- }
-
- break;
- }
-
- case Source::Texture0:
- case Source::Texture1:
- case Source::Texture2: {
- unsigned texture_index;
- if (surface_source == Source::Texture0)
- texture_index = 0;
- else if (surface_source == Source::Texture1)
- texture_index = 1;
- else if (surface_source == Source::Texture2)
- texture_index = 2;
- else {
- qDebug() << "Unknown texture source " << static_cast<int>(surface_source);
- break;
- }
-
- const auto texture = Pica::g_state.regs.texturing.GetTextures()[texture_index];
- auto info = Pica::Texture::TextureInfo::FromPicaRegister(texture.config, texture.format);
-
- surface_address = info.physical_address;
- surface_width = info.width;
- surface_height = info.height;
- surface_format = static_cast<Format>(info.format);
-
- if (surface_format > Format::MaxTextureFormat) {
- qDebug() << "Unknown texture format " << static_cast<int>(info.format);
- }
- break;
- }
-
- case Source::Custom: {
- // Keep user-specified values
- break;
- }
-
- default:
- qDebug() << "Unknown surface source " << static_cast<int>(surface_source);
- break;
- }
-
- surface_address_control->SetValue(surface_address);
- surface_width_control->setValue(surface_width);
- surface_height_control->setValue(surface_height);
- surface_format_control->setCurrentIndex(static_cast<int>(surface_format));
-
- // TODO: Implement a good way to visualize alpha components!
-
- QImage decoded_image(surface_width, surface_height, QImage::Format_ARGB32);
- u8* buffer = Memory::GetPhysicalPointer(surface_address);
-
- if (buffer == nullptr) {
- surface_picture_label->hide();
- surface_info_label->setText(tr("(invalid surface address)"));
- surface_info_label->setAlignment(Qt::AlignCenter);
- surface_picker_x_control->setEnabled(false);
- surface_picker_y_control->setEnabled(false);
- save_surface->setEnabled(false);
- return;
- }
-
- if (surface_format == Format::Unknown) {
- surface_picture_label->hide();
- surface_info_label->setText(tr("(unknown surface format)"));
- surface_info_label->setAlignment(Qt::AlignCenter);
- surface_picker_x_control->setEnabled(false);
- surface_picker_y_control->setEnabled(false);
- save_surface->setEnabled(false);
- return;
- }
-
- surface_picture_label->show();
-
- if (surface_format <= Format::MaxTextureFormat) {
- // Generate a virtual texture
- Pica::Texture::TextureInfo info;
- info.physical_address = surface_address;
- info.width = surface_width;
- info.height = surface_height;
- info.format = static_cast<Pica::TexturingRegs::TextureFormat>(surface_format);
- info.SetDefaultStride();
-
- for (unsigned int y = 0; y < surface_height; ++y) {
- for (unsigned int x = 0; x < surface_width; ++x) {
- Math::Vec4<u8> color = Pica::Texture::LookupTexture(buffer, x, y, info, true);
- decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
- }
- }
- } else {
- // We handle depth formats here because DebugUtils only supports TextureFormats
-
- // TODO(yuriks): Convert to newer tile-based addressing
- unsigned nibbles_per_pixel = GraphicsSurfaceWidget::NibblesPerPixel(surface_format);
- unsigned stride = nibbles_per_pixel * surface_width / 2;
-
- ASSERT_MSG(nibbles_per_pixel >= 2,
- "Depth decoder only supports formats with at least one byte per pixel");
- unsigned bytes_per_pixel = nibbles_per_pixel / 2;
-
- for (unsigned int y = 0; y < surface_height; ++y) {
- for (unsigned int x = 0; x < surface_width; ++x) {
- const u32 coarse_y = y & ~7;
- u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * stride;
- const u8* pixel = buffer + offset;
- Math::Vec4<u8> color = {0, 0, 0, 0};
-
- switch (surface_format) {
- case Format::D16: {
- u32 data = Color::DecodeD16(pixel);
- color.r() = data & 0xFF;
- color.g() = (data >> 8) & 0xFF;
- break;
- }
- case Format::D24: {
- u32 data = Color::DecodeD24(pixel);
- color.r() = data & 0xFF;
- color.g() = (data >> 8) & 0xFF;
- color.b() = (data >> 16) & 0xFF;
- break;
- }
- case Format::D24X8: {
- Math::Vec2<u32> data = Color::DecodeD24S8(pixel);
- color.r() = data.x & 0xFF;
- color.g() = (data.x >> 8) & 0xFF;
- color.b() = (data.x >> 16) & 0xFF;
- break;
- }
- case Format::X24S8: {
- Math::Vec2<u32> data = Color::DecodeD24S8(pixel);
- color.r() = color.g() = color.b() = data.y;
- break;
- }
- default:
- qDebug() << "Unknown surface format " << static_cast<int>(surface_format);
- break;
- }
-
- decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), 255));
- }
- }
- }
-
- pixmap = QPixmap::fromImage(decoded_image);
- surface_picture_label->setPixmap(pixmap);
- surface_picture_label->resize(pixmap.size());
-
- // Update the info with pixel data
- surface_picker_x_control->setEnabled(true);
- surface_picker_y_control->setEnabled(true);
- Pick(surface_picker_x, surface_picker_y);
-
- // Enable saving the converted pixmap to file
- save_surface->setEnabled(true);
-}
-
-void GraphicsSurfaceWidget::SaveSurface() {
- QString png_filter = tr("Portable Network Graphic (*.png)");
- QString bin_filter = tr("Binary data (*.bin)");
-
- QString selectedFilter;
- QString filename = QFileDialog::getSaveFileName(
- this, tr("Save Surface"),
- QString("texture-0x%1.png").arg(QString::number(surface_address, 16)),
- QString("%1;;%2").arg(png_filter, bin_filter), &selectedFilter);
-
- if (filename.isEmpty()) {
- // If the user canceled the dialog, don't save anything.
- return;
- }
-
- if (selectedFilter == png_filter) {
- const QPixmap* pixmap = surface_picture_label->pixmap();
- ASSERT_MSG(pixmap != nullptr, "No pixmap set");
-
- QFile file(filename);
- file.open(QIODevice::WriteOnly);
- if (pixmap)
- pixmap->save(&file, "PNG");
- } else if (selectedFilter == bin_filter) {
- const u8* buffer = Memory::GetPhysicalPointer(surface_address);
- ASSERT_MSG(buffer != nullptr, "Memory not accessible");
-
- QFile file(filename);
- file.open(QIODevice::WriteOnly);
- int size = surface_width * surface_height * NibblesPerPixel(surface_format) / 2;
- QByteArray data(reinterpret_cast<const char*>(buffer), size);
- file.write(data);
- } else {
- UNREACHABLE_MSG("Unhandled filter selected");
- }
-}
-
-unsigned int GraphicsSurfaceWidget::NibblesPerPixel(GraphicsSurfaceWidget::Format format) {
- if (format <= Format::MaxTextureFormat) {
- return Pica::TexturingRegs::NibblesPerPixel(
- static_cast<Pica::TexturingRegs::TextureFormat>(format));
- }
-
- switch (format) {
- case Format::D24X8:
- case Format::X24S8:
- return 4 * 2;
- case Format::D24:
- return 3 * 2;
- case Format::D16:
- return 2 * 2;
- default:
- UNREACHABLE_MSG("GraphicsSurfaceWidget::BytesPerPixel: this should not be reached as this "
- "function should be given a format which is in "
- "GraphicsSurfaceWidget::Format. Instead got %i",
- static_cast<int>(format));
- return 0;
- }
-}
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.h b/src/citra_qt/debugger/graphics/graphics_surface.h
deleted file mode 100644
index 28f5650a7..000000000
--- a/src/citra_qt/debugger/graphics/graphics_surface.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QLabel>
-#include <QPushButton>
-#include "citra_qt/debugger/graphics/graphics_breakpoint_observer.h"
-
-class QComboBox;
-class QSpinBox;
-class CSpinBox;
-
-class GraphicsSurfaceWidget;
-
-class SurfacePicture : public QLabel {
- Q_OBJECT
-
-public:
- explicit SurfacePicture(QWidget* parent = nullptr,
- GraphicsSurfaceWidget* surface_widget = nullptr);
- ~SurfacePicture();
-
-protected slots:
- virtual void mouseMoveEvent(QMouseEvent* event);
- virtual void mousePressEvent(QMouseEvent* event);
-
-private:
- GraphicsSurfaceWidget* surface_widget;
-};
-
-class GraphicsSurfaceWidget : public BreakPointObserverDock {
- Q_OBJECT
-
- using Event = Pica::DebugContext::Event;
-
- enum class Source {
- ColorBuffer = 0,
- DepthBuffer = 1,
- StencilBuffer = 2,
- Texture0 = 3,
- Texture1 = 4,
- Texture2 = 5,
- Custom = 6,
- };
-
- enum class Format {
- // These must match the TextureFormat type!
- RGBA8 = 0,
- RGB8 = 1,
- RGB5A1 = 2,
- RGB565 = 3,
- RGBA4 = 4,
- IA8 = 5,
- RG8 = 6, ///< @note Also called HILO8 in 3DBrew.
- I8 = 7,
- A8 = 8,
- IA4 = 9,
- I4 = 10,
- A4 = 11,
- ETC1 = 12, // compressed
- ETC1A4 = 13,
- MaxTextureFormat = 13,
- D16 = 14,
- D24 = 15,
- D24X8 = 16,
- X24S8 = 17,
- Unknown = 18,
- };
-
- static unsigned int NibblesPerPixel(Format format);
-
-public:
- explicit GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
- void Pick(int x, int y);
-
-public slots:
- void OnSurfaceSourceChanged(int new_value);
- void OnSurfaceAddressChanged(qint64 new_value);
- void OnSurfaceWidthChanged(int new_value);
- void OnSurfaceHeightChanged(int new_value);
- void OnSurfaceFormatChanged(int new_value);
- void OnSurfacePickerXChanged(int new_value);
- void OnSurfacePickerYChanged(int new_value);
- void OnUpdate();
-
-private slots:
- void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
- void OnResumed() override;
-
- void SaveSurface();
-
-signals:
- void Update();
-
-private:
- QComboBox* surface_source_list;
- CSpinBox* surface_address_control;
- QSpinBox* surface_width_control;
- QSpinBox* surface_height_control;
- QComboBox* surface_format_control;
-
- SurfacePicture* surface_picture_label;
- QSpinBox* surface_picker_x_control;
- QSpinBox* surface_picker_y_control;
- QLabel* surface_info_label;
- QPushButton* save_surface;
-
- Source surface_source;
- unsigned surface_address;
- unsigned surface_width;
- unsigned surface_height;
- Format surface_format;
- int surface_picker_x = 0;
- int surface_picker_y = 0;
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_tracing.cpp b/src/citra_qt/debugger/graphics/graphics_tracing.cpp
deleted file mode 100644
index 40d5bed51..000000000
--- a/src/citra_qt/debugger/graphics/graphics_tracing.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <algorithm>
-#include <array>
-#include <iterator>
-#include <memory>
-#include <QBoxLayout>
-#include <QComboBox>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QPushButton>
-#include <boost/range/algorithm/copy.hpp>
-#include "citra_qt/debugger/graphics/graphics_tracing.h"
-#include "common/common_types.h"
-#include "core/hw/gpu.h"
-#include "core/hw/lcd.h"
-#include "core/tracer/recorder.h"
-#include "nihstro/float24.h"
-#include "video_core/pica_state.h"
-
-GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent)
- : BreakPointObserverDock(debug_context, tr("CiTrace Recorder"), parent) {
-
- setObjectName("CiTracing");
-
- QPushButton* start_recording = new QPushButton(tr("Start Recording"));
- QPushButton* stop_recording =
- new QPushButton(QIcon::fromTheme("document-save"), tr("Stop and Save"));
- QPushButton* abort_recording = new QPushButton(tr("Abort Recording"));
-
- connect(this, SIGNAL(SetStartTracingButtonEnabled(bool)), start_recording,
- SLOT(setVisible(bool)));
- connect(this, SIGNAL(SetStopTracingButtonEnabled(bool)), stop_recording,
- SLOT(setVisible(bool)));
- connect(this, SIGNAL(SetAbortTracingButtonEnabled(bool)), abort_recording,
- SLOT(setVisible(bool)));
- connect(start_recording, SIGNAL(clicked()), this, SLOT(StartRecording()));
- connect(stop_recording, SIGNAL(clicked()), this, SLOT(StopRecording()));
- connect(abort_recording, SIGNAL(clicked()), this, SLOT(AbortRecording()));
-
- stop_recording->setVisible(false);
- abort_recording->setVisible(false);
-
- auto main_widget = new QWidget;
- auto main_layout = new QVBoxLayout;
- {
- auto sub_layout = new QHBoxLayout;
- sub_layout->addWidget(start_recording);
- sub_layout->addWidget(stop_recording);
- sub_layout->addWidget(abort_recording);
- main_layout->addLayout(sub_layout);
- }
- main_widget->setLayout(main_layout);
- setWidget(main_widget);
-}
-
-void GraphicsTracingWidget::StartRecording() {
- auto context = context_weak.lock();
- if (!context)
- return;
-
- auto shader_binary = Pica::g_state.vs.program_code;
- auto swizzle_data = Pica::g_state.vs.swizzle_data;
-
- // Encode floating point numbers to 24-bit values
- // TODO: Drop this explicit conversion once we store float24 values bit-correctly internally.
- std::array<u32, 4 * 16> default_attributes;
- for (unsigned i = 0; i < 16; ++i) {
- for (unsigned comp = 0; comp < 3; ++comp) {
- default_attributes[4 * i + comp] = nihstro::to_float24(
- Pica::g_state.input_default_attributes.attr[i][comp].ToFloat32());
- }
- }
-
- std::array<u32, 4 * 96> vs_float_uniforms;
- for (unsigned i = 0; i < 96; ++i)
- for (unsigned comp = 0; comp < 3; ++comp)
- vs_float_uniforms[4 * i + comp] =
- nihstro::to_float24(Pica::g_state.vs.uniforms.f[i][comp].ToFloat32());
-
- CiTrace::Recorder::InitialState state;
- std::copy_n((u32*)&GPU::g_regs, sizeof(GPU::g_regs) / sizeof(u32),
- std::back_inserter(state.gpu_registers));
- std::copy_n((u32*)&LCD::g_regs, sizeof(LCD::g_regs) / sizeof(u32),
- std::back_inserter(state.lcd_registers));
- std::copy_n((u32*)&Pica::g_state.regs, sizeof(Pica::g_state.regs) / sizeof(u32),
- std::back_inserter(state.pica_registers));
- boost::copy(default_attributes, std::back_inserter(state.default_attributes));
- boost::copy(shader_binary, std::back_inserter(state.vs_program_binary));
- boost::copy(swizzle_data, std::back_inserter(state.vs_swizzle_data));
- boost::copy(vs_float_uniforms, std::back_inserter(state.vs_float_uniforms));
- // boost::copy(TODO: Not implemented, std::back_inserter(state.gs_program_binary));
- // boost::copy(TODO: Not implemented, std::back_inserter(state.gs_swizzle_data));
- // boost::copy(TODO: Not implemented, std::back_inserter(state.gs_float_uniforms));
-
- auto recorder = new CiTrace::Recorder(state);
- context->recorder = std::shared_ptr<CiTrace::Recorder>(recorder);
-
- emit SetStartTracingButtonEnabled(false);
- emit SetStopTracingButtonEnabled(true);
- emit SetAbortTracingButtonEnabled(true);
-}
-
-void GraphicsTracingWidget::StopRecording() {
- auto context = context_weak.lock();
- if (!context)
- return;
-
- QString filename = QFileDialog::getSaveFileName(this, tr("Save CiTrace"), "citrace.ctf",
- tr("CiTrace File (*.ctf)"));
-
- if (filename.isEmpty()) {
- // If the user canceled the dialog, keep recording
- return;
- }
-
- context->recorder->Finish(filename.toStdString());
- context->recorder = nullptr;
-
- emit SetStopTracingButtonEnabled(false);
- emit SetAbortTracingButtonEnabled(false);
- emit SetStartTracingButtonEnabled(true);
-}
-
-void GraphicsTracingWidget::AbortRecording() {
- auto context = context_weak.lock();
- if (!context)
- return;
-
- context->recorder = nullptr;
-
- emit SetStopTracingButtonEnabled(false);
- emit SetAbortTracingButtonEnabled(false);
- emit SetStartTracingButtonEnabled(true);
-}
-
-void GraphicsTracingWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) {
- widget()->setEnabled(true);
-}
-
-void GraphicsTracingWidget::OnResumed() {
- widget()->setEnabled(false);
-}
-
-void GraphicsTracingWidget::OnEmulationStarting(EmuThread* emu_thread) {
- // Disable tracing starting/stopping until a GPU breakpoint is reached
- widget()->setEnabled(false);
-}
-
-void GraphicsTracingWidget::OnEmulationStopping() {
- // TODO: Is it safe to access the context here?
-
- auto context = context_weak.lock();
- if (!context)
- return;
-
- if (context->recorder) {
- auto reply =
- QMessageBox::question(this, tr("CiTracing still active"),
- tr("A CiTrace is still being recorded. Do you want to save it? "
- "If not, all recorded data will be discarded."),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
-
- if (reply == QMessageBox::Yes) {
- StopRecording();
- } else {
- AbortRecording();
- }
- }
-
- // If the widget was disabled before, enable it now to allow starting
- // tracing before starting the next emulation session
- widget()->setEnabled(true);
-}
diff --git a/src/citra_qt/debugger/graphics/graphics_tracing.h b/src/citra_qt/debugger/graphics/graphics_tracing.h
deleted file mode 100644
index eb1292c29..000000000
--- a/src/citra_qt/debugger/graphics/graphics_tracing.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "citra_qt/debugger/graphics/graphics_breakpoint_observer.h"
-
-class EmuThread;
-
-class GraphicsTracingWidget : public BreakPointObserverDock {
- Q_OBJECT
-
-public:
- explicit GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
-
- void OnEmulationStarting(EmuThread* emu_thread);
- void OnEmulationStopping();
-
-private slots:
- void StartRecording();
- void StopRecording();
- void AbortRecording();
-
- void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
- void OnResumed() override;
-
-signals:
- void SetStartTracingButtonEnabled(bool enable);
- void SetStopTracingButtonEnabled(bool enable);
- void SetAbortTracingButtonEnabled(bool enable);
-};
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
deleted file mode 100644
index 7f4ec0c52..000000000
--- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
+++ /dev/null
@@ -1,622 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <iomanip>
-#include <sstream>
-#include <QBoxLayout>
-#include <QFileDialog>
-#include <QFormLayout>
-#include <QGroupBox>
-#include <QLabel>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QSignalMapper>
-#include <QSpinBox>
-#include <QTreeView>
-#include "citra_qt/debugger/graphics/graphics_vertex_shader.h"
-#include "citra_qt/util/util.h"
-#include "video_core/pica_state.h"
-#include "video_core/shader/debug_data.h"
-#include "video_core/shader/shader.h"
-#include "video_core/shader/shader_interpreter.h"
-
-using nihstro::OpCode;
-using nihstro::Instruction;
-using nihstro::SourceRegister;
-using nihstro::SwizzlePattern;
-
-GraphicsVertexShaderModel::GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent)
- : QAbstractTableModel(parent), par(parent) {}
-
-int GraphicsVertexShaderModel::columnCount(const QModelIndex& parent) const {
- return 3;
-}
-
-int GraphicsVertexShaderModel::rowCount(const QModelIndex& parent) const {
- return static_cast<int>(par->info.code.size());
-}
-
-QVariant GraphicsVertexShaderModel::headerData(int section, Qt::Orientation orientation,
- int role) const {
- switch (role) {
- case Qt::DisplayRole: {
- if (section == 0) {
- return tr("Offset");
- } else if (section == 1) {
- return tr("Raw");
- } else if (section == 2) {
- return tr("Disassembly");
- }
-
- break;
- }
- }
-
- return QVariant();
-}
-
-static std::string SelectorToString(u32 selector) {
- std::string ret;
- for (int i = 0; i < 4; ++i) {
- int component = (selector >> ((3 - i) * 2)) & 3;
- ret += "xyzw"[component];
- }
- return ret;
-}
-
-// e.g. "-c92[a0.x].xyzw"
-static void print_input(std::ostringstream& output, const SourceRegister& input, bool negate,
- const std::string& swizzle_mask, bool align = true,
- const std::string& address_register_name = std::string()) {
- if (align)
- output << std::setw(4) << std::right;
- output << ((negate ? "-" : "") + input.GetName());
-
- if (!address_register_name.empty())
- output << '[' << address_register_name << ']';
- output << '.' << swizzle_mask;
-};
-
-QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) const {
- switch (role) {
- case Qt::DisplayRole: {
- switch (index.column()) {
- case 0:
- if (par->info.HasLabel(index.row()))
- return QString::fromStdString(par->info.GetLabel(index.row()));
-
- return QString("%1").arg(4 * index.row(), 4, 16, QLatin1Char('0'));
-
- case 1:
- return QString("%1").arg(par->info.code[index.row()].hex, 8, 16, QLatin1Char('0'));
-
- case 2: {
- std::ostringstream output;
- output.flags(std::ios::uppercase);
-
- // To make the code aligning columns of assembly easier to keep track of, this function
- // keeps track of the start of the start of the previous column, allowing alignment
- // based on desired field widths.
- int current_column = 0;
- auto AlignToColumn = [&](int col_width) {
- // Prints spaces to the output to pad previous column to size and advances the
- // column marker.
- current_column += col_width;
- int to_add = std::max(1, current_column - (int)output.tellp());
- for (int i = 0; i < to_add; ++i) {
- output << ' ';
- }
- };
-
- const Instruction instr = par->info.code[index.row()];
- const OpCode opcode = instr.opcode;
- const OpCode::Info opcode_info = opcode.GetInfo();
- const u32 operand_desc_id = opcode_info.type == OpCode::Type::MultiplyAdd
- ? instr.mad.operand_desc_id.Value()
- : instr.common.operand_desc_id.Value();
- const SwizzlePattern swizzle = par->info.swizzle_info[operand_desc_id].pattern;
-
- // longest known instruction name: "setemit "
- int kOpcodeColumnWidth = 8;
- // "rXX.xyzw "
- int kOutputColumnWidth = 10;
- // "-rXX.xyzw ", no attempt is made to align indexed inputs
- int kInputOperandColumnWidth = 11;
-
- output << opcode_info.name;
-
- switch (opcode_info.type) {
- case OpCode::Type::Trivial:
- // Nothing to do here
- break;
-
- case OpCode::Type::Arithmetic:
- case OpCode::Type::MultiplyAdd: {
- // Use custom code for special instructions
- switch (opcode.EffectiveOpCode()) {
- case OpCode::Id::CMP: {
- AlignToColumn(kOpcodeColumnWidth);
-
- // NOTE: CMP always writes both cc components, so we do not consider the dest
- // mask here.
- output << " cc.xy";
- AlignToColumn(kOutputColumnWidth);
-
- SourceRegister src1 = instr.common.GetSrc1(false);
- SourceRegister src2 = instr.common.GetSrc2(false);
-
- output << ' ';
- print_input(output, src1, swizzle.negate_src1,
- swizzle.SelectorToString(false).substr(0, 1), false,
- instr.common.AddressRegisterName());
- output << ' ' << instr.common.compare_op.ToString(instr.common.compare_op.x)
- << ' ';
- print_input(output, src2, swizzle.negate_src2,
- swizzle.SelectorToString(true).substr(0, 1), false);
-
- output << ", ";
-
- print_input(output, src1, swizzle.negate_src1,
- swizzle.SelectorToString(false).substr(1, 1), false,
- instr.common.AddressRegisterName());
- output << ' ' << instr.common.compare_op.ToString(instr.common.compare_op.y)
- << ' ';
- print_input(output, src2, swizzle.negate_src2,
- swizzle.SelectorToString(true).substr(1, 1), false);
-
- break;
- }
-
- case OpCode::Id::MAD:
- case OpCode::Id::MADI: {
- AlignToColumn(kOpcodeColumnWidth);
-
- bool src_is_inverted = 0 != (opcode_info.subtype & OpCode::Info::SrcInversed);
- SourceRegister src1 = instr.mad.GetSrc1(src_is_inverted);
- SourceRegister src2 = instr.mad.GetSrc2(src_is_inverted);
- SourceRegister src3 = instr.mad.GetSrc3(src_is_inverted);
-
- output << std::setw(3) << std::right << instr.mad.dest.Value().GetName() << '.'
- << swizzle.DestMaskToString();
- AlignToColumn(kOutputColumnWidth);
- print_input(output, src1, swizzle.negate_src1,
- SelectorToString(swizzle.src1_selector));
- AlignToColumn(kInputOperandColumnWidth);
- print_input(output, src2, swizzle.negate_src2,
- SelectorToString(swizzle.src2_selector), true,
- src_is_inverted ? "" : instr.mad.AddressRegisterName());
- AlignToColumn(kInputOperandColumnWidth);
- print_input(output, src3, swizzle.negate_src3,
- SelectorToString(swizzle.src3_selector), true,
- src_is_inverted ? instr.mad.AddressRegisterName() : "");
- AlignToColumn(kInputOperandColumnWidth);
- break;
- }
-
- default: {
- AlignToColumn(kOpcodeColumnWidth);
-
- bool src_is_inverted = 0 != (opcode_info.subtype & OpCode::Info::SrcInversed);
-
- if (opcode_info.subtype & OpCode::Info::Dest) {
- // e.g. "r12.xy__"
- output << std::setw(3) << std::right << instr.common.dest.Value().GetName()
- << '.' << swizzle.DestMaskToString();
- } else if (opcode_info.subtype == OpCode::Info::MOVA) {
- output << " a0." << swizzle.DestMaskToString();
- }
- AlignToColumn(kOutputColumnWidth);
-
- if (opcode_info.subtype & OpCode::Info::Src1) {
- SourceRegister src1 = instr.common.GetSrc1(src_is_inverted);
- print_input(output, src1, swizzle.negate_src1,
- swizzle.SelectorToString(false), true,
- src_is_inverted ? "" : instr.common.AddressRegisterName());
- AlignToColumn(kInputOperandColumnWidth);
- }
-
- if (opcode_info.subtype & OpCode::Info::Src2) {
- SourceRegister src2 = instr.common.GetSrc2(src_is_inverted);
- print_input(output, src2, swizzle.negate_src2,
- swizzle.SelectorToString(true), true,
- src_is_inverted ? instr.common.AddressRegisterName() : "");
- AlignToColumn(kInputOperandColumnWidth);
- }
- break;
- }
- }
-
- break;
- }
-
- case OpCode::Type::Conditional:
- case OpCode::Type::UniformFlowControl: {
- output << ' ';
-
- switch (opcode.EffectiveOpCode()) {
- case OpCode::Id::LOOP:
- output << 'i' << instr.flow_control.int_uniform_id << " (end on 0x"
- << std::setw(4) << std::right << std::setfill('0') << std::hex
- << (4 * instr.flow_control.dest_offset) << ")";
- break;
-
- default:
- if (opcode_info.subtype & OpCode::Info::HasCondition) {
- output << '(';
-
- if (instr.flow_control.op != instr.flow_control.JustY) {
- if (!instr.flow_control.refx)
- output << '!';
- output << "cc.x";
- }
-
- if (instr.flow_control.op == instr.flow_control.Or) {
- output << " || ";
- } else if (instr.flow_control.op == instr.flow_control.And) {
- output << " && ";
- }
-
- if (instr.flow_control.op != instr.flow_control.JustX) {
- if (!instr.flow_control.refy)
- output << '!';
- output << "cc.y";
- }
-
- output << ") ";
- } else if (opcode_info.subtype & OpCode::Info::HasUniformIndex) {
- if (opcode.EffectiveOpCode() == OpCode::Id::JMPU &&
- (instr.flow_control.num_instructions & 1) == 1) {
- output << '!';
- }
- output << 'b' << instr.flow_control.bool_uniform_id << ' ';
- }
-
- if (opcode_info.subtype & OpCode::Info::HasAlternative) {
- output << "else jump to 0x" << std::setw(4) << std::right
- << std::setfill('0') << std::hex
- << (4 * instr.flow_control.dest_offset);
- } else if (opcode_info.subtype & OpCode::Info::HasExplicitDest) {
- output << "jump to 0x" << std::setw(4) << std::right << std::setfill('0')
- << std::hex << (4 * instr.flow_control.dest_offset);
- } else {
- // TODO: Handle other cases
- output << "(unknown destination)";
- }
-
- if (opcode_info.subtype & OpCode::Info::HasFinishPoint) {
- output << " (return on 0x" << std::setw(4) << std::right
- << std::setfill('0') << std::hex
- << (4 * instr.flow_control.dest_offset +
- 4 * instr.flow_control.num_instructions)
- << ')';
- }
-
- break;
- }
- break;
- }
-
- default:
- output << " (unknown instruction format)";
- break;
- }
-
- return QString::fromLatin1(output.str().c_str());
- }
-
- default:
- break;
- }
- }
-
- case Qt::FontRole:
- return GetMonospaceFont();
-
- case Qt::BackgroundRole: {
- // Highlight current instruction
- int current_record_index = par->cycle_index->value();
- if (current_record_index < static_cast<int>(par->debug_data.records.size())) {
- const auto& current_record = par->debug_data.records[current_record_index];
- if (index.row() == static_cast<int>(current_record.instruction_offset)) {
- return QColor(255, 255, 63);
- }
- }
-
- // Use a grey background for instructions which have no debug data associated to them
- for (const auto& record : par->debug_data.records)
- if (index.row() == static_cast<int>(record.instruction_offset))
- return QVariant();
-
- return QBrush(QColor(192, 192, 192));
- }
-
- // TODO: Draw arrows for each "reachable" instruction to visualize control flow
-
- default:
- break;
- }
-
- return QVariant();
-}
-
-void GraphicsVertexShaderWidget::DumpShader() {
- QString filename = QFileDialog::getSaveFileName(
- this, tr("Save Shader Dump"), "shader_dump.shbin", tr("Shader Binary (*.shbin)"));
-
- if (filename.isEmpty()) {
- // If the user canceled the dialog, don't dump anything.
- return;
- }
-
- auto& setup = Pica::g_state.vs;
- auto& config = Pica::g_state.regs.vs;
-
- Pica::DebugUtils::DumpShader(filename.toStdString(), config, setup,
- Pica::g_state.regs.rasterizer.vs_output_attributes);
-}
-
-GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(
- std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent)
- : BreakPointObserverDock(debug_context, "Pica Vertex Shader", parent) {
- setObjectName("PicaVertexShader");
-
- // Clear input vertex data so that it contains valid float values in case a debug shader
- // execution happens before the first Vertex Loaded breakpoint.
- // TODO: This makes a crash in the interpreter much less likely, but not impossible. The
- // interpreter should guard against out-of-bounds accesses to ensure crashes in it aren't
- // possible.
- std::memset(&input_vertex, 0, sizeof(input_vertex));
-
- auto input_data_mapper = new QSignalMapper(this);
-
- // TODO: Support inputting data in hexadecimal raw format
- for (unsigned i = 0; i < ARRAY_SIZE(input_data); ++i) {
- input_data[i] = new QLineEdit;
- input_data[i]->setValidator(new QDoubleValidator(input_data[i]));
- }
-
- breakpoint_warning =
- new QLabel(tr("(data only available at vertex shader invocation breakpoints)"));
-
- // TODO: Add some button for jumping to the shader entry point
-
- model = new GraphicsVertexShaderModel(this);
- binary_list = new QTreeView;
- binary_list->setModel(model);
- binary_list->setRootIsDecorated(false);
- binary_list->setAlternatingRowColors(true);
-
- auto dump_shader = new QPushButton(QIcon::fromTheme("document-save"), tr("Dump"));
-
- instruction_description = new QLabel;
-
- cycle_index = new QSpinBox;
-
- connect(dump_shader, SIGNAL(clicked()), this, SLOT(DumpShader()));
-
- connect(cycle_index, SIGNAL(valueChanged(int)), this, SLOT(OnCycleIndexChanged(int)));
-
- for (unsigned i = 0; i < ARRAY_SIZE(input_data); ++i) {
- connect(input_data[i], SIGNAL(textEdited(const QString&)), input_data_mapper, SLOT(map()));
- input_data_mapper->setMapping(input_data[i], i);
- }
- connect(input_data_mapper, SIGNAL(mapped(int)), this, SLOT(OnInputAttributeChanged(int)));
-
- auto main_widget = new QWidget;
- auto main_layout = new QVBoxLayout;
- {
- auto input_data_group = new QGroupBox(tr("Input Data"));
-
- // For each vertex attribute, add a QHBoxLayout consisting of:
- // - A QLabel denoting the source attribute index
- // - Four QLineEdits for showing and manipulating attribute data
- // - A QLabel denoting the shader input attribute index
- auto sub_layout = new QVBoxLayout;
- for (unsigned i = 0; i < 16; ++i) {
- // Create an HBoxLayout to store the widgets used to specify a particular attribute
- // and store it in a QWidget to allow for easy hiding and unhiding.
- auto row_layout = new QHBoxLayout;
- // Remove unnecessary padding between rows
- row_layout->setContentsMargins(0, 0, 0, 0);
-
- row_layout->addWidget(new QLabel(tr("Attribute %1").arg(i, 2)));
- for (unsigned comp = 0; comp < 4; ++comp)
- row_layout->addWidget(input_data[4 * i + comp]);
-
- row_layout->addWidget(input_data_mapping[i] = new QLabel);
-
- input_data_container[i] = new QWidget;
- input_data_container[i]->setLayout(row_layout);
- input_data_container[i]->hide();
-
- sub_layout->addWidget(input_data_container[i]);
- }
-
- sub_layout->addWidget(breakpoint_warning);
- breakpoint_warning->hide();
-
- input_data_group->setLayout(sub_layout);
- main_layout->addWidget(input_data_group);
- }
-
- // Make program listing expand to fill available space in the dialog
- binary_list->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
- main_layout->addWidget(binary_list);
-
- main_layout->addWidget(dump_shader);
- {
- auto sub_layout = new QFormLayout;
- sub_layout->addRow(tr("Cycle Index:"), cycle_index);
-
- main_layout->addLayout(sub_layout);
- }
-
- // Set a minimum height so that the size of this label doesn't cause the rest of the bottom
- // part of the UI to keep jumping up and down when cycling through instructions.
- instruction_description->setMinimumHeight(instruction_description->fontMetrics().lineSpacing() *
- 6);
- instruction_description->setAlignment(Qt::AlignLeft | Qt::AlignTop);
- main_layout->addWidget(instruction_description);
-
- main_widget->setLayout(main_layout);
- setWidget(main_widget);
-
- widget()->setEnabled(false);
-}
-
-void GraphicsVertexShaderWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) {
- if (event == Pica::DebugContext::Event::VertexShaderInvocation) {
- Reload(true, data);
- } else {
- // No vertex data is retrievable => invalidate currently stored vertex data
- Reload(true, nullptr);
- }
- widget()->setEnabled(true);
-}
-
-void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_data) {
- model->beginResetModel();
-
- if (replace_vertex_data) {
- if (vertex_data) {
- memcpy(&input_vertex, vertex_data, sizeof(input_vertex));
- for (unsigned attr = 0; attr < 16; ++attr) {
- for (unsigned comp = 0; comp < 4; ++comp) {
- input_data[4 * attr + comp]->setText(
- QString("%1").arg(input_vertex.attr[attr][comp].ToFloat32()));
- }
- }
- breakpoint_warning->hide();
- } else {
- for (unsigned attr = 0; attr < 16; ++attr) {
- for (unsigned comp = 0; comp < 4; ++comp) {
- input_data[4 * attr + comp]->setText(QString("???"));
- }
- }
- breakpoint_warning->show();
- }
- }
-
- // Reload shader code
- info.Clear();
-
- auto& shader_setup = Pica::g_state.vs;
- auto& shader_config = Pica::g_state.regs.vs;
- for (auto instr : shader_setup.program_code)
- info.code.push_back({instr});
- int num_attributes = shader_config.max_input_attribute_index + 1;
-
- for (auto pattern : shader_setup.swizzle_data)
- info.swizzle_info.push_back({pattern});
-
- u32 entry_point = Pica::g_state.regs.vs.main_offset;
- info.labels.insert({entry_point, "main"});
-
- // Generate debug information
- Pica::Shader::InterpreterEngine shader_engine;
- shader_engine.SetupBatch(shader_setup, entry_point);
- debug_data = shader_engine.ProduceDebugInfo(shader_setup, input_vertex, shader_config);
-
- // Reload widget state
- for (int attr = 0; attr < num_attributes; ++attr) {
- unsigned source_attr = shader_config.GetRegisterForAttribute(attr);
- input_data_mapping[attr]->setText(QString("-> v%1").arg(source_attr));
- input_data_container[attr]->setVisible(true);
- }
- // Only show input attributes which are used as input to the shader
- for (unsigned int attr = num_attributes; attr < 16; ++attr) {
- input_data_container[attr]->setVisible(false);
- }
-
- // Initialize debug info text for current cycle count
- cycle_index->setMaximum(static_cast<int>(debug_data.records.size() - 1));
- OnCycleIndexChanged(cycle_index->value());
-
- model->endResetModel();
-}
-
-void GraphicsVertexShaderWidget::OnResumed() {
- widget()->setEnabled(false);
-}
-
-void GraphicsVertexShaderWidget::OnInputAttributeChanged(int index) {
- float value = input_data[index]->text().toFloat();
- input_vertex.attr[index / 4][index % 4] = Pica::float24::FromFloat32(value);
- // Re-execute shader with updated value
- Reload();
-}
-
-void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) {
- QString text;
-
- auto& record = debug_data.records[index];
- if (record.mask & Pica::Shader::DebugDataRecord::SRC1)
- text += tr("SRC1: %1, %2, %3, %4\n")
- .arg(record.src1.x.ToFloat32())
- .arg(record.src1.y.ToFloat32())
- .arg(record.src1.z.ToFloat32())
- .arg(record.src1.w.ToFloat32());
- if (record.mask & Pica::Shader::DebugDataRecord::SRC2)
- text += tr("SRC2: %1, %2, %3, %4\n")
- .arg(record.src2.x.ToFloat32())
- .arg(record.src2.y.ToFloat32())
- .arg(record.src2.z.ToFloat32())
- .arg(record.src2.w.ToFloat32());
- if (record.mask & Pica::Shader::DebugDataRecord::SRC3)
- text += tr("SRC3: %1, %2, %3, %4\n")
- .arg(record.src3.x.ToFloat32())
- .arg(record.src3.y.ToFloat32())
- .arg(record.src3.z.ToFloat32())
- .arg(record.src3.w.ToFloat32());
- if (record.mask & Pica::Shader::DebugDataRecord::DEST_IN)
- text += tr("DEST_IN: %1, %2, %3, %4\n")
- .arg(record.dest_in.x.ToFloat32())
- .arg(record.dest_in.y.ToFloat32())
- .arg(record.dest_in.z.ToFloat32())
- .arg(record.dest_in.w.ToFloat32());
- if (record.mask & Pica::Shader::DebugDataRecord::DEST_OUT)
- text += tr("DEST_OUT: %1, %2, %3, %4\n")
- .arg(record.dest_out.x.ToFloat32())
- .arg(record.dest_out.y.ToFloat32())
- .arg(record.dest_out.z.ToFloat32())
- .arg(record.dest_out.w.ToFloat32());
-
- if (record.mask & Pica::Shader::DebugDataRecord::ADDR_REG_OUT)
- text += tr("Address Registers: %1, %2\n")
- .arg(record.address_registers[0])
- .arg(record.address_registers[1]);
- if (record.mask & Pica::Shader::DebugDataRecord::CMP_RESULT)
- text += tr("Compare Result: %1, %2\n")
- .arg(record.conditional_code[0] ? "true" : "false")
- .arg(record.conditional_code[1] ? "true" : "false");
-
- if (record.mask & Pica::Shader::DebugDataRecord::COND_BOOL_IN)
- text += tr("Static Condition: %1\n").arg(record.cond_bool ? "true" : "false");
- if (record.mask & Pica::Shader::DebugDataRecord::COND_CMP_IN)
- text += tr("Dynamic Conditions: %1, %2\n")
- .arg(record.cond_cmp[0] ? "true" : "false")
- .arg(record.cond_cmp[1] ? "true" : "false");
- if (record.mask & Pica::Shader::DebugDataRecord::LOOP_INT_IN)
- text += tr("Loop Parameters: %1 (repeats), %2 (initializer), %3 (increment), %4\n")
- .arg(record.loop_int.x)
- .arg(record.loop_int.y)
- .arg(record.loop_int.z)
- .arg(record.loop_int.w);
-
- text +=
- tr("Instruction offset: 0x%1").arg(4 * record.instruction_offset, 4, 16, QLatin1Char('0'));
- if (record.mask & Pica::Shader::DebugDataRecord::NEXT_INSTR) {
- text += tr(" -> 0x%2").arg(4 * record.next_instruction, 4, 16, QLatin1Char('0'));
- } else {
- text += tr(" (last instruction)");
- }
-
- instruction_description->setText(text);
-
- // Emit model update notification and scroll to current instruction
- QModelIndex instr_index = model->index(record.instruction_offset, 0);
- emit model->dataChanged(instr_index,
- model->index(record.instruction_offset, model->columnCount()));
- binary_list->scrollTo(instr_index, QAbstractItemView::EnsureVisible);
-}
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.h b/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
deleted file mode 100644
index c249a2ff8..000000000
--- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QAbstractTableModel>
-#include <QTreeView>
-#include "citra_qt/debugger/graphics/graphics_breakpoint_observer.h"
-#include "nihstro/parser_shbin.h"
-#include "video_core/shader/debug_data.h"
-#include "video_core/shader/shader.h"
-
-class QLabel;
-class QSpinBox;
-
-class GraphicsVertexShaderWidget;
-
-class GraphicsVertexShaderModel : public QAbstractTableModel {
- Q_OBJECT
-
-public:
- explicit GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent);
-
- int columnCount(const QModelIndex& parent = QModelIndex()) const override;
- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const override;
-
-private:
- GraphicsVertexShaderWidget* par;
-
- friend class GraphicsVertexShaderWidget;
-};
-
-class GraphicsVertexShaderWidget : public BreakPointObserverDock {
- Q_OBJECT
-
- using Event = Pica::DebugContext::Event;
-
-public:
- GraphicsVertexShaderWidget(std::shared_ptr<Pica::DebugContext> debug_context,
- QWidget* parent = nullptr);
-
-private slots:
- void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
- void OnResumed() override;
-
- void OnInputAttributeChanged(int index);
-
- void OnCycleIndexChanged(int index);
-
- void DumpShader();
-
- /**
- * Reload widget based on the current PICA200 state
- * @param replace_vertex_data If true, invalidate all current vertex data
- * @param vertex_data New vertex data to use, as passed to OnBreakPointHit. May be nullptr to
- * specify that no valid vertex data can be retrieved currently. Only used if
- * replace_vertex_data is true.
- */
- void Reload(bool replace_vertex_data = false, void* vertex_data = nullptr);
-
-private:
- QLabel* instruction_description;
- QTreeView* binary_list;
- GraphicsVertexShaderModel* model;
-
- /// TODO: Move these into a single struct
- std::array<QLineEdit*, 4 * 16>
- input_data; // A text box for each of the 4 components of up to 16 vertex attributes
- std::array<QWidget*, 16>
- input_data_container; // QWidget containing the QLayout containing each vertex attribute
- std::array<QLabel*, 16> input_data_mapping; // A QLabel denoting the shader input attribute
- // which the vertex attribute maps to
-
- // Text to be shown when input vertex data is not retrievable
- QLabel* breakpoint_warning;
-
- QSpinBox* cycle_index;
-
- nihstro::ShaderInfo info;
- Pica::Shader::DebugData<true> debug_data;
- Pica::Shader::AttributeBuffer input_vertex;
-
- friend class GraphicsVertexShaderModel;
-};
diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp
deleted file mode 100644
index f060bbe08..000000000
--- a/src/citra_qt/debugger/profiler.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QAction>
-#include <QLayout>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QString>
-#include "citra_qt/debugger/profiler.h"
-#include "citra_qt/util/util.h"
-#include "common/common_types.h"
-#include "common/microprofile.h"
-
-// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the
-// non-Qt frontends don't need it (and don't implement the UI drawing hooks either).
-#if MICROPROFILE_ENABLED
-#define MICROPROFILEUI_IMPL 1
-#include "common/microprofileui.h"
-
-class MicroProfileWidget : public QWidget {
-public:
- MicroProfileWidget(QWidget* parent = nullptr);
-
-protected:
- void paintEvent(QPaintEvent* ev) override;
- void showEvent(QShowEvent* ev) override;
- void hideEvent(QHideEvent* ev) override;
-
- void mouseMoveEvent(QMouseEvent* ev) override;
- void mousePressEvent(QMouseEvent* ev) override;
- void mouseReleaseEvent(QMouseEvent* ev) override;
- void wheelEvent(QWheelEvent* ev) override;
-
- void keyPressEvent(QKeyEvent* ev) override;
- void keyReleaseEvent(QKeyEvent* ev) override;
-
-private:
- /// This timer is used to redraw the widget's contents continuously. To save resources, it only
- /// runs while the widget is visible.
- QTimer update_timer;
- /// Scale the coordinate system appropriately when dpi != 96.
- qreal x_scale = 1.0, y_scale = 1.0;
-};
-
-#endif
-
-MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) {
- setObjectName("MicroProfile");
- setWindowTitle(tr("MicroProfile"));
- resize(1000, 600);
- // Remove the "?" button from the titlebar and enable the maximize button
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::WindowMaximizeButtonHint);
-
-#if MICROPROFILE_ENABLED
-
- MicroProfileWidget* widget = new MicroProfileWidget(this);
-
- QLayout* layout = new QVBoxLayout(this);
- layout->setContentsMargins(0, 0, 0, 0);
- layout->addWidget(widget);
- setLayout(layout);
-
- // Configure focus so that widget is focusable and the dialog automatically forwards focus to
- // it.
- setFocusProxy(widget);
- widget->setFocusPolicy(Qt::StrongFocus);
- widget->setFocus();
-#endif
-}
-
-QAction* MicroProfileDialog::toggleViewAction() {
- if (toggle_view_action == nullptr) {
- toggle_view_action = new QAction(windowTitle(), this);
- toggle_view_action->setCheckable(true);
- toggle_view_action->setChecked(isVisible());
- connect(toggle_view_action, SIGNAL(toggled(bool)), SLOT(setVisible(bool)));
- }
-
- return toggle_view_action;
-}
-
-void MicroProfileDialog::showEvent(QShowEvent* ev) {
- if (toggle_view_action) {
- toggle_view_action->setChecked(isVisible());
- }
- QWidget::showEvent(ev);
-}
-
-void MicroProfileDialog::hideEvent(QHideEvent* ev) {
- if (toggle_view_action) {
- toggle_view_action->setChecked(isVisible());
- }
- QWidget::hideEvent(ev);
-}
-
-#if MICROPROFILE_ENABLED
-
-/// There's no way to pass a user pointer to MicroProfile, so this variable is used to make the
-/// QPainter available inside the drawing callbacks.
-static QPainter* mp_painter = nullptr;
-
-MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) {
- // Send mouse motion events even when not dragging.
- setMouseTracking(true);
-
- MicroProfileSetDisplayMode(1); // Timers screen
- MicroProfileInitUI();
-
- connect(&update_timer, SIGNAL(timeout()), SLOT(update()));
-}
-
-void MicroProfileWidget::paintEvent(QPaintEvent* ev) {
- QPainter painter(this);
-
- // The units used by Microprofile for drawing are based in pixels on a 96 dpi display.
- x_scale = qreal(painter.device()->logicalDpiX()) / 96.0;
- y_scale = qreal(painter.device()->logicalDpiY()) / 96.0;
- painter.scale(x_scale, y_scale);
-
- painter.setBackground(Qt::black);
- painter.eraseRect(rect());
-
- QFont font = GetMonospaceFont();
- font.setPixelSize(MICROPROFILE_TEXT_HEIGHT);
- painter.setFont(font);
-
- mp_painter = &painter;
- MicroProfileDraw(rect().width() / x_scale, rect().height() / y_scale);
- mp_painter = nullptr;
-}
-
-void MicroProfileWidget::showEvent(QShowEvent* ev) {
- update_timer.start(15); // ~60 Hz
- QWidget::showEvent(ev);
-}
-
-void MicroProfileWidget::hideEvent(QHideEvent* ev) {
- update_timer.stop();
- QWidget::hideEvent(ev);
-}
-
-void MicroProfileWidget::mouseMoveEvent(QMouseEvent* ev) {
- MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, 0);
- ev->accept();
-}
-
-void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) {
- MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, 0);
- MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton);
- ev->accept();
-}
-
-void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) {
- MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, 0);
- MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton);
- ev->accept();
-}
-
-void MicroProfileWidget::wheelEvent(QWheelEvent* ev) {
- MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, ev->delta() / 120);
- ev->accept();
-}
-
-void MicroProfileWidget::keyPressEvent(QKeyEvent* ev) {
- if (ev->key() == Qt::Key_Control) {
- // Inform MicroProfile that the user is holding Ctrl.
- MicroProfileModKey(1);
- }
- QWidget::keyPressEvent(ev);
-}
-
-void MicroProfileWidget::keyReleaseEvent(QKeyEvent* ev) {
- if (ev->key() == Qt::Key_Control) {
- MicroProfileModKey(0);
- }
- QWidget::keyReleaseEvent(ev);
-}
-
-// These functions are called by MicroProfileDraw to draw the interface elements on the screen.
-
-void MicroProfileDrawText(int x, int y, u32 hex_color, const char* text, u32 text_length) {
- // hex_color does not include an alpha, so it must be assumed to be 255
- mp_painter->setPen(QColor::fromRgb(hex_color));
-
- // It's impossible to draw a string using a monospaced font with a fixed width per cell in a
- // way that's reliable across different platforms and fonts as far as I (yuriks) can tell, so
- // draw each character individually in order to precisely control the text advance.
- for (u32 i = 0; i < text_length; ++i) {
- // Position the text baseline 1 pixel above the bottom of the text cell, this gives nice
- // vertical alignment of text for a wide range of tested fonts.
- mp_painter->drawText(x, y + MICROPROFILE_TEXT_HEIGHT - 2, QChar(text[i]));
- x += MICROPROFILE_TEXT_WIDTH + 1;
- }
-}
-
-void MicroProfileDrawBox(int left, int top, int right, int bottom, u32 hex_color,
- MicroProfileBoxType type) {
- QColor color = QColor::fromRgba(hex_color);
- QBrush brush = color;
- if (type == MicroProfileBoxTypeBar) {
- QLinearGradient gradient(left, top, left, bottom);
- gradient.setColorAt(0.f, color.lighter(125));
- gradient.setColorAt(1.f, color.darker(125));
- brush = gradient;
- }
- mp_painter->fillRect(left, top, right - left, bottom - top, brush);
-}
-
-void MicroProfileDrawLine2D(u32 vertices_length, float* vertices, u32 hex_color) {
- // Temporary vector used to convert between the float array and QPointF. Marked static to reuse
- // the allocation across calls.
- static std::vector<QPointF> point_buf;
-
- for (u32 i = 0; i < vertices_length; ++i) {
- point_buf.emplace_back(vertices[i * 2 + 0], vertices[i * 2 + 1]);
- }
-
- // hex_color does not include an alpha, so it must be assumed to be 255
- mp_painter->setPen(QColor::fromRgb(hex_color));
- mp_painter->drawPolyline(point_buf.data(), vertices_length);
- point_buf.clear();
-}
-#endif
diff --git a/src/citra_qt/debugger/profiler.h b/src/citra_qt/debugger/profiler.h
deleted file mode 100644
index eae1e9e3c..000000000
--- a/src/citra_qt/debugger/profiler.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QAbstractItemModel>
-#include <QDockWidget>
-#include <QTimer>
-#include "common/microprofile.h"
-
-class MicroProfileDialog : public QWidget {
- Q_OBJECT
-
-public:
- explicit MicroProfileDialog(QWidget* parent = nullptr);
-
- /// Returns a QAction that can be used to toggle visibility of this dialog.
- QAction* toggleViewAction();
-
-protected:
- void showEvent(QShowEvent* ev) override;
- void hideEvent(QHideEvent* ev) override;
-
-private:
- QAction* toggle_view_action = nullptr;
-};
diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp
deleted file mode 100644
index f9345c9f6..000000000
--- a/src/citra_qt/debugger/registers.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QTreeWidgetItem>
-#include "citra_qt/debugger/registers.h"
-#include "citra_qt/util/util.h"
-#include "core/arm/arm_interface.h"
-#include "core/core.h"
-
-RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) {
- cpu_regs_ui.setupUi(this);
-
- tree = cpu_regs_ui.treeWidget;
- tree->addTopLevelItem(core_registers = new QTreeWidgetItem(QStringList(tr("Registers"))));
- tree->addTopLevelItem(vfp_registers = new QTreeWidgetItem(QStringList(tr("VFP Registers"))));
- tree->addTopLevelItem(vfp_system_registers =
- new QTreeWidgetItem(QStringList(tr("VFP System Registers"))));
- tree->addTopLevelItem(cpsr = new QTreeWidgetItem(QStringList("CPSR")));
-
- for (int i = 0; i < 16; ++i) {
- QTreeWidgetItem* child = new QTreeWidgetItem(QStringList(QString("R[%1]").arg(i)));
- core_registers->addChild(child);
- }
-
- for (int i = 0; i < 32; ++i) {
- QTreeWidgetItem* child = new QTreeWidgetItem(QStringList(QString("S[%1]").arg(i)));
- vfp_registers->addChild(child);
- }
-
- QFont font = GetMonospaceFont();
-
- CreateCPSRChildren();
- CreateVFPSystemRegisterChildren();
-
- // Set Registers to display in monospace font
- for (int i = 0; i < core_registers->childCount(); ++i)
- core_registers->child(i)->setFont(1, font);
-
- for (int i = 0; i < vfp_registers->childCount(); ++i)
- vfp_registers->child(i)->setFont(1, font);
-
- for (int i = 0; i < vfp_system_registers->childCount(); ++i) {
- vfp_system_registers->child(i)->setFont(1, font);
- for (int x = 0; x < vfp_system_registers->child(i)->childCount(); ++x) {
- vfp_system_registers->child(i)->child(x)->setFont(1, font);
- }
- }
- // Set CSPR to display in monospace font
- cpsr->setFont(1, font);
- for (int i = 0; i < cpsr->childCount(); ++i) {
- cpsr->child(i)->setFont(1, font);
- for (int x = 0; x < cpsr->child(i)->childCount(); ++x) {
- cpsr->child(i)->child(x)->setFont(1, font);
- }
- }
- setEnabled(false);
-}
-
-void RegistersWidget::OnDebugModeEntered() {
- if (!Core::System::GetInstance().IsPoweredOn())
- return;
-
- for (int i = 0; i < core_registers->childCount(); ++i)
- core_registers->child(i)->setText(
- 1, QString("0x%1").arg(Core::CPU().GetReg(i), 8, 16, QLatin1Char('0')));
-
- UpdateCPSRValues();
-}
-
-void RegistersWidget::OnDebugModeLeft() {}
-
-void RegistersWidget::OnEmulationStarting(EmuThread* emu_thread) {
- setEnabled(true);
-}
-
-void RegistersWidget::OnEmulationStopping() {
- // Reset widget text
- for (int i = 0; i < core_registers->childCount(); ++i)
- core_registers->child(i)->setText(1, QString(""));
-
- for (int i = 0; i < vfp_registers->childCount(); ++i)
- vfp_registers->child(i)->setText(1, QString(""));
-
- for (int i = 0; i < cpsr->childCount(); ++i)
- cpsr->child(i)->setText(1, QString(""));
-
- cpsr->setText(1, QString(""));
-
- // FPSCR
- for (int i = 0; i < vfp_system_registers->child(0)->childCount(); ++i)
- vfp_system_registers->child(0)->child(i)->setText(1, QString(""));
-
- // FPEXC
- for (int i = 0; i < vfp_system_registers->child(1)->childCount(); ++i)
- vfp_system_registers->child(1)->child(i)->setText(1, QString(""));
-
- vfp_system_registers->child(0)->setText(1, QString(""));
- vfp_system_registers->child(1)->setText(1, QString(""));
- vfp_system_registers->child(2)->setText(1, QString(""));
- vfp_system_registers->child(3)->setText(1, QString(""));
-
- setEnabled(false);
-}
-
-void RegistersWidget::CreateCPSRChildren() {
- cpsr->addChild(new QTreeWidgetItem(QStringList("M")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("T")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("F")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("I")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("A")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("E")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("IT")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("GE")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("DNM")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("J")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("Q")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("V")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("C")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("Z")));
- cpsr->addChild(new QTreeWidgetItem(QStringList("N")));
-}
-
-void RegistersWidget::UpdateCPSRValues() {
- const u32 cpsr_val = Core::CPU().GetCPSR();
-
- cpsr->setText(1, QString("0x%1").arg(cpsr_val, 8, 16, QLatin1Char('0')));
- cpsr->child(0)->setText(
- 1, QString("b%1").arg(cpsr_val & 0x1F, 5, 2, QLatin1Char('0'))); // M - Mode
- cpsr->child(1)->setText(1, QString::number((cpsr_val >> 5) & 1)); // T - State
- cpsr->child(2)->setText(1, QString::number((cpsr_val >> 6) & 1)); // F - FIQ disable
- cpsr->child(3)->setText(1, QString::number((cpsr_val >> 7) & 1)); // I - IRQ disable
- cpsr->child(4)->setText(1, QString::number((cpsr_val >> 8) & 1)); // A - Imprecise abort
- cpsr->child(5)->setText(1, QString::number((cpsr_val >> 9) & 1)); // E - Data endianness
- cpsr->child(6)->setText(1,
- QString::number((cpsr_val >> 10) & 0x3F)); // IT - If-Then state (DNM)
- cpsr->child(7)->setText(1,
- QString::number((cpsr_val >> 16) & 0xF)); // GE - Greater-than-or-Equal
- cpsr->child(8)->setText(1, QString::number((cpsr_val >> 20) & 0xF)); // DNM - Do not modify
- cpsr->child(9)->setText(1, QString::number((cpsr_val >> 24) & 1)); // J - Jazelle
- cpsr->child(10)->setText(1, QString::number((cpsr_val >> 27) & 1)); // Q - Saturation
- cpsr->child(11)->setText(1, QString::number((cpsr_val >> 28) & 1)); // V - Overflow
- cpsr->child(12)->setText(1, QString::number((cpsr_val >> 29) & 1)); // C - Carry/Borrow/Extend
- cpsr->child(13)->setText(1, QString::number((cpsr_val >> 30) & 1)); // Z - Zero
- cpsr->child(14)->setText(1, QString::number((cpsr_val >> 31) & 1)); // N - Negative/Less than
-}
-
-void RegistersWidget::CreateVFPSystemRegisterChildren() {
- QTreeWidgetItem* const fpscr = new QTreeWidgetItem(QStringList("FPSCR"));
- fpscr->addChild(new QTreeWidgetItem(QStringList("IOC")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("DZC")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("OFC")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("UFC")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("IXC")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("IDC")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("IOE")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("DZE")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("OFE")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("UFE")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("IXE")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("IDE")));
- fpscr->addChild(new QTreeWidgetItem(QStringList(tr("Vector Length"))));
- fpscr->addChild(new QTreeWidgetItem(QStringList(tr("Vector Stride"))));
- fpscr->addChild(new QTreeWidgetItem(QStringList(tr("Rounding Mode"))));
- fpscr->addChild(new QTreeWidgetItem(QStringList("FZ")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("DN")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("V")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("C")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("Z")));
- fpscr->addChild(new QTreeWidgetItem(QStringList("N")));
-
- QTreeWidgetItem* const fpexc = new QTreeWidgetItem(QStringList("FPEXC"));
- fpexc->addChild(new QTreeWidgetItem(QStringList("IOC")));
- fpexc->addChild(new QTreeWidgetItem(QStringList("OFC")));
- fpexc->addChild(new QTreeWidgetItem(QStringList("UFC")));
- fpexc->addChild(new QTreeWidgetItem(QStringList("INV")));
- fpexc->addChild(new QTreeWidgetItem(QStringList(tr("Vector Iteration Count"))));
- fpexc->addChild(new QTreeWidgetItem(QStringList("FP2V")));
- fpexc->addChild(new QTreeWidgetItem(QStringList("EN")));
- fpexc->addChild(new QTreeWidgetItem(QStringList("EX")));
-
- vfp_system_registers->addChild(fpscr);
- vfp_system_registers->addChild(fpexc);
- vfp_system_registers->addChild(new QTreeWidgetItem(QStringList("FPINST")));
- vfp_system_registers->addChild(new QTreeWidgetItem(QStringList("FPINST2")));
-}
-
-void RegistersWidget::UpdateVFPSystemRegisterValues() {
- UNIMPLEMENTED();
-}
diff --git a/src/citra_qt/debugger/registers.h b/src/citra_qt/debugger/registers.h
deleted file mode 100644
index 55bda5b59..000000000
--- a/src/citra_qt/debugger/registers.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QDockWidget>
-#include "ui_registers.h"
-
-class QTreeWidget;
-class QTreeWidgetItem;
-class EmuThread;
-
-class RegistersWidget : public QDockWidget {
- Q_OBJECT
-
-public:
- explicit RegistersWidget(QWidget* parent = nullptr);
-
-public slots:
- void OnDebugModeEntered();
- void OnDebugModeLeft();
-
- void OnEmulationStarting(EmuThread* emu_thread);
- void OnEmulationStopping();
-
-private:
- void CreateCPSRChildren();
- void UpdateCPSRValues();
-
- void CreateVFPSystemRegisterChildren();
- void UpdateVFPSystemRegisterValues();
-
- Ui::ARMRegisters cpu_regs_ui;
-
- QTreeWidget* tree;
-
- QTreeWidgetItem* core_registers;
- QTreeWidgetItem* vfp_registers;
- QTreeWidgetItem* vfp_system_registers;
- QTreeWidgetItem* cpsr;
-};
diff --git a/src/citra_qt/debugger/registers.ui b/src/citra_qt/debugger/registers.ui
deleted file mode 100644
index c81ae03f9..000000000
--- a/src/citra_qt/debugger/registers.ui
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ARMRegisters</class>
- <widget class="QDockWidget" name="ARMRegisters">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>ARM Registers</string>
- </property>
- <widget class="QWidget" name="dockWidgetContents">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTreeWidget" name="treeWidget">
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- <column>
- <property name="text">
- <string>Register</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Value</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp
deleted file mode 100644
index eefbcb9f1..000000000
--- a/src/citra_qt/debugger/wait_tree.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "citra_qt/debugger/wait_tree.h"
-#include "citra_qt/util/util.h"
-
-#include "core/hle/kernel/condition_variable.h"
-#include "core/hle/kernel/event.h"
-#include "core/hle/kernel/mutex.h"
-#include "core/hle/kernel/thread.h"
-#include "core/hle/kernel/timer.h"
-#include "core/hle/kernel/wait_object.h"
-
-WaitTreeItem::~WaitTreeItem() {}
-
-QColor WaitTreeItem::GetColor() const {
- return QColor(Qt::GlobalColor::black);
-}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeItem::GetChildren() const {
- return {};
-}
-
-void WaitTreeItem::Expand() {
- if (IsExpandable() && !expanded) {
- children = GetChildren();
- for (std::size_t i = 0; i < children.size(); ++i) {
- children[i]->parent = this;
- children[i]->row = i;
- }
- expanded = true;
- }
-}
-
-WaitTreeItem* WaitTreeItem::Parent() const {
- return parent;
-}
-
-const std::vector<std::unique_ptr<WaitTreeItem>>& WaitTreeItem::Children() const {
- return children;
-}
-
-bool WaitTreeItem::IsExpandable() const {
- return false;
-}
-
-std::size_t WaitTreeItem::Row() const {
- return row;
-}
-
-std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList() {
- const auto& threads = Kernel::GetThreadList();
- std::vector<std::unique_ptr<WaitTreeThread>> item_list;
- item_list.reserve(threads.size());
- for (std::size_t i = 0; i < threads.size(); ++i) {
- item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i]));
- item_list.back()->row = i;
- }
- return item_list;
-}
-
-WaitTreeText::WaitTreeText(const QString& t) : text(t) {}
-
-QString WaitTreeText::GetText() const {
- return text;
-}
-
-WaitTreeWaitObject::WaitTreeWaitObject(const Kernel::WaitObject& o) : object(o) {}
-
-bool WaitTreeExpandableItem::IsExpandable() const {
- return true;
-}
-
-QString WaitTreeWaitObject::GetText() const {
- return tr("[%1]%2 %3")
- .arg(object.GetObjectId())
- .arg(QString::fromStdString(object.GetTypeName()),
- QString::fromStdString(object.GetName()));
-}
-
-std::unique_ptr<WaitTreeWaitObject> WaitTreeWaitObject::make(const Kernel::WaitObject& object) {
- switch (object.GetHandleType()) {
- case Kernel::HandleType::Event:
- return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::Event&>(object));
- case Kernel::HandleType::Mutex:
- return std::make_unique<WaitTreeMutex>(static_cast<const Kernel::Mutex&>(object));
- case Kernel::HandleType::ConditionVariable:
- return std::make_unique<WaitTreeConditionVariable>(
- static_cast<const Kernel::ConditionVariable&>(object));
- case Kernel::HandleType::Timer:
- return std::make_unique<WaitTreeTimer>(static_cast<const Kernel::Timer&>(object));
- case Kernel::HandleType::Thread:
- return std::make_unique<WaitTreeThread>(static_cast<const Kernel::Thread&>(object));
- default:
- return std::make_unique<WaitTreeWaitObject>(object);
- }
-}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeWaitObject::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list;
-
- const auto& threads = object.GetWaitingThreads();
- if (threads.empty()) {
- list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread")));
- } else {
- list.push_back(std::make_unique<WaitTreeThreadList>(threads));
- }
- return list;
-}
-
-QString WaitTreeWaitObject::GetResetTypeQString(Kernel::ResetType reset_type) {
- switch (reset_type) {
- case Kernel::ResetType::OneShot:
- return tr("one shot");
- case Kernel::ResetType::Sticky:
- return tr("sticky");
- case Kernel::ResetType::Pulse:
- return tr("pulse");
- }
-}
-
-WaitTreeObjectList::WaitTreeObjectList(
- const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& list, bool w_all)
- : object_list(list), wait_all(w_all) {}
-
-QString WaitTreeObjectList::GetText() const {
- if (wait_all)
- return tr("waiting for all objects");
- return tr("waiting for one of the following objects");
-}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size());
- std::transform(object_list.begin(), object_list.end(), list.begin(),
- [](const auto& t) { return WaitTreeWaitObject::make(*t); });
- return list;
-}
-
-WaitTreeThread::WaitTreeThread(const Kernel::Thread& thread) : WaitTreeWaitObject(thread) {}
-
-QString WaitTreeThread::GetText() const {
- const auto& thread = static_cast<const Kernel::Thread&>(object);
- QString status;
- switch (thread.status) {
- case THREADSTATUS_RUNNING:
- status = tr("running");
- break;
- case THREADSTATUS_READY:
- status = tr("ready");
- break;
- case THREADSTATUS_WAIT_ARB:
- status = tr("waiting for address 0x%1").arg(thread.wait_address, 8, 16, QLatin1Char('0'));
- break;
- case THREADSTATUS_WAIT_SLEEP:
- status = tr("sleeping");
- break;
- case THREADSTATUS_WAIT_SYNCH_ALL:
- case THREADSTATUS_WAIT_SYNCH_ANY:
- status = tr("waiting for objects");
- break;
- case THREADSTATUS_DORMANT:
- status = tr("dormant");
- break;
- case THREADSTATUS_DEAD:
- status = tr("dead");
- break;
- }
- QString pc_info = tr(" PC = 0x%1 LR = 0x%2")
- .arg(thread.context.pc, 8, 16, QLatin1Char('0'))
- .arg(thread.context.cpu_registers[31], 8, 16, QLatin1Char('0'));
- return WaitTreeWaitObject::GetText() + pc_info + " (" + status + ") ";
-}
-
-QColor WaitTreeThread::GetColor() const {
- const auto& thread = static_cast<const Kernel::Thread&>(object);
- switch (thread.status) {
- case THREADSTATUS_RUNNING:
- return QColor(Qt::GlobalColor::darkGreen);
- case THREADSTATUS_READY:
- return QColor(Qt::GlobalColor::darkBlue);
- case THREADSTATUS_WAIT_ARB:
- return QColor(Qt::GlobalColor::darkRed);
- case THREADSTATUS_WAIT_SLEEP:
- return QColor(Qt::GlobalColor::darkYellow);
- case THREADSTATUS_WAIT_SYNCH_ALL:
- case THREADSTATUS_WAIT_SYNCH_ANY:
- return QColor(Qt::GlobalColor::red);
- case THREADSTATUS_DORMANT:
- return QColor(Qt::GlobalColor::darkCyan);
- case THREADSTATUS_DEAD:
- return QColor(Qt::GlobalColor::gray);
- default:
- return WaitTreeItem::GetColor();
- }
-}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
-
- const auto& thread = static_cast<const Kernel::Thread&>(object);
-
- QString processor;
- switch (thread.processor_id) {
- case ThreadProcessorId::THREADPROCESSORID_DEFAULT:
- processor = tr("default");
- break;
- case ThreadProcessorId::THREADPROCESSORID_0:
- case ThreadProcessorId::THREADPROCESSORID_1:
- case ThreadProcessorId::THREADPROCESSORID_2:
- case ThreadProcessorId::THREADPROCESSORID_3:
- processor = tr("core %1").arg(thread.processor_id);
- break;
- default:
- processor = tr("Unknown processor %1").arg(thread.processor_id);
- break;
- }
-
- list.push_back(std::make_unique<WaitTreeText>(tr("processor = %1").arg(processor)));
- list.push_back(std::make_unique<WaitTreeText>(tr("thread id = %1").arg(thread.GetThreadId())));
- list.push_back(std::make_unique<WaitTreeText>(tr("priority = %1(current) / %2(normal)")
- .arg(thread.current_priority)
- .arg(thread.nominal_priority)));
- list.push_back(std::make_unique<WaitTreeText>(
- tr("last running ticks = %1").arg(thread.last_running_ticks)));
-
- if (thread.held_mutexes.empty()) {
- list.push_back(std::make_unique<WaitTreeText>(tr("not holding mutex")));
- } else {
- list.push_back(std::make_unique<WaitTreeMutexList>(thread.held_mutexes));
- }
- if (thread.status == THREADSTATUS_WAIT_SYNCH_ANY ||
- thread.status == THREADSTATUS_WAIT_SYNCH_ALL) {
- list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects,
- thread.IsSleepingOnWaitAll()));
- }
-
- return list;
-}
-
-WaitTreeEvent::WaitTreeEvent(const Kernel::Event& object) : WaitTreeWaitObject(object) {}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeEvent::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
-
- list.push_back(std::make_unique<WaitTreeText>(
- tr("reset type = %1")
- .arg(GetResetTypeQString(static_cast<const Kernel::Event&>(object).reset_type))));
- return list;
-}
-
-WaitTreeMutex::WaitTreeMutex(const Kernel::Mutex& object) : WaitTreeWaitObject(object) {}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutex::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
-
- const auto& mutex = static_cast<const Kernel::Mutex&>(object);
- if (mutex.GetHasWaiters()) {
- list.push_back(std::make_unique<WaitTreeText>(tr("locked by thread:")));
- list.push_back(std::make_unique<WaitTreeThread>(*mutex.GetHoldingThread()));
- } else {
- list.push_back(std::make_unique<WaitTreeText>(tr("free")));
- }
- return list;
-}
-
-WaitTreeConditionVariable::WaitTreeConditionVariable(const Kernel::ConditionVariable& object)
- : WaitTreeWaitObject(object) {}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeConditionVariable::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
-
- const auto& condition_variable = static_cast<const Kernel::ConditionVariable&>(object);
- list.push_back(std::make_unique<WaitTreeText>(
- tr("available count = %1").arg(condition_variable.GetAvailableCount())));
- return list;
-}
-
-WaitTreeTimer::WaitTreeTimer(const Kernel::Timer& object) : WaitTreeWaitObject(object) {}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeTimer::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
-
- const auto& timer = static_cast<const Kernel::Timer&>(object);
-
- list.push_back(std::make_unique<WaitTreeText>(
- tr("reset type = %1").arg(GetResetTypeQString(timer.reset_type))));
- list.push_back(
- std::make_unique<WaitTreeText>(tr("initial delay = %1").arg(timer.initial_delay)));
- list.push_back(
- std::make_unique<WaitTreeText>(tr("interval delay = %1").arg(timer.interval_delay)));
- return list;
-}
-
-WaitTreeMutexList::WaitTreeMutexList(
- const boost::container::flat_set<Kernel::SharedPtr<Kernel::Mutex>>& list)
- : mutex_list(list) {}
-
-QString WaitTreeMutexList::GetText() const {
- return tr("holding mutexes");
-}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexList::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(mutex_list.size());
- std::transform(mutex_list.begin(), mutex_list.end(), list.begin(),
- [](const auto& t) { return std::make_unique<WaitTreeMutex>(*t); });
- return list;
-}
-
-WaitTreeThreadList::WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list)
- : thread_list(list) {}
-
-QString WaitTreeThreadList::GetText() const {
- return tr("waited by thread");
-}
-
-std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const {
- std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size());
- std::transform(thread_list.begin(), thread_list.end(), list.begin(),
- [](const auto& t) { return std::make_unique<WaitTreeThread>(*t); });
- return list;
-}
-
-WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {}
-
-QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const {
- if (!hasIndex(row, column, parent))
- return {};
-
- if (parent.isValid()) {
- WaitTreeItem* parent_item = static_cast<WaitTreeItem*>(parent.internalPointer());
- parent_item->Expand();
- return createIndex(row, column, parent_item->Children()[row].get());
- }
-
- return createIndex(row, column, thread_items[row].get());
-}
-
-QModelIndex WaitTreeModel::parent(const QModelIndex& index) const {
- if (!index.isValid())
- return {};
-
- WaitTreeItem* parent_item = static_cast<WaitTreeItem*>(index.internalPointer())->Parent();
- if (!parent_item) {
- return QModelIndex();
- }
- return createIndex(static_cast<int>(parent_item->Row()), 0, parent_item);
-}
-
-int WaitTreeModel::rowCount(const QModelIndex& parent) const {
- if (!parent.isValid())
- return static_cast<int>(thread_items.size());
-
- WaitTreeItem* parent_item = static_cast<WaitTreeItem*>(parent.internalPointer());
- parent_item->Expand();
- return static_cast<int>(parent_item->Children().size());
-}
-
-int WaitTreeModel::columnCount(const QModelIndex&) const {
- return 1;
-}
-
-QVariant WaitTreeModel::data(const QModelIndex& index, int role) const {
- if (!index.isValid())
- return {};
-
- switch (role) {
- case Qt::DisplayRole:
- return static_cast<WaitTreeItem*>(index.internalPointer())->GetText();
- case Qt::ForegroundRole:
- return static_cast<WaitTreeItem*>(index.internalPointer())->GetColor();
- default:
- return {};
- }
-}
-
-void WaitTreeModel::ClearItems() {
- thread_items.clear();
-}
-
-void WaitTreeModel::InitItems() {
- thread_items = WaitTreeItem::MakeThreadItemList();
-}
-
-WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("Wait Tree"), parent) {
- setObjectName("WaitTreeWidget");
- view = new QTreeView(this);
- view->setHeaderHidden(true);
- setWidget(view);
- setEnabled(false);
-}
-
-void WaitTreeWidget::OnDebugModeEntered() {
- if (!Core::System::GetInstance().IsPoweredOn())
- return;
- model->InitItems();
- view->setModel(model);
- setEnabled(true);
-}
-
-void WaitTreeWidget::OnDebugModeLeft() {
- setEnabled(false);
- view->setModel(nullptr);
- model->ClearItems();
-}
-
-void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) {
- model = new WaitTreeModel(this);
- view->setModel(model);
- setEnabled(false);
-}
-
-void WaitTreeWidget::OnEmulationStopping() {
- view->setModel(nullptr);
- delete model;
- setEnabled(false);
-}
diff --git a/src/citra_qt/debugger/wait_tree.h b/src/citra_qt/debugger/wait_tree.h
deleted file mode 100644
index 4034e909b..000000000
--- a/src/citra_qt/debugger/wait_tree.h
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QAbstractItemModel>
-#include <QDockWidget>
-#include <QTreeView>
-#include <boost/container/flat_set.hpp>
-#include "core/core.h"
-#include "core/hle/kernel/kernel.h"
-
-class EmuThread;
-
-namespace Kernel {
-class WaitObject;
-class Event;
-class Mutex;
-class ConditionVariable;
-class Thread;
-class Timer;
-}
-
-class WaitTreeThread;
-
-class WaitTreeItem : public QObject {
- Q_OBJECT
-public:
- virtual bool IsExpandable() const;
- virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const;
- virtual QString GetText() const = 0;
- virtual QColor GetColor() const;
- virtual ~WaitTreeItem();
- void Expand();
- WaitTreeItem* Parent() const;
- const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;
- std::size_t Row() const;
- static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList();
-
-private:
- std::size_t row;
- bool expanded = false;
- WaitTreeItem* parent = nullptr;
- std::vector<std::unique_ptr<WaitTreeItem>> children;
-};
-
-class WaitTreeText : public WaitTreeItem {
- Q_OBJECT
-public:
- explicit WaitTreeText(const QString& text);
- QString GetText() const override;
-
-private:
- QString text;
-};
-
-class WaitTreeExpandableItem : public WaitTreeItem {
- Q_OBJECT
-public:
- bool IsExpandable() const override;
-};
-
-class WaitTreeWaitObject : public WaitTreeExpandableItem {
- Q_OBJECT
-public:
- 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;
-
-protected:
- const Kernel::WaitObject& object;
-
- static QString GetResetTypeQString(Kernel::ResetType reset_type);
-};
-
-class WaitTreeObjectList : public WaitTreeExpandableItem {
- Q_OBJECT
-public:
- WaitTreeObjectList(const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& list,
- bool wait_all);
- QString GetText() const override;
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-
-private:
- const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& object_list;
- bool wait_all;
-};
-
-class WaitTreeThread : public WaitTreeWaitObject {
- Q_OBJECT
-public:
- explicit WaitTreeThread(const Kernel::Thread& thread);
- QString GetText() const override;
- QColor GetColor() const override;
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-};
-
-class WaitTreeEvent : public WaitTreeWaitObject {
- Q_OBJECT
-public:
- explicit WaitTreeEvent(const Kernel::Event& object);
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-};
-
-class WaitTreeMutex : public WaitTreeWaitObject {
- Q_OBJECT
-public:
- explicit WaitTreeMutex(const Kernel::Mutex& object);
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-};
-
-class WaitTreeConditionVariable : public WaitTreeWaitObject {
- Q_OBJECT
-public:
- explicit WaitTreeConditionVariable(const Kernel::ConditionVariable& object);
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-};
-
-class WaitTreeTimer : public WaitTreeWaitObject {
- Q_OBJECT
-public:
- explicit WaitTreeTimer(const Kernel::Timer& object);
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-};
-
-class WaitTreeMutexList : public WaitTreeExpandableItem {
- Q_OBJECT
-public:
- 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;
-
-private:
- const boost::container::flat_set<Kernel::SharedPtr<Kernel::Mutex>>& mutex_list;
-};
-
-class WaitTreeThreadList : public WaitTreeExpandableItem {
- Q_OBJECT
-public:
- explicit WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list);
- QString GetText() const override;
- std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
-
-private:
- const std::vector<Kernel::SharedPtr<Kernel::Thread>>& thread_list;
-};
-
-class WaitTreeModel : public QAbstractItemModel {
- Q_OBJECT
-
-public:
- 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;
- QModelIndex parent(const QModelIndex& index) const override;
- int rowCount(const QModelIndex& parent) const override;
- int columnCount(const QModelIndex& parent) const override;
-
- void ClearItems();
- void InitItems();
-
-private:
- std::vector<std::unique_ptr<WaitTreeThread>> thread_items;
-};
-
-class WaitTreeWidget : public QDockWidget {
- Q_OBJECT
-
-public:
- explicit WaitTreeWidget(QWidget* parent = nullptr);
-
-public slots:
- void OnDebugModeEntered();
- void OnDebugModeLeft();
-
- void OnEmulationStarting(EmuThread* emu_thread);
- void OnEmulationStopping();
-
-private:
- QTreeView* view;
- WaitTreeModel* model;
-};
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp
deleted file mode 100644
index a8e3541cd..000000000
--- a/src/citra_qt/game_list.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <QApplication>
-#include <QFileInfo>
-#include <QHeaderView>
-#include <QKeyEvent>
-#include <QMenu>
-#include <QThreadPool>
-#include "common/common_paths.h"
-#include "common/logging/log.h"
-#include "common/string_util.h"
-#include "core/loader/loader.h"
-#include "game_list.h"
-#include "game_list_p.h"
-#include "ui_settings.h"
-
-GameList::SearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist) {
- this->gamelist = gamelist;
- edit_filter_text_old = "";
-}
-
-// EventFilter in order to process systemkeys while editing the searchfield
-bool GameList::SearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* event) {
- // If it isn't a KeyRelease event then continue with standard event processing
- if (event->type() != QEvent::KeyRelease)
- return QObject::eventFilter(obj, event);
-
- QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
- int rowCount = gamelist->tree_view->model()->rowCount();
- QString edit_filter_text = gamelist->search_field->edit_filter->text().toLower();
-
- // If the searchfield's text hasn't changed special function keys get checked
- // If no function key changes the searchfield's text the filter doesn't need to get reloaded
- if (edit_filter_text == edit_filter_text_old) {
- switch (keyEvent->key()) {
- // Escape: Resets the searchfield
- case Qt::Key_Escape: {
- if (edit_filter_text_old.isEmpty()) {
- return QObject::eventFilter(obj, event);
- } else {
- gamelist->search_field->edit_filter->clear();
- edit_filter_text = "";
- }
- break;
- }
- // Return and Enter
- // If the enter key gets pressed first checks how many and which entry is visible
- // If there is only one result launch this game
- case Qt::Key_Return:
- case Qt::Key_Enter: {
- QStandardItemModel* item_model = new QStandardItemModel(gamelist->tree_view);
- QModelIndex root_index = item_model->invisibleRootItem()->index();
- QStandardItem* child_file;
- QString file_path;
- int resultCount = 0;
- for (int i = 0; i < rowCount; ++i) {
- if (!gamelist->tree_view->isRowHidden(i, root_index)) {
- ++resultCount;
- child_file = gamelist->item_model->item(i, 0);
- file_path = child_file->data(GameListItemPath::FullPathRole).toString();
- }
- }
- if (resultCount == 1) {
- // To avoid loading error dialog loops while confirming them using enter
- // Also users usually want to run a diffrent game after closing one
- gamelist->search_field->edit_filter->setText("");
- edit_filter_text = "";
- emit gamelist->GameChosen(file_path);
- } else {
- return QObject::eventFilter(obj, event);
- }
- break;
- }
- default:
- return QObject::eventFilter(obj, event);
- }
- }
- edit_filter_text_old = edit_filter_text;
- return QObject::eventFilter(obj, event);
-}
-
-void GameList::SearchField::setFilterResult(int visible, int total) {
- QString result_of_text = tr("of");
- QString result_text;
- if (total == 1) {
- result_text = tr("result");
- } else {
- result_text = tr("results");
- }
- label_filter_result->setText(
- QString("%1 %2 %3 %4").arg(visible).arg(result_of_text).arg(total).arg(result_text));
-}
-
-void GameList::SearchField::clear() {
- edit_filter->setText("");
-}
-
-void GameList::SearchField::setFocus() {
- if (edit_filter->isVisible()) {
- edit_filter->setFocus();
- }
-}
-
-GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} {
- KeyReleaseEater* keyReleaseEater = new KeyReleaseEater(parent);
- layout_filter = new QHBoxLayout;
- layout_filter->setMargin(8);
- label_filter = new QLabel;
- label_filter->setText(tr("Filter:"));
- edit_filter = new QLineEdit;
- edit_filter->setText("");
- edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
- edit_filter->installEventFilter(keyReleaseEater);
- edit_filter->setClearButtonEnabled(true);
- connect(edit_filter, SIGNAL(textChanged(const QString&)), parent,
- SLOT(onTextChanged(const QString&)));
- label_filter_result = new QLabel;
- button_filter_close = new QToolButton(this);
- button_filter_close->setText("X");
- button_filter_close->setCursor(Qt::ArrowCursor);
- button_filter_close->setStyleSheet("QToolButton{ border: none; padding: 0px; color: "
- "#000000; font-weight: bold; background: #F0F0F0; }"
- "QToolButton:hover{ border: none; padding: 0px; color: "
- "#EEEEEE; font-weight: bold; background: #E81123}");
- connect(button_filter_close, SIGNAL(clicked()), parent, SLOT(onFilterCloseClicked()));
- layout_filter->setSpacing(10);
- layout_filter->addWidget(label_filter);
- layout_filter->addWidget(edit_filter);
- layout_filter->addWidget(label_filter_result);
- layout_filter->addWidget(button_filter_close);
- setLayout(layout_filter);
-}
-
-/**
- * Checks if all words separated by spaces are contained in another string
- * This offers a word order insensitive search function
- *
- * @param String that gets checked if it contains all words of the userinput string
- * @param String containing all words getting checked
- * @return true if the haystack contains all words of userinput
- */
-bool GameList::containsAllWords(QString haystack, QString userinput) {
- QStringList userinput_split = userinput.split(" ", QString::SplitBehavior::SkipEmptyParts);
- return std::all_of(userinput_split.begin(), userinput_split.end(),
- [haystack](QString s) { return haystack.contains(s); });
-}
-
-// Event in order to filter the gamelist after editing the searchfield
-void GameList::onTextChanged(const QString& newText) {
- int rowCount = tree_view->model()->rowCount();
- QString edit_filter_text = newText.toLower();
-
- QModelIndex root_index = item_model->invisibleRootItem()->index();
-
- // If the searchfield is empty every item is visible
- // Otherwise the filter gets applied
- if (edit_filter_text.isEmpty()) {
- for (int i = 0; i < rowCount; ++i) {
- tree_view->setRowHidden(i, root_index, false);
- }
- search_field->setFilterResult(rowCount, rowCount);
- } else {
- QStandardItem* child_file;
- QString file_path, file_name, file_title, file_programmid;
- int result_count = 0;
- for (int i = 0; i < rowCount; ++i) {
- child_file = item_model->item(i, 0);
- file_path = child_file->data(GameListItemPath::FullPathRole).toString().toLower();
- file_name = file_path.mid(file_path.lastIndexOf("/") + 1);
- file_title = child_file->data(GameListItemPath::TitleRole).toString().toLower();
- file_programmid =
- child_file->data(GameListItemPath::ProgramIdRole).toString().toLower();
-
- // Only items which filename in combination with its title contains all words
- // that are in the searchfiel will be visible in the gamelist
- // The search is case insensitive because of toLower()
- // I decided not to use Qt::CaseInsensitive in containsAllWords to prevent
- // multiple conversions of edit_filter_text for each game in the gamelist
- if (containsAllWords(file_name.append(" ").append(file_title), edit_filter_text) ||
- (file_programmid.count() == 16 && edit_filter_text.contains(file_programmid))) {
- tree_view->setRowHidden(i, root_index, false);
- ++result_count;
- } else {
- tree_view->setRowHidden(i, root_index, true);
- }
- search_field->setFilterResult(result_count, rowCount);
- }
- }
-}
-
-void GameList::onFilterCloseClicked() {
- main_window->filterBarSetChecked(false);
-}
-
-GameList::GameList(GMainWindow* parent) : QWidget{parent} {
- watcher = new QFileSystemWatcher(this);
- connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
-
- this->main_window = parent;
- layout = new QVBoxLayout;
- tree_view = new QTreeView;
- search_field = new SearchField(this);
- item_model = new QStandardItemModel(tree_view);
- tree_view->setModel(item_model);
-
- tree_view->setAlternatingRowColors(true);
- tree_view->setSelectionMode(QHeaderView::SingleSelection);
- tree_view->setSelectionBehavior(QHeaderView::SelectRows);
- tree_view->setVerticalScrollMode(QHeaderView::ScrollPerPixel);
- tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel);
- tree_view->setSortingEnabled(true);
- tree_view->setEditTriggers(QHeaderView::NoEditTriggers);
- tree_view->setUniformRowHeights(true);
- tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
-
- item_model->insertColumns(0, COLUMN_COUNT);
- item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, "Name");
- item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, "File type");
- item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, "Size");
-
- connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry);
- connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu);
-
- // We must register all custom types with the Qt Automoc system so that we are able to use it
- // with signals/slots. In this case, QList falls under the umbrells of custom types.
- qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>");
-
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
- layout->addWidget(tree_view);
- layout->addWidget(search_field);
- setLayout(layout);
-}
-
-GameList::~GameList() {
- emit ShouldCancelWorker();
-}
-
-void GameList::setFilterFocus() {
- if (tree_view->model()->rowCount() > 0) {
- search_field->setFocus();
- }
-}
-
-void GameList::setFilterVisible(bool visibility) {
- search_field->setVisible(visibility);
-}
-
-void GameList::clearFilter() {
- search_field->clear();
-}
-
-void GameList::AddEntry(const QList<QStandardItem*>& entry_items) {
- item_model->invisibleRootItem()->appendRow(entry_items);
-}
-
-void GameList::ValidateEntry(const QModelIndex& item) {
- // We don't care about the individual QStandardItem that was selected, but its row.
- int row = item_model->itemFromIndex(item)->row();
- QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME);
- QString file_path = child_file->data(GameListItemPath::FullPathRole).toString();
-
- if (file_path.isEmpty())
- return;
- std::string std_file_path(file_path.toStdString());
- if (!FileUtil::Exists(std_file_path) || FileUtil::IsDirectory(std_file_path))
- return;
- // Users usually want to run a diffrent game after closing one
- search_field->clear();
- emit GameChosen(file_path);
-}
-
-void GameList::DonePopulating(QStringList watch_list) {
- // Clear out the old directories to watch for changes and add the new ones
- auto watch_dirs = watcher->directories();
- if (!watch_dirs.isEmpty()) {
- watcher->removePaths(watch_dirs);
- }
- // Workaround: Add the watch paths in chunks to allow the gui to refresh
- // This prevents the UI from stalling when a large number of watch paths are added
- // Also artificially caps the watcher to a certain number of directories
- constexpr int LIMIT_WATCH_DIRECTORIES = 5000;
- constexpr int SLICE_SIZE = 25;
- int len = std::min(watch_list.length(), LIMIT_WATCH_DIRECTORIES);
- for (int i = 0; i < len; i += SLICE_SIZE) {
- watcher->addPaths(watch_list.mid(i, i + SLICE_SIZE));
- QCoreApplication::processEvents();
- }
- tree_view->setEnabled(true);
- int rowCount = tree_view->model()->rowCount();
- search_field->setFilterResult(rowCount, rowCount);
- if (rowCount > 0) {
- search_field->setFocus();
- }
-}
-
-void GameList::PopupContextMenu(const QPoint& menu_location) {
- QModelIndex item = tree_view->indexAt(menu_location);
- if (!item.isValid())
- return;
-
- int row = item_model->itemFromIndex(item)->row();
- QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME);
- u64 program_id = child_file->data(GameListItemPath::ProgramIdRole).toULongLong();
-
- QMenu context_menu;
- QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location"));
- open_save_location->setEnabled(program_id != 0);
- connect(open_save_location, &QAction::triggered,
- [&]() { emit OpenSaveFolderRequested(program_id); });
- context_menu.exec(tree_view->viewport()->mapToGlobal(menu_location));
-}
-
-void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
- if (!FileUtil::Exists(dir_path.toStdString()) ||
- !FileUtil::IsDirectory(dir_path.toStdString())) {
- LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data());
- search_field->setFilterResult(0, 0);
- return;
- }
-
- tree_view->setEnabled(false);
- // Delete any rows that might already exist if we're repopulating
- item_model->removeRows(0, item_model->rowCount());
-
- emit ShouldCancelWorker();
-
- GameListWorker* worker = new GameListWorker(dir_path, deep_scan);
-
- 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, &GameList::ShouldCancelWorker, worker, &GameListWorker::Cancel,
- Qt::DirectConnection);
-
- QThreadPool::globalInstance()->start(worker);
- current_worker = std::move(worker);
-}
-
-void GameList::SaveInterfaceLayout() {
- UISettings::values.gamelist_header_state = tree_view->header()->saveState();
-}
-
-void GameList::LoadInterfaceLayout() {
- auto header = tree_view->header();
- if (!header->restoreState(UISettings::values.gamelist_header_state)) {
- // We are using the name column to display icons and titles
- // so make it as large as possible as default.
- header->resizeSection(COLUMN_NAME, header->width());
- }
-
- item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder());
-}
-
-const QStringList GameList::supported_file_extensions = {"3ds", "3dsx", "elf", "axf",
- "cci", "cxi", "app"};
-
-static bool HasSupportedFileExtension(const std::string& file_name) {
- QFileInfo file = QFileInfo(file_name.c_str());
- return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive);
-}
-
-void GameList::RefreshGameDirectory() {
- if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) {
- LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
- search_field->clear();
- PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
- }
-}
-
-void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
- const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory,
- const std::string& virtual_name) -> bool {
- std::string physical_name = directory + DIR_SEP + virtual_name;
-
- if (stop_processing)
- return false; // Breaks the callback loop.
-
- bool is_dir = FileUtil::IsDirectory(physical_name);
- if (!is_dir && HasSupportedFileExtension(physical_name)) {
- std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
- if (!loader)
- return true;
-
- std::vector<u8> smdh;
- loader->ReadIcon(smdh);
-
- u64 program_id = 0;
- loader->ReadProgramId(program_id);
-
- emit EntryReady({
- new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id),
- new GameListItem(
- QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
- new GameListItemSize(FileUtil::GetSize(physical_name)),
- });
- } else if (is_dir && recursion > 0) {
- watch_list.append(QString::fromStdString(physical_name));
- AddFstEntriesToGameList(physical_name, recursion - 1);
- }
-
- return true;
- };
-
- FileUtil::ForeachDirectoryEntry(nullptr, dir_path, callback);
-}
-
-void GameListWorker::run() {
- stop_processing = false;
- watch_list.append(dir_path);
- AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0);
- emit Finished(watch_list);
-}
-
-void GameListWorker::Cancel() {
- this->disconnect();
- stop_processing = true;
-}
diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h
deleted file mode 100644
index 4823a1296..000000000
--- a/src/citra_qt/game_list.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QFileSystemWatcher>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QLineEdit>
-#include <QModelIndex>
-#include <QSettings>
-#include <QStandardItem>
-#include <QStandardItemModel>
-#include <QString>
-#include <QToolButton>
-#include <QTreeView>
-#include <QVBoxLayout>
-#include <QWidget>
-#include "main.h"
-
-class GameListWorker;
-
-class GameList : public QWidget {
- Q_OBJECT
-
-public:
- enum {
- COLUMN_NAME,
- COLUMN_FILE_TYPE,
- COLUMN_SIZE,
- COLUMN_COUNT, // Number of columns
- };
-
- class SearchField : public QWidget {
- public:
- void setFilterResult(int visible, int total);
- void clear();
- void setFocus();
- explicit SearchField(GameList* parent = nullptr);
-
- private:
- class KeyReleaseEater : public QObject {
- public:
- explicit KeyReleaseEater(GameList* gamelist);
-
- private:
- GameList* gamelist = nullptr;
- QString edit_filter_text_old;
-
- protected:
- bool eventFilter(QObject* obj, QEvent* event);
- };
- QHBoxLayout* layout_filter = nullptr;
- QTreeView* tree_view = nullptr;
- QLabel* label_filter = nullptr;
- QLineEdit* edit_filter = nullptr;
- QLabel* label_filter_result = nullptr;
- QToolButton* button_filter_close = nullptr;
- };
-
- explicit GameList(GMainWindow* parent = nullptr);
- ~GameList() override;
-
- void clearFilter();
- void setFilterFocus();
- void setFilterVisible(bool visibility);
-
- void PopulateAsync(const QString& dir_path, bool deep_scan);
-
- void SaveInterfaceLayout();
- void LoadInterfaceLayout();
-
- static const QStringList supported_file_extensions;
-
-signals:
- void GameChosen(QString game_path);
- void ShouldCancelWorker();
- void OpenSaveFolderRequested(u64 program_id);
-
-private slots:
- void onTextChanged(const QString& newText);
- void onFilterCloseClicked();
-
-private:
- void AddEntry(const QList<QStandardItem*>& entry_items);
- void ValidateEntry(const QModelIndex& item);
- void DonePopulating(QStringList watch_list);
-
- void PopupContextMenu(const QPoint& menu_location);
- void RefreshGameDirectory();
- bool containsAllWords(QString haystack, QString userinput);
-
- SearchField* search_field;
- GMainWindow* main_window = nullptr;
- QVBoxLayout* layout = nullptr;
- QTreeView* tree_view = nullptr;
- QStandardItemModel* item_model = nullptr;
- GameListWorker* current_worker = nullptr;
- QFileSystemWatcher* watcher = nullptr;
-};
diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h
deleted file mode 100644
index 9881296d9..000000000
--- a/src/citra_qt/game_list_p.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <atomic>
-#include <QImage>
-#include <QRunnable>
-#include <QStandardItem>
-#include <QString>
-#include "citra_qt/util/util.h"
-#include "common/string_util.h"
-
-/**
- * Gets the default icon (for games without valid SMDH)
- * @param large If true, returns large icon (48x48), otherwise returns small icon (24x24)
- * @return QPixmap default icon
- */
-static QPixmap GetDefaultIcon(bool large) {
- int size = large ? 48 : 24;
- QPixmap icon(size, size);
- icon.fill(Qt::transparent);
- return icon;
-}
-
-class GameListItem : public QStandardItem {
-
-public:
- GameListItem() : QStandardItem() {}
- GameListItem(const QString& string) : QStandardItem(string) {}
- virtual ~GameListItem() override {}
-};
-
-/**
- * A specialization of GameListItem for path values.
- * This class ensures that for every full path value it holds, a correct string representation
- * of just the filename (with no extension) will be displayed to the user.
- * If this class receives valid SMDH data, it will also display game icons and titles.
- */
-class GameListItemPath : public GameListItem {
-
-public:
- static const int FullPathRole = Qt::UserRole + 1;
- static const int TitleRole = Qt::UserRole + 2;
- static const int ProgramIdRole = Qt::UserRole + 3;
-
- GameListItemPath() : GameListItem() {}
- GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id)
- : GameListItem() {
- setData(game_path, FullPathRole);
- setData(qulonglong(program_id), ProgramIdRole);
- }
-
- QVariant data(int role) const override {
- if (role == Qt::DisplayRole) {
- std::string filename;
- Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename,
- nullptr);
- QString title = data(TitleRole).toString();
- return QString::fromStdString(filename) + (title.isEmpty() ? "" : "\n " + title);
- } else {
- return GameListItem::data(role);
- }
- }
-};
-
-/**
- * A specialization of GameListItem for size values.
- * This class ensures that for every numerical size value it holds (in bytes), a correct
- * human-readable string representation will be displayed to the user.
- */
-class GameListItemSize : public GameListItem {
-
-public:
- static const int SizeRole = Qt::UserRole + 1;
-
- GameListItemSize() : GameListItem() {}
- GameListItemSize(const qulonglong size_bytes) : GameListItem() {
- setData(size_bytes, SizeRole);
- }
-
- void setData(const QVariant& value, int role) override {
- // By specializing setData for SizeRole, we can ensure that the numerical and string
- // representations of the data are always accurate and in the correct format.
- if (role == SizeRole) {
- qulonglong size_bytes = value.toULongLong();
- GameListItem::setData(ReadableByteSize(size_bytes), Qt::DisplayRole);
- GameListItem::setData(value, SizeRole);
- } else {
- GameListItem::setData(value, role);
- }
- }
-
- /**
- * This operator is, in practice, only used by the TreeView sorting systems.
- * Override it so that it will correctly sort by numerical value instead of by string
- * representation.
- */
- bool operator<(const QStandardItem& other) const override {
- return data(SizeRole).toULongLong() < other.data(SizeRole).toULongLong();
- }
-};
-
-/**
- * Asynchronous worker object for populating the game list.
- * Communicates with other threads through Qt's signal/slot system.
- */
-class GameListWorker : public QObject, public QRunnable {
- Q_OBJECT
-
-public:
- GameListWorker(QString dir_path, bool deep_scan)
- : QObject(), QRunnable(), dir_path(dir_path), deep_scan(deep_scan) {}
-
-public slots:
- /// Starts the processing of directory tree information.
- void run() override;
- /// Tells the worker that it should no longer continue processing. Thread-safe.
- void Cancel();
-
-signals:
- /**
- * The `EntryReady` signal is emitted once an entry has been prepared and is ready
- * to be added to the game list.
- * @param entry_items a list with `QStandardItem`s that make up the columns of the new entry.
- */
- void EntryReady(QList<QStandardItem*> entry_items);
-
- /**
- * After the worker has traversed the game directory looking for entries, this signal is emmited
- * with a list of folders that should be watched for changes as well.
- */
- void Finished(QStringList watch_list);
-
-private:
- QStringList watch_list;
- QString dir_path;
- bool deep_scan;
- std::atomic_bool stop_processing;
-
- void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion = 0);
-};
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp
deleted file mode 100644
index 158ed506f..000000000
--- a/src/citra_qt/hotkeys.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <map>
-#include <QKeySequence>
-#include <QShortcut>
-#include <QtGlobal>
-#include "citra_qt/hotkeys.h"
-#include "citra_qt/ui_settings.h"
-
-struct Hotkey {
- Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) {}
-
- QKeySequence keyseq;
- QShortcut* shortcut;
- Qt::ShortcutContext context;
-};
-
-typedef std::map<QString, Hotkey> HotkeyMap;
-typedef std::map<QString, HotkeyMap> HotkeyGroupMap;
-
-HotkeyGroupMap hotkey_groups;
-
-void SaveHotkeys() {
- UISettings::values.shortcuts.clear();
- for (auto group : hotkey_groups) {
- for (auto hotkey : group.second) {
- UISettings::values.shortcuts.emplace_back(
- UISettings::Shortcut(group.first + "/" + hotkey.first,
- UISettings::ContextualShortcut(hotkey.second.keyseq.toString(),
- hotkey.second.context)));
- }
- }
-}
-
-void LoadHotkeys() {
- // Make sure NOT to use a reference here because it would become invalid once we call
- // beginGroup()
- for (auto shortcut : UISettings::values.shortcuts) {
- QStringList cat = shortcut.first.split("/");
- Q_ASSERT(cat.size() >= 2);
-
- // RegisterHotkey assigns default keybindings, so use old values as default parameters
- Hotkey& hk = hotkey_groups[cat[0]][cat[1]];
- if (!shortcut.second.first.isEmpty()) {
- hk.keyseq = QKeySequence::fromString(shortcut.second.first);
- hk.context = (Qt::ShortcutContext)shortcut.second.second;
- }
- if (hk.shortcut)
- hk.shortcut->setKey(hk.keyseq);
- }
-}
-
-void RegisterHotkey(const QString& group, const QString& action, const QKeySequence& default_keyseq,
- Qt::ShortcutContext default_context) {
- if (hotkey_groups[group].find(action) == hotkey_groups[group].end()) {
- hotkey_groups[group][action].keyseq = default_keyseq;
- hotkey_groups[group][action].context = default_context;
- }
-}
-
-QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget) {
- Hotkey& hk = hotkey_groups[group][action];
-
- if (!hk.shortcut)
- hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context);
-
- return hk.shortcut;
-}
-
-GHotkeysDialog::GHotkeysDialog(QWidget* parent) : QWidget(parent) {
- ui.setupUi(this);
-
- for (auto group : hotkey_groups) {
- QTreeWidgetItem* toplevel_item = new QTreeWidgetItem(QStringList(group.first));
- for (auto hotkey : group.second) {
- QStringList columns;
- columns << hotkey.first << hotkey.second.keyseq.toString();
- QTreeWidgetItem* item = new QTreeWidgetItem(columns);
- toplevel_item->addChild(item);
- }
- ui.treeWidget->addTopLevelItem(toplevel_item);
- }
- // TODO: Make context configurable as well (hiding the column for now)
- ui.treeWidget->setColumnCount(2);
-
- ui.treeWidget->resizeColumnToContents(0);
- ui.treeWidget->resizeColumnToContents(1);
-}
diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h
deleted file mode 100644
index a4ccc193b..000000000
--- a/src/citra_qt/hotkeys.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "ui_hotkeys.h"
-
-class QDialog;
-class QKeySequence;
-class QSettings;
-class QShortcut;
-
-/**
- * Register a hotkey.
- *
- * @param group General group this hotkey belongs to (e.g. "Main Window", "Debugger")
- * @param action Name of the action (e.g. "Start Emulation", "Load Image")
- * @param default_keyseq Default key sequence to assign if the hotkey wasn't present in the settings
- * file before
- * @param default_context Default context to assign if the hotkey wasn't present in the settings
- * file before
- * @warning Both the group and action strings will be displayed in the hotkey settings dialog
- */
-void RegisterHotkey(const QString& group, const QString& action,
- const QKeySequence& default_keyseq = QKeySequence(),
- Qt::ShortcutContext default_context = Qt::WindowShortcut);
-
-/**
- * Returns a QShortcut object whose activated() signal can be connected to other QObjects' slots.
- *
- * @param group General group this hotkey belongs to (e.g. "Main Window", "Debugger").
- * @param action Name of the action (e.g. "Start Emulation", "Load Image").
- * @param widget Parent widget of the returned QShortcut.
- * @warning If multiple QWidgets' call this function for the same action, the returned QShortcut
- * will be the same. Thus, you shouldn't rely on the caller really being the QShortcut's parent.
- */
-QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget);
-
-/**
- * Saves all registered hotkeys to the settings file.
- *
- * @note Each hotkey group will be stored a settings group; For each hotkey inside that group, a
- * settings group will be created to store the key sequence and the hotkey context.
- */
-void SaveHotkeys();
-
-/**
- * Loads hotkeys from the settings file.
- *
- * @note Yet unregistered hotkeys which are present in the settings will automatically be
- * registered.
- */
-void LoadHotkeys();
-
-class GHotkeysDialog : public QWidget {
- Q_OBJECT
-
-public:
- explicit GHotkeysDialog(QWidget* parent = nullptr);
-
-private:
- Ui::hotkeys ui;
-};
diff --git a/src/citra_qt/hotkeys.ui b/src/citra_qt/hotkeys.ui
deleted file mode 100644
index 050fe064e..000000000
--- a/src/citra_qt/hotkeys.ui
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>hotkeys</class>
- <widget class="QWidget" name="hotkeys">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>363</width>
- <height>388</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Hotkey Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTreeWidget" name="treeWidget">
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectItems</enum>
- </property>
- <property name="headerHidden">
- <bool>false</bool>
- </property>
- <column>
- <property name="text">
- <string>Action</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Hotkey</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Context</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
deleted file mode 100644
index 943aee30d..000000000
--- a/src/citra_qt/main.cpp
+++ /dev/null
@@ -1,877 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <cinttypes>
-#include <clocale>
-#include <memory>
-#include <thread>
-#include <glad/glad.h>
-#define QT_NO_OPENGL
-#include <QDesktopWidget>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QtGui>
-#include <QtWidgets>
-#include "citra_qt/bootmanager.h"
-#include "citra_qt/configuration/config.h"
-#include "citra_qt/configuration/configure_dialog.h"
-#include "citra_qt/debugger/graphics/graphics.h"
-#include "citra_qt/debugger/graphics/graphics_breakpoints.h"
-#include "citra_qt/debugger/graphics/graphics_cmdlists.h"
-#include "citra_qt/debugger/graphics/graphics_surface.h"
-#include "citra_qt/debugger/graphics/graphics_tracing.h"
-#include "citra_qt/debugger/graphics/graphics_vertex_shader.h"
-#include "citra_qt/debugger/profiler.h"
-#include "citra_qt/debugger/registers.h"
-#include "citra_qt/debugger/wait_tree.h"
-#include "citra_qt/game_list.h"
-#include "citra_qt/hotkeys.h"
-#include "citra_qt/main.h"
-#include "citra_qt/ui_settings.h"
-#include "common/logging/backend.h"
-#include "common/logging/filter.h"
-#include "common/logging/log.h"
-#include "common/logging/text_formatter.h"
-#include "common/microprofile.h"
-#include "common/platform.h"
-#include "common/scm_rev.h"
-#include "common/scope_exit.h"
-#include "common/string_util.h"
-#include "core/core.h"
-#include "core/gdbstub/gdbstub.h"
-#include "core/loader/loader.h"
-#include "core/settings.h"
-
-#ifdef QT_STATICPLUGIN
-Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
-#endif
-
-/**
- * "Callouts" are one-time instructional messages shown to the user. In the config settings, there
- * is a bitfield "callout_flags" options, used to track if a message has already been shown to the
- * user. This is 32-bits - if we have more than 32 callouts, we should retire and recyle old ones.
- */
-enum class CalloutFlag : uint32_t {
- Telemetry = 0x1,
-};
-
-static void ShowCalloutMessage(const QString& message, CalloutFlag flag) {
- if (UISettings::values.callout_flags & static_cast<uint32_t>(flag)) {
- return;
- }
-
- UISettings::values.callout_flags |= static_cast<uint32_t>(flag);
-
- QMessageBox msg;
- msg.setText(message);
- msg.setStandardButtons(QMessageBox::Ok);
- msg.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- msg.setStyleSheet("QLabel{min-width: 900px;}");
- msg.exec();
-}
-
-void GMainWindow::ShowCallouts() {
- static const QString telemetry_message =
- tr("To help improve Citra, the Citra Team collects anonymous usage data. No private or "
- "personally identifying information is collected. This data helps us to understand how "
- "people use Citra and prioritize our efforts. Furthermore, it helps us to more easily "
- "identify emulation bugs and performance issues. This data includes:<ul><li>Information"
- " about the version of Citra you are using</li><li>Performance data about the games you "
- "play</li><li>Your configuration settings</li><li>Information about your computer "
- "hardware</li><li>Emulation errors and crash information</li></ul>By default, this "
- "feature is enabled. To disable this feature, click 'Emulation' from the menu and then "
- "select 'Configure...'. Then, on the 'Web' tab, uncheck 'Share anonymous usage data with"
- " the Citra team'. <br/><br/>By using this software, you agree to the above terms.<br/>"
- "<br/><a href='https://citra-emu.org/entry/telemetry-and-why-thats-a-good-thing/'>Learn "
- "more</a>");
- ShowCalloutMessage(telemetry_message, CalloutFlag::Telemetry);
-}
-
-GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
- Pica::g_debug_context = Pica::DebugContext::Construct();
- setAcceptDrops(true);
- ui.setupUi(this);
- statusBar()->hide();
-
- InitializeWidgets();
- InitializeDebugWidgets();
- InitializeRecentFileMenuActions();
- InitializeHotkeys();
-
- SetDefaultUIGeometry();
- RestoreUIState();
-
- ConnectMenuEvents();
- ConnectWidgetEvents();
-
- setWindowTitle(QString("Citra %1| %2-%3")
- .arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
- show();
-
- game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
-
- UpdateUITheme();
-
- // Show one-time "callout" messages to the user
- ShowCallouts();
-
- QStringList args = QApplication::arguments();
- if (args.length() >= 2) {
- BootGame(args[1]);
- }
-}
-
-GMainWindow::~GMainWindow() {
- // will get automatically deleted otherwise
- if (render_window->parent() == nullptr)
- delete render_window;
-
- Pica::g_debug_context.reset();
-}
-
-void GMainWindow::InitializeWidgets() {
- render_window = new GRenderWindow(this, emu_thread.get());
- render_window->hide();
-
- game_list = new GameList(this);
- ui.horizontalLayout->addWidget(game_list);
-
- // Create status bar
- message_label = new QLabel();
- // Configured separately for left alignment
- message_label->setVisible(false);
- message_label->setFrameStyle(QFrame::NoFrame);
- message_label->setContentsMargins(4, 0, 4, 0);
- message_label->setAlignment(Qt::AlignLeft);
- statusBar()->addPermanentWidget(message_label, 1);
-
- emu_speed_label = new QLabel();
- emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% "
- "indicate emulation is running faster or slower than a 3DS."));
- game_fps_label = new QLabel();
- game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "
- "This will vary from game to game and scene to scene."));
- emu_frametime_label = new QLabel();
- emu_frametime_label->setToolTip(
- tr("Time taken to emulate a 3DS frame, not counting framelimiting or v-sync. For "
- "full-speed emulation this should be at most 16.67 ms."));
-
- for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) {
- label->setVisible(false);
- label->setFrameStyle(QFrame::NoFrame);
- label->setContentsMargins(4, 0, 4, 0);
- statusBar()->addPermanentWidget(label, 0);
- }
- statusBar()->setVisible(true);
- setStyleSheet("QStatusBar::item{border: none;}");
-}
-
-void GMainWindow::InitializeDebugWidgets() {
- connect(ui.action_Create_Pica_Surface_Viewer, &QAction::triggered, this,
- &GMainWindow::OnCreateGraphicsSurfaceViewer);
-
- QMenu* debug_menu = ui.menu_View_Debugging;
-
-#if MICROPROFILE_ENABLED
- microProfileDialog = new MicroProfileDialog(this);
- microProfileDialog->hide();
- debug_menu->addAction(microProfileDialog->toggleViewAction());
-#endif
-
- registersWidget = new RegistersWidget(this);
- addDockWidget(Qt::RightDockWidgetArea, registersWidget);
- registersWidget->hide();
- debug_menu->addAction(registersWidget->toggleViewAction());
- connect(this, &GMainWindow::EmulationStarting, registersWidget,
- &RegistersWidget::OnEmulationStarting);
- connect(this, &GMainWindow::EmulationStopping, registersWidget,
- &RegistersWidget::OnEmulationStopping);
-
- graphicsWidget = new GPUCommandStreamWidget(this);
- addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
- graphicsWidget->hide();
- debug_menu->addAction(graphicsWidget->toggleViewAction());
-
- graphicsCommandsWidget = new GPUCommandListWidget(this);
- addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
- graphicsCommandsWidget->hide();
- debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
-
- graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this);
- addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
- graphicsBreakpointsWidget->hide();
- debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
-
- graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this);
- addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget);
- graphicsVertexShaderWidget->hide();
- debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());
-
- graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this);
- addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget);
- graphicsTracingWidget->hide();
- debug_menu->addAction(graphicsTracingWidget->toggleViewAction());
- connect(this, &GMainWindow::EmulationStarting, graphicsTracingWidget,
- &GraphicsTracingWidget::OnEmulationStarting);
- connect(this, &GMainWindow::EmulationStopping, graphicsTracingWidget,
- &GraphicsTracingWidget::OnEmulationStopping);
-
- waitTreeWidget = new WaitTreeWidget(this);
- addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
- waitTreeWidget->hide();
- debug_menu->addAction(waitTreeWidget->toggleViewAction());
- connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
- &WaitTreeWidget::OnEmulationStarting);
- connect(this, &GMainWindow::EmulationStopping, waitTreeWidget,
- &WaitTreeWidget::OnEmulationStopping);
-}
-
-void GMainWindow::InitializeRecentFileMenuActions() {
- for (int i = 0; i < max_recent_files_item; ++i) {
- actions_recent_files[i] = new QAction(this);
- actions_recent_files[i]->setVisible(false);
- connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile()));
-
- ui.menu_recent_files->addAction(actions_recent_files[i]);
- }
-
- UpdateRecentFiles();
-}
-
-void GMainWindow::InitializeHotkeys() {
- RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
- RegisterHotkey("Main Window", "Swap Screens", QKeySequence::NextChild);
- RegisterHotkey("Main Window", "Start Emulation");
- LoadHotkeys();
-
- connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this,
- SLOT(OnMenuLoadFile()));
- connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this,
- SLOT(OnStartGame()));
- connect(GetHotkey("Main Window", "Swap Screens", render_window), SIGNAL(activated()), this,
- SLOT(OnSwapScreens()));
-}
-
-void GMainWindow::SetDefaultUIGeometry() {
- // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
- const QRect screenRect = QApplication::desktop()->screenGeometry(this);
-
- const int w = screenRect.width() * 2 / 3;
- const int h = screenRect.height() / 2;
- const int x = (screenRect.x() + screenRect.width()) / 2 - w / 2;
- const int y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100;
-
- setGeometry(x, y, w, h);
-}
-
-void GMainWindow::RestoreUIState() {
- restoreGeometry(UISettings::values.geometry);
- restoreState(UISettings::values.state);
- render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
-#if MICROPROFILE_ENABLED
- microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
- microProfileDialog->setVisible(UISettings::values.microprofile_visible);
-#endif
-
- game_list->LoadInterfaceLayout();
-
- ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode);
- ToggleWindowMode();
-
- ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
- OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
-
- ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar);
- game_list->setFilterVisible(ui.action_Show_Filter_Bar->isChecked());
-
- ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar);
- statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
-}
-
-void GMainWindow::ConnectWidgetEvents() {
- connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
- connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this,
- SLOT(OnGameListOpenSaveFolder(u64)));
-
- connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window,
- SLOT(OnEmulationStarting(EmuThread*)));
- connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
-
- connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar);
-}
-
-void GMainWindow::ConnectMenuEvents() {
- // File
- connect(ui.action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
- connect(ui.action_Select_Game_List_Root, &QAction::triggered, this,
- &GMainWindow::OnMenuSelectGameListRoot);
- connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close);
-
- // Emulation
- connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
- connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
- connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
- connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
-
- // View
- connect(ui.action_Single_Window_Mode, &QAction::triggered, this,
- &GMainWindow::ToggleWindowMode);
- connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this,
- &GMainWindow::OnDisplayTitleBars);
- ui.action_Show_Filter_Bar->setShortcut(tr("CTRL+F"));
- connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
- connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
-}
-
-void GMainWindow::OnDisplayTitleBars(bool show) {
- QList<QDockWidget*> widgets = findChildren<QDockWidget*>();
-
- if (show) {
- for (QDockWidget* widget : widgets) {
- QWidget* old = widget->titleBarWidget();
- widget->setTitleBarWidget(nullptr);
- if (old != nullptr)
- delete old;
- }
- } else {
- for (QDockWidget* widget : widgets) {
- QWidget* old = widget->titleBarWidget();
- widget->setTitleBarWidget(new QWidget());
- if (old != nullptr)
- delete old;
- }
- }
-}
-
-bool GMainWindow::LoadROM(const QString& filename) {
- // Shutdown previous session if the emu thread is still active...
- if (emu_thread != nullptr)
- ShutdownGame();
-
- render_window->InitRenderTarget();
- render_window->MakeCurrent();
-
- if (!gladLoadGL()) {
- QMessageBox::critical(this, tr("Error while initializing OpenGL 3.3 Core!"),
- tr("Your GPU may not support OpenGL 3.3, or you do not "
- "have the latest graphics driver."));
- return false;
- }
-
- Core::System& system{Core::System::GetInstance()};
-
- const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())};
-
- Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt");
-
- if (result != Core::System::ResultStatus::Success) {
- switch (result) {
- case Core::System::ResultStatus::ErrorGetLoader:
- LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!",
- filename.toStdString().c_str());
- QMessageBox::critical(this, tr("Error while loading ROM!"),
- tr("The ROM format is not supported."));
- break;
-
- case Core::System::ResultStatus::ErrorSystemMode:
- LOG_CRITICAL(Frontend, "Failed to load ROM!");
- QMessageBox::critical(this, tr("Error while loading ROM!"),
- tr("Could not determine the system mode."));
- break;
-
- case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: {
- QMessageBox::critical(
- this, tr("Error while loading ROM!"),
- tr("The game that you are trying to load must be decrypted before being used with "
- "Citra. A real 3DS is required.<br/><br/>"
- "For more information on dumping and decrypting games, please see the following "
- "wiki pages: <ul>"
- "<li><a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>Dumping Game "
- "Cartridges</a></li>"
- "<li><a href='https://citra-emu.org/wiki/dumping-installed-titles/'>Dumping "
- "Installed Titles</a></li>"
- "</ul>"));
- break;
- }
- case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
- QMessageBox::critical(this, tr("Error while loading ROM!"),
- tr("The ROM format is not supported."));
- break;
-
- case Core::System::ResultStatus::ErrorVideoCore:
- QMessageBox::critical(
- this, tr("An error occured in the video core."),
- tr("Citra has encountered an error while running the video core, please see the "
- "log for more details."
- "For more information on accessing the log, please see the following page: "
- "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How "
- "to "
- "Upload the Log File</a>."
- "Ensure that you have the latest graphics drivers for your GPU."));
-
- break;
-
- default:
- QMessageBox::critical(
- this, tr("Error while loading ROM!"),
- tr("An unknown error occured. Please see the log for more details."));
- break;
- }
- return false;
- }
- return true;
-}
-
-void GMainWindow::BootGame(const QString& filename) {
- LOG_INFO(Frontend, "Citra starting...");
- StoreRecentFile(filename); // Put the filename on top of the list
-
- if (!LoadROM(filename))
- return;
-
- // Create and start the emulation thread
- emu_thread = std::make_unique<EmuThread>(render_window);
- emit EmulationStarting(emu_thread.get());
- render_window->moveContext();
- emu_thread->start();
-
- connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));
- // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
- // before the CPU continues
- connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget,
- SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
- connect(emu_thread.get(), SIGNAL(DebugModeEntered()), waitTreeWidget,
- SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
- connect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()),
- Qt::BlockingQueuedConnection);
- connect(emu_thread.get(), SIGNAL(DebugModeLeft()), waitTreeWidget, SLOT(OnDebugModeLeft()),
- Qt::BlockingQueuedConnection);
-
- // Update the GUI
- registersWidget->OnDebugModeEntered();
- if (ui.action_Single_Window_Mode->isChecked()) {
- game_list->hide();
- }
- status_bar_update_timer.start(2000);
-
- render_window->show();
- render_window->setFocus();
-
- emulation_running = true;
- OnStartGame();
-}
-
-void GMainWindow::ShutdownGame() {
- emu_thread->RequestStop();
-
- // Release emu threads from any breakpoints
- // This belongs after RequestStop() and before wait() because if emulation stops on a GPU
- // breakpoint after (or before) RequestStop() is called, the emulation would never be able
- // to continue out to the main loop and terminate. Thus wait() would hang forever.
- // TODO(bunnei): This function is not thread safe, but it's being used as if it were
- Pica::g_debug_context->ClearBreakpoints();
-
- emit EmulationStopping();
-
- // Wait for emulation thread to complete and delete it
- emu_thread->wait();
- emu_thread = nullptr;
-
- // The emulation is stopped, so closing the window or not does not matter anymore
- disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));
-
- // Update the GUI
- ui.action_Start->setEnabled(false);
- ui.action_Start->setText(tr("Start"));
- ui.action_Pause->setEnabled(false);
- ui.action_Stop->setEnabled(false);
- render_window->hide();
- game_list->show();
- game_list->setFilterFocus();
-
- // Disable status bar updates
- status_bar_update_timer.stop();
- message_label->setVisible(false);
- emu_speed_label->setVisible(false);
- game_fps_label->setVisible(false);
- emu_frametime_label->setVisible(false);
-
- emulation_running = false;
-}
-
-void GMainWindow::StoreRecentFile(const QString& filename) {
- UISettings::values.recent_files.prepend(filename);
- UISettings::values.recent_files.removeDuplicates();
- while (UISettings::values.recent_files.size() > max_recent_files_item) {
- UISettings::values.recent_files.removeLast();
- }
-
- UpdateRecentFiles();
-}
-
-void GMainWindow::UpdateRecentFiles() {
- unsigned int num_recent_files =
- std::min(UISettings::values.recent_files.size(), static_cast<int>(max_recent_files_item));
-
- for (unsigned int i = 0; i < num_recent_files; i++) {
- QString text = QString("&%1. %2").arg(i + 1).arg(
- QFileInfo(UISettings::values.recent_files[i]).fileName());
- actions_recent_files[i]->setText(text);
- actions_recent_files[i]->setData(UISettings::values.recent_files[i]);
- actions_recent_files[i]->setToolTip(UISettings::values.recent_files[i]);
- actions_recent_files[i]->setVisible(true);
- }
-
- for (int j = num_recent_files; j < max_recent_files_item; ++j) {
- actions_recent_files[j]->setVisible(false);
- }
-
- // Grey out the recent files menu if the list is empty
- if (num_recent_files == 0) {
- ui.menu_recent_files->setEnabled(false);
- } else {
- ui.menu_recent_files->setEnabled(true);
- }
-}
-
-void GMainWindow::OnGameListLoadFile(QString game_path) {
- BootGame(game_path);
-}
-
-void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
- UNIMPLEMENTED();
-}
-
-void GMainWindow::OnMenuLoadFile() {
- QString extensions;
- for (const auto& piece : game_list->supported_file_extensions)
- extensions += "*." + piece + " ";
-
- QString file_filter = tr("3DS Executable") + " (" + extensions + ")";
- file_filter += ";;" + tr("All Files (*.*)");
-
- QString filename = QFileDialog::getOpenFileName(this, tr("Load File"),
- UISettings::values.roms_path, file_filter);
- if (!filename.isEmpty()) {
- UISettings::values.roms_path = QFileInfo(filename).path();
-
- BootGame(filename);
- }
-}
-
-void GMainWindow::OnMenuSelectGameListRoot() {
- QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
- if (!dir_path.isEmpty()) {
- UISettings::values.gamedir = dir_path;
- game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan);
- }
-}
-
-void GMainWindow::OnMenuRecentFile() {
- QAction* action = qobject_cast<QAction*>(sender());
- assert(action);
-
- QString filename = action->data().toString();
- QFileInfo file_info(filename);
- if (file_info.exists()) {
- BootGame(filename);
- } else {
- // Display an error message and remove the file from the list.
- QMessageBox::information(this, tr("File not found"),
- tr("File \"%1\" not found").arg(filename));
-
- UISettings::values.recent_files.removeOne(filename);
- UpdateRecentFiles();
- }
-}
-
-void GMainWindow::OnStartGame() {
- emu_thread->SetRunning(true);
- qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
- qRegisterMetaType<std::string>("std::string");
- connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus, std::string)), this,
- SLOT(OnCoreError(Core::System::ResultStatus, std::string)));
-
- ui.action_Start->setEnabled(false);
- ui.action_Start->setText(tr("Continue"));
-
- ui.action_Pause->setEnabled(true);
- ui.action_Stop->setEnabled(true);
-}
-
-void GMainWindow::OnPauseGame() {
- emu_thread->SetRunning(false);
-
- ui.action_Start->setEnabled(true);
- ui.action_Pause->setEnabled(false);
- ui.action_Stop->setEnabled(true);
-}
-
-void GMainWindow::OnStopGame() {
- ShutdownGame();
-}
-
-void GMainWindow::ToggleWindowMode() {
- if (ui.action_Single_Window_Mode->isChecked()) {
- // Render in the main window...
- render_window->BackupGeometry();
- ui.horizontalLayout->addWidget(render_window);
- render_window->setFocusPolicy(Qt::ClickFocus);
- if (emulation_running) {
- render_window->setVisible(true);
- render_window->setFocus();
- game_list->hide();
- }
-
- } else {
- // Render in a separate window...
- ui.horizontalLayout->removeWidget(render_window);
- render_window->setParent(nullptr);
- render_window->setFocusPolicy(Qt::NoFocus);
- if (emulation_running) {
- render_window->setVisible(true);
- render_window->RestoreGeometry();
- game_list->show();
- }
- }
-}
-
-void GMainWindow::OnConfigure() {
- ConfigureDialog configureDialog(this);
- auto result = configureDialog.exec();
- if (result == QDialog::Accepted) {
- configureDialog.applyConfiguration();
- UpdateUITheme();
- config->Save();
- }
-}
-
-void GMainWindow::OnToggleFilterBar() {
- game_list->setFilterVisible(ui.action_Show_Filter_Bar->isChecked());
- if (ui.action_Show_Filter_Bar->isChecked()) {
- game_list->setFilterFocus();
- } else {
- game_list->clearFilter();
- }
-}
-
-void GMainWindow::OnSwapScreens() {
- Settings::values.swap_screen = !Settings::values.swap_screen;
- Settings::Apply();
-}
-
-void GMainWindow::OnCreateGraphicsSurfaceViewer() {
- auto graphicsSurfaceViewerWidget = new GraphicsSurfaceWidget(Pica::g_debug_context, this);
- addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceViewerWidget);
- // TODO: Maybe graphicsSurfaceViewerWidget->setFloating(true);
- graphicsSurfaceViewerWidget->show();
-}
-
-void GMainWindow::UpdateStatusBar() {
- if (emu_thread == nullptr) {
- status_bar_update_timer.stop();
- return;
- }
-
- auto results = Core::System::GetInstance().GetAndResetPerfStats();
-
- emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0));
- game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 0));
- emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2));
-
- emu_speed_label->setVisible(true);
- game_fps_label->setVisible(true);
- emu_frametime_label->setVisible(true);
-}
-
-void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
- QMessageBox::StandardButton answer;
- QString status_message;
- const QString common_message =
- tr("The game you are trying to load requires additional files from your 3DS to be dumped "
- "before playing.<br/><br/>For more information on dumping these files, please see the "
- "following wiki page: <a "
- "href='https://citra-emu.org/wiki/"
- "dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>Dumping System "
- "Archives and the Shared Fonts from a 3DS Console</a>.<br/><br/>Would you like to quit "
- "back to the game list? Continuing emulation may result in crashes, corrupted save "
- "data, or other bugs.");
- switch (result) {
- case Core::System::ResultStatus::ErrorSystemFiles: {
- QString message = "Citra was unable to locate a 3DS system archive";
- if (!details.empty()) {
- message.append(tr(": %1. ").arg(details.c_str()));
- } else {
- message.append(". ");
- }
- message.append(common_message);
-
- answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- status_message = "System Archive Missing";
- break;
- }
-
- case Core::System::ResultStatus::ErrorSharedFont: {
- QString message = tr("Citra was unable to locate the 3DS shared fonts. ");
- message.append(common_message);
- answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message,
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- status_message = "Shared Font Missing";
- break;
- }
-
- default:
- answer = QMessageBox::question(
- this, tr("Fatal Error"),
- tr("Citra has encountered a fatal error, please see the log for more details. "
- "For more information on accessing the log, please see the following page: "
- "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How to "
- "Upload the Log File</a>.<br/><br/>Would you like to quit back to the game list? "
- "Continuing emulation may result in crashes, corrupted save data, or other bugs."),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- status_message = "Fatal Error encountered";
- break;
- }
-
- if (answer == QMessageBox::Yes) {
- if (emu_thread) {
- ShutdownGame();
- }
- } else {
- // Only show the message if the game is still running.
- if (emu_thread) {
- message_label->setText(status_message);
- message_label->setVisible(true);
- }
- }
-}
-
-bool GMainWindow::ConfirmClose() {
- if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
- return true;
-
- QMessageBox::StandardButton answer =
- QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- return answer != QMessageBox::No;
-}
-
-void GMainWindow::closeEvent(QCloseEvent* event) {
- if (!ConfirmClose()) {
- event->ignore();
- return;
- }
-
- UISettings::values.geometry = saveGeometry();
- UISettings::values.state = saveState();
- UISettings::values.renderwindow_geometry = render_window->saveGeometry();
-#if MICROPROFILE_ENABLED
- UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry();
- UISettings::values.microprofile_visible = microProfileDialog->isVisible();
-#endif
- UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
- UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked();
- UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked();
- UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked();
- UISettings::values.first_start = false;
-
- game_list->SaveInterfaceLayout();
- SaveHotkeys();
-
- // Shutdown session if the emu thread is active...
- if (emu_thread != nullptr)
- ShutdownGame();
-
- render_window->close();
-
- QWidget::closeEvent(event);
-}
-
-static bool IsSingleFileDropEvent(QDropEvent* event) {
- const QMimeData* mimeData = event->mimeData();
- return mimeData->hasUrls() && mimeData->urls().length() == 1;
-}
-
-void GMainWindow::dropEvent(QDropEvent* event) {
- if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) {
- const QMimeData* mimeData = event->mimeData();
- QString filename = mimeData->urls().at(0).toLocalFile();
- BootGame(filename);
- }
-}
-
-void GMainWindow::dragEnterEvent(QDragEnterEvent* event) {
- if (IsSingleFileDropEvent(event)) {
- event->acceptProposedAction();
- }
-}
-
-void GMainWindow::dragMoveEvent(QDragMoveEvent* event) {
- event->acceptProposedAction();
-}
-
-bool GMainWindow::ConfirmChangeGame() {
- if (emu_thread == nullptr)
- return true;
-
- auto answer = QMessageBox::question(
- this, tr("Citra"),
- tr("Are you sure you want to stop the emulation? Any unsaved progress will be lost."),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- return answer != QMessageBox::No;
-}
-
-void GMainWindow::filterBarSetChecked(bool state) {
- ui.action_Show_Filter_Bar->setChecked(state);
- emit(OnToggleFilterBar());
-}
-
-void GMainWindow::UpdateUITheme() {
- if (UISettings::values.theme != UISettings::themes[0].second) {
- QString theme_uri(":" + UISettings::values.theme + "/style.qss");
- QFile f(theme_uri);
- if (!f.exists()) {
- LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
- } else {
- f.open(QFile::ReadOnly | QFile::Text);
- QTextStream ts(&f);
- qApp->setStyleSheet(ts.readAll());
- GMainWindow::setStyleSheet(ts.readAll());
- }
- } else {
- qApp->setStyleSheet("");
- GMainWindow::setStyleSheet("");
- }
-}
-
-#ifdef main
-#undef main
-#endif
-
-int main(int argc, char* argv[]) {
- Log::Filter log_filter(Log::Level::Info);
- Log::SetFilter(&log_filter);
-
- MicroProfileOnThreadCreate("Frontend");
- SCOPE_EXIT({ MicroProfileShutdown(); });
-
- // Init settings params
- QCoreApplication::setOrganizationName("Citra team");
- QCoreApplication::setApplicationName("Citra");
-
- QApplication::setAttribute(Qt::AA_X11InitThreads);
- QApplication app(argc, argv);
-
- // Qt changes the locale and causes issues in float conversion using std::to_string() when
- // generating shaders
- setlocale(LC_ALL, "C");
-
- GMainWindow main_window;
- // After settings have been loaded by GMainWindow, apply the filter
- log_filter.ParseFilterString(Settings::values.log_filter);
-
- main_window.show();
- return app.exec();
-}
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
deleted file mode 100644
index d59a6d67d..000000000
--- a/src/citra_qt/main.h
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#ifndef _CITRA_QT_MAIN_HXX_
-#define _CITRA_QT_MAIN_HXX_
-
-#include <memory>
-#include <QMainWindow>
-#include <QTimer>
-#include "core/core.h"
-#include "ui_main.h"
-
-class Config;
-class EmuThread;
-class GameList;
-class GImageInfo;
-class GPUCommandStreamWidget;
-class GPUCommandListWidget;
-class GraphicsBreakPointsWidget;
-class GraphicsTracingWidget;
-class GraphicsVertexShaderWidget;
-class GRenderWindow;
-class MicroProfileDialog;
-class ProfilerWidget;
-class RegistersWidget;
-class WaitTreeWidget;
-
-class GMainWindow : public QMainWindow {
- Q_OBJECT
-
- /// Max number of recently loaded items to keep track of
- static const int max_recent_files_item = 10;
-
- // TODO: Make use of this!
- enum {
- UI_IDLE,
- UI_EMU_BOOTING,
- UI_EMU_RUNNING,
- UI_EMU_STOPPING,
- };
-
-public:
- void filterBarSetChecked(bool state);
- void UpdateUITheme();
- GMainWindow();
- ~GMainWindow();
-
-signals:
-
- /**
- * Signal that is emitted when a new EmuThread has been created and an emulation session is
- * about to start. At this time, the core system emulation has been initialized, and all
- * emulation handles and memory should be valid.
- *
- * @param emu_thread Pointer to the newly created EmuThread (to be used by widgets that need to
- * access/change emulation state).
- */
- void EmulationStarting(EmuThread* emu_thread);
-
- /**
- * Signal that is emitted when emulation is about to stop. At this time, the EmuThread and core
- * system emulation handles and memory are still valid, but are about become invalid.
- */
- void EmulationStopping();
-
-private:
- void InitializeWidgets();
- void InitializeDebugWidgets();
- void InitializeRecentFileMenuActions();
- void InitializeHotkeys();
-
- void SetDefaultUIGeometry();
- void RestoreUIState();
-
- void ConnectWidgetEvents();
- void ConnectMenuEvents();
-
- bool LoadROM(const QString& filename);
- void BootGame(const QString& filename);
- void ShutdownGame();
-
- void ShowCallouts();
-
- /**
- * Stores the filename in the recently loaded files list.
- * The new filename is stored at the beginning of the recently loaded files list.
- * After inserting the new entry, duplicates are removed meaning that if
- * this was inserted from \a OnMenuRecentFile(), the entry will be put on top
- * and remove from its previous position.
- *
- * Finally, this function calls \a UpdateRecentFiles() to update the UI.
- *
- * @param filename the filename to store
- */
- void StoreRecentFile(const QString& filename);
-
- /**
- * Updates the recent files menu.
- * Menu entries are rebuilt from the configuration file.
- * If there is no entry in the menu, the menu is greyed out.
- */
- void UpdateRecentFiles();
-
- /**
- * If the emulation is running,
- * asks the user if he really want to close the emulator
- *
- * @return true if the user confirmed
- */
- bool ConfirmClose();
- bool ConfirmChangeGame();
- void closeEvent(QCloseEvent* event) override;
-
-private slots:
- void OnStartGame();
- void OnPauseGame();
- void OnStopGame();
- /// Called whenever a user selects a game in the game list widget.
- void OnGameListLoadFile(QString game_path);
- void OnGameListOpenSaveFolder(u64 program_id);
- void OnMenuLoadFile();
- /// Called whenever a user selects the "File->Select Game List Root" menu item
- void OnMenuSelectGameListRoot();
- void OnMenuRecentFile();
- void OnSwapScreens();
- void OnConfigure();
- void OnToggleFilterBar();
- void OnDisplayTitleBars(bool);
- void ToggleWindowMode();
- void OnCreateGraphicsSurfaceViewer();
- void OnCoreError(Core::System::ResultStatus, std::string);
-
-private:
- void UpdateStatusBar();
-
- Ui::MainWindow ui;
-
- GRenderWindow* render_window;
- GameList* game_list;
-
- // Status bar elements
- QLabel* message_label = nullptr;
- QLabel* emu_speed_label = nullptr;
- QLabel* game_fps_label = nullptr;
- QLabel* emu_frametime_label = nullptr;
- QTimer status_bar_update_timer;
-
- std::unique_ptr<Config> config;
-
- // Whether emulation is currently running in Citra.
- bool emulation_running = false;
- std::unique_ptr<EmuThread> emu_thread;
-
- // Debugger panes
- ProfilerWidget* profilerWidget;
- MicroProfileDialog* microProfileDialog;
- RegistersWidget* registersWidget;
- GPUCommandStreamWidget* graphicsWidget;
- GPUCommandListWidget* graphicsCommandsWidget;
- GraphicsBreakPointsWidget* graphicsBreakpointsWidget;
- GraphicsVertexShaderWidget* graphicsVertexShaderWidget;
- GraphicsTracingWidget* graphicsTracingWidget;
- WaitTreeWidget* waitTreeWidget;
-
- QAction* actions_recent_files[max_recent_files_item];
-
-protected:
- void dropEvent(QDropEvent* event) override;
- void dragEnterEvent(QDragEnterEvent* event) override;
- void dragMoveEvent(QDragMoveEvent* event) override;
-};
-
-#endif // _CITRA_QT_MAIN_HXX_
diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui
deleted file mode 100644
index b13d578f5..000000000
--- a/src/citra_qt/main.ui
+++ /dev/null
@@ -1,201 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>1081</width>
- <height>730</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Citra</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>src/pcafe/res/icon3_64x64.ico</normaloff>src/pcafe/res/icon3_64x64.ico</iconset>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="dockNestingEnabled">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>1081</width>
- <height>19</height>
- </rect>
- </property>
- <widget class="QMenu" name="menu_File">
- <property name="title">
- <string>&amp;File</string>
- </property>
- <widget class="QMenu" name="menu_recent_files">
- <property name="title">
- <string>Recent Files</string>
- </property>
- </widget>
- <addaction name="action_Load_File"/>
- <addaction name="separator"/>
- <addaction name="action_Select_Game_List_Root"/>
- <addaction name="menu_recent_files"/>
- <addaction name="separator"/>
- <addaction name="action_Exit"/>
- </widget>
- <widget class="QMenu" name="menu_Emulation">
- <property name="title">
- <string>&amp;Emulation</string>
- </property>
- <addaction name="action_Start"/>
- <addaction name="action_Pause"/>
- <addaction name="action_Stop"/>
- <addaction name="separator"/>
- <addaction name="action_Configure"/>
- </widget>
- <widget class="QMenu" name="menu_View">
- <property name="title">
- <string>&amp;View</string>
- </property>
- <widget class="QMenu" name="menu_View_Debugging">
- <property name="title">
- <string>Debugging</string>
- </property>
- <addaction name="action_Create_Pica_Surface_Viewer"/>
- <addaction name="separator"/>
- </widget>
- <addaction name="action_Single_Window_Mode"/>
- <addaction name="action_Display_Dock_Widget_Headers"/>
- <addaction name="action_Show_Filter_Bar"/>
- <addaction name="action_Show_Status_Bar"/>
- <addaction name="menu_View_Debugging"/>
- </widget>
- <widget class="QMenu" name="menu_Help">
- <property name="title">
- <string>&amp;Help</string>
- </property>
- <addaction name="action_About"/>
- </widget>
- <addaction name="menu_File"/>
- <addaction name="menu_Emulation"/>
- <addaction name="menu_View"/>
- <addaction name="menu_Help"/>
- </widget>
- <action name="action_Load_File">
- <property name="text">
- <string>Load File...</string>
- </property>
- </action>
- <action name="action_Load_Symbol_Map">
- <property name="text">
- <string>Load Symbol Map...</string>
- </property>
- </action>
- <action name="action_Exit">
- <property name="text">
- <string>E&amp;xit</string>
- </property>
- </action>
- <action name="action_Start">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Start</string>
- </property>
- </action>
- <action name="action_Pause">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Pause</string>
- </property>
- </action>
- <action name="action_Stop">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Stop</string>
- </property>
- </action>
- <action name="action_About">
- <property name="text">
- <string>About Citra</string>
- </property>
- </action>
- <action name="action_Single_Window_Mode">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Single Window Mode</string>
- </property>
- </action>
- <action name="action_Configure">
- <property name="text">
- <string>Configure...</string>
- </property>
- </action>
- <action name="action_Display_Dock_Widget_Headers">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Display Dock Widget Headers</string>
- </property>
- </action>
- <action name="action_Show_Filter_Bar">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Show Filter Bar</string>
- </property>
- </action>
- <action name="action_Show_Status_Bar">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Show Status Bar</string>
- </property>
- </action>
- <action name="action_Select_Game_List_Root">
- <property name="text">
- <string>Select Game Directory...</string>
- </property>
- <property name="toolTip">
- <string>Selects a folder to display in the game list</string>
- </property>
- </action>
- <action name="action_Create_Pica_Surface_Viewer">
- <property name="text">
- <string>Create Pica Surface Viewer</string>
- </property>
- </action>
- </widget>
- <resources/>
-</ui>
diff --git a/src/citra_qt/ui_settings.cpp b/src/citra_qt/ui_settings.cpp
deleted file mode 100644
index 120b34990..000000000
--- a/src/citra_qt/ui_settings.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "ui_settings.h"
-
-namespace UISettings {
-
-Values values = {};
-}
diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h
deleted file mode 100644
index d85c92765..000000000
--- a/src/citra_qt/ui_settings.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <array>
-#include <vector>
-#include <QByteArray>
-#include <QString>
-#include <QStringList>
-
-namespace UISettings {
-
-using ContextualShortcut = std::pair<QString, int>;
-using Shortcut = std::pair<QString, ContextualShortcut>;
-
-static const std::array<std::pair<QString, QString>, 2> themes = {
- {std::make_pair(QString("Default"), QString("default")),
- std::make_pair(QString("Dark"), QString("qdarkstyle"))}};
-
-struct Values {
- QByteArray geometry;
- QByteArray state;
-
- QByteArray renderwindow_geometry;
-
- QByteArray gamelist_header_state;
-
- QByteArray microprofile_geometry;
- bool microprofile_visible;
-
- bool single_window_mode;
- bool display_titlebar;
- bool show_filter_bar;
- bool show_status_bar;
-
- bool confirm_before_closing;
- bool first_start;
-
- QString roms_path;
- QString symbols_path;
- QString gamedir;
- bool gamedir_deepscan;
- QStringList recent_files;
-
- QString theme;
-
- // Shortcut name <Shortcut, context>
- std::vector<Shortcut> shortcuts;
-
- uint32_t callout_flags;
-};
-
-extern Values values;
-}
diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp
deleted file mode 100644
index 212709007..000000000
--- a/src/citra_qt/util/spinbox.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-// Copyright 2014 Tony Wasserka
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the owner nor the names of its contributors may
-// be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <cstdlib>
-#include <QLineEdit>
-#include <QRegExpValidator>
-#include "citra_qt/util/spinbox.h"
-#include "common/assert.h"
-
-CSpinBox::CSpinBox(QWidget* parent)
- : QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) {
- // TODO: Might be nice to not immediately call the slot.
- // Think of an address that is being replaced by a different one, in which case a lot
- // invalid intermediate addresses would be read from during editing.
- connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(OnEditingFinished()));
-
- UpdateText();
-}
-
-void CSpinBox::SetValue(qint64 val) {
- auto old_value = value;
- value = std::max(std::min(val, max_value), min_value);
-
- if (old_value != value) {
- UpdateText();
- emit ValueChanged(value);
- }
-}
-
-void CSpinBox::SetRange(qint64 min, qint64 max) {
- min_value = min;
- max_value = max;
-
- SetValue(value);
- UpdateText();
-}
-
-void CSpinBox::stepBy(int steps) {
- auto new_value = value;
- // Scale number of steps by the currently selected digit
- // TODO: Move this code elsewhere and enable it.
- // TODO: Support for num_digits==0, too
- // TODO: Support base!=16, too
- // TODO: Make the cursor not jump back to the end of the line...
- /*if (base == 16 && num_digits > 0) {
- int digit = num_digits - (lineEdit()->cursorPosition() - prefix.length()) - 1;
- digit = std::max(0, std::min(digit, num_digits - 1));
- steps <<= digit * 4;
- }*/
-
- // Increment "new_value" by "steps", and perform annoying overflow checks, too.
- if (steps < 0 && new_value + steps > new_value) {
- new_value = std::numeric_limits<qint64>::min();
- } else if (steps > 0 && new_value + steps < new_value) {
- new_value = std::numeric_limits<qint64>::max();
- } else {
- new_value += steps;
- }
-
- SetValue(new_value);
- UpdateText();
-}
-
-QAbstractSpinBox::StepEnabled CSpinBox::stepEnabled() const {
- StepEnabled ret = StepNone;
-
- if (value > min_value)
- ret |= StepDownEnabled;
-
- if (value < max_value)
- ret |= StepUpEnabled;
-
- return ret;
-}
-
-void CSpinBox::SetBase(int base) {
- this->base = base;
-
- UpdateText();
-}
-
-void CSpinBox::SetNumDigits(int num_digits) {
- this->num_digits = num_digits;
-
- UpdateText();
-}
-
-void CSpinBox::SetPrefix(const QString& prefix) {
- this->prefix = prefix;
-
- UpdateText();
-}
-
-void CSpinBox::SetSuffix(const QString& suffix) {
- this->suffix = suffix;
-
- UpdateText();
-}
-
-static QString StringToInputMask(const QString& input) {
- QString mask = input;
-
- // ... replace any special characters by their escaped counterparts ...
- mask.replace("\\", "\\\\");
- mask.replace("A", "\\A");
- mask.replace("a", "\\a");
- mask.replace("N", "\\N");
- mask.replace("n", "\\n");
- mask.replace("X", "\\X");
- mask.replace("x", "\\x");
- mask.replace("9", "\\9");
- mask.replace("0", "\\0");
- mask.replace("D", "\\D");
- mask.replace("d", "\\d");
- mask.replace("#", "\\#");
- mask.replace("H", "\\H");
- mask.replace("h", "\\h");
- mask.replace("B", "\\B");
- mask.replace("b", "\\b");
- mask.replace(">", "\\>");
- mask.replace("<", "\\<");
- mask.replace("!", "\\!");
-
- return mask;
-}
-
-void CSpinBox::UpdateText() {
- // If a fixed number of digits is used, we put the line edit in insertion mode by setting an
- // input mask.
- QString mask;
- if (num_digits != 0) {
- mask += StringToInputMask(prefix);
-
- // For base 10 and negative range, demand a single sign character
- if (HasSign())
- mask += "X"; // identified as "-" or "+" in the validator
-
- // Uppercase digits greater than 9.
- mask += ">";
-
- // Match num_digits digits
- // Digits irrelevant to the chosen number base are filtered in the validator
- mask += QString("H").repeated(std::max(num_digits, 1));
-
- // Switch off case conversion
- mask += "!";
-
- mask += StringToInputMask(suffix);
- }
- lineEdit()->setInputMask(mask);
-
- // Set new text without changing the cursor position. This will cause the cursor to briefly
- // appear at the end of the line and then to jump back to its original position. That's
- // a bit ugly, but better than having setText() move the cursor permanently all the time.
- int cursor_position = lineEdit()->cursorPosition();
- lineEdit()->setText(TextFromValue());
- lineEdit()->setCursorPosition(cursor_position);
-}
-
-QString CSpinBox::TextFromValue() {
- return prefix + QString(HasSign() ? ((value < 0) ? "-" : "+") : "") +
- QString("%1").arg(std::abs(value), num_digits, base, QLatin1Char('0')).toUpper() +
- suffix;
-}
-
-qint64 CSpinBox::ValueFromText() {
- unsigned strpos = prefix.length();
-
- QString num_string = text().mid(strpos, text().length() - strpos - suffix.length());
- return num_string.toLongLong(nullptr, base);
-}
-
-bool CSpinBox::HasSign() const {
- return base == 10 && min_value < 0;
-}
-
-void CSpinBox::OnEditingFinished() {
- // Only update for valid input
- QString input = lineEdit()->text();
- int pos = 0;
- if (QValidator::Acceptable == validate(input, pos))
- SetValue(ValueFromText());
-}
-
-QValidator::State CSpinBox::validate(QString& input, int& pos) const {
- if (!prefix.isEmpty() && input.left(prefix.length()) != prefix)
- return QValidator::Invalid;
-
- int strpos = prefix.length();
-
- // Empty "numbers" allowed as intermediate values
- if (strpos >= input.length() - HasSign() - suffix.length())
- return QValidator::Intermediate;
-
- DEBUG_ASSERT(base <= 10 || base == 16);
- QString regexp;
-
- // Demand sign character for negative ranges
- if (HasSign())
- regexp += "[+\\-]";
-
- // Match digits corresponding to the chosen number base.
- regexp += QString("[0-%1").arg(std::min(base, 9));
- if (base == 16) {
- regexp += "a-fA-F";
- }
- regexp += "]";
-
- // Specify number of digits
- if (num_digits > 0) {
- regexp += QString("{%1}").arg(num_digits);
- } else {
- regexp += "+";
- }
-
- // Match string
- QRegExp num_regexp(regexp);
- int num_pos = strpos;
- QString sub_input = input.mid(strpos, input.length() - strpos - suffix.length());
-
- if (!num_regexp.exactMatch(sub_input) && num_regexp.matchedLength() == 0)
- return QValidator::Invalid;
-
- sub_input = sub_input.left(num_regexp.matchedLength());
- bool ok;
- qint64 val = sub_input.toLongLong(&ok, base);
-
- if (!ok)
- return QValidator::Invalid;
-
- // Outside boundaries => don't accept
- if (val < min_value || val > max_value)
- return QValidator::Invalid;
-
- // Make sure we are actually at the end of this string...
- strpos += num_regexp.matchedLength();
-
- if (!suffix.isEmpty() && input.mid(strpos) != suffix) {
- return QValidator::Invalid;
- } else {
- strpos += suffix.length();
- }
-
- if (strpos != input.length())
- return QValidator::Invalid;
-
- // At this point we can say for sure that the input is fine. Let's fix it up a bit though
- input.replace(num_pos, sub_input.length(), sub_input.toUpper());
-
- return QValidator::Acceptable;
-}
diff --git a/src/citra_qt/util/spinbox.h b/src/citra_qt/util/spinbox.h
deleted file mode 100644
index 2fa1db3a4..000000000
--- a/src/citra_qt/util/spinbox.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-// Copyright 2014 Tony Wasserka
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// * Neither the name of the owner nor the names of its contributors may
-// be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#pragma once
-
-#include <QAbstractSpinBox>
-#include <QtGlobal>
-
-class QVariant;
-
-/**
- * A custom spin box widget with enhanced functionality over Qt's QSpinBox
- */
-class CSpinBox : public QAbstractSpinBox {
- Q_OBJECT
-
-public:
- explicit CSpinBox(QWidget* parent = nullptr);
-
- void stepBy(int steps) override;
- StepEnabled stepEnabled() const override;
-
- void SetValue(qint64 val);
-
- void SetRange(qint64 min, qint64 max);
-
- void SetBase(int base);
-
- void SetPrefix(const QString& prefix);
- void SetSuffix(const QString& suffix);
-
- void SetNumDigits(int num_digits);
-
- QValidator::State validate(QString& input, int& pos) const override;
-
-signals:
- void ValueChanged(qint64 val);
-
-private slots:
- void OnEditingFinished();
-
-private:
- void UpdateText();
-
- bool HasSign() const;
-
- QString TextFromValue();
- qint64 ValueFromText();
-
- qint64 min_value, max_value;
-
- qint64 value;
-
- QString prefix, suffix;
-
- int base;
-
- int num_digits;
-};
diff --git a/src/citra_qt/util/util.cpp b/src/citra_qt/util/util.cpp
deleted file mode 100644
index 02be92bbd..000000000
--- a/src/citra_qt/util/util.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <array>
-#include <cmath>
-#include "citra_qt/util/util.h"
-
-QFont GetMonospaceFont() {
- QFont font("monospace");
- // Automatic fallback to a monospace font on on platforms without a font called "monospace"
- font.setStyleHint(QFont::Monospace);
- font.setFixedPitch(true);
- return font;
-}
-
-QString ReadableByteSize(qulonglong size) {
- static const std::array<const char*, 6> units = {"B", "KiB", "MiB", "GiB", "TiB", "PiB"};
- if (size == 0)
- return "0";
- int digit_groups = std::min<int>(static_cast<int>(std::log10(size) / std::log10(1024)),
- static_cast<int>(units.size()));
- return QString("%L1 %2")
- .arg(size / std::pow(1024, digit_groups), 0, 'f', 1)
- .arg(units[digit_groups]);
-}
diff --git a/src/citra_qt/util/util.h b/src/citra_qt/util/util.h
deleted file mode 100644
index ab443ef9b..000000000
--- a/src/citra_qt/util/util.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2015 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include <QFont>
-#include <QString>
-
-/// Returns a QFont object appropriate to use as a monospace font for debugging widgets, etc.
-QFont GetMonospaceFont();
-
-/// Convert a size in bytes into a readable format (KiB, MiB, etc.)
-QString ReadableByteSize(qulonglong size);