mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Only one function calls EnumDisplaySettings now
This commit is contained in:
parent
45e075c8fe
commit
5d8666e226
@ -1353,15 +1353,13 @@ void win32_get_video_output_prev(
|
|||||||
unsigned curr_width = 0;
|
unsigned curr_width = 0;
|
||||||
unsigned curr_height = 0;
|
unsigned curr_height = 0;
|
||||||
|
|
||||||
memset(&dm, 0, sizeof(dm));
|
if (win32_get_video_output(&dm, -1, sizeof(dm)))
|
||||||
|
{
|
||||||
|
curr_width = dm.dmPelsWidth;
|
||||||
|
curr_height = dm.dmPelsHeight;
|
||||||
|
}
|
||||||
|
|
||||||
dm.dmSize = sizeof(dm);
|
for (i = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++)
|
||||||
|
|
||||||
win32_get_video_output_size(&curr_width, &curr_height);
|
|
||||||
|
|
||||||
for (i = 0;
|
|
||||||
EnumDisplaySettings(NULL, i, &dm) != 0;
|
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
if ( dm.dmPelsWidth == curr_width
|
if ( dm.dmPelsWidth == curr_width
|
||||||
&& dm.dmPelsHeight == curr_height)
|
&& dm.dmPelsHeight == curr_height)
|
||||||
@ -1458,14 +1456,13 @@ void win32_get_video_output_next(
|
|||||||
unsigned curr_width = 0;
|
unsigned curr_width = 0;
|
||||||
unsigned curr_height = 0;
|
unsigned curr_height = 0;
|
||||||
|
|
||||||
memset(&dm, 0, sizeof(dm));
|
if (win32_get_video_output(&dm, -1, sizeof(dm)))
|
||||||
dm.dmSize = sizeof(dm);
|
{
|
||||||
|
curr_width = dm.dmPelsWidth;
|
||||||
|
curr_height = dm.dmPelsHeight;
|
||||||
|
}
|
||||||
|
|
||||||
win32_get_video_output_size(&curr_width, &curr_height);
|
for (i = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++)
|
||||||
|
|
||||||
for (i = 0;
|
|
||||||
EnumDisplaySettings(NULL, i, &dm) != 0;
|
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
@ -1480,13 +1477,23 @@ void win32_get_video_output_next(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len)
|
||||||
|
{
|
||||||
|
memset(dm, 0, len);
|
||||||
|
dm->dmSize = len;
|
||||||
|
|
||||||
|
if (EnumDisplaySettings(NULL,
|
||||||
|
(mode == -1) ? ENUM_CURRENT_SETTINGS : mode, dm) == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void win32_get_video_output_size(unsigned *width, unsigned *height)
|
void win32_get_video_output_size(unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
memset(&dm, 0, sizeof(dm));
|
|
||||||
dm.dmSize = sizeof(dm);
|
|
||||||
|
|
||||||
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) != 0)
|
if (win32_get_video_output(&dm, -1, sizeof(dm)))
|
||||||
{
|
{
|
||||||
*width = dm.dmPelsWidth;
|
*width = dm.dmPelsWidth;
|
||||||
*height = dm.dmPelsHeight;
|
*height = dm.dmPelsHeight;
|
||||||
|
@ -101,6 +101,8 @@ void win32_check_window(bool *quit,
|
|||||||
void win32_set_window(unsigned *width, unsigned *height,
|
void win32_set_window(unsigned *width, unsigned *height,
|
||||||
bool fullscreen, bool windowed_full, void *rect_data);
|
bool fullscreen, bool windowed_full, void *rect_data);
|
||||||
|
|
||||||
|
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len);
|
||||||
|
|
||||||
void win32_get_video_output_size(
|
void win32_get_video_output_size(
|
||||||
unsigned *width, unsigned *height);
|
unsigned *width, unsigned *height);
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ static bool win32_display_server_set_resolution(void *data,
|
|||||||
if (!serv)
|
if (!serv)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &curDevmode);
|
win32_get_video_output(&curDevmode, -1, sizeof(curDevmode));
|
||||||
|
|
||||||
if (win32_orig_width == 0)
|
if (win32_orig_width == 0)
|
||||||
win32_orig_width = GetSystemMetrics(SM_CXSCREEN);
|
win32_orig_width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
@ -238,7 +238,7 @@ static bool win32_display_server_set_resolution(void *data,
|
|||||||
LONG res;
|
LONG res;
|
||||||
DEVMODE devmode;
|
DEVMODE devmode;
|
||||||
|
|
||||||
if (!EnumDisplaySettings(NULL, iModeNum, &devmode))
|
if (!win32_get_video_output(&devmode, iModeNum, sizeof(devmode)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (devmode.dmPelsWidth != width)
|
if (devmode.dmPelsWidth != width)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user