Config: Add scaled resolution option

This commit is contained in:
tfarley 2016-04-16 18:51:49 -04:00
parent 15b44fb380
commit e46d086189
9 changed files with 20 additions and 1 deletions

View file

@ -65,6 +65,7 @@ void Config::ReadValues() {
// Renderer // Renderer
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", false); Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", false);
Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false);
Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0);
Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0); Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0);

View file

@ -46,6 +46,10 @@ use_hw_renderer =
# 0 : Interpreter (slow), 1 (default): JIT (fast) # 0 : Interpreter (slow), 1 (default): JIT (fast)
use_shader_jit = use_shader_jit =
# Whether to use native 3DS screen resolution or to scale rendering resolution to the displayed screen size.
# 0 (default): Native, 1: Scaled
use_scaled_resolution =
# The clear color for the renderer. What shows up on the sides of the bottom screen. # 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. # Must be in range of 0.0-1.0. Defaults to 1.0 for all.
bg_red = bg_red =

View file

@ -45,6 +45,7 @@ void Config::ReadValues() {
qt_config->beginGroup("Renderer"); qt_config->beginGroup("Renderer");
Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", false).toBool(); 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.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool();
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat(); 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_green = qt_config->value("bg_green", 1.0).toFloat();
@ -129,6 +130,7 @@ void Config::SaveValues() {
qt_config->beginGroup("Renderer"); qt_config->beginGroup("Renderer");
qt_config->setValue("use_hw_renderer", Settings::values.use_hw_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("use_shader_jit", Settings::values.use_shader_jit);
qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution);
// Cast to double because Qt's written float values are not human-readable // 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_red", (double)Settings::values.bg_red);

View file

@ -25,6 +25,7 @@ void ConfigureGeneral::setConfiguration() {
ui->region_combobox->setCurrentIndex(Settings::values.region_value); ui->region_combobox->setCurrentIndex(Settings::values.region_value);
ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer); ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit); ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit);
ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution);
} }
void ConfigureGeneral::applyConfiguration() { void ConfigureGeneral::applyConfiguration() {
@ -33,5 +34,6 @@ void ConfigureGeneral::applyConfiguration() {
Settings::values.region_value = ui->region_combobox->currentIndex(); Settings::values.region_value = ui->region_combobox->currentIndex();
Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked(); Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked();
Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked(); Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked();
Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked();
Settings::Apply(); Settings::Apply();
} }

View file

@ -128,6 +128,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="toogle_scaled_resolution">
<property name="text">
<string>Enable scaled resolution</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View file

@ -19,7 +19,7 @@ void Apply() {
VideoCore::g_hw_renderer_enabled = values.use_hw_renderer; VideoCore::g_hw_renderer_enabled = values.use_hw_renderer;
VideoCore::g_shader_jit_enabled = values.use_shader_jit; VideoCore::g_shader_jit_enabled = values.use_shader_jit;
VideoCore::g_scaled_resolution_enabled = values.use_scaled_resolution;
} }
} // namespace } // namespace

View file

@ -55,6 +55,7 @@ struct Values {
// Renderer // Renderer
bool use_hw_renderer; bool use_hw_renderer;
bool use_shader_jit; bool use_shader_jit;
bool use_scaled_resolution;
float bg_red; float bg_red;
float bg_green; float bg_green;

View file

@ -25,6 +25,7 @@ std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
std::atomic<bool> g_hw_renderer_enabled; std::atomic<bool> g_hw_renderer_enabled;
std::atomic<bool> g_shader_jit_enabled; std::atomic<bool> g_shader_jit_enabled;
std::atomic<bool> g_scaled_resolution_enabled;
/// Initialize the video core /// Initialize the video core
bool Init(EmuWindow* emu_window) { bool Init(EmuWindow* emu_window) {

View file

@ -36,6 +36,7 @@ extern EmuWindow* g_emu_window; ///< Emu window
// TODO: Wrap these in a user settings struct along with any other graphics settings (often set from qt ui) // TODO: Wrap these in a user settings struct along with any other graphics settings (often set from qt ui)
extern std::atomic<bool> g_hw_renderer_enabled; extern std::atomic<bool> g_hw_renderer_enabled;
extern std::atomic<bool> g_shader_jit_enabled; extern std::atomic<bool> g_shader_jit_enabled;
extern std::atomic<bool> g_scaled_resolution_enabled;
/// Start the video core /// Start the video core
void Start(); void Start();