From 38a4141eef0fdb66cf53179b04442cfaf383ff6a Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 1 Apr 2012 16:12:04 +0200 Subject: [PATCH] Add allow_rotate. --- config.def.h | 4 ++++ dynamic.c | 3 +++ general.h | 1 + settings.c | 2 ++ ssnes.cfg | 5 +++++ 5 files changed, 15 insertions(+) diff --git a/config.def.h b/config.def.h index 54ae55ae89..c774ebbfe5 100644 --- a/config.def.h +++ b/config.def.h @@ -212,6 +212,10 @@ static const float refresh_rate = 59.92; static const float refresh_rate = 59.95; #endif +// Allow games to set rotation. If false, rotation requests are honored, but ignored. +// Used for setups where one manually rotates the monitor. +static const bool allow_rotate = true; + //////////////// // Audio //////////////// diff --git a/dynamic.c b/dynamic.c index 298290a444..c71b03336b 100644 --- a/dynamic.c +++ b/dynamic.c @@ -421,6 +421,9 @@ static bool environment_cb(unsigned cmd, void *data) { unsigned rotation = *(const unsigned*)data; SSNES_LOG("Environ SET_ROTATION: %u\n", rotation); + if (!g_settings.video.allow_rotate) + break; + if (driver.video && driver.video_data && driver.video->set_rotation) video_set_rotation_func(rotation); else diff --git a/general.h b/general.h index f524bdfa5d..f3ae4c325b 100644 --- a/general.h +++ b/general.h @@ -126,6 +126,7 @@ struct settings bool h264_record; bool post_filter_record; + bool allow_rotate; char external_driver[PATH_MAX]; } video; diff --git a/settings.c b/settings.c index 1f3f0434bd..489894aa58 100644 --- a/settings.c +++ b/settings.c @@ -164,6 +164,7 @@ void config_set_defaults(void) g_settings.video.crop_overscan = crop_overscan; g_settings.video.aspect_ratio = -1.0f; // Automatic g_settings.video.shader_type = SSNES_SHADER_AUTO; + g_settings.video.allow_rotate = allow_rotate; #ifdef HAVE_FREETYPE g_settings.video.font_enable = font_enable; @@ -371,6 +372,7 @@ bool config_load_file(const char *path) CONFIG_GET_FLOAT(video.fbo_scale_x, "video_fbo_scale_x"); CONFIG_GET_FLOAT(video.fbo_scale_y, "video_fbo_scale_y"); CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth"); + CONFIG_GET_BOOL(video.allow_rotate, "video_allow_rotate"); #ifdef HAVE_FREETYPE CONFIG_GET_STRING(video.font_path, "video_font_path"); diff --git a/ssnes.cfg b/ssnes.cfg index bed6579de6..f6a3fb99c6 100644 --- a/ssnes.cfg +++ b/ssnes.cfg @@ -117,6 +117,11 @@ # Used to calculate a suitable audio input rate. # video_refresh_rate = 59.95 +# Allows libsnes cores to set rotation modes. +# Setting this to false will honor, but ignore this request. +# This is useful for vertically oriented games where one manually rotates the monitor. +# video_allow_rotate = true + #### Audio # Enable audio.