Get rid of camera_driver_ctl and bsv_movie_ctl

This commit is contained in:
twinaphex 2019-06-17 11:38:28 +02:00
parent c87344dca8
commit 66022c1b13
5 changed files with 32 additions and 66 deletions

View File

@ -1108,7 +1108,7 @@ static void command_event_init_cheats(void)
allow_cheats &= !netplay_driver_ctl(
RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL);
#endif
allow_cheats &= !bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL);
allow_cheats &= !rarch_ctl(RARCH_CTL_BSV_MOVIE_IS_INITED, NULL);
if (!allow_cheats)
return;
@ -1873,7 +1873,7 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_LOAD_STATE:
/* Immutable - disallow savestate load when
* we absolutely cannot change game state. */
if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
if (rarch_ctl(RARCH_CTL_BSV_MOVIE_IS_INITED, NULL))
return false;
#ifdef HAVE_CHEEVOS

View File

@ -662,7 +662,7 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
rarch_ctl(RARCH_CTL_FRAME_TIME_FREE, NULL);
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
/* Performance counters no longer valid. */
@ -1417,12 +1417,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
cb->start = driver_camera_start;
cb->stop = driver_camera_stop;
camera_driver_ctl(RARCH_CAMERA_CTL_SET_CB, cb);
rarch_ctl(RARCH_CTL_CAMERA_SET_CB, cb);
if (cb->caps != 0)
camera_driver_ctl(RARCH_CAMERA_CTL_SET_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_CAMERA_SET_ACTIVE, NULL);
else
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
break;
}

View File

@ -773,7 +773,7 @@ bool state_manager_check_rewind(bool pressed,
cnt = (cnt + 1) % (rewind_granularity ?
rewind_granularity : 1); /* Avoid possible SIGFPE. */
if ((cnt == 0) || bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
if ((cnt == 0) || rarch_ctl(RARCH_CTL_BSV_MOVIE_IS_INITED, NULL))
{
retro_ctx_serialize_info_t serial_info;
void *state = NULL;

View File

@ -695,20 +695,6 @@ void bsv_movie_set_input(int16_t *bsv_data)
}
}
bool bsv_movie_ctl(enum bsv_ctl_state state, void *data)
{
switch (state)
{
case BSV_MOVIE_CTL_IS_INITED:
return (bsv_movie_state_handle != NULL);
case BSV_MOVIE_CTL_NONE:
default:
return false;
}
return true;
}
void bsv_movie_set_path(const char *path)
{
strlcpy(bsv_movie_state.movie_path,
@ -930,30 +916,6 @@ static void camera_driver_find_driver(void)
}
}
bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
{
switch (state)
{
case RARCH_CAMERA_CTL_SET_ACTIVE:
camera_driver_active = true;
break;
case RARCH_CAMERA_CTL_UNSET_ACTIVE:
camera_driver_active = false;
break;
case RARCH_CAMERA_CTL_SET_CB:
{
struct retro_camera_callback *cb =
(struct retro_camera_callback*)data;
camera_cb = *cb;
}
break;
default:
break;
}
return true;
}
/* Drivers */
/**
@ -1298,7 +1260,7 @@ void drivers_init(int flags)
if (!camera_data)
{
RARCH_ERR("Failed to initialize camera driver. Will continue without camera.\n");
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_CAMERA_UNSET_ACTIVE, NULL);
}
if (camera_cb.initialized)
@ -2925,6 +2887,8 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
switch(state)
{
case RARCH_CTL_BSV_MOVIE_IS_INITED:
return (bsv_movie_state_handle != NULL);
case RARCH_CTL_IS_PATCH_BLOCKED:
return rarch_patch_blocked;
case RARCH_CTL_SET_PATCH_BLOCKED:
@ -3504,6 +3468,19 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
httpserver_destroy();
#endif
break;
case RARCH_CTL_CAMERA_SET_ACTIVE:
camera_driver_active = true;
break;
case RARCH_CTL_CAMERA_UNSET_ACTIVE:
camera_driver_active = false;
break;
case RARCH_CTL_CAMERA_SET_CB:
{
struct retro_camera_callback *cb =
(struct retro_camera_callback*)data;
camera_cb = *cb;
}
break;
case RARCH_CTL_NONE:
default:
return false;

View File

@ -184,7 +184,15 @@ enum rarch_ctl_state
RARCH_CTL_HTTPSERVER_DESTROY,
RARCH_CTL_CONTENT_RUNTIME_LOG_INIT,
RARCH_CTL_CONTENT_RUNTIME_LOG_DEINIT
RARCH_CTL_CONTENT_RUNTIME_LOG_DEINIT,
/* Camera */
RARCH_CTL_CAMERA_SET_ACTIVE,
RARCH_CTL_CAMERA_UNSET_ACTIVE,
RARCH_CTL_CAMERA_SET_CB,
/* BSV Movie */
RARCH_CTL_BSV_MOVIE_IS_INITED
};
enum rarch_capabilities
@ -441,13 +449,6 @@ enum rarch_movie_type
RARCH_MOVIE_RECORD
};
enum bsv_ctl_state
{
BSV_MOVIE_CTL_NONE = 0,
BSV_MOVIE_CTL_IS_INITED
};
void bsv_movie_deinit(void);
bool bsv_movie_init(void);
@ -460,20 +461,10 @@ bool bsv_movie_get_input(int16_t *bsv_data);
void bsv_movie_set_input(int16_t *bsv_data);
bool bsv_movie_ctl(enum bsv_ctl_state state, void *data);
bool bsv_movie_check(void);
/* Camera */
enum rarch_camera_ctl_state
{
RARCH_CAMERA_CTL_NONE = 0,
RARCH_CAMERA_CTL_SET_ACTIVE,
RARCH_CAMERA_CTL_UNSET_ACTIVE,
RARCH_CAMERA_CTL_SET_CB,
};
typedef struct camera_driver
{
/* FIXME: params for initialization - queries for resolution,
@ -535,8 +526,6 @@ void driver_camera_stop(void);
bool driver_camera_start(void);
bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data);
RETRO_END_DECLS
#endif