mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-13 22:08:34 +00:00
Fix driver next/previous switching
This commit is contained in:
parent
b2d1fe66b3
commit
aab3f93f56
34
driver.c
34
driver.c
@ -195,28 +195,28 @@ static void find_audio_driver(void)
|
||||
rarch_fail(1, "find_audio_driver()");
|
||||
}
|
||||
|
||||
void find_prev_audio_driver(char *str, size_t sizeof_str)
|
||||
void find_prev_audio_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = (ARRAY_SIZE(audio_drivers)-1); i > 0; i--)
|
||||
{
|
||||
if (strcasecmp(g_settings.audio.driver, audio_drivers[i]->ident) == 0)
|
||||
{
|
||||
strlcpy(str, audio_drivers[i-1]->ident, sizeof_str);
|
||||
strlcpy(g_settings.audio.driver, audio_drivers[i-1]->ident, sizeof(g_settings.audio.driver));
|
||||
return;
|
||||
}
|
||||
}
|
||||
RARCH_WARN("Couldn't find any previous audio driver (current one: \"%s\")\n", g_settings.audio.driver);
|
||||
}
|
||||
|
||||
void find_next_audio_driver(char *str, size_t sizeof_str)
|
||||
void find_next_audio_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE(audio_drivers); i++)
|
||||
for (i = 0; i < (ARRAY_SIZE(audio_drivers)-1); i++)
|
||||
{
|
||||
if (strcasecmp(g_settings.audio.driver, audio_drivers[i]->ident) == 0)
|
||||
{
|
||||
strlcpy(str, audio_drivers[i+1]->ident, sizeof_str);
|
||||
strlcpy(g_settings.audio.driver, audio_drivers[i+1]->ident, sizeof(g_settings.audio.driver));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -251,14 +251,14 @@ static void find_video_driver(void)
|
||||
rarch_fail(1, "find_video_driver()");
|
||||
}
|
||||
|
||||
void find_prev_video_driver(char *str, size_t sizeof_str)
|
||||
void find_prev_video_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
#if defined(HAVE_OPENGL) && defined(HAVE_FBO)
|
||||
if (g_extern.system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_LOG("Using HW render, OpenGL driver forced.\n");
|
||||
strlcpy(str, video_gl.ident, sizeof_str);
|
||||
strlcpy(g_settings.video.driver, video_gl.ident, sizeof(g_settings.video.driver));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -267,30 +267,30 @@ void find_prev_video_driver(char *str, size_t sizeof_str)
|
||||
{
|
||||
if (strcasecmp(g_settings.video.driver, video_drivers[i]->ident) == 0)
|
||||
{
|
||||
strlcpy(str, video_drivers[i-1]->ident, sizeof_str);
|
||||
strlcpy(g_settings.video.driver, video_drivers[i-1]->ident, sizeof(g_settings.video.driver));
|
||||
return;
|
||||
}
|
||||
}
|
||||
RARCH_WARN("Couldn't find any previous video driver (current one: \"%s\")\n", g_settings.video.driver);
|
||||
}
|
||||
|
||||
void find_next_video_driver(char *str, size_t sizeof_str)
|
||||
void find_next_video_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
#if defined(HAVE_OPENGL) && defined(HAVE_FBO)
|
||||
if (g_extern.system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_LOG("Using HW render, OpenGL driver forced.\n");
|
||||
strlcpy(str, video_gl.ident, sizeof_str);
|
||||
strlcpy(g_settings.video.driver, video_gl.ident, sizeof(g_settings.video.driver));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(video_drivers); i++)
|
||||
for (i = 0; i < (ARRAY_SIZE(video_drivers)-1); i++)
|
||||
{
|
||||
if (strcasecmp(g_settings.video.driver, video_drivers[i]->ident) == 0)
|
||||
{
|
||||
strlcpy(str, video_drivers[i]->ident, sizeof_str);
|
||||
strlcpy(g_settings.video.driver, video_drivers[i]->ident, sizeof(g_settings.video.driver));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -316,28 +316,28 @@ static void find_input_driver(void)
|
||||
rarch_fail(1, "find_input_driver()");
|
||||
}
|
||||
|
||||
void find_prev_input_driver(char *str, size_t sizeof_str)
|
||||
void find_prev_input_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = (ARRAY_SIZE(input_drivers)-1); i > 0; i--)
|
||||
{
|
||||
if (strcasecmp(g_settings.input.driver, input_drivers[i]->ident) == 0)
|
||||
{
|
||||
strlcpy(str, input_drivers[i-1]->ident, sizeof_str);
|
||||
strlcpy(g_settings.input.driver, input_drivers[i-1]->ident, sizeof(g_settings.input.driver));
|
||||
return;
|
||||
}
|
||||
}
|
||||
RARCH_ERR("Couldn't find any previous input driver (current one: \"%s\")\n", g_settings.input.driver);
|
||||
}
|
||||
|
||||
void find_next_input_driver(char *str, size_t sizeof_str)
|
||||
void find_next_input_driver(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE(input_drivers); i++)
|
||||
for (i = 0; i < (ARRAY_SIZE(input_drivers)-1); i++)
|
||||
{
|
||||
if (strcasecmp(g_settings.input.driver, input_drivers[i]->ident) == 0)
|
||||
{
|
||||
strlcpy(str, input_drivers[i]->ident, sizeof_str);
|
||||
strlcpy(g_settings.input.driver, input_drivers[i]->ident, sizeof(g_settings.input.driver));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
12
driver.h
12
driver.h
@ -486,12 +486,12 @@ void uninit_video_input(void);
|
||||
void init_audio(void);
|
||||
void uninit_audio(void);
|
||||
|
||||
void find_prev_video_driver(char *str, size_t sizeof_str);
|
||||
void find_prev_audio_driver(char *str, size_t sizeof_str);
|
||||
void find_prev_input_driver(char *str, size_t sizeof_str);
|
||||
void find_next_video_driver(char *str, size_t sizeof_str);
|
||||
void find_next_audio_driver(char *str, size_t sizeof_str);
|
||||
void find_next_input_driver(char *str, size_t sizeof_str);
|
||||
void find_prev_video_driver(void);
|
||||
void find_prev_audio_driver(void);
|
||||
void find_prev_input_driver(void);
|
||||
void find_next_video_driver(void);
|
||||
void find_next_audio_driver(void);
|
||||
void find_next_input_driver(void);
|
||||
|
||||
void driver_set_monitor_refresh_rate(float hz);
|
||||
bool driver_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points);
|
||||
|
@ -626,63 +626,21 @@ int menu_set_settings(unsigned setting, unsigned action)
|
||||
|
||||
case RGUI_SETTINGS_DRIVER_VIDEO:
|
||||
if (action == RGUI_ACTION_LEFT)
|
||||
{
|
||||
char driver[32];
|
||||
driver[0] = '\0';
|
||||
find_next_video_driver(driver, sizeof(driver));
|
||||
|
||||
if (driver[0] != '\0')
|
||||
strlcpy(g_settings.video.driver, driver, sizeof(g_settings.video.driver));
|
||||
}
|
||||
find_prev_video_driver();
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
{
|
||||
char driver[32];
|
||||
driver[0] = '\0';
|
||||
find_prev_video_driver(driver, sizeof(driver));
|
||||
|
||||
if (driver[0] != '\0')
|
||||
strlcpy(g_settings.video.driver, driver, sizeof(g_settings.video.driver));
|
||||
}
|
||||
find_next_video_driver();
|
||||
break;
|
||||
case RGUI_SETTINGS_DRIVER_AUDIO:
|
||||
if (action == RGUI_ACTION_LEFT)
|
||||
{
|
||||
char driver[32];
|
||||
driver[0] = '\0';
|
||||
find_next_audio_driver(driver, sizeof(driver));
|
||||
|
||||
if (driver[0] != '\0')
|
||||
strlcpy(g_settings.audio.driver, driver, sizeof(g_settings.audio.driver));
|
||||
}
|
||||
find_prev_audio_driver();
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
{
|
||||
char driver[32];
|
||||
driver[0] = '\0';
|
||||
find_prev_audio_driver(driver, sizeof(driver));
|
||||
|
||||
if (driver[0] != '\0')
|
||||
strlcpy(g_settings.audio.driver, driver, sizeof(g_settings.audio.driver));
|
||||
}
|
||||
find_next_audio_driver();
|
||||
break;
|
||||
case RGUI_SETTINGS_DRIVER_INPUT:
|
||||
if (action == RGUI_ACTION_LEFT)
|
||||
{
|
||||
char driver[32];
|
||||
driver[0] = '\0';
|
||||
find_next_input_driver(driver, sizeof(driver));
|
||||
|
||||
if (driver[0] != '\0')
|
||||
strlcpy(g_settings.input.driver, driver, sizeof(g_settings.input.driver));
|
||||
}
|
||||
find_prev_input_driver();
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
{
|
||||
char driver[32];
|
||||
driver[0] = '\0';
|
||||
find_prev_input_driver(driver, sizeof(driver));
|
||||
|
||||
if (driver[0] != '\0')
|
||||
strlcpy(g_settings.input.driver, driver, sizeof(g_settings.input.driver));
|
||||
}
|
||||
find_next_input_driver();
|
||||
break;
|
||||
|
||||
case RGUI_SETTINGS_VIDEO_GAMMA:
|
||||
|
Loading…
Reference in New Issue
Block a user