mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Cut down on some code duplication
This commit is contained in:
parent
9c8c889477
commit
e840a6c95a
@ -4956,7 +4956,7 @@ static int action_ok_push_dropdown_item(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_item_resolution(const char *path,
|
||||
int action_cb_push_dropdown_item_resolution(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char str[100];
|
||||
@ -4965,6 +4965,11 @@ static int action_ok_push_dropdown_item_resolution(const char *path,
|
||||
unsigned height = 0;
|
||||
unsigned refreshrate = 0;
|
||||
|
||||
(void)label;
|
||||
(void)type;
|
||||
(void)idx;
|
||||
(void)entry_idx;
|
||||
|
||||
snprintf(str, sizeof(str), "%s", path);
|
||||
|
||||
pch = strtok(str, "x");
|
||||
@ -4987,11 +4992,22 @@ static int action_ok_push_dropdown_item_resolution(const char *path,
|
||||
settings->uints.video_fullscreen_x = width;
|
||||
settings->uints.video_fullscreen_y = height;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_item_resolution(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
if (action_cb_push_dropdown_item_resolution(path,
|
||||
label, type, idx, entry_idx) == 1)
|
||||
{
|
||||
/* TODO/FIXME - menu drivers like XMB don't rescale
|
||||
* automatically */
|
||||
return menu_cbs_exit();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,8 @@ enum
|
||||
};
|
||||
|
||||
/* Function callbacks */
|
||||
int action_cb_push_dropdown_item_resolution(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx);
|
||||
|
||||
int action_cancel_pop_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx);
|
||||
|
@ -290,35 +290,9 @@ QWidget *CrtSwitchresPage::widget()
|
||||
|
||||
void VideoPage::onResolutionComboIndexChanged(const QString &text)
|
||||
{
|
||||
char str[100];
|
||||
char *pch = NULL;
|
||||
const char *path = text.toUtf8().constData();
|
||||
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, 0, 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;
|
||||
}
|
||||
action_cb_push_dropdown_item_resolution(path,
|
||||
NULL, 0, 0, 0);
|
||||
}
|
||||
|
||||
void CrtSwitchresPage::onCrtSuperResolutionComboIndexChanged(int index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user