summaryrefslogtreecommitdiffstats
path: root/src/citra
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/citra/citra.cpp4
-rw-r--r--src/citra/config.cpp2
-rw-r--r--src/citra/default_ini.h4
-rw-r--r--src/citra_qt/bootmanager.cpp4
-rw-r--r--src/citra_qt/config.cpp4
-rw-r--r--src/citra_qt/main.cpp10
-rw-r--r--src/citra_qt/main.h1
-rw-r--r--src/citra_qt/main.ui9
8 files changed, 36 insertions, 2 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index ca93d5b91..ce8d7dd25 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -18,6 +18,8 @@
#include "citra/config.h"
#include "citra/emu_window/emu_window_glfw.h"
+#include "video_core/video_core.h"
+
/// Application entry point
int main(int argc, char **argv) {
Log::Filter log_filter(Log::Level::Debug);
@@ -34,6 +36,8 @@ int main(int argc, char **argv) {
std::string boot_filename = argv[1];
EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
+ VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer;
+
System::Init(emu_window);
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index ab564559d..846479fd7 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -70,6 +70,8 @@ void Config::ReadValues() {
Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0);
// Renderer
+ Settings::values.use_hw_renderer = glfw_config->GetBoolean("Renderer", "use_hw_renderer", false);
+
Settings::values.bg_red = (float)glfw_config->GetReal("Renderer", "bg_red", 1.0);
Settings::values.bg_green = (float)glfw_config->GetReal("Renderer", "bg_green", 1.0);
Settings::values.bg_blue = (float)glfw_config->GetReal("Renderer", "bg_blue", 1.0);
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index 1dd971926..fd5a90d56 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -42,6 +42,10 @@ gpu_refresh_rate =
frame_skip =
[Renderer]
+# Whether to use software or hardware rendering.
+# 0 (default): Software, 1: Hardware
+use_hw_renderer =
+
# The clear color for the renderer. What shows up on the sides of the bottom screen.
# Must be in range of 0.0-1.0. Defaults to 1.0 for all.
bg_red =
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index ab9403007..ea46bb1da 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -28,11 +28,11 @@
EmuThread::EmuThread(GRenderWindow* render_window) :
exec_step(false), running(false), stop_run(false), render_window(render_window) {
-
- connect(this, SIGNAL(started()), render_window, SLOT(moveContext()));
}
void EmuThread::run() {
+ render_window->MakeCurrent();
+
stop_run = false;
// holds whether the cpu was running during the last iteration,
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index fb85121b3..460f4ec07 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -54,6 +54,8 @@ void Config::ReadValues() {
qt_config->endGroup();
qt_config->beginGroup("Renderer");
+ Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", false).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();
Settings::values.bg_blue = qt_config->value("bg_blue", 1.0).toFloat();
@@ -105,6 +107,8 @@ void Config::SaveValues() {
qt_config->endGroup();
qt_config->beginGroup("Renderer");
+ qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
+
// 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);
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 24506deab..f6010459a 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -44,6 +44,8 @@
#include "core/arm/disassembler/load_symbol_map.h"
#include "citra_qt/config.h"
+#include "video_core/video_core.h"
+
#include "version.h"
GMainWindow::GMainWindow() : emu_thread(nullptr)
@@ -123,6 +125,9 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
restoreState(settings.value("state").toByteArray());
render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
+ ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer);
+ SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked());
+
ui.action_Single_Window_Mode->setChecked(settings.value("singleWindowMode", true).toBool());
ToggleWindowMode();
@@ -135,6 +140,7 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
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_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
@@ -210,6 +216,7 @@ void GMainWindow::BootGame(std::string filename) {
// Create and start the emulation thread
emu_thread = Common::make_unique<EmuThread>(render_window);
emit EmulationStarting(emu_thread.get());
+ render_window->moveContext();
emu_thread->start();
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
@@ -300,6 +307,9 @@ void GMainWindow::OnOpenHotkeysDialog()
dialog.exec();
}
+void GMainWindow::SetHardwareRendererEnabled(bool enabled) {
+ VideoCore::g_hw_renderer_enabled = enabled;
+}
void GMainWindow::ToggleWindowMode() {
if (ui.action_Single_Window_Mode->isChecked()) {
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
index 3e29534fb..242b08c39 100644
--- a/src/citra_qt/main.h
+++ b/src/citra_qt/main.h
@@ -69,6 +69,7 @@ private slots:
void OnOpenHotkeysDialog();
void OnConfigure();
void OnDisplayTitleBars(bool);
+ void SetHardwareRendererEnabled(bool);
void ToggleWindowMode();
private:
diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui
index 689806465..0942c28c8 100644
--- a/src/citra_qt/main.ui
+++ b/src/citra_qt/main.ui
@@ -52,6 +52,7 @@
<addaction name="action_Pause"/>
<addaction name="action_Stop"/>
<addaction name="separator"/>
+ <addaction name="action_Use_Hardware_Renderer"/>
<addaction name="action_Configure"/>
</widget>
<widget class="QMenu" name="menu_View">
@@ -131,6 +132,14 @@
<string>Configure &amp;Hotkeys ...</string>
</property>
</action>
+ <action name="action_Use_Hardware_Renderer">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Use Hardware Renderer</string>
+ </property>
+ </action>
<action name="action_Configure">
<property name="text">
<string>Configure ...</string>