mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 05:54:16 +00:00
Merge pull request #10887 from hhromic/improv-menu-res
(Win32/DispServer) Improve screen resolution menu
This commit is contained in:
commit
3b855cb278
@ -222,64 +222,70 @@ static bool win32_display_server_set_window_decorations(void *data, bool on)
|
|||||||
static bool win32_display_server_set_resolution(void *data,
|
static bool win32_display_server_set_resolution(void *data,
|
||||||
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset)
|
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index, int xoffset)
|
||||||
{
|
{
|
||||||
DEVMODE curDevmode;
|
DEVMODE dm = {0};
|
||||||
int iModeNum;
|
LONG res = 0;
|
||||||
int freq = int_hz;
|
unsigned i = 0;
|
||||||
int depth = 0;
|
unsigned curr_bpp = 0;
|
||||||
dispserv_win32_t *serv = (dispserv_win32_t*)data;
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
unsigned curr_orientation = 0;
|
||||||
|
#endif
|
||||||
|
dispserv_win32_t *serv = (dispserv_win32_t*)data;
|
||||||
|
|
||||||
if (!serv)
|
if (!serv)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
win32_get_video_output(&curDevmode, -1, sizeof(curDevmode));
|
win32_get_video_output(&dm, -1, sizeof(dm));
|
||||||
|
|
||||||
if (serv->orig_width == 0)
|
if (serv->orig_width == 0)
|
||||||
serv->orig_width = GetSystemMetrics(SM_CXSCREEN);
|
serv->orig_width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
serv->orig_refresh = curDevmode.dmDisplayFrequency;
|
|
||||||
if (serv->orig_height == 0)
|
if (serv->orig_height == 0)
|
||||||
serv->orig_height = GetSystemMetrics(SM_CYSCREEN);
|
serv->orig_height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
serv->orig_refresh = dm.dmDisplayFrequency;
|
||||||
|
|
||||||
/* Used to stop super resolution bug */
|
/* Used to stop super resolution bug */
|
||||||
if (width == curDevmode.dmPelsWidth)
|
if (width == dm.dmPelsWidth)
|
||||||
width = 0;
|
width = 0;
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
width = curDevmode.dmPelsWidth;
|
width = dm.dmPelsWidth;
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
height = curDevmode.dmPelsHeight;
|
height = dm.dmPelsHeight;
|
||||||
if (depth == 0)
|
if (curr_bpp == 0)
|
||||||
depth = curDevmode.dmBitsPerPel;
|
curr_bpp = dm.dmBitsPerPel;
|
||||||
if (freq == 0)
|
if (int_hz == 0)
|
||||||
freq = curDevmode.dmDisplayFrequency;
|
int_hz = dm.dmDisplayFrequency;
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
if (curr_orientation == 0)
|
||||||
|
curr_orientation = dm.dmDisplayOrientation;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (iModeNum = 0;; iModeNum++)
|
for (i = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++)
|
||||||
{
|
{
|
||||||
LONG res;
|
if (dm.dmPelsWidth != width)
|
||||||
DEVMODE devmode;
|
|
||||||
|
|
||||||
if (!win32_get_video_output(&devmode, iModeNum, sizeof(devmode)))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (devmode.dmPelsWidth != width)
|
|
||||||
continue;
|
continue;
|
||||||
|
if (dm.dmPelsHeight != height)
|
||||||
if (devmode.dmPelsHeight != height)
|
|
||||||
continue;
|
continue;
|
||||||
|
if (dm.dmBitsPerPel != curr_bpp)
|
||||||
if (devmode.dmBitsPerPel != depth)
|
|
||||||
continue;
|
continue;
|
||||||
|
if (dm.dmDisplayFrequency != int_hz)
|
||||||
if (devmode.dmDisplayFrequency != freq)
|
|
||||||
continue;
|
continue;
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
if (dm.dmDisplayOrientation != curr_orientation)
|
||||||
|
continue;
|
||||||
|
if (dm.dmDisplayFixedOutput != DMDFO_DEFAULT)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
devmode.dmFields |=
|
dm.dmFields |= DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
|
||||||
DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
|
#if _WIN32_WINNT >= 0x0500
|
||||||
res =
|
dm.dmFields |= DM_DISPLAYORIENTATION;
|
||||||
win32_change_display_settings(NULL, &devmode, CDS_TEST);
|
#endif
|
||||||
|
|
||||||
|
res = win32_change_display_settings(NULL, &dm, CDS_TEST);
|
||||||
|
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
case DISP_CHANGE_SUCCESSFUL:
|
case DISP_CHANGE_SUCCESSFUL:
|
||||||
res = win32_change_display_settings(NULL, &devmode, 0);
|
res = win32_change_display_settings(NULL, &dm, 0);
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
case DISP_CHANGE_SUCCESSFUL:
|
case DISP_CHANGE_SUCCESSFUL:
|
||||||
@ -303,28 +309,39 @@ static bool win32_display_server_set_resolution(void *data,
|
|||||||
void *win32_display_server_get_resolution_list(void *data,
|
void *win32_display_server_get_resolution_list(void *data,
|
||||||
unsigned *len)
|
unsigned *len)
|
||||||
{
|
{
|
||||||
DEVMODE dm;
|
DEVMODE dm = {0};
|
||||||
unsigned i, count = 0;
|
unsigned i, j, count = 0;
|
||||||
unsigned curr_width = 0;
|
unsigned curr_width = 0;
|
||||||
unsigned curr_height = 0;
|
unsigned curr_height = 0;
|
||||||
unsigned curr_bpp = 0;
|
unsigned curr_bpp = 0;
|
||||||
unsigned curr_refreshrate = 0;
|
unsigned curr_refreshrate = 0;
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
unsigned curr_orientation = 0;
|
||||||
|
#endif
|
||||||
struct video_display_config *conf = NULL;
|
struct video_display_config *conf = NULL;
|
||||||
|
|
||||||
for (i = 0;; i++)
|
if (win32_get_video_output(&dm, -1, sizeof(dm))) {
|
||||||
{
|
|
||||||
if (!win32_get_video_output(&dm, i, sizeof(dm)))
|
|
||||||
break;
|
|
||||||
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (win32_get_video_output(&dm, -1, sizeof(dm)))
|
|
||||||
{
|
|
||||||
curr_width = dm.dmPelsWidth;
|
curr_width = dm.dmPelsWidth;
|
||||||
curr_height = dm.dmPelsHeight;
|
curr_height = dm.dmPelsHeight;
|
||||||
curr_bpp = dm.dmBitsPerPel;
|
curr_bpp = dm.dmBitsPerPel;
|
||||||
curr_refreshrate = dm.dmDisplayFrequency;
|
curr_refreshrate = dm.dmDisplayFrequency;
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
curr_orientation = dm.dmDisplayOrientation;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++)
|
||||||
|
{
|
||||||
|
if (dm.dmBitsPerPel != curr_bpp)
|
||||||
|
continue;
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
if (dm.dmDisplayOrientation != curr_orientation)
|
||||||
|
continue;
|
||||||
|
if (dm.dmDisplayFixedOutput != DMDFO_DEFAULT)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*len = count;
|
*len = count;
|
||||||
@ -333,24 +350,32 @@ void *win32_display_server_get_resolution_list(void *data,
|
|||||||
if (!conf)
|
if (!conf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0;; i++)
|
for (i = 0, j = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++)
|
||||||
{
|
{
|
||||||
if (!win32_get_video_output(&dm, i, sizeof(dm)))
|
if (dm.dmBitsPerPel != curr_bpp)
|
||||||
break;
|
continue;
|
||||||
|
#if _WIN32_WINNT >= 0x0500
|
||||||
|
if (dm.dmDisplayOrientation != curr_orientation)
|
||||||
|
continue;
|
||||||
|
if (dm.dmDisplayFixedOutput != DMDFO_DEFAULT)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
conf[i].width = dm.dmPelsWidth;
|
conf[j].width = dm.dmPelsWidth;
|
||||||
conf[i].height = dm.dmPelsHeight;
|
conf[j].height = dm.dmPelsHeight;
|
||||||
conf[i].bpp = dm.dmBitsPerPel;
|
conf[j].bpp = dm.dmBitsPerPel;
|
||||||
conf[i].refreshrate = dm.dmDisplayFrequency;
|
conf[j].refreshrate = dm.dmDisplayFrequency;
|
||||||
conf[i].idx = i;
|
conf[j].idx = j;
|
||||||
conf[i].current = false;
|
conf[j].current = false;
|
||||||
|
|
||||||
if ( (conf[i].width == curr_width)
|
if ( (conf[j].width == curr_width)
|
||||||
&& (conf[i].height == curr_height)
|
&& (conf[j].height == curr_height)
|
||||||
&& (conf[i].refreshrate == curr_refreshrate)
|
&& (conf[j].bpp == curr_bpp)
|
||||||
&& (conf[i].bpp == curr_bpp)
|
&& (conf[j].refreshrate == curr_refreshrate)
|
||||||
)
|
)
|
||||||
conf[i].current = true;
|
conf[j].current = true;
|
||||||
|
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
|
@ -191,6 +191,8 @@ uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
|
|||||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_AUDIO];
|
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_AUDIO];
|
||||||
case MENU_ENUM_LABEL_AUDIO_MIXER_SETTINGS:
|
case MENU_ENUM_LABEL_AUDIO_MIXER_SETTINGS:
|
||||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_MIXER];
|
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_MIXER];
|
||||||
|
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
|
||||||
|
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING];
|
||||||
case MENU_ENUM_LABEL_INPUT_SETTINGS:
|
case MENU_ENUM_LABEL_INPUT_SETTINGS:
|
||||||
case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES:
|
case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES:
|
||||||
case MENU_ENUM_LABEL_INPUT_USER_1_BINDS:
|
case MENU_ENUM_LABEL_INPUT_USER_1_BINDS:
|
||||||
|
@ -2594,6 +2594,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
|
|||||||
return xmb->textures.list[XMB_TEXTURE_AUDIO];
|
return xmb->textures.list[XMB_TEXTURE_AUDIO];
|
||||||
case MENU_ENUM_LABEL_AUDIO_MIXER_SETTINGS:
|
case MENU_ENUM_LABEL_AUDIO_MIXER_SETTINGS:
|
||||||
return xmb->textures.list[XMB_TEXTURE_MIXER];
|
return xmb->textures.list[XMB_TEXTURE_MIXER];
|
||||||
|
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
|
||||||
|
return xmb->textures.list[XMB_TEXTURE_SUBSETTING];
|
||||||
case MENU_ENUM_LABEL_INPUT_SETTINGS:
|
case MENU_ENUM_LABEL_INPUT_SETTINGS:
|
||||||
case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES:
|
case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES:
|
||||||
case MENU_ENUM_LABEL_INPUT_USER_1_BINDS:
|
case MENU_ENUM_LABEL_INPUT_USER_1_BINDS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user