Compare commits

...

1 Commits

Author SHA1 Message Date
raven02
8f4ad684d3 Add option aspect ratio 2020-02-14 01:01:29 +08:00
9 changed files with 44 additions and 2 deletions

View File

@@ -27,8 +27,10 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) {
// so just calculate them both even if the other isn't showing.
FramebufferLayout res{width, height};
const float emulation_aspect_ratio{static_cast<float>(ScreenUndocked::Height) /
ScreenUndocked::Width};
const float emulation_aspect_ratio =
Settings::values.aspect_ratio
? static_cast<float>(height) / width
: static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width;
const auto window_aspect_ratio = static_cast<float>(height) / width;
const Common::Rectangle<u32> screen_window_area{0, 0, width, height};

View File

@@ -94,6 +94,7 @@ void LogSettings() {
LogSetting("Renderer_UseAccurateGpuEmulation", Settings::values.use_accurate_gpu_emulation);
LogSetting("Renderer_UseAsynchronousGpuEmulation",
Settings::values.use_asynchronous_gpu_emulation);
LogSetting("Renderer_AspectRatio", Settings::values.aspect_ratio);
LogSetting("Audio_OutputEngine", Settings::values.sink_id);
LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching);
LogSetting("Audio_OutputDevice", Settings::values.audio_device_id);

View File

@@ -429,6 +429,7 @@ struct Values {
int vulkan_device;
float resolution_factor;
int aspect_ratio;
bool use_frame_limit;
u16 frame_limit;
bool use_disk_shader_cache;

View File

@@ -188,6 +188,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) {
Settings::values.use_accurate_gpu_emulation);
AddField(field_type, "Renderer_UseAsynchronousGpuEmulation",
Settings::values.use_asynchronous_gpu_emulation);
AddField(field_type, "Renderer_AspectRatio", Settings::values.aspect_ratio);
AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode);
}

View File

@@ -639,6 +639,7 @@ void Config::ReadRendererValues() {
ReadSetting(QStringLiteral("use_accurate_gpu_emulation"), false).toBool();
Settings::values.use_asynchronous_gpu_emulation =
ReadSetting(QStringLiteral("use_asynchronous_gpu_emulation"), false).toBool();
Settings::values.aspect_ratio = ReadSetting(QStringLiteral("aspect_ratio"), 0).toInt();
Settings::values.force_30fps_mode =
ReadSetting(QStringLiteral("force_30fps_mode"), false).toBool();
@@ -1073,6 +1074,7 @@ void Config::SaveRendererValues() {
Settings::values.use_accurate_gpu_emulation, false);
WriteSetting(QStringLiteral("use_asynchronous_gpu_emulation"),
Settings::values.use_asynchronous_gpu_emulation, false);
WriteSetting(QStringLiteral("aspect_ratio"), static_cast<int>(Settings::values.aspect_ratio));
WriteSetting(QStringLiteral("force_30fps_mode"), Settings::values.force_30fps_mode, false);
// Cast to double because Qt's written float values are not human-readable

View File

@@ -102,6 +102,7 @@ void ConfigureGraphics::SetConfiguration() {
ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation);
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
ui->use_asynchronous_gpu_emulation->setChecked(Settings::values.use_asynchronous_gpu_emulation);
ui->aspect_ratio_combobox->setCurrentIndex(static_cast<int>(Settings::values.aspect_ratio));
ui->force_30fps_mode->setEnabled(runtime_lock);
ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode);
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
@@ -118,6 +119,7 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.use_accurate_gpu_emulation = ui->use_accurate_gpu_emulation->isChecked();
Settings::values.use_asynchronous_gpu_emulation =
ui->use_asynchronous_gpu_emulation->isChecked();
Settings::values.aspect_ratio = static_cast<int>(ui->aspect_ratio_combobox->currentIndex());
Settings::values.force_30fps_mode = ui->force_30fps_mode->isChecked();
Settings::values.bg_red = static_cast<float>(bg_color.redF());
Settings::values.bg_green = static_cast<float>(bg_color.greenF());

View File

@@ -138,6 +138,33 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="ar_label">
<property name="text">
<string>Aspect Ratio:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="aspect_ratio_combobox">
<item>
<property name="text">
<string>Default (16:9)</string>
</property>
</item>
<item>
<property name="text">
<string>Stretch to window</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>

View File

@@ -388,6 +388,8 @@ void Config::ReadValues() {
sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false);
Settings::values.use_asynchronous_gpu_emulation =
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false);
Settings::values.aspect_ratio =
static_cast<int>(sdl2_config->GetReal("Renderer", "aspect_ratio", 0));
Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0));
Settings::values.bg_green =

View File

@@ -146,6 +146,10 @@ use_accurate_gpu_emulation =
# 0 : Off (slow), 1 (default): On (fast)
use_asynchronous_gpu_emulation =
# Whether to stretch to full screen
# 0 (default): default 16:9, 1 : Stretch to window
aspect_ratio =
# 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 =