(UWP) Push temporary fixes for issue that happens when resizing on UWP
with latest Xbox Series dashboard; DXGIResizeBuffers passing 0, 0 as width/height is apparently problematic as it changes 0, 0 to 8,8 instead, breaking the program
This commit is contained in:
parent
77a17b213d
commit
eb50d7dbb4
|
@ -280,9 +280,6 @@
|
||||||
#define DEFAULT_FULLSCREEN_Y 0
|
#define DEFAULT_FULLSCREEN_Y 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Force 4k resolution */
|
|
||||||
#define DEFAULT_FORCE_RESOLUTION false
|
|
||||||
|
|
||||||
/* Number of threads to use for video recording */
|
/* Number of threads to use for video recording */
|
||||||
#define DEFAULT_VIDEO_RECORD_THREADS 2
|
#define DEFAULT_VIDEO_RECORD_THREADS 2
|
||||||
|
|
||||||
|
|
|
@ -1572,9 +1572,6 @@ static struct config_bool_setting *populate_settings_bool(
|
||||||
SETTING_BOOL("auto_screenshot_filename", &settings->bools.auto_screenshot_filename, true, DEFAULT_AUTO_SCREENSHOT_FILENAME, false);
|
SETTING_BOOL("auto_screenshot_filename", &settings->bools.auto_screenshot_filename, true, DEFAULT_AUTO_SCREENSHOT_FILENAME, false);
|
||||||
SETTING_BOOL("video_force_srgb_disable", &settings->bools.video_force_srgb_disable, true, false, false);
|
SETTING_BOOL("video_force_srgb_disable", &settings->bools.video_force_srgb_disable, true, false, false);
|
||||||
SETTING_BOOL("video_fullscreen", &settings->bools.video_fullscreen, true, DEFAULT_FULLSCREEN, false);
|
SETTING_BOOL("video_fullscreen", &settings->bools.video_fullscreen, true, DEFAULT_FULLSCREEN, false);
|
||||||
#ifdef __WINRT__
|
|
||||||
SETTING_BOOL("video_force_resolution", &settings->bools.video_force_resolution, true, DEFAULT_FORCE_RESOLUTION, false);
|
|
||||||
#endif
|
|
||||||
SETTING_BOOL("bundle_assets_extract_enable", &settings->bools.bundle_assets_extract_enable, true, DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE, false);
|
SETTING_BOOL("bundle_assets_extract_enable", &settings->bools.bundle_assets_extract_enable, true, DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE, false);
|
||||||
SETTING_BOOL("video_vsync", &settings->bools.video_vsync, true, DEFAULT_VSYNC, false);
|
SETTING_BOOL("video_vsync", &settings->bools.video_vsync, true, DEFAULT_VSYNC, false);
|
||||||
SETTING_BOOL("video_adaptive_vsync", &settings->bools.video_adaptive_vsync, true, DEFAULT_ADAPTIVE_VSYNC, false);
|
SETTING_BOOL("video_adaptive_vsync", &settings->bools.video_adaptive_vsync, true, DEFAULT_ADAPTIVE_VSYNC, false);
|
||||||
|
|
|
@ -524,7 +524,6 @@ typedef struct settings
|
||||||
#ifdef HAVE_VIDEO_LAYOUT
|
#ifdef HAVE_VIDEO_LAYOUT
|
||||||
bool video_layout_enable;
|
bool video_layout_enable;
|
||||||
#endif
|
#endif
|
||||||
bool video_force_resolution;
|
|
||||||
|
|
||||||
/* Accessibility */
|
/* Accessibility */
|
||||||
bool accessibility_enable;
|
bool accessibility_enable;
|
||||||
|
|
|
@ -97,6 +97,8 @@ void win32_show_cursor(void *data, bool state);
|
||||||
|
|
||||||
HWND win32_get_window(void);
|
HWND win32_get_window(void);
|
||||||
|
|
||||||
|
bool is_running_on_xbox(void);
|
||||||
|
|
||||||
bool win32_has_focus(void *data);
|
bool win32_has_focus(void *data);
|
||||||
|
|
||||||
void win32_clip_window(bool grab);
|
void win32_clip_window(bool grab);
|
||||||
|
|
|
@ -11017,23 +11017,6 @@ static bool setting_append_list(
|
||||||
general_read_handler);
|
general_read_handler);
|
||||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
|
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
|
||||||
menu_settings_list_current_add_range(list, list_info, 0, 4320, 8, true, true);
|
menu_settings_list_current_add_range(list, list_info, 0, 4320, 8, true, true);
|
||||||
|
|
||||||
CONFIG_BOOL(
|
|
||||||
list, list_info,
|
|
||||||
&settings->bools.video_force_resolution,
|
|
||||||
MENU_ENUM_LABEL_VIDEO_FORCE_RESOLUTION,
|
|
||||||
MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_RESOLUTION,
|
|
||||||
DEFAULT_FORCE_RESOLUTION,
|
|
||||||
MENU_ENUM_LABEL_VALUE_OFF,
|
|
||||||
MENU_ENUM_LABEL_VALUE_ON,
|
|
||||||
&group_info,
|
|
||||||
&subgroup_info,
|
|
||||||
parent_group,
|
|
||||||
general_write_handler,
|
|
||||||
general_read_handler,
|
|
||||||
SD_FLAG_CMD_APPLY_AUTO);
|
|
||||||
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT_FROM_TOGGLE);
|
|
||||||
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DINGUX) && defined(DINGUX_BETA)
|
#if defined(DINGUX) && defined(DINGUX_BETA)
|
||||||
|
|
156
retroarch.c
156
retroarch.c
|
@ -30105,103 +30105,101 @@ static bool video_driver_init_internal(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
#ifdef __WINRT__
|
||||||
bool window_custom_size_enable = settings->bools.video_window_save_positions;
|
if (is_running_on_xbox())
|
||||||
#else
|
|
||||||
bool window_custom_size_enable = settings->bools.video_window_custom_size_enable;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* TODO: remove when the new window resizing core is hooked */
|
|
||||||
if (window_custom_size_enable &&
|
|
||||||
settings->uints.window_position_width &&
|
|
||||||
settings->uints.window_position_height)
|
|
||||||
{
|
{
|
||||||
width = settings->uints.window_position_width;
|
width = settings->uints.video_fullscreen_x != 0 ? settings->uints.video_fullscreen_x : 3840;
|
||||||
height = settings->uints.window_position_height;
|
height = settings->uints.video_fullscreen_y != 0 ? settings->uints.video_fullscreen_y : 2160;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
float video_scale = settings->floats.video_scale;
|
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||||
unsigned max_win_width;
|
bool window_custom_size_enable = settings->bools.video_window_save_positions;
|
||||||
unsigned max_win_height;
|
#else
|
||||||
|
bool window_custom_size_enable = settings->bools.video_window_custom_size_enable;
|
||||||
/* Determine maximum allowed window dimensions
|
#endif
|
||||||
* NOTE: We cannot read the actual display
|
/* TODO: remove when the new window resizing core is hooked */
|
||||||
* metrics here, because the context driver
|
if (window_custom_size_enable &&
|
||||||
* has not yet been initialised... */
|
settings->uints.window_position_width &&
|
||||||
|
settings->uints.window_position_height)
|
||||||
/* > Try explicitly configured values */
|
|
||||||
max_win_width = settings->uints.window_auto_width_max;
|
|
||||||
max_win_height = settings->uints.window_auto_height_max;
|
|
||||||
|
|
||||||
/* > Handle invalid settings */
|
|
||||||
if ((max_win_width == 0) || (max_win_height == 0))
|
|
||||||
{
|
{
|
||||||
/* > Try configured fullscreen width/height */
|
width = settings->uints.window_position_width;
|
||||||
max_win_width = settings->uints.video_fullscreen_x;
|
height = settings->uints.window_position_height;
|
||||||
max_win_height = settings->uints.video_fullscreen_y;
|
|
||||||
|
|
||||||
if ((max_win_width == 0) || (max_win_height == 0))
|
|
||||||
{
|
|
||||||
/* Maximum window width/size *must* be non-zero;
|
|
||||||
* if all else fails, used defined default
|
|
||||||
* maximum window size */
|
|
||||||
max_win_width = DEFAULT_WINDOW_AUTO_WIDTH_MAX;
|
|
||||||
max_win_height = DEFAULT_WINDOW_AUTO_HEIGHT_MAX;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine nominal window size based on
|
|
||||||
* core geometry */
|
|
||||||
if (settings->bools.video_force_aspect)
|
|
||||||
{
|
|
||||||
/* Do rounding here to simplify integer
|
|
||||||
* scale correctness. */
|
|
||||||
unsigned base_width = roundf(geom->base_height *
|
|
||||||
p_rarch->video_driver_aspect_ratio);
|
|
||||||
width = roundf(base_width * video_scale);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
width = roundf(geom->base_width * video_scale);
|
|
||||||
|
|
||||||
height = roundf(geom->base_height * video_scale);
|
|
||||||
|
|
||||||
/* Cap window size to maximum allowed values */
|
|
||||||
if ((width > max_win_width) || (height > max_win_height))
|
|
||||||
{
|
{
|
||||||
unsigned geom_width = (width > 0) ? width : 1;
|
float video_scale = settings->floats.video_scale;
|
||||||
unsigned geom_height = (height > 0) ? height : 1;
|
/* Determine maximum allowed window dimensions
|
||||||
float geom_aspect = (float)geom_width / (float)geom_height;
|
* NOTE: We cannot read the actual display
|
||||||
float max_win_aspect = (float)max_win_width / (float)max_win_height;
|
* metrics here, because the context driver
|
||||||
|
* has not yet been initialised... */
|
||||||
|
|
||||||
if (geom_aspect > max_win_aspect)
|
/* > Try explicitly configured values */
|
||||||
|
unsigned max_win_width = settings->uints.window_auto_width_max;
|
||||||
|
unsigned max_win_height = settings->uints.window_auto_height_max;
|
||||||
|
|
||||||
|
/* > Handle invalid settings */
|
||||||
|
if ((max_win_width == 0) || (max_win_height == 0))
|
||||||
{
|
{
|
||||||
width = max_win_width;
|
/* > Try configured fullscreen width/height */
|
||||||
height = geom_height * max_win_width / geom_width;
|
max_win_width = settings->uints.video_fullscreen_x;
|
||||||
/* Account for any possible rounding errors... */
|
max_win_height = settings->uints.video_fullscreen_y;
|
||||||
height = (height < 1) ? 1 : height;
|
|
||||||
height = (height > max_win_height) ? max_win_height : height;
|
if ((max_win_width == 0) || (max_win_height == 0))
|
||||||
|
{
|
||||||
|
/* Maximum window width/size *must* be non-zero;
|
||||||
|
* if all else fails, used defined default
|
||||||
|
* maximum window size */
|
||||||
|
max_win_width = DEFAULT_WINDOW_AUTO_WIDTH_MAX;
|
||||||
|
max_win_height = DEFAULT_WINDOW_AUTO_HEIGHT_MAX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine nominal window size based on
|
||||||
|
* core geometry */
|
||||||
|
if (settings->bools.video_force_aspect)
|
||||||
|
{
|
||||||
|
/* Do rounding here to simplify integer
|
||||||
|
* scale correctness. */
|
||||||
|
unsigned base_width = roundf(geom->base_height *
|
||||||
|
p_rarch->video_driver_aspect_ratio);
|
||||||
|
width = roundf(base_width * video_scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
width = roundf(geom->base_width * video_scale);
|
||||||
|
|
||||||
|
height = roundf(geom->base_height * video_scale);
|
||||||
|
|
||||||
|
/* Cap window size to maximum allowed values */
|
||||||
|
if ((width > max_win_width) || (height > max_win_height))
|
||||||
{
|
{
|
||||||
height = max_win_height;
|
unsigned geom_width = (width > 0) ? width : 1;
|
||||||
width = geom_width * max_win_height / geom_height;
|
unsigned geom_height = (height > 0) ? height : 1;
|
||||||
/* Account for any possible rounding errors... */
|
float geom_aspect = (float)geom_width / (float)geom_height;
|
||||||
width = (width < 1) ? 1 : width;
|
float max_win_aspect = (float)max_win_width / (float)max_win_height;
|
||||||
width = (width > max_win_width) ? max_win_width : width;
|
|
||||||
|
if (geom_aspect > max_win_aspect)
|
||||||
|
{
|
||||||
|
width = max_win_width;
|
||||||
|
height = geom_height * max_win_width / geom_width;
|
||||||
|
/* Account for any possible rounding errors... */
|
||||||
|
height = (height < 1) ? 1 : height;
|
||||||
|
height = (height > max_win_height) ? max_win_height : height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
height = max_win_height;
|
||||||
|
width = geom_width * max_win_height / geom_height;
|
||||||
|
/* Account for any possible rounding errors... */
|
||||||
|
width = (width < 1) ? 1 : width;
|
||||||
|
width = (width > max_win_width) ? max_win_width : width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WINRT__
|
|
||||||
if (settings->bools.video_force_resolution)
|
|
||||||
{
|
|
||||||
width = settings->uints.video_fullscreen_x != 0 ? settings->uints.video_fullscreen_x : 3840;
|
|
||||||
height = settings->uints.video_fullscreen_y != 0 ? settings->uints.video_fullscreen_y : 2160;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (width && height)
|
if (width && height)
|
||||||
RARCH_LOG("[Video]: Video @ %ux%u\n", width, height);
|
RARCH_LOG("[Video]: Video @ %ux%u\n", width, height);
|
||||||
else
|
else
|
||||||
|
|
|
@ -558,6 +558,8 @@ void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
|
||||||
|
|
||||||
/* DisplayInformation event handlers. */
|
/* DisplayInformation event handlers. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void App::OnDpiChanged(DisplayInformation^ sender, Object^ args)
|
void App::OnDpiChanged(DisplayInformation^ sender, Object^ args)
|
||||||
{
|
{
|
||||||
m_windowResized = true;
|
m_windowResized = true;
|
||||||
|
@ -587,6 +589,12 @@ void App::OnPackageInstalling(PackageCatalog^ sender, PackageInstallingEventArgs
|
||||||
/* Implement UWP equivalents of various win32_* functions */
|
/* Implement UWP equivalents of various win32_* functions */
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
bool is_running_on_xbox(void)
|
||||||
|
{
|
||||||
|
Platform::String^ device_family = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily;
|
||||||
|
return (device_family == L"Windows.Xbox");
|
||||||
|
}
|
||||||
|
|
||||||
bool win32_has_focus(void *data)
|
bool win32_has_focus(void *data)
|
||||||
{
|
{
|
||||||
return App::GetInstance()->IsWindowFocused();
|
return App::GetInstance()->IsWindowFocused();
|
||||||
|
@ -668,12 +676,13 @@ extern "C" {
|
||||||
void win32_check_window(void *data,
|
void win32_check_window(void *data,
|
||||||
bool *quit, bool *resize, unsigned *width, unsigned *height)
|
bool *quit, bool *resize, unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
*quit = App::GetInstance()->IsWindowClosed();
|
static bool is_xbox = is_running_on_xbox();
|
||||||
settings_t* settings = config_get_ptr();
|
*quit = App::GetInstance()->IsWindowClosed();
|
||||||
if (settings->bools.video_force_resolution)
|
if (is_xbox)
|
||||||
{
|
{
|
||||||
*width = settings->uints.video_fullscreen_x != 0 ? settings->uints.video_fullscreen_x : 3840;
|
settings_t* settings = config_get_ptr();
|
||||||
*height = settings->uints.video_fullscreen_y != 0 ? settings->uints.video_fullscreen_y : 2160;
|
*width = settings->uints.video_fullscreen_x != 0 ? settings->uints.video_fullscreen_x : 3840;
|
||||||
|
*height = settings->uints.video_fullscreen_y != 0 ? settings->uints.video_fullscreen_y : 2160;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue