mirror of
https://github.com/libretro/RetroArch
synced 2025-03-05 19:13:45 +00:00
Remove BSV code - was obsolete and no longer working - input recording
can be done in other ways instead of being held back by this old input recording format - was decided along with Themaister that we want to arrive at a codebase more easily maintained by all
This commit is contained in:
parent
7e6cb03f6b
commit
7f731e390a
18
command.c
18
command.c
@ -1104,7 +1104,6 @@ static void command_event_init_cheats(void)
|
||||
allow_cheats &= !netplay_driver_ctl(
|
||||
RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL);
|
||||
#endif
|
||||
allow_cheats &= !rarch_ctl(RARCH_CTL_BSV_MOVIE_IS_INITED, NULL);
|
||||
|
||||
if (!allow_cheats)
|
||||
return;
|
||||
@ -1276,7 +1275,6 @@ static bool event_init_content(void)
|
||||
command_event_load_auto_state();
|
||||
#endif
|
||||
|
||||
command_event(CMD_EVENT_BSV_MOVIE_INIT, NULL);
|
||||
command_event(CMD_EVENT_NETPLAY_INIT, NULL);
|
||||
|
||||
return true;
|
||||
@ -1760,11 +1758,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
dir_check_shader(false, true);
|
||||
break;
|
||||
case CMD_EVENT_BSV_RECORDING_TOGGLE:
|
||||
if (!recording_is_enabled())
|
||||
command_event(CMD_EVENT_RECORD_INIT, NULL);
|
||||
else
|
||||
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
|
||||
bsv_movie_check();
|
||||
/* Dead code */
|
||||
break;
|
||||
case CMD_EVENT_AI_SERVICE_TOGGLE:
|
||||
{
|
||||
@ -1886,11 +1880,6 @@ bool command_event(enum event_command cmd, void *data)
|
||||
break;
|
||||
}
|
||||
case CMD_EVENT_LOAD_STATE:
|
||||
/* Immutable - disallow savestate load when
|
||||
* we absolutely cannot change game state. */
|
||||
if (rarch_ctl(RARCH_CTL_BSV_MOVIE_IS_INITED, NULL))
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
if (rcheevos_hardcore_active)
|
||||
return false;
|
||||
@ -2629,11 +2618,10 @@ TODO: Add a setting for these tweaks */
|
||||
return false;
|
||||
break;
|
||||
case CMD_EVENT_BSV_MOVIE_DEINIT:
|
||||
bsv_movie_deinit();
|
||||
/* Dead code */
|
||||
break;
|
||||
case CMD_EVENT_BSV_MOVIE_INIT:
|
||||
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
|
||||
bsv_movie_init();
|
||||
/* Dead code */
|
||||
break;
|
||||
#ifdef HAVE_NETWORKING
|
||||
case CMD_EVENT_NETPLAY_GAME_WATCH:
|
||||
|
@ -149,15 +149,6 @@ Sets path to a config file for use during recording.
|
||||
Allows specifying the exact output width and height of recording. This option will override any configuration settings.
|
||||
The video input is scaled with point filtering before being encoded at the correct size.
|
||||
|
||||
.TP
|
||||
\fB--bsvplay PATH, -P PATH\fR
|
||||
Play back a movie recorded in the .bsv format (bsnes). Cart ROM and movie file need to correspond.
|
||||
It also requires to play back with the same libretro backend that was used for recording.
|
||||
|
||||
.TP
|
||||
\fB--bsvrecord PATH, -R PATH\fR
|
||||
Start recording a .bsv video to PATH immediately after startup.
|
||||
|
||||
.TP
|
||||
\fB--sram-mode MODE, -M MODE\fR
|
||||
MODE designates how to handle SRAM.
|
||||
|
@ -735,8 +735,6 @@ bool state_manager_check_rewind(bool pressed,
|
||||
serial_info.size = rewind_state.size;
|
||||
|
||||
core_unserialize(&serial_info);
|
||||
|
||||
bsv_movie_frame_rewind();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -772,7 +770,7 @@ bool state_manager_check_rewind(bool pressed,
|
||||
cnt = (cnt + 1) % (rewind_granularity ?
|
||||
rewind_granularity : 1); /* Avoid possible SIGFPE. */
|
||||
|
||||
if ((cnt == 0) || rarch_ctl(RARCH_CTL_BSV_MOVIE_IS_INITED, NULL))
|
||||
if (cnt == 0)
|
||||
{
|
||||
retro_ctx_serialize_info_t serial_info;
|
||||
void *state = NULL;
|
||||
|
34
paths.c
34
paths.c
@ -435,32 +435,30 @@ static void path_init_savefile_internal(void)
|
||||
|
||||
void path_fill_names(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
path_init_savefile_internal();
|
||||
|
||||
if (global)
|
||||
bsv_movie_set_path(global->name.savefile);
|
||||
|
||||
if (string_is_empty(path_main_basename))
|
||||
return;
|
||||
|
||||
if (global)
|
||||
{
|
||||
if (string_is_empty(global->name.ups))
|
||||
fill_pathname_noext(global->name.ups, path_main_basename,
|
||||
file_path_str(FILE_PATH_UPS_EXTENSION),
|
||||
sizeof(global->name.ups));
|
||||
global_t *global = global_get_ptr();
|
||||
if (global)
|
||||
{
|
||||
if (string_is_empty(global->name.ups))
|
||||
fill_pathname_noext(global->name.ups, path_main_basename,
|
||||
file_path_str(FILE_PATH_UPS_EXTENSION),
|
||||
sizeof(global->name.ups));
|
||||
|
||||
if (string_is_empty(global->name.bps))
|
||||
fill_pathname_noext(global->name.bps, path_main_basename,
|
||||
file_path_str(FILE_PATH_BPS_EXTENSION),
|
||||
sizeof(global->name.bps));
|
||||
if (string_is_empty(global->name.bps))
|
||||
fill_pathname_noext(global->name.bps, path_main_basename,
|
||||
file_path_str(FILE_PATH_BPS_EXTENSION),
|
||||
sizeof(global->name.bps));
|
||||
|
||||
if (string_is_empty(global->name.ips))
|
||||
fill_pathname_noext(global->name.ips, path_main_basename,
|
||||
file_path_str(FILE_PATH_IPS_EXTENSION),
|
||||
sizeof(global->name.ips));
|
||||
if (string_is_empty(global->name.ips))
|
||||
fill_pathname_noext(global->name.ips, path_main_basename,
|
||||
file_path_str(FILE_PATH_IPS_EXTENSION),
|
||||
sizeof(global->name.ips));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
536
retroarch.c
536
retroarch.c
@ -2522,7 +2522,6 @@ static int16_t input_state_internal(
|
||||
unsigned idx, unsigned id,
|
||||
bool button_mask)
|
||||
{
|
||||
int16_t bsv_result;
|
||||
int16_t res = 0;
|
||||
#ifdef HAVE_OVERLAY
|
||||
int16_t res_overlay = 0;
|
||||
@ -2531,9 +2530,6 @@ static int16_t input_state_internal(
|
||||
is in action for that button*/
|
||||
bool reset_state = false;
|
||||
|
||||
if (bsv_movie_get_input(&bsv_result))
|
||||
return bsv_result;
|
||||
|
||||
if ( !input_driver_flushing_input
|
||||
&& !input_driver_block_libretro_input)
|
||||
{
|
||||
@ -2661,8 +2657,6 @@ static int16_t input_state_internal(
|
||||
}
|
||||
}
|
||||
|
||||
bsv_movie_set_input(&res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -11039,497 +11033,6 @@ struct string_list* video_driver_get_gpu_api_devices(enum gfx_ctx_api api)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* BSV Movie */
|
||||
|
||||
struct bsv_state
|
||||
{
|
||||
bool movie_start_recording;
|
||||
bool movie_start_playback;
|
||||
bool movie_playback;
|
||||
bool eof_exit;
|
||||
bool movie_end;
|
||||
|
||||
/* Movie playback/recording support. */
|
||||
char movie_path[PATH_MAX_LENGTH];
|
||||
/* Immediate playback/recording. */
|
||||
char movie_start_path[PATH_MAX_LENGTH];
|
||||
};
|
||||
|
||||
|
||||
struct bsv_movie
|
||||
{
|
||||
intfstream_t *file;
|
||||
|
||||
/* A ring buffer keeping track of positions
|
||||
* in the file for each frame. */
|
||||
size_t *frame_pos;
|
||||
size_t frame_mask;
|
||||
size_t frame_ptr;
|
||||
|
||||
size_t min_file_pos;
|
||||
|
||||
size_t state_size;
|
||||
uint8_t *state;
|
||||
|
||||
bool playback;
|
||||
bool first_rewind;
|
||||
bool did_rewind;
|
||||
};
|
||||
|
||||
#define BSV_MAGIC 0x42535631
|
||||
|
||||
#define MAGIC_INDEX 0
|
||||
#define SERIALIZER_INDEX 1
|
||||
#define CRC_INDEX 2
|
||||
#define STATE_SIZE_INDEX 3
|
||||
|
||||
typedef struct bsv_movie bsv_movie_t;
|
||||
|
||||
static bsv_movie_t *bsv_movie_state_handle = NULL;
|
||||
static struct bsv_state bsv_movie_state;
|
||||
|
||||
static bool bsv_movie_init_playback(bsv_movie_t *handle, const char *path)
|
||||
{
|
||||
uint32_t state_size = 0;
|
||||
uint32_t content_crc = 0;
|
||||
uint32_t header[4] = {0};
|
||||
intfstream_t *file = intfstream_open_file(path,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
RARCH_ERR("Could not open BSV file for playback, path : \"%s\".\n", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
handle->file = file;
|
||||
handle->playback = true;
|
||||
|
||||
intfstream_read(handle->file, header, sizeof(uint32_t) * 4);
|
||||
/* Compatibility with old implementation that
|
||||
* used incorrect documentation. */
|
||||
if (swap_if_little32(header[MAGIC_INDEX]) != BSV_MAGIC
|
||||
&& swap_if_big32(header[MAGIC_INDEX]) != BSV_MAGIC)
|
||||
{
|
||||
RARCH_ERR("%s\n", msg_hash_to_str(MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE));
|
||||
return false;
|
||||
}
|
||||
|
||||
content_crc = content_get_crc();
|
||||
|
||||
if (content_crc != 0)
|
||||
if (swap_if_big32(header[CRC_INDEX]) != content_crc)
|
||||
RARCH_WARN("%s.\n", msg_hash_to_str(MSG_CRC32_CHECKSUM_MISMATCH));
|
||||
|
||||
state_size = swap_if_big32(header[STATE_SIZE_INDEX]);
|
||||
|
||||
#if 0
|
||||
RARCH_ERR("----- debug %u -----\n", header[0]);
|
||||
RARCH_ERR("----- debug %u -----\n", header[1]);
|
||||
RARCH_ERR("----- debug %u -----\n", header[2]);
|
||||
RARCH_ERR("----- debug %u -----\n", header[3]);
|
||||
#endif
|
||||
|
||||
if (state_size)
|
||||
{
|
||||
retro_ctx_size_info_t info;
|
||||
retro_ctx_serialize_info_t serial_info;
|
||||
uint8_t *buf = (uint8_t*)malloc(state_size);
|
||||
|
||||
if (!buf)
|
||||
return false;
|
||||
|
||||
handle->state = buf;
|
||||
handle->state_size = state_size;
|
||||
if (intfstream_read(handle->file,
|
||||
handle->state, state_size) != state_size)
|
||||
{
|
||||
RARCH_ERR("%s\n", msg_hash_to_str(MSG_COULD_NOT_READ_STATE_FROM_MOVIE));
|
||||
return false;
|
||||
}
|
||||
|
||||
core_serialize_size( &info);
|
||||
|
||||
if (info.size == state_size)
|
||||
{
|
||||
serial_info.data_const = handle->state;
|
||||
serial_info.size = state_size;
|
||||
core_unserialize(&serial_info);
|
||||
}
|
||||
else
|
||||
RARCH_WARN("%s\n",
|
||||
msg_hash_to_str(MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION));
|
||||
}
|
||||
|
||||
handle->min_file_pos = sizeof(header) + state_size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool bsv_movie_init_record(bsv_movie_t *handle, const char *path)
|
||||
{
|
||||
retro_ctx_size_info_t info;
|
||||
uint32_t state_size = 0;
|
||||
uint32_t content_crc = 0;
|
||||
uint32_t header[4] = {0};
|
||||
intfstream_t *file = intfstream_open_file(path,
|
||||
RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
RARCH_ERR("Could not open BSV file for recording, path : \"%s\".\n", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
handle->file = file;
|
||||
|
||||
content_crc = content_get_crc();
|
||||
|
||||
/* This value is supposed to show up as
|
||||
* BSV1 in a HEX editor, big-endian. */
|
||||
header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC);
|
||||
header[CRC_INDEX] = swap_if_big32(content_crc);
|
||||
|
||||
core_serialize_size(&info);
|
||||
|
||||
state_size = (unsigned)info.size;
|
||||
|
||||
header[STATE_SIZE_INDEX] = swap_if_big32(state_size);
|
||||
#if 0
|
||||
RARCH_ERR("----- debug %u -----\n", header[0]);
|
||||
RARCH_ERR("----- debug %u -----\n", header[1]);
|
||||
RARCH_ERR("----- debug %u -----\n", header[2]);
|
||||
RARCH_ERR("----- debug %u -----\n", header[3]);
|
||||
#endif
|
||||
|
||||
intfstream_write(handle->file, header, 4 * sizeof(uint32_t));
|
||||
|
||||
handle->min_file_pos = sizeof(header) + state_size;
|
||||
handle->state_size = state_size;
|
||||
|
||||
if (state_size)
|
||||
{
|
||||
retro_ctx_serialize_info_t serial_info;
|
||||
|
||||
handle->state = (uint8_t*)malloc(state_size);
|
||||
if (!handle->state)
|
||||
return false;
|
||||
|
||||
serial_info.data = handle->state;
|
||||
serial_info.size = state_size;
|
||||
|
||||
core_serialize(&serial_info);
|
||||
|
||||
intfstream_write(handle->file,
|
||||
handle->state, state_size);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void bsv_movie_free(bsv_movie_t *handle)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
intfstream_close(handle->file);
|
||||
free(handle->file);
|
||||
|
||||
free(handle->state);
|
||||
free(handle->frame_pos);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
static bsv_movie_t *bsv_movie_init_internal(const char *path,
|
||||
enum rarch_movie_type type)
|
||||
{
|
||||
size_t *frame_pos = NULL;
|
||||
bsv_movie_t *handle = (bsv_movie_t*)calloc(1, sizeof(*handle));
|
||||
|
||||
if (!handle)
|
||||
return NULL;
|
||||
|
||||
if (type == RARCH_MOVIE_PLAYBACK)
|
||||
{
|
||||
if (!bsv_movie_init_playback(handle, path))
|
||||
goto error;
|
||||
}
|
||||
else if (!bsv_movie_init_record(handle, path))
|
||||
goto error;
|
||||
|
||||
/* Just pick something really large
|
||||
* ~1 million frames rewind should do the trick. */
|
||||
if (!(frame_pos = (size_t*)calloc((1 << 20), sizeof(size_t))))
|
||||
goto error;
|
||||
|
||||
handle->frame_pos = frame_pos;
|
||||
|
||||
handle->frame_pos[0] = handle->min_file_pos;
|
||||
handle->frame_mask = (1 << 20) - 1;
|
||||
|
||||
return handle;
|
||||
|
||||
error:
|
||||
bsv_movie_free(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void bsv_movie_frame_rewind(void)
|
||||
{
|
||||
bsv_movie_t *handle = bsv_movie_state_handle;
|
||||
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
handle->did_rewind = true;
|
||||
|
||||
if ( (handle->frame_ptr <= 1)
|
||||
&& (handle->frame_pos[0] == handle->min_file_pos))
|
||||
{
|
||||
/* If we're at the beginning... */
|
||||
handle->frame_ptr = 0;
|
||||
intfstream_seek(handle->file, (int)handle->min_file_pos, SEEK_SET);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First time rewind is performed, the old frame is simply replayed.
|
||||
* However, playing back that frame caused us to read data, and push
|
||||
* data to the ring buffer.
|
||||
*
|
||||
* Sucessively rewinding frames, we need to rewind past the read data,
|
||||
* plus another. */
|
||||
handle->frame_ptr = (handle->frame_ptr -
|
||||
(handle->first_rewind ? 1 : 2)) & handle->frame_mask;
|
||||
intfstream_seek(handle->file,
|
||||
(int)handle->frame_pos[handle->frame_ptr], SEEK_SET);
|
||||
}
|
||||
|
||||
if (intfstream_tell(handle->file) <= (long)handle->min_file_pos)
|
||||
{
|
||||
/* We rewound past the beginning. */
|
||||
|
||||
if (!handle->playback)
|
||||
{
|
||||
retro_ctx_serialize_info_t serial_info;
|
||||
|
||||
/* If recording, we simply reset
|
||||
* the starting point. Nice and easy. */
|
||||
|
||||
intfstream_seek(handle->file, 4 * sizeof(uint32_t), SEEK_SET);
|
||||
|
||||
serial_info.data = handle->state;
|
||||
serial_info.size = handle->state_size;
|
||||
|
||||
core_serialize(&serial_info);
|
||||
|
||||
intfstream_write(handle->file, handle->state, handle->state_size);
|
||||
}
|
||||
else
|
||||
intfstream_seek(handle->file, (int)handle->min_file_pos, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
static bool bsv_movie_init_handle(const char *path,
|
||||
enum rarch_movie_type type)
|
||||
{
|
||||
bsv_movie_t *state = bsv_movie_init_internal(path, type);
|
||||
if (!state)
|
||||
return false;
|
||||
|
||||
bsv_movie_state_handle = state;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bsv_movie_init(void)
|
||||
{
|
||||
bool set_granularity = false;
|
||||
|
||||
if (bsv_movie_state.movie_start_playback)
|
||||
{
|
||||
if (!bsv_movie_init_handle(bsv_movie_state.movie_start_path,
|
||||
RARCH_MOVIE_PLAYBACK))
|
||||
{
|
||||
RARCH_ERR("%s: \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_LOAD_MOVIE_FILE),
|
||||
bsv_movie_state.movie_start_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
bsv_movie_state.movie_playback = true;
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_STARTING_MOVIE_PLAYBACK),
|
||||
2, 180, false,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_STARTING_MOVIE_PLAYBACK));
|
||||
|
||||
set_granularity = true;
|
||||
}
|
||||
else if (bsv_movie_state.movie_start_recording)
|
||||
{
|
||||
if (!bsv_movie_init_handle(bsv_movie_state.movie_start_path,
|
||||
RARCH_MOVIE_RECORD))
|
||||
{
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
|
||||
1, 180, true,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_ERR("%s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
char msg[8192];
|
||||
snprintf(msg, sizeof(msg),
|
||||
"%s \"%s\".",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
bsv_movie_state.movie_start_path);
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_LOG("%s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
bsv_movie_state.movie_start_path);
|
||||
}
|
||||
|
||||
set_granularity = true;
|
||||
}
|
||||
|
||||
if (set_granularity)
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
configuration_set_uint(settings,
|
||||
settings->uints.rewind_granularity, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define bsv_movie_is_playback_on() (bsv_movie_state_handle && bsv_movie_state.movie_playback)
|
||||
#define bsv_movie_is_playback_off() (bsv_movie_state_handle && !bsv_movie_state.movie_playback)
|
||||
|
||||
bool bsv_movie_get_input(int16_t *bsv_data)
|
||||
{
|
||||
if (!bsv_movie_is_playback_on())
|
||||
return false;
|
||||
if (intfstream_read(bsv_movie_state_handle->file, bsv_data, 1) != 1)
|
||||
{
|
||||
bsv_movie_state.movie_end = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
*bsv_data = swap_if_big16(*bsv_data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bsv_movie_set_input(int16_t *bsv_data)
|
||||
{
|
||||
if (bsv_data && bsv_movie_is_playback_off())
|
||||
{
|
||||
*bsv_data = swap_if_big16(*bsv_data);
|
||||
intfstream_write(bsv_movie_state_handle->file, bsv_data, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void bsv_movie_set_path(const char *path)
|
||||
{
|
||||
strlcpy(bsv_movie_state.movie_path,
|
||||
path, sizeof(bsv_movie_state.movie_path));
|
||||
}
|
||||
|
||||
void bsv_movie_deinit(void)
|
||||
{
|
||||
if (!bsv_movie_state_handle)
|
||||
return;
|
||||
|
||||
bsv_movie_free(bsv_movie_state_handle);
|
||||
bsv_movie_state_handle = NULL;
|
||||
}
|
||||
|
||||
static bool runloop_check_movie_init(void)
|
||||
{
|
||||
char msg[16384], path[8192];
|
||||
settings_t *settings = configuration_settings;
|
||||
|
||||
msg[0] = path[0] = '\0';
|
||||
|
||||
configuration_set_uint(settings, settings->uints.rewind_granularity, 1);
|
||||
|
||||
if (settings->ints.state_slot > 0)
|
||||
snprintf(path, sizeof(path), "%s%d",
|
||||
bsv_movie_state.movie_path,
|
||||
settings->ints.state_slot);
|
||||
else
|
||||
strlcpy(path, bsv_movie_state.movie_path, sizeof(path));
|
||||
|
||||
strlcat(path,
|
||||
file_path_str(FILE_PATH_BSV_EXTENSION),
|
||||
sizeof(path));
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
path);
|
||||
|
||||
bsv_movie_init_handle(path, RARCH_MOVIE_RECORD);
|
||||
|
||||
if (!bsv_movie_state_handle)
|
||||
{
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
|
||||
2, 180, true,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_ERR("%s\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
|
||||
return false;
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(msg, 2, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_LOG("%s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bsv_movie_check(void)
|
||||
{
|
||||
if (!bsv_movie_state_handle)
|
||||
return runloop_check_movie_init();
|
||||
|
||||
if (bsv_movie_state.movie_playback)
|
||||
{
|
||||
/* Checks if movie is being played back. */
|
||||
if (!bsv_movie_state.movie_end)
|
||||
return false;
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED), 2, 180, false,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED));
|
||||
|
||||
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
|
||||
|
||||
bsv_movie_state.movie_end = false;
|
||||
bsv_movie_state.movie_playback = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Checks if movie is being recorded. */
|
||||
if (!bsv_movie_state_handle)
|
||||
return false;
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED), 2, 180, true,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED));
|
||||
|
||||
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Location */
|
||||
|
||||
static const location_driver_t *location_drivers[] = {
|
||||
@ -13814,18 +13317,6 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
|
||||
#endif
|
||||
case 'P':
|
||||
case 'R':
|
||||
strlcpy(bsv_movie_state.movie_start_path, optarg,
|
||||
sizeof(bsv_movie_state.movie_start_path));
|
||||
|
||||
if (c == 'P')
|
||||
bsv_movie_state.movie_start_playback = true;
|
||||
else
|
||||
bsv_movie_state.movie_start_playback = false;
|
||||
|
||||
if (c == 'R')
|
||||
bsv_movie_state.movie_start_recording = true;
|
||||
else
|
||||
bsv_movie_state.movie_start_recording = false;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
@ -13995,7 +13486,6 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
|
||||
exit(0);
|
||||
|
||||
case RA_OPT_EOF_EXIT:
|
||||
bsv_movie_state.eof_exit = true;
|
||||
break;
|
||||
|
||||
case RA_OPT_VERSION:
|
||||
@ -14488,8 +13978,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
case RARCH_CTL_LOCATION_UNSET_ACTIVE:
|
||||
location_driver_active = false;
|
||||
break;
|
||||
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:
|
||||
@ -14567,7 +14055,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
|
||||
command_event(CMD_EVENT_REWIND_DEINIT, NULL);
|
||||
command_event(CMD_EVENT_CHEATS_DEINIT, NULL);
|
||||
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
|
||||
|
||||
command_event(CMD_EVENT_CORE_DEINIT, NULL);
|
||||
|
||||
@ -15644,8 +15131,6 @@ void runloop_get_status(bool *is_paused, bool *is_idle,
|
||||
*is_perfcnt_enable = runloop_perfcnt_enable;
|
||||
}
|
||||
|
||||
#define bsv_movie_is_end_of_file() (bsv_movie_state.movie_end && bsv_movie_state.eof_exit)
|
||||
|
||||
/* Time to exit out of the main loop?
|
||||
* Reasons for exiting:
|
||||
* a) Shutdown environment callback was invoked.
|
||||
@ -15654,7 +15139,7 @@ void runloop_get_status(bool *is_paused, bool *is_idle,
|
||||
* d) Video driver no longer alive.
|
||||
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
|
||||
*/
|
||||
#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || bsv_movie_is_end_of_file() || ((runloop_max_frames != 0) && (frame_count >= runloop_max_frames)) || runloop_exec)
|
||||
#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || ((runloop_max_frames != 0) && (frame_count >= runloop_max_frames)) || runloop_exec)
|
||||
|
||||
#define runloop_check_cheevos() (settings->bools.cheevos_enable && rcheevos_loaded && (!rcheevos_cheats_are_enabled && !rcheevos_cheats_were_enabled))
|
||||
|
||||
@ -16527,9 +16012,6 @@ static enum runloop_state runloop_check_state(
|
||||
old_slowmotion_hold_button_state = new_slowmotion_hold_button_state;
|
||||
}
|
||||
|
||||
/* Check movie record toggle */
|
||||
HOTKEY_CHECK(RARCH_BSV_RECORD_TOGGLE, CMD_EVENT_BSV_RECORDING_TOGGLE, true, NULL);
|
||||
|
||||
/* Check shader prev/next */
|
||||
HOTKEY_CHECK(RARCH_SHADER_NEXT, CMD_EVENT_SHADER_NEXT, true, NULL);
|
||||
HOTKEY_CHECK(RARCH_SHADER_PREV, CMD_EVENT_SHADER_PREV, true, NULL);
|
||||
@ -16703,11 +16185,6 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
if (runloop_autosave)
|
||||
autosave_lock();
|
||||
|
||||
/* Used for rewinding while playback/record. */
|
||||
if (bsv_movie_state_handle)
|
||||
bsv_movie_state_handle->frame_pos[bsv_movie_state_handle->frame_ptr]
|
||||
= intfstream_tell(bsv_movie_state_handle->file);
|
||||
|
||||
if (camera_cb.caps && camera_driver && camera_driver->poll && camera_data)
|
||||
camera_driver->poll(camera_data,
|
||||
camera_cb.frame_raw_framebuffer,
|
||||
@ -16783,17 +16260,6 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
}
|
||||
}
|
||||
|
||||
if (bsv_movie_state_handle)
|
||||
{
|
||||
bsv_movie_state_handle->frame_ptr =
|
||||
(bsv_movie_state_handle->frame_ptr + 1)
|
||||
& bsv_movie_state_handle->frame_mask;
|
||||
|
||||
bsv_movie_state_handle->first_rewind =
|
||||
!bsv_movie_state_handle->did_rewind;
|
||||
bsv_movie_state_handle->did_rewind = false;
|
||||
}
|
||||
|
||||
if (runloop_autosave)
|
||||
autosave_unlock();
|
||||
|
||||
|
@ -833,7 +833,7 @@
|
||||
# Save all playlists/collections to this directory.
|
||||
# playlist_directory =
|
||||
|
||||
# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ...
|
||||
# Save all save files (*.srm) to this directory. This includes related files like .rtc, .psrm, etc ...
|
||||
# This will be overridden by explicit command line options.
|
||||
# savefile_directory =
|
||||
|
||||
|
25
retroarch.h
25
retroarch.h
@ -200,9 +200,6 @@ enum rarch_ctl_state
|
||||
RARCH_CTL_CAMERA_UNSET_ACTIVE,
|
||||
RARCH_CTL_CAMERA_SET_CB,
|
||||
|
||||
/* BSV Movie */
|
||||
RARCH_CTL_BSV_MOVIE_IS_INITED,
|
||||
|
||||
/* Location */
|
||||
RARCH_CTL_LOCATION_SET_ACTIVE,
|
||||
RARCH_CTL_LOCATION_UNSET_ACTIVE
|
||||
@ -2092,28 +2089,6 @@ extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||
extern const shader_backend_t gl_glsl_backend;
|
||||
extern const shader_backend_t gl_cg_backend;
|
||||
|
||||
/* BSV Movie */
|
||||
|
||||
enum rarch_movie_type
|
||||
{
|
||||
RARCH_MOVIE_PLAYBACK = 0,
|
||||
RARCH_MOVIE_RECORD
|
||||
};
|
||||
|
||||
void bsv_movie_deinit(void);
|
||||
|
||||
bool bsv_movie_init(void);
|
||||
|
||||
void bsv_movie_frame_rewind(void);
|
||||
|
||||
void bsv_movie_set_path(const char *path);
|
||||
|
||||
bool bsv_movie_get_input(int16_t *bsv_data);
|
||||
|
||||
void bsv_movie_set_input(int16_t *bsv_data);
|
||||
|
||||
bool bsv_movie_check(void);
|
||||
|
||||
/* Location */
|
||||
|
||||
typedef struct location_driver
|
||||
|
Loading…
x
Reference in New Issue
Block a user