1
0
Fork 0
forked from suyu/suyu

Make Citra build with MICROPROFILE_ENABLED set to 0 (#1709)

* Make Citra build with MICROPROFILE_ENABLED set to 0

* Buildfix with microprofile kept on

* moc did not like a dialog to conditionally exist.

* Cleanup

* Fix end of line
This commit is contained in:
Henrik Rydgård 2016-04-29 02:17:31 +02:00 committed by bunnei
parent fda578e19d
commit 90501f20e6
5 changed files with 30 additions and 1 deletions

View file

@ -71,7 +71,9 @@ void EmuThread::run() {
// Shutdown the core emulation // Shutdown the core emulation
System::Shutdown(); System::Shutdown();
#if MICROPROFILE_ENABLED
MicroProfileOnThreadExit(); MicroProfileOnThreadExit();
#endif
render_window->moveContext(); render_window->moveContext();
} }

View file

@ -14,8 +14,10 @@
// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the // 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). // non-Qt frontends don't need it (and don't implement the UI drawing hooks either).
#if MICROPROFILE_ENABLED
#define MICROPROFILEUI_IMPL 1 #define MICROPROFILEUI_IMPL 1
#include "common/microprofileui.h" #include "common/microprofileui.h"
#endif
using namespace Common::Profiling; using namespace Common::Profiling;
@ -148,6 +150,8 @@ void ProfilerWidget::setProfilingInfoUpdateEnabled(bool enable)
} }
} }
#if MICROPROFILE_ENABLED
class MicroProfileWidget : public QWidget { class MicroProfileWidget : public QWidget {
public: public:
MicroProfileWidget(QWidget* parent = nullptr); MicroProfileWidget(QWidget* parent = nullptr);
@ -171,6 +175,8 @@ private:
QTimer update_timer; QTimer update_timer;
}; };
#endif
MicroProfileDialog::MicroProfileDialog(QWidget* parent) MicroProfileDialog::MicroProfileDialog(QWidget* parent)
: QWidget(parent, Qt::Dialog) : QWidget(parent, Qt::Dialog)
{ {
@ -180,6 +186,8 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent)
// Remove the "?" button from the titlebar and enable the maximize button // Remove the "?" button from the titlebar and enable the maximize button
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::WindowMaximizeButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::WindowMaximizeButtonHint);
#if MICROPROFILE_ENABLED
MicroProfileWidget* widget = new MicroProfileWidget(this); MicroProfileWidget* widget = new MicroProfileWidget(this);
QLayout* layout = new QVBoxLayout(this); QLayout* layout = new QVBoxLayout(this);
@ -191,6 +199,7 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent)
setFocusProxy(widget); setFocusProxy(widget);
widget->setFocusPolicy(Qt::StrongFocus); widget->setFocusPolicy(Qt::StrongFocus);
widget->setFocus(); widget->setFocus();
#endif
} }
QAction* MicroProfileDialog::toggleViewAction() { QAction* MicroProfileDialog::toggleViewAction() {
@ -218,6 +227,9 @@ void MicroProfileDialog::hideEvent(QHideEvent* ev) {
QWidget::hideEvent(ev); 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 /// 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. /// QPainter available inside the drawing callbacks.
static QPainter* mp_painter = nullptr; static QPainter* mp_painter = nullptr;
@ -337,3 +349,4 @@ void MicroProfileDrawLine2D(u32 vertices_length, float* vertices, u32 hex_color)
mp_painter->drawPolyline(point_buf.data(), vertices_length); mp_painter->drawPolyline(point_buf.data(), vertices_length);
point_buf.clear(); point_buf.clear();
} }
#endif

View file

@ -7,8 +7,10 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QDockWidget> #include <QDockWidget>
#include <QTimer> #include <QTimer>
#include "ui_profiler.h" #include "ui_profiler.h"
#include "common/microprofile.h"
#include "common/profiler_reporting.h" #include "common/profiler_reporting.h"
class ProfilerModel : public QAbstractItemModel class ProfilerModel : public QAbstractItemModel
@ -49,6 +51,7 @@ private:
QTimer update_timer; QTimer update_timer;
}; };
class MicroProfileDialog : public QWidget { class MicroProfileDialog : public QWidget {
Q_OBJECT Q_OBJECT

View file

@ -69,8 +69,10 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr)
addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
profilerWidget->hide(); profilerWidget->hide();
#if MICROPROFILE_ENABLED
microProfileDialog = new MicroProfileDialog(this); microProfileDialog = new MicroProfileDialog(this);
microProfileDialog->hide(); microProfileDialog->hide();
#endif
disasmWidget = new DisassemblerWidget(this, emu_thread.get()); disasmWidget = new DisassemblerWidget(this, emu_thread.get());
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget); addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
@ -110,7 +112,9 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr)
QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
debug_menu->addAction(profilerWidget->toggleViewAction()); debug_menu->addAction(profilerWidget->toggleViewAction());
#if MICROPROFILE_ENABLED
debug_menu->addAction(microProfileDialog->toggleViewAction()); debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif
debug_menu->addAction(disasmWidget->toggleViewAction()); debug_menu->addAction(disasmWidget->toggleViewAction());
debug_menu->addAction(registersWidget->toggleViewAction()); debug_menu->addAction(registersWidget->toggleViewAction());
debug_menu->addAction(callstackWidget->toggleViewAction()); debug_menu->addAction(callstackWidget->toggleViewAction());
@ -136,8 +140,10 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr)
restoreGeometry(UISettings::values.geometry); restoreGeometry(UISettings::values.geometry);
restoreState(UISettings::values.state); restoreState(UISettings::values.state);
render_window->restoreGeometry(UISettings::values.renderwindow_geometry); render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
#if MICROPROFILE_ENABLED
microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry); microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
microProfileDialog->setVisible(UISettings::values.microprofile_visible); microProfileDialog->setVisible(UISettings::values.microprofile_visible);
#endif
game_list->LoadInterfaceLayout(); game_list->LoadInterfaceLayout();
@ -511,9 +517,10 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
UISettings::values.geometry = saveGeometry(); UISettings::values.geometry = saveGeometry();
UISettings::values.state = saveState(); UISettings::values.state = saveState();
UISettings::values.renderwindow_geometry = render_window->saveGeometry(); UISettings::values.renderwindow_geometry = render_window->saveGeometry();
#if MICROPROFILE_ENABLED
UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry(); UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry();
UISettings::values.microprofile_visible = microProfileDialog->isVisible(); UISettings::values.microprofile_visible = microProfileDialog->isVisible();
#endif
UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
UISettings::values.display_titlebar = ui.actionDisplay_widget_title_bars->isChecked(); UISettings::values.display_titlebar = ui.actionDisplay_widget_title_bars->isChecked();
UISettings::values.first_start = false; UISettings::values.first_start = false;

View file

@ -4,6 +4,10 @@
#pragma once #pragma once
// Uncomment this to disable microprofile. This will get you cleaner profiles when using
// external sampling profilers like "Very Sleepy", and will improve performance somewhat.
// #define MICROPROFILE_ENABLED 0
// Customized Citra settings. // Customized Citra settings.
// This file wraps the MicroProfile header so that these are consistent everywhere. // This file wraps the MicroProfile header so that these are consistent everywhere.
#define MICROPROFILE_WEBSERVER 0 #define MICROPROFILE_WEBSERVER 0