summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/CMakeLists.txt2
-rw-r--r--src/citra_qt/config.cpp2
-rw-r--r--src/citra_qt/debugger/graphics_vertex_shader.cpp2
-rw-r--r--src/citra_qt/main.cpp103
-rw-r--r--src/citra_qt/main.h8
-rw-r--r--src/citra_qt/main.ui16
6 files changed, 113 insertions, 20 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 47aaeca24..0c0515054 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -71,7 +71,7 @@ if (APPLE)
else()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
endif()
-target_link_libraries(citra-qt core common video_core qhexedit)
+target_link_libraries(citra-qt core video_core common qhexedit)
target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 5716634ee..a20351fb8 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -44,6 +44,7 @@ void Config::ReadValues() {
qt_config->beginGroup("Renderer");
Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", false).toBool();
+ Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
@@ -77,6 +78,7 @@ void Config::SaveValues() {
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);
// Cast to double because Qt's written float values are not human-readable
qt_config->setValue("bg_red", (double)Settings::values.bg_red);
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp
index f42a2f4ce..302e22d7a 100644
--- a/src/citra_qt/debugger/graphics_vertex_shader.cpp
+++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp
@@ -8,7 +8,7 @@
#include <QBoxLayout>
#include <QTreeView>
-#include "video_core/vertex_shader.h"
+#include "video_core/shader/shader_interpreter.h"
#include "graphics_vertex_shader.h"
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 6b030c178..a1a4865bd 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -7,6 +7,7 @@
#include <QtGui>
#include <QDesktopWidget>
#include <QFileDialog>
+#include <QMessageBox>
#include "qhexedit.h"
#include "main.h"
@@ -131,12 +132,25 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer);
SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked());
+ ui.action_Use_Shader_JIT->setChecked(Settings::values.use_shader_jit);
+ SetShaderJITEnabled(ui.action_Use_Shader_JIT->isChecked());
+
ui.action_Single_Window_Mode->setChecked(settings.value("singleWindowMode", true).toBool());
ToggleWindowMode();
ui.actionDisplay_widget_title_bars->setChecked(settings.value("displayTitleBars", true).toBool());
OnDisplayTitleBars(ui.actionDisplay_widget_title_bars->isChecked());
+ // Prepare actions for recent files
+ 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();
+
// Setup connections
connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap()));
@@ -144,6 +158,7 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
connect(ui.action_Use_Hardware_Renderer, SIGNAL(triggered(bool)), this, SLOT(SetHardwareRendererEnabled(bool)));
+ connect(ui.action_Use_Shader_JIT, SIGNAL(triggered(bool)), this, SLOT(SetShaderJITEnabled(bool)));
connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
@@ -209,6 +224,10 @@ void GMainWindow::OnDisplayTitleBars(bool show)
void GMainWindow::BootGame(const std::string& filename) {
LOG_INFO(Frontend, "Citra starting...\n");
+ // Shutdown previous session if the emu thread is still active...
+ if (emu_thread != nullptr)
+ ShutdownGame();
+
// Initialize the core emulation
System::Init(render_window);
@@ -268,18 +287,43 @@ void GMainWindow::ShutdownGame() {
render_window->hide();
}
-void GMainWindow::OnMenuLoadFile()
-{
+void GMainWindow::UpdateRecentFiles() {
+ QSettings settings;
+ QStringList recent_files = settings.value("recentFiles").toStringList();
+
+ unsigned int num_recent_files = std::min(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(recent_files[i]).fileName());
+ actions_recent_files[i]->setText(text);
+ actions_recent_files[i]->setData(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::OnMenuLoadFile() {
QSettings settings;
QString rom_path = settings.value("romsPath", QString()).toString();
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)"));
if (filename.size()) {
settings.setValue("romsPath", QFileInfo(filename).path());
-
- // Shutdown previous session if the emu thread is still active...
- if (emu_thread != nullptr)
- ShutdownGame();
+ // Update recent files list
+ QStringList recent_files = settings.value("recentFiles").toStringList();
+ recent_files.prepend(filename);
+ settings.setValue("recentFiles", recent_files);
+ UpdateRecentFiles(); // Update UI
BootGame(filename.toLatin1().data());
}
@@ -297,8 +341,32 @@ void GMainWindow::OnMenuLoadSymbolMap() {
}
}
-void GMainWindow::OnStartGame()
-{
+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.toLatin1().data());
+ } 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));
+
+ QSettings settings;
+ QStringList recent_files = settings.value("recentFiles").toStringList();
+ recent_files.removeOne(filename);
+ settings.setValue("recentFiles", recent_files);
+
+ action->setVisible(false);
+ // Grey out the recent files menu if the list is empty
+ if (ui.menu_recent_files->isEmpty()) {
+ ui.menu_recent_files->setEnabled(false);
+ }
+ }
+}
+
+void GMainWindow::OnStartGame() {
emu_thread->SetRunning(true);
ui.action_Start->setEnabled(false);
@@ -308,8 +376,7 @@ void GMainWindow::OnStartGame()
ui.action_Stop->setEnabled(true);
}
-void GMainWindow::OnPauseGame()
-{
+void GMainWindow::OnPauseGame() {
emu_thread->SetRunning(false);
ui.action_Start->setEnabled(true);
@@ -321,8 +388,7 @@ void GMainWindow::OnStopGame() {
ShutdownGame();
}
-void GMainWindow::OnOpenHotkeysDialog()
-{
+void GMainWindow::OnOpenHotkeysDialog() {
GHotkeysDialog dialog(this);
dialog.exec();
}
@@ -331,6 +397,10 @@ void GMainWindow::SetHardwareRendererEnabled(bool enabled) {
VideoCore::g_hw_renderer_enabled = enabled;
}
+void GMainWindow::SetShaderJITEnabled(bool enabled) {
+ VideoCore::g_shader_jit_enabled = enabled;
+}
+
void GMainWindow::ToggleWindowMode() {
if (ui.action_Single_Window_Mode->isChecked()) {
// Render in the main window...
@@ -350,13 +420,11 @@ void GMainWindow::ToggleWindowMode() {
}
}
-void GMainWindow::OnConfigure()
-{
+void GMainWindow::OnConfigure() {
//GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this);
}
-void GMainWindow::closeEvent(QCloseEvent* event)
-{
+void GMainWindow::closeEvent(QCloseEvent* event) {
// Save window layout
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra");
settings.setValue("geometry", saveGeometry());
@@ -380,8 +448,7 @@ void GMainWindow::closeEvent(QCloseEvent* event)
#undef main
#endif
-int main(int argc, char* argv[])
-{
+int main(int argc, char* argv[]) {
Log::Filter log_filter(Log::Level::Info);
Log::SetFilter(&log_filter);
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
index 9fe9e0c9c..4b260ae8b 100644
--- a/src/citra_qt/main.h
+++ b/src/citra_qt/main.h
@@ -24,6 +24,8 @@ class GMainWindow : public QMainWindow
{
Q_OBJECT
+ static const int max_recent_files_item = 10; ///< Max number of recently loaded items to keep track
+
// TODO: Make use of this!
enum {
UI_IDLE,
@@ -58,6 +60,8 @@ private:
void BootGame(const std::string& filename);
void ShutdownGame();
+ void UpdateRecentFiles();
+
void closeEvent(QCloseEvent* event) override;
private slots:
@@ -66,10 +70,12 @@ private slots:
void OnStopGame();
void OnMenuLoadFile();
void OnMenuLoadSymbolMap();
+ void OnMenuRecentFile();
void OnOpenHotkeysDialog();
void OnConfigure();
void OnDisplayTitleBars(bool);
void SetHardwareRendererEnabled(bool);
+ void SetShaderJITEnabled(bool);
void ToggleWindowMode();
private:
@@ -85,6 +91,8 @@ private:
CallstackWidget* callstackWidget;
GPUCommandStreamWidget* graphicsWidget;
GPUCommandListWidget* graphicsCommandsWidget;
+
+ QAction* actions_recent_files[max_recent_files_item];
};
#endif // _CITRA_QT_MAIN_HXX_
diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui
index 9a809ee6c..1ba700a3a 100644
--- a/src/citra_qt/main.ui
+++ b/src/citra_qt/main.ui
@@ -52,9 +52,16 @@
<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="action_Load_Symbol_Map"/>
<addaction name="separator"/>
+ <addaction name="menu_recent_files"/>
+ <addaction name="separator"/>
<addaction name="action_Exit"/>
</widget>
<widget class="QMenu" name="menu_Emulation">
@@ -66,6 +73,7 @@
<addaction name="action_Stop"/>
<addaction name="separator"/>
<addaction name="action_Use_Hardware_Renderer"/>
+ <addaction name="action_Use_Shader_JIT"/>
<addaction name="action_Configure"/>
</widget>
<widget class="QMenu" name="menu_View">
@@ -153,6 +161,14 @@
<string>Use Hardware Renderer</string>
</property>
</action>
+ <action name="action_Use_Shader_JIT">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Use Shader JIT</string>
+ </property>
+ </action>
<action name="action_Configure">
<property name="text">
<string>Configure ...</string>