diff --git a/config.def.h b/config.def.h index fec65fdee6..514b486ef9 100644 --- a/config.def.h +++ b/config.def.h @@ -280,6 +280,12 @@ #define DEFAULT_FULLSCREEN_Y 0 #endif +#if defined(HAVE_WINDOW_OFFSET) +/* Screen offsets to center content in CTRs */ +#define DEFAULT_WINDOW_OFFSET_X 0 +#define DEFAULT_WINDOW_OFFSET_Y 0 +#endif + /* Number of threads to use for video recording */ #define DEFAULT_VIDEO_RECORD_THREADS 2 diff --git a/configuration.c b/configuration.c index a791b3c2e4..c3fadc4136 100644 --- a/configuration.c +++ b/configuration.c @@ -2327,6 +2327,10 @@ static struct config_int_setting *populate_settings_int( #endif #ifdef HAVE_D3D12 SETTING_INT("d3d12_gpu_index", &settings->ints.d3d12_gpu_index, true, DEFAULT_D3D12_GPU_INDEX, false); +#endif +#ifdef HAVE_WINDOW_OFFSET + SETTING_INT("video_window_offset_x", &settings->ints.video_window_offset_x, true, DEFAULT_WINDOW_OFFSET_X, false); + SETTING_INT("video_window_offset_y", &settings->ints.video_window_offset_y, true, DEFAULT_WINDOW_OFFSET_Y, false); #endif SETTING_INT("content_favorites_size", &settings->ints.content_favorites_size, true, default_content_favorites_size, false); diff --git a/configuration.h b/configuration.h index 37a2c7ae70..002318b724 100644 --- a/configuration.h +++ b/configuration.h @@ -140,6 +140,10 @@ typedef struct settings #endif #ifdef HAVE_D3D12 int d3d12_gpu_index; +#endif +#ifdef HAVE_WINDOW_OFFSET + int video_window_offset_x; + int video_window_offset_y; #endif int content_favorites_size; } ints; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index fc8e578700..75e35a287b 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -3316,6 +3316,14 @@ MSG_HASH( MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX, "video_monitor_index" ) +MSG_HASH( + MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_X, + "video_window_offset_x" + ) +MSG_HASH( + MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_Y, + "video_window_offset_y" + ) MSG_HASH( MENU_ENUM_LABEL_VIDEO_POST_FILTER_RECORD, "video_post_filter_record" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index c370df7810..afc901aa2a 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1514,6 +1514,22 @@ MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_INDEX, "Select which graphics card to use." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OFFSET_X, + "Screen Horizontal Offset" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_OFFSET_X, + "Forces a certain offset horizontally to the video. The offset is applied globaly." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OFFSET_Y, + "Screen Vertical Offset" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_OFFSET_Y, + "Forces a certain offset vertically to the video. The offset is applied globaly." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, "Vertical Refresh Rate" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index fd4e103e6b..de3f8bebcd 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -935,6 +935,11 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_overscan_correction_top, ME DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_overscan_correction_bottom, MENU_ENUM_SUBLABEL_VIDEO_OVERSCAN_CORRECTION_BOTTOM) #endif +#if defined(HAVE_WINDOW_OFFSET) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_offset_x, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_OFFSET_X) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_offset_y, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_OFFSET_Y) +#endif + DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_sublabels, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_SUBLABELS) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_entry_idx, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_ENTRY_IDX) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_border_filler_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BORDER_FILLER_ENABLE) @@ -3763,6 +3768,14 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_monitor_index); break; +#if defined(HAVE_WINDOW_OFFSET) + case MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_X: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_offset_x); + break; + case MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_Y: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_offset_y); + break; +#endif case MENU_ENUM_LABEL_LOG_VERBOSITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_log_verbosity); break; @@ -4241,6 +4254,14 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_OVERSCAN_CORRECTION_BOTTOM: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_overscan_correction_bottom); break; +#endif +#if defined(HAVE_WINDOW_OFFSET) + case MENU_ENUM_SUBLABEL_VIDEO_WINDOW_OFFSET_X: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_offset_x); + break; + case MENU_ENUM_SUBLABEL_VIDEO_WINDOW_OFFSET_Y: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_window_offset_y); + break; #endif case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_LOAD: #ifdef HAVE_CHEATS diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 2452028c13..17025f3a02 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7904,7 +7904,17 @@ unsigned menu_displaylist_build_list( PARSE_ACTION, false) == 0) count++; } +#if defined(HAVE_WINDOW_OFFSET) + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_X, + PARSE_ONLY_INT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_Y, + PARSE_ONLY_INT, false) == 0) + count++; +#endif if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, MENU_ENUM_LABEL_PAL60_ENABLE, PARSE_ONLY_BOOL, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index bed125c2b1..8f21b64dab 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -11405,6 +11405,34 @@ static bool setting_append_list( parent_group); } +#if defined(HAVE_WINDOW_OFFSET) + CONFIG_INT( + list, list_info, + &settings->ints.video_window_offset_x, + MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_X, + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OFFSET_X, + DEFAULT_WINDOW_OFFSET_X, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, -24, 24, 1, true, true); + + CONFIG_INT( + list, list_info, + &settings->ints.video_window_offset_y, + MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_Y, + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OFFSET_Y, + DEFAULT_WINDOW_OFFSET_Y, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, -24, 24, 1, true, true); +#endif + CONFIG_UINT( list, list_info, &custom_vp->width, diff --git a/msg_hash.h b/msg_hash.h index 8e59f4c935..cd6405a7f6 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1088,6 +1088,8 @@ enum msg_hash_enums MENU_LABEL(VIDEO_FULLSCREEN), MENU_LABEL(VIDEO_MONITOR_INDEX), MENU_LABEL(VIDEO_WINDOW_SCALE), + MENU_LABEL(VIDEO_WINDOW_OFFSET_X), + MENU_LABEL(VIDEO_WINDOW_OFFSET_Y), MENU_LABEL(VIDEO_REFRESH_RATE), MENU_LABEL(VIDEO_REFRESH_RATE_AUTO), MENU_LABEL(VIDEO_REFRESH_RATE_POLLED),