[meta] remove MicroProfile (#185)

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/185
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
crueter 2025-08-06 07:48:11 +02:00
parent dbbe5b3328
commit f1e74f6855
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
76 changed files with 5547 additions and 11468 deletions

View file

@ -160,8 +160,6 @@ add_executable(yuzu
debugger/console.h
debugger/controller.cpp
debugger/controller.h
debugger/profiler.cpp
debugger/profiler.h
debugger/wait_tree.cpp
debugger/wait_tree.h
discord.h

View file

@ -38,7 +38,6 @@
#include <QOpenGLContext>
#endif
#include "common/microprofile.h"
#include "common/polyfill_thread.h"
#include "common/scm_rev.h"
#include "common/settings.h"
@ -73,7 +72,6 @@ EmuThread::~EmuThread() = default;
void EmuThread::run() {
const char* name = "EmuControlThread";
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
auto& gpu = m_system.GPU();
@ -124,10 +122,6 @@ void EmuThread::run() {
// Shutdown the main emulated process
m_system.DetachDebugger();
m_system.ShutdownMainProcess();
#if MICROPROFILE_ENABLED
MicroProfileOnThreadExit();
#endif
}
// Unlock while emitting signals so that the main thread can

View file

@ -1,227 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#if MICROPROFILE_ENABLED
#include <QAction>
#include <QLayout>
#include <QMouseEvent>
#include <QPainter>
#include <QString>
#include <QTimer>
#include "common/common_types.h"
#include "common/microprofile.h"
#include "yuzu/debugger/profiler.h"
#include "yuzu/util/util.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).
#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;
};
MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) {
setObjectName(QStringLiteral("MicroProfile"));
setWindowTitle(tr("&MicroProfile"));
resize(1000, 600);
// Enable the maximize button
setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);
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();
}
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, &QAction::toggled, this, &MicroProfileDialog::setVisible);
}
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);
}
/// 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, &QTimer::timeout, this, qOverload<>(&MicroProfileWidget::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) {
const auto mouse_position = ev->pos();
MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0);
ev->accept();
}
void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) {
const auto mouse_position = ev->pos();
MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0);
MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton);
ev->accept();
}
void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) {
const auto mouse_position = ev->pos();
MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0);
MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton);
ev->accept();
}
void MicroProfileWidget::wheelEvent(QWheelEvent* ev) {
const auto wheel_position = ev->position().toPoint();
MicroProfileMousePosition(wheel_position.x() / x_scale, wheel_position.y() / y_scale,
ev->angleDelta().y() / 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, QString{QLatin1Char{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

View file

@ -1,33 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#if MICROPROFILE_ENABLED
#include <QWidget>
class QAction;
class QHideEvent;
class QShowEvent;
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;
};
#endif

View file

@ -114,7 +114,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "common/logging/backend.h"
#include "common/logging/log.h"
#include "common/memory_detect.h"
#include "common/microprofile.h"
#include "common/scm_rev.h"
#include "common/scope_exit.h"
#ifdef _WIN32
@ -159,7 +158,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/configuration/qt_config.h"
#include "yuzu/debugger/console.h"
#include "yuzu/debugger/controller.h"
#include "yuzu/debugger/profiler.h"
#include "yuzu/debugger/wait_tree.h"
#include "yuzu/discord.h"
#include "yuzu/game_list.h"
@ -1344,17 +1342,6 @@ void GMainWindow::InitializeWidgets() {
void GMainWindow::InitializeDebugWidgets() {
QMenu* debug_menu = ui->menu_View_Debugging;
#if MICROPROFILE_ENABLED
microProfileDialog = new MicroProfileDialog(this);
microProfileDialog->hide();
debug_menu->addAction(microProfileDialog->toggleViewAction());
#else
auto micro_profile_stub = new QAction(tr("MicroProfile (unavailable)"), this);
micro_profile_stub->setEnabled(false);
micro_profile_stub->setChecked(false);
debug_menu->addAction(micro_profile_stub);
#endif
waitTreeWidget = new WaitTreeWidget(*system, this);
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
waitTreeWidget->hide();
@ -1505,10 +1492,6 @@ void GMainWindow::RestoreUIState() {
restoreState(UISettings::values.state);
render_window->setWindowFlags(render_window->windowFlags() & ~Qt::FramelessWindowHint);
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
#if MICROPROFILE_ENABLED
microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
microProfileDialog->setVisible(UISettings::values.microprofile_visible.GetValue());
#endif
game_list->LoadInterfaceLayout();
@ -5109,10 +5092,6 @@ void GMainWindow::UpdateUISettings() {
UISettings::values.renderwindow_geometry = render_window->saveGeometry();
}
UISettings::values.state = saveState();
#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.fullscreen = ui->action_Fullscreen->isChecked();
UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked();
@ -5635,14 +5614,6 @@ int main(int argc, char* argv[]) {
#endif
Common::DetachedTasks detached_tasks;
#if MICROPROFILE_ENABLED
MicroProfileOnThreadCreate("Frontend");
SCOPE_EXIT {
MicroProfileShutdown();
};
#endif
Common::ConfigureNvidiaEnvironmentFlags();
// Init settings params

View file

@ -43,11 +43,7 @@ class GameList;
class GImageInfo;
class GRenderWindow;
class LoadingScreen;
#if MICROPROFILE_ENABLED
class MicroProfileDialog;
#endif
class OverlayDialog;
class ProfilerWidget;
class ControllerDialog;
class QLabel;
class MultiplayerState;
@ -566,10 +562,6 @@ private:
std::unique_ptr<FileSys::ManualContentProvider> provider;
// Debugger panes
ProfilerWidget* profilerWidget;
#if MICROPROFILE_ENABLED
MicroProfileDialog* microProfileDialog;
#endif
WaitTreeWidget* waitTreeWidget;
ControllerDialog* controller_dialog;

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -66,7 +69,6 @@ void SaveWindowState() {
config.setValue(QStringLiteral("state"), values.state);
config.setValue(QStringLiteral("geometryRenderWindow"), values.renderwindow_geometry);
config.setValue(QStringLiteral("gameListHeaderState"), values.gamelist_header_state);
config.setValue(QStringLiteral("microProfileDialogGeometry"), values.microprofile_geometry);
config.sync();
}
@ -89,8 +91,6 @@ void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig) {
config.value(QStringLiteral("geometryRenderWindow")).toByteArray();
values.gamelist_header_state =
config.value(QStringLiteral("gameListHeaderState")).toByteArray();
values.microprofile_geometry =
config.value(QStringLiteral("microProfileDialogGeometry")).toByteArray();
config.endGroup();
config.endGroup();
return;
@ -105,8 +105,6 @@ void RestoreWindowState(std::unique_ptr<QtConfig>& qtConfig) {
config.value(QStringLiteral("geometryRenderWindow")).toByteArray();
values.gamelist_header_state =
config.value(QStringLiteral("gameListHeaderState")).toByteArray();
values.microprofile_geometry =
config.value(QStringLiteral("microProfileDialogGeometry")).toByteArray();
}
} // namespace UISettings

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -92,10 +95,6 @@ struct Values {
QByteArray gamelist_header_state;
QByteArray microprofile_geometry;
Setting<bool> microprofile_visible{linkage, false, "microProfileDialogVisible",
Category::UiLayout};
Setting<bool> single_window_mode{linkage, true, "singleWindowMode", Category::Ui};
Setting<bool> fullscreen{linkage, false, "fullscreen", Category::Ui};
Setting<bool> display_titlebar{linkage, true, "displayTitleBars", Category::Ui};