mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-31 14:04:21 +00:00
Start rewriting bsv movie code so that global->bsv.movie is
only accessed inside movie.c
This commit is contained in:
parent
508f1f594f
commit
d05ed635c6
@ -467,7 +467,6 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
const struct retro_keybind *libretro_input_binds[MAX_USERS];
|
||||
int16_t res = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
libretro_input_binds[i] = settings->input.binds[i];
|
||||
@ -477,7 +476,7 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
if (bsv_movie_ctl(BSV_MOVIE_CTL_PLAYBACK_ON, NULL))
|
||||
{
|
||||
int16_t ret;
|
||||
if (bsv_movie_get_input(global->bsv.movie, &ret))
|
||||
if (bsv_movie_get_input(&ret))
|
||||
return ret;
|
||||
|
||||
bsv_movie_ctl(BSV_MOVIE_CTL_SET_END, NULL);
|
||||
@ -527,7 +526,7 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
}
|
||||
|
||||
if (bsv_movie_ctl(BSV_MOVIE_CTL_PLAYBACK_OFF, NULL))
|
||||
bsv_movie_set_input(global->bsv.movie, res);
|
||||
bsv_movie_set_input(res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
9
movie.c
9
movie.c
@ -156,8 +156,10 @@ void bsv_movie_free(bsv_movie_t *handle)
|
||||
free(handle);
|
||||
}
|
||||
|
||||
bool bsv_movie_get_input(bsv_movie_t *handle, int16_t *input)
|
||||
bool bsv_movie_get_input(int16_t *input)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
bsv_movie_t *handle = global->bsv.movie;
|
||||
if (fread(input, sizeof(int16_t), 1, handle->file) != 1)
|
||||
return false;
|
||||
|
||||
@ -165,8 +167,11 @@ bool bsv_movie_get_input(bsv_movie_t *handle, int16_t *input)
|
||||
return true;
|
||||
}
|
||||
|
||||
void bsv_movie_set_input(bsv_movie_t *handle, int16_t input)
|
||||
void bsv_movie_set_input(int16_t input)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
bsv_movie_t *handle = global->bsv.movie;
|
||||
|
||||
input = swap_if_big16(input);
|
||||
fwrite(&input, sizeof(int16_t), 1, handle->file);
|
||||
}
|
||||
|
4
movie.h
4
movie.h
@ -61,10 +61,10 @@ enum bsv_ctl_state
|
||||
bsv_movie_t *bsv_movie_init(const char *path, enum rarch_movie_type type);
|
||||
|
||||
/* Playback. */
|
||||
bool bsv_movie_get_input(bsv_movie_t *handle, int16_t *input);
|
||||
bool bsv_movie_get_input(int16_t *input);
|
||||
|
||||
/* Recording. */
|
||||
void bsv_movie_set_input(bsv_movie_t *handle, int16_t input);
|
||||
void bsv_movie_set_input(int16_t input);
|
||||
|
||||
/* Used for rewinding while playback/record. */
|
||||
void bsv_movie_set_frame_start(bsv_movie_t *handle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user