Add get_resolution_list for Win32

This commit is contained in:
twinaphex 2018-11-24 02:47:22 +01:00
parent 5d8666e226
commit fdb4d2b6ad
4 changed files with 51 additions and 4 deletions

View File

@ -48,9 +48,10 @@ const video_display_server_t dispserv_null = {
null_display_server_destroy,
null_display_server_set_window_opacity,
null_display_server_set_window_progress,
NULL,
NULL,
NULL,
NULL, /* set_window_decorations */
NULL, /* set_resolution */
NULL, /* get_resolution_list */
NULL, /* get_output_options */
"null"
};

View File

@ -282,6 +282,39 @@ static bool win32_display_server_set_resolution(void *data,
return true;
}
unsigned win32_display_server_get_resolution_list(struct video_display_config **conf)
{
unsigned i;
unsigned len = 0;
for (i = 0;; i++)
{
void *optr = NULL;
DEVMODE dm;
if (!win32_get_video_output(&dm, i, sizeof(dm)))
continue;
len++;
if (*conf)
optr = realloc(*conf, len);
else
optr = malloc(len);
if (optr)
*conf = optr;
conf[i]->width = dm.dmPelsWidth;
conf[i]->height = dm.dmPelsHeight;
conf[i]->bpp = dm.dmBitsPerPel;
conf[i]->refreshrate = dm.dmDisplayFrequency;
conf[i]->idx = i;
}
return len;
}
const video_display_server_t dispserv_win32 = {
win32_display_server_init,
win32_display_server_destroy,
@ -289,6 +322,7 @@ const video_display_server_t dispserv_win32 = {
win32_display_server_set_window_progress,
win32_display_server_set_window_decorations,
win32_display_server_set_resolution,
win32_display_server_get_resolution_list,
NULL, /* get_output_options */
"win32"
};

View File

@ -306,9 +306,10 @@ const video_display_server_t dispserv_x11 = {
x11_display_server_init,
x11_display_server_destroy,
x11_display_server_set_window_opacity,
NULL,
NULL, /* set_window_progress */
x11_display_server_set_window_decorations,
x11_display_server_set_resolution,
NULL, /* get_resolution_list */
x11_display_server_get_output_options,
"x11"
};

View File

@ -23,6 +23,16 @@
RETRO_BEGIN_DECLS
typedef struct video_display_config
{
unsigned width;
unsigned height;
unsigned bpp;
unsigned refreshrate;
unsigned idx;
bool current;
} video_display_config_t;
typedef struct video_display_server
{
void *(*init)(void);
@ -32,6 +42,7 @@ typedef struct video_display_server
bool (*set_window_decorations)(void *data, bool on);
bool (*switch_resolution)(void *data, unsigned width,
unsigned height, int int_hz, float hz, int center);
unsigned (*get_resolution_list)(struct video_display_config **conf);
const char *(*get_output_options)(void *data);
const char *ident;
} video_display_server_t;