Add initial implementation for resolution switching for Win32

This commit is contained in:
twinaphex 2018-11-24 20:12:57 +01:00
parent 0eb8acd766
commit d04f3c01a1
2 changed files with 33 additions and 7 deletions

View File

@ -60,6 +60,7 @@
#include "../../verbosity.h"
#include "../../lakka.h"
#include "../../wifi/wifi_driver.h"
#include "../../gfx/video_display_server.h"
#include <net/net_http.h>
@ -4463,12 +4464,37 @@ static int action_ok_push_dropdown_item(const char *path,
static int action_ok_push_dropdown_item_resolution(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
RARCH_LOG("dropdown: \n");
RARCH_LOG("path: %s \n", path);
RARCH_LOG("label: %s \n", label);
RARCH_LOG("type: %d \n", type);
RARCH_LOG("idx: %d \n", idx);
RARCH_LOG("entry_idx: %d \n", entry_idx);
char str[100];
char *pch = NULL;
unsigned width = 0;
unsigned height = 0;
unsigned refreshrate = 0;
snprintf(str, sizeof(str), "%s", path);
pch = strtok(str, "x");
if (pch)
width = strtoul(pch, NULL, 0);
pch = strtok(NULL, " ");
if (pch)
height = strtoul(pch, NULL, 0);
pch = strtok(NULL, "(");
if (pch)
refreshrate = strtoul(pch, NULL, 0);
if (video_display_server_set_resolution(width, height,
refreshrate, (float)refreshrate, 0))
{
settings_t *settings = config_get_ptr();
video_monitor_set_refresh_rate((float)refreshrate);
settings->uints.video_fullscreen_x = width;
settings->uints.video_fullscreen_y = height;
/* TODO/FIXME - menu drivers like XMB don't rescale
* automatically */
}
return 0;
}

View File

@ -8333,7 +8333,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
for (i = 0; i < size; i++)
{
char val_d[256], str[256];
snprintf(str, sizeof(str), "%dx%d (%dHz)", list[i].width, list[i].height, list[i].refreshrate);
snprintf(str, sizeof(str), "%dx%d (%d Hz)", list[i].width, list[i].height, list[i].refreshrate);
snprintf(val_d, sizeof(val_d), "%d", i);
menu_entries_append_enum(info->list,
str,