mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 00:40:09 +00:00
BSV ergonomics improvements (#14929)
* BSV ergonomics improvements - Date stamp toggled recordings instead of overwriting or using save slot number - Properly stop movie on playback EOF; also pause emulation - Add recording flag to match playback flag in bsv state enum - Rename bsv "movie path" to "movie auto path" to clarify role - Allow stopping movie playback before EOF using record toggle hotkey --------- Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
This commit is contained in:
parent
456434928b
commit
5dbdde4316
@ -234,8 +234,8 @@ enum input_turbo_default_button
|
||||
#define GET_HAT(x) (x & (~HAT_MASK))
|
||||
|
||||
#ifdef HAVE_BSV_MOVIE
|
||||
#define BSV_MOVIE_IS_PLAYBACK_ON() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK))
|
||||
#define BSV_MOVIE_IS_PLAYBACK_OFF() (input_st->bsv_movie_state_handle && (!(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK)))
|
||||
#define BSV_MOVIE_IS_PLAYBACK_ON() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK) && !(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END))
|
||||
#define BSV_MOVIE_IS_RECORDING() (input_st->bsv_movie_state_handle && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_RECORDING))
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -5447,7 +5447,7 @@ int16_t input_driver_state_wrapper(unsigned port, unsigned device,
|
||||
|
||||
#ifdef HAVE_BSV_MOVIE
|
||||
/* Save input to BSV record, if enabled */
|
||||
if (BSV_MOVIE_IS_PLAYBACK_OFF())
|
||||
if (BSV_MOVIE_IS_RECORDING())
|
||||
{
|
||||
result = swap_if_big16(result);
|
||||
intfstream_write(input_st->bsv_movie_state_handle->file, &result, 2);
|
||||
|
@ -114,15 +114,16 @@ enum bsv_flags
|
||||
BSV_FLAG_MOVIE_START_RECORDING = (1 << 0),
|
||||
BSV_FLAG_MOVIE_START_PLAYBACK = (1 << 1),
|
||||
BSV_FLAG_MOVIE_PLAYBACK = (1 << 2),
|
||||
BSV_FLAG_MOVIE_EOF_EXIT = (1 << 3),
|
||||
BSV_FLAG_MOVIE_END = (1 << 4)
|
||||
BSV_FLAG_MOVIE_RECORDING = (1 << 3),
|
||||
BSV_FLAG_MOVIE_END = (1 << 4),
|
||||
BSV_FLAG_MOVIE_EOF_EXIT = (1 << 5)
|
||||
};
|
||||
|
||||
struct bsv_state
|
||||
{
|
||||
uint8_t flags;
|
||||
/* Movie playback/recording support. */
|
||||
char movie_path[PATH_MAX_LENGTH];
|
||||
char movie_auto_path[PATH_MAX_LENGTH];
|
||||
/* Immediate playback/recording. */
|
||||
char movie_start_path[PATH_MAX_LENGTH];
|
||||
};
|
||||
|
@ -4681,9 +4681,9 @@ void runloop_path_fill_names(void)
|
||||
runloop_path_init_savefile_internal(runloop_st);
|
||||
|
||||
#ifdef HAVE_BSV_MOVIE
|
||||
strlcpy(input_st->bsv_movie_state.movie_path,
|
||||
strlcpy(input_st->bsv_movie_state.movie_auto_path,
|
||||
runloop_st->name.savefile,
|
||||
sizeof(input_st->bsv_movie_state.movie_path));
|
||||
sizeof(input_st->bsv_movie_state.movie_auto_path));
|
||||
#endif
|
||||
|
||||
if (string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
@ -6984,6 +6984,11 @@ int runloop_iterate(void)
|
||||
!input_st->bsv_movie_state_handle->did_rewind;
|
||||
input_st->bsv_movie_state_handle->did_rewind = false;
|
||||
}
|
||||
if (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END)
|
||||
{
|
||||
movie_stop_playback(input_st);
|
||||
command_event(CMD_EVENT_PAUSE, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <compat/strl.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
@ -243,6 +244,7 @@ bool bsv_movie_start_record(input_driver_state_t * input_st, char *path)
|
||||
}
|
||||
|
||||
input_st->bsv_movie_state_handle = state;
|
||||
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_RECORDING;
|
||||
snprintf(msg, sizeof(msg),
|
||||
"%s \"%s\".", movie_rec_str,
|
||||
path);
|
||||
@ -310,7 +312,7 @@ static void moviectl_start_playback_cb(retro_task_t *task,
|
||||
struct bsv_state *state = (struct bsv_state *)task_data;
|
||||
input_driver_state_t *input_st = input_state_get_ptr();
|
||||
input_st->bsv_movie_state = *state;
|
||||
bsv_movie_start_playback(input_st, state->movie_path);
|
||||
bsv_movie_start_playback(input_st, state->movie_start_path);
|
||||
free(state);
|
||||
}
|
||||
bool content_load_state_in_progress(void* data);
|
||||
@ -337,7 +339,7 @@ static void moviectl_start_record_cb(retro_task_t *task,
|
||||
struct bsv_state *state = (struct bsv_state *)task_data;
|
||||
input_driver_state_t *input_st = input_state_get_ptr();
|
||||
input_st->bsv_movie_state = *state;
|
||||
bsv_movie_start_record(input_st, state->movie_path);
|
||||
bsv_movie_start_record(input_st, state->movie_start_path);
|
||||
free(state);
|
||||
}
|
||||
|
||||
@ -353,11 +355,7 @@ bool movie_toggle_record(input_driver_state_t *input_st, settings_t *settings)
|
||||
|
||||
configuration_set_uint(settings, settings->uints.rewind_granularity, 1);
|
||||
|
||||
_len = strlcpy(path,
|
||||
input_st->bsv_movie_state.movie_path, sizeof(path));
|
||||
if (state_slot > 0)
|
||||
snprintf(path + _len, sizeof(path) - _len, "%d", state_slot);
|
||||
strlcat(path, ".bsv", sizeof(path));
|
||||
fill_str_dated_filename(path, input_st->bsv_movie_state.movie_auto_path, "bsv", sizeof(path));
|
||||
|
||||
return movie_start_record(input_st, path);
|
||||
}
|
||||
@ -373,8 +371,6 @@ bool movie_stop_playback(input_driver_state_t *input_st){
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END))
|
||||
return false;
|
||||
movie_playback_end_str = msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED);
|
||||
runloop_msg_queue_push(
|
||||
movie_playback_end_str, 2, 180, false,
|
||||
@ -423,7 +419,7 @@ bool movie_start_playback(input_driver_state_t *input_st, char *path)
|
||||
if (!task || !state)
|
||||
goto error;
|
||||
*state = input_st->bsv_movie_state;
|
||||
strlcpy(state->movie_path, path, sizeof(state->movie_path));
|
||||
strlcpy(state->movie_start_path, path, sizeof(state->movie_start_path));
|
||||
task->type = TASK_TYPE_NONE;
|
||||
task->state = state;
|
||||
task->handler = task_moviectl_playback_handler;
|
||||
@ -453,12 +449,12 @@ bool movie_start_record(input_driver_state_t *input_st, char*path)
|
||||
goto error;
|
||||
|
||||
*state = input_st->bsv_movie_state;
|
||||
strlcpy(state->movie_path, path, sizeof(state->movie_path));
|
||||
strlcpy(state->movie_start_path, path, sizeof(state->movie_start_path));
|
||||
|
||||
msg[0] = '\0';
|
||||
snprintf(msg, sizeof(msg),
|
||||
"%s \"%s\".", movie_rec_str,
|
||||
state->movie_path);
|
||||
path);
|
||||
|
||||
task->type = TASK_TYPE_NONE;
|
||||
task->state = state;
|
||||
|
Loading…
x
Reference in New Issue
Block a user