(Menu) Show camera driver inside 'Drivers' category

This commit is contained in:
twinaphex 2013-11-11 15:39:46 +01:00
parent f8d44c6e60
commit 6a9bc1bfa4
5 changed files with 42 additions and 1 deletions

View File

@ -212,6 +212,24 @@ static void find_camera_driver(void)
rarch_fail(1, "find_camera_driver()");
}
}
void find_prev_camera_driver(void)
{
int i = find_camera_driver_index(g_settings.camera.driver);
if (i > 0)
strlcpy(g_settings.camera.driver, camera_drivers[i - 1]->ident, sizeof(g_settings.camera.driver));
else
RARCH_WARN("Couldn't find any previous camera driver (current one: \"%s\").\n", g_settings.camera.driver);
}
void find_next_camera_driver(void)
{
int i = find_camera_driver_index(g_settings.camera.driver);
if (i >= 0 && camera_drivers[i + 1])
strlcpy(g_settings.camera.driver, camera_drivers[i + 1]->ident, sizeof(g_settings.camera.driver));
else
RARCH_WARN("Couldn't find any next camera driver (current one: \"%s\").\n", g_settings.camera.driver);
}
#endif
static int find_audio_driver_index(const char *driver)

View File

@ -515,6 +515,13 @@ void find_next_video_driver(void);
void find_next_audio_driver(void);
void find_next_input_driver(void);
#ifdef HAVE_CAMERA
void init_camera(void);
void uninit_camera(void);
void find_prev_camera_driver(void);
void find_next_camera_driver(void);
#endif
void driver_set_monitor_refresh_rate(float hz);
bool driver_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points);
void driver_set_nonblock_state(bool nonblock);

View File

@ -1932,6 +1932,9 @@ void menu_populate_entries(void *data, unsigned menu_type)
file_list_push(rgui->selection_buf, "Video driver", RGUI_SETTINGS_DRIVER_VIDEO, 0);
file_list_push(rgui->selection_buf, "Audio driver", RGUI_SETTINGS_DRIVER_AUDIO, 0);
file_list_push(rgui->selection_buf, "Input driver", RGUI_SETTINGS_DRIVER_INPUT, 0);
#ifdef HAVE_CAMERA
file_list_push(rgui->selection_buf, "Camera driver", RGUI_SETTINGS_DRIVER_CAMERA, 0);
#endif
break;
case RGUI_SETTINGS:
file_list_clear(rgui->selection_buf);

View File

@ -120,6 +120,7 @@ typedef enum
RGUI_SETTINGS_DRIVER_VIDEO,
RGUI_SETTINGS_DRIVER_AUDIO,
RGUI_SETTINGS_DRIVER_INPUT,
RGUI_SETTINGS_DRIVER_CAMERA,
RGUI_SETTINGS_SCREENSHOT,
RGUI_SETTINGS_GPU_SCREENSHOT,
RGUI_SCREENSHOT_DIR_PATH,

View File

@ -888,7 +888,14 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
else if (action == RGUI_ACTION_RIGHT)
find_next_input_driver();
break;
#ifdef HAVE_CAMERA
case RGUI_SETTINGS_DRIVER_CAMERA:
if (action == RGUI_ACTION_LEFT)
find_prev_camera_driver();
else if (action == RGUI_ACTION_RIGHT)
find_next_camera_driver();
break;
#endif
case RGUI_SETTINGS_VIDEO_GAMMA:
if (action == RGUI_ACTION_START)
{
@ -1427,6 +1434,11 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
case RGUI_SETTINGS_DRIVER_INPUT:
strlcpy(type_str, g_settings.input.driver, type_str_size);
break;
#ifdef HAVE_CAMERA
case RGUI_SETTINGS_DRIVER_CAMERA:
strlcpy(type_str, g_settings.camera.driver, type_str_size);
break;
#endif
case RGUI_SETTINGS_VIDEO_REFRESH_RATE_AUTO:
{
double refresh_rate = 0.0;