mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Add video_rotation.
Replaces g_extern.console.screen.orientation. Rotation semantics have slightly changed to be more composable. The rotation is now video_rotation + rotation set by cores themselves (if allowed). The config is now also saved properly.
This commit is contained in:
parent
086caef070
commit
841d8fa8e1
4
driver.c
4
driver.c
@ -1003,8 +1003,8 @@ void init_video_input(void)
|
||||
if (driver.video->poke_interface)
|
||||
driver.video->poke_interface(driver.video_data, &driver.video_poke);
|
||||
|
||||
if (driver.video->set_rotation && g_extern.system.rotation)
|
||||
video_set_rotation_func(g_extern.system.rotation);
|
||||
if (driver.video->set_rotation)
|
||||
video_set_rotation_func((g_settings.video.rotation + g_extern.system.rotation) % 4);
|
||||
|
||||
if (driver.video_poke && driver.video_poke->set_aspect_ratio &&
|
||||
g_settings.video.aspect_ratio_idx != ASPECT_RATIO_CONFIG)
|
||||
|
@ -596,7 +596,7 @@ static void render_text(rgui_handle_t *rgui)
|
||||
switch (type)
|
||||
{
|
||||
case RGUI_SETTINGS_VIDEO_ROTATION:
|
||||
strlcpy(type_str, rotation_lut[g_extern.console.screen.orientation],
|
||||
strlcpy(type_str, rotation_lut[g_settings.video.rotation],
|
||||
sizeof(type_str));
|
||||
break;
|
||||
case RGUI_SETTINGS_VIDEO_SOFT_FILTER:
|
||||
@ -1812,18 +1812,18 @@ static int video_option_toggle_setting(rgui_handle_t *rgui, unsigned setting, rg
|
||||
case RGUI_SETTINGS_VIDEO_ROTATION:
|
||||
if (action == RGUI_ACTION_START)
|
||||
{
|
||||
settings_set(1ULL << S_DEF_AUDIO_CONTROL_RATE);
|
||||
video_set_rotation_func(g_extern.console.screen.orientation);
|
||||
settings_set(1ULL << S_DEF_ROTATION);
|
||||
video_set_rotation_func((g_settings.video.rotation + g_extern.system.rotation) % 4);
|
||||
}
|
||||
else if (action == RGUI_ACTION_LEFT)
|
||||
{
|
||||
settings_set(1ULL << S_ROTATION_DECREMENT);
|
||||
video_set_rotation_func(g_extern.console.screen.orientation);
|
||||
video_set_rotation_func((g_settings.video.rotation + g_extern.system.rotation) % 4);
|
||||
}
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
{
|
||||
settings_set(1ULL << S_ROTATION_INCREMENT);
|
||||
video_set_rotation_func(g_extern.console.screen.orientation);
|
||||
video_set_rotation_func((g_settings.video.rotation + g_extern.system.rotation) % 4);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1365,19 +1365,19 @@ static int set_setting_action(uint8_t menu_type, unsigned switchvalue, uint64_t
|
||||
if (input & (1ULL << DEVICE_NAV_LEFT))
|
||||
{
|
||||
settings_set(1ULL << S_ROTATION_DECREMENT);
|
||||
video_set_rotation_func(g_extern.console.screen.orientation);
|
||||
video_set_rotation_func((g_extern.system.rotation + g_settings.video.rotation) % 4);
|
||||
}
|
||||
|
||||
if ((input & (1ULL << DEVICE_NAV_RIGHT)) || (input & (1ULL << DEVICE_NAV_B)))
|
||||
{
|
||||
settings_set(1ULL << S_ROTATION_INCREMENT);
|
||||
video_set_rotation_func(g_extern.console.screen.orientation);
|
||||
video_set_rotation_func((g_extern.system.rotation + g_settings.video.rotation) % 4);
|
||||
}
|
||||
|
||||
if (input & (1ULL << DEVICE_NAV_START))
|
||||
{
|
||||
settings_set(1ULL << S_DEF_ROTATION);
|
||||
video_set_rotation_func(g_extern.console.screen.orientation);
|
||||
video_set_rotation_func((g_extern.system.rotation + g_settings.video.rotation) % 4);
|
||||
}
|
||||
break;
|
||||
case INGAME_MENU_FRAME_ADVANCE:
|
||||
@ -1998,7 +1998,7 @@ static int select_setting(void *data, uint64_t input)
|
||||
break;
|
||||
case SETTING_ROTATION:
|
||||
strlcpy(text, "Rotation", sizeof(text));
|
||||
strlcpy(setting_text, rotation_lut[g_extern.console.screen.orientation], sizeof(setting_text));
|
||||
strlcpy(setting_text, rotation_lut[g_settings.video.rotation], sizeof(setting_text));
|
||||
strlcpy(comment, "Change orientation of the screen.", sizeof(comment));
|
||||
break;
|
||||
case SETTING_CUSTOM_VIEWPORT:
|
||||
|
@ -169,6 +169,7 @@ struct settings
|
||||
bool aspect_ratio_auto;
|
||||
bool scale_integer;
|
||||
unsigned aspect_ratio_idx;
|
||||
unsigned rotation;
|
||||
|
||||
char shader_path[PATH_MAX];
|
||||
bool shader_enable;
|
||||
@ -586,7 +587,6 @@ struct global
|
||||
rarch_viewport_t custom_vp;
|
||||
} viewports;
|
||||
|
||||
unsigned orientation;
|
||||
unsigned gamma_correction;
|
||||
unsigned char flicker_filter_index;
|
||||
unsigned char soft_filter_index;
|
||||
|
@ -166,6 +166,11 @@
|
||||
# This is useful for vertically oriented games where one manually rotates the monitor.
|
||||
# video_allow_rotate = true
|
||||
|
||||
# Forces a certain rotation of the screen.
|
||||
# The rotation is added to rotations which the libretro core sets (see video_allow_rotate).
|
||||
# The angle is <value> * 90 degrees counter-clockwise.
|
||||
# video_rotation = 0
|
||||
|
||||
#### Audio
|
||||
|
||||
# Enable audio.
|
||||
|
18
settings.c
18
settings.c
@ -199,6 +199,7 @@ void config_set_defaults(void)
|
||||
g_settings.video.post_filter_record = post_filter_record;
|
||||
g_settings.video.gpu_record = gpu_record;
|
||||
g_settings.video.gpu_screenshot = gpu_screenshot;
|
||||
g_settings.video.rotation = ORIENTATION_NORMAL;
|
||||
|
||||
g_settings.audio.enable = audio_enable;
|
||||
g_settings.audio.out_rate = out_rate;
|
||||
@ -291,7 +292,6 @@ void config_set_defaults(void)
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE);
|
||||
|
||||
g_extern.console.screen.orientation = ORIENTATION_NORMAL;
|
||||
g_extern.console.screen.resolutions.current.id = 0;
|
||||
strlcpy(g_extern.savestate_dir, default_paths.savestate_dir, sizeof(g_extern.savestate_dir));
|
||||
#ifdef HAVE_RMENU
|
||||
@ -526,6 +526,7 @@ bool config_load_file(const char *path)
|
||||
CONFIG_GET_BOOL(video.font_scale, "video_font_scale");
|
||||
CONFIG_GET_FLOAT(video.msg_pos_x, "video_message_pos_x");
|
||||
CONFIG_GET_FLOAT(video.msg_pos_y, "video_message_pos_y");
|
||||
CONFIG_GET_INT(video.rotation, "video_rotation");
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
/* TODO - will be refactored later to make it more clean - it's more
|
||||
@ -601,7 +602,6 @@ bool config_load_file(const char *path)
|
||||
CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id");
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
|
||||
CONFIG_GET_INT_EXTERN(console.screen.orientation, "screen_orientation");
|
||||
CONFIG_GET_INT_EXTERN(console.sound.mode, "sound_mode");
|
||||
#endif
|
||||
|
||||
@ -1007,6 +1007,7 @@ bool config_save_file(const char *path)
|
||||
config_set_bool(conf, "video_black_frame_insertion", g_settings.video.black_frame_insertion);
|
||||
config_set_int(conf, "video_swap_interval", g_settings.video.swap_interval);
|
||||
config_set_bool(conf, "video_gpu_screenshot", g_settings.video.gpu_screenshot);
|
||||
config_set_int(conf, "video_rotation", g_settings.video.rotation);
|
||||
config_set_string(conf, "screenshot_directory", *g_settings.screenshot_directory ? g_settings.screenshot_directory : "default");
|
||||
config_set_int(conf, "aspect_ratio_index", g_settings.video.aspect_ratio_idx);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
@ -1100,7 +1101,6 @@ bool config_save_file(const char *path)
|
||||
config_set_int(conf, "sound_mode", g_extern.console.sound.mode);
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
config_set_int(conf, "screen_orientation", g_extern.console.screen.orientation);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE))
|
||||
config_set_bool(conf, "custom_bgm_enable", true);
|
||||
@ -1276,14 +1276,14 @@ void settings_set(uint64_t settings)
|
||||
|
||||
if (settings & (1ULL << S_ROTATION_DECREMENT))
|
||||
{
|
||||
if(g_extern.console.screen.orientation > 0)
|
||||
g_extern.console.screen.orientation--;
|
||||
if (g_settings.video.rotation > 0)
|
||||
g_settings.video.rotation--;
|
||||
}
|
||||
|
||||
if (settings & (1ULL << S_ROTATION_INCREMENT))
|
||||
{
|
||||
if(g_extern.console.screen.orientation < LAST_ORIENTATION)
|
||||
g_extern.console.screen.orientation++;
|
||||
if (g_settings.video.rotation < LAST_ORIENTATION)
|
||||
g_settings.video.rotation++;
|
||||
}
|
||||
|
||||
if (settings & (1ULL << S_REWIND))
|
||||
@ -1291,7 +1291,7 @@ void settings_set(uint64_t settings)
|
||||
|
||||
if (settings & (1ULL << S_SAVESTATE_DECREMENT))
|
||||
{
|
||||
if(g_extern.state_slot != 0)
|
||||
if (g_extern.state_slot != 0)
|
||||
g_extern.state_slot--;
|
||||
}
|
||||
|
||||
@ -1347,7 +1347,7 @@ void settings_set(uint64_t settings)
|
||||
g_settings.video.smooth = video_smooth;
|
||||
|
||||
if (settings & (1ULL << S_DEF_ROTATION))
|
||||
g_extern.console.screen.orientation = ORIENTATION_NORMAL;
|
||||
g_settings.video.rotation = ORIENTATION_NORMAL;
|
||||
|
||||
if (settings & (1ULL << S_DEF_TRIPLE_BUFFERING))
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user