mirror of
https://github.com/libretro/RetroArch
synced 2025-04-11 00:44:20 +00:00
More runloop_state changes
This commit is contained in:
parent
d1c7d97b10
commit
364d518726
462
retroarch.c
462
retroarch.c
File diff suppressed because it is too large
Load Diff
55
retroarch.h
55
retroarch.h
@ -31,6 +31,8 @@
|
|||||||
#include <rthreads/rthreads.h>
|
#include <rthreads/rthreads.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <streams/interface_stream.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@ -87,6 +89,16 @@ RETRO_BEGIN_DECLS
|
|||||||
#define MEASURE_FRAME_TIME_SAMPLES_COUNT (2 * 1024)
|
#define MEASURE_FRAME_TIME_SAMPLES_COUNT (2 * 1024)
|
||||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||||
|
|
||||||
|
#ifdef HAVE_BSV_MOVIE
|
||||||
|
#define BSV_MAGIC 0x42535631
|
||||||
|
|
||||||
|
#define BSV_MOVIE_IS_PLAYBACK_ON(runloop) (runloop->bsv_movie_state_handle && runloop->bsv_movie_state.movie_playback)
|
||||||
|
#define BSV_MOVIE_IS_PLAYBACK_OFF(runloop) (runloop->bsv_movie_state_handle && !runloop->bsv_movie_state.movie_playback)
|
||||||
|
#define BSV_MOVIE_IS_EOF(runloop) || (runloop->bsv_movie_state.movie_end && runloop->bsv_movie_state.eof_exit)
|
||||||
|
#else
|
||||||
|
#define BSV_MOVIE_IS_EOF(runloop)
|
||||||
|
#endif
|
||||||
|
|
||||||
enum rarch_ctl_state
|
enum rarch_ctl_state
|
||||||
{
|
{
|
||||||
RARCH_CTL_NONE = 0,
|
RARCH_CTL_NONE = 0,
|
||||||
@ -208,6 +220,42 @@ enum runloop_action
|
|||||||
RUNLOOP_ACTION_AUTOSAVE
|
RUNLOOP_ACTION_AUTOSAVE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_BSV_MOVIE
|
||||||
|
struct bsv_state
|
||||||
|
{
|
||||||
|
/* Movie playback/recording support. */
|
||||||
|
char movie_path[PATH_MAX_LENGTH];
|
||||||
|
/* Immediate playback/recording. */
|
||||||
|
char movie_start_path[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
|
bool movie_start_recording;
|
||||||
|
bool movie_start_playback;
|
||||||
|
bool movie_playback;
|
||||||
|
bool eof_exit;
|
||||||
|
bool movie_end;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bsv_movie
|
||||||
|
{
|
||||||
|
intfstream_t *file;
|
||||||
|
uint8_t *state;
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
bool playback;
|
||||||
|
bool first_rewind;
|
||||||
|
bool did_rewind;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct bsv_movie bsv_movie_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct rarch_main_wrap
|
struct rarch_main_wrap
|
||||||
{
|
{
|
||||||
char **argv;
|
char **argv;
|
||||||
@ -2088,6 +2136,9 @@ struct runloop
|
|||||||
rarch_system_info_t system; /* ptr alignment */
|
rarch_system_info_t system; /* ptr alignment */
|
||||||
struct retro_frame_time_callback frame_time; /* ptr alignment */
|
struct retro_frame_time_callback frame_time; /* ptr alignment */
|
||||||
struct retro_audio_buffer_status_callback audio_buffer_status; /* ptr alignment */
|
struct retro_audio_buffer_status_callback audio_buffer_status; /* ptr alignment */
|
||||||
|
#ifdef HAVE_BSV_MOVIE
|
||||||
|
bsv_movie_t *bsv_movie_state_handle; /* ptr alignment */
|
||||||
|
#endif
|
||||||
|
|
||||||
void *audio_context_audio_data;
|
void *audio_context_audio_data;
|
||||||
void *audio_resampler_data;
|
void *audio_resampler_data;
|
||||||
@ -2120,6 +2171,10 @@ struct runloop
|
|||||||
float audio_mixer_volume_gain;
|
float audio_mixer_volume_gain;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_BSV_MOVIE
|
||||||
|
struct bsv_state bsv_movie_state; /* char alignment */
|
||||||
|
#endif
|
||||||
|
|
||||||
input_game_focus_state_t game_focus_state; /* bool alignment */
|
input_game_focus_state_t game_focus_state; /* bool alignment */
|
||||||
#ifdef HAVE_GFX_WIDGETS
|
#ifdef HAVE_GFX_WIDGETS
|
||||||
bool widgets_active;
|
bool widgets_active;
|
||||||
|
@ -67,12 +67,6 @@
|
|||||||
#define CRC_INDEX 2
|
#define CRC_INDEX 2
|
||||||
#define STATE_SIZE_INDEX 3
|
#define STATE_SIZE_INDEX 3
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
|
||||||
#define BSV_MAGIC 0x42535631
|
|
||||||
|
|
||||||
#define BSV_MOVIE_IS_PLAYBACK_ON() (p_rarch->bsv_movie_state_handle && p_rarch->bsv_movie_state.movie_playback)
|
|
||||||
#define BSV_MOVIE_IS_PLAYBACK_OFF() (p_rarch->bsv_movie_state_handle && !p_rarch->bsv_movie_state.movie_playback)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TIME_TO_FPS(last_time, new_time, frames) ((1000000.0f * (frames)) / ((new_time) - (last_time)))
|
#define TIME_TO_FPS(last_time, new_time, frames) ((1000000.0f * (frames)) / ((new_time) - (last_time)))
|
||||||
|
|
||||||
@ -165,12 +159,6 @@
|
|||||||
#define RUNLOOP_MSG_QUEUE_UNLOCK(p_runloop)
|
#define RUNLOOP_MSG_QUEUE_UNLOCK(p_runloop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
|
||||||
#define BSV_MOVIE_IS_EOF(p_rarch) || (p_rarch->bsv_movie_state.movie_end && p_rarch->bsv_movie_state.eof_exit)
|
|
||||||
#else
|
|
||||||
#define BSV_MOVIE_IS_EOF(p_rarch)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Time to exit out of the main loop?
|
/* Time to exit out of the main loop?
|
||||||
* Reasons for exiting:
|
* Reasons for exiting:
|
||||||
* a) Shutdown environment callback was invoked.
|
* a) Shutdown environment callback was invoked.
|
||||||
@ -179,7 +167,7 @@
|
|||||||
* d) Video driver no longer alive.
|
* d) Video driver no longer alive.
|
||||||
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
|
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
|
||||||
*/
|
*/
|
||||||
#define TIME_TO_EXIT(quit_key_pressed) (runloop_state.shutdown_initiated || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF(p_rarch) || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
|
#define TIME_TO_EXIT(quit_key_pressed) (runloop_state.shutdown_initiated || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF(p_runloop) || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
|
||||||
|
|
||||||
/* Depends on ASCII character values */
|
/* Depends on ASCII character values */
|
||||||
#define ISPRINT(c) (((int)(c) >= ' ' && (int)(c) <= '~') ? 1 : 0)
|
#define ISPRINT(c) (((int)(c) >= ' ' && (int)(c) <= '~') ? 1 : 0)
|
||||||
@ -1315,40 +1303,6 @@ struct rarch_dir_shader_list
|
|||||||
bool remember_last_preset_dir;
|
bool remember_last_preset_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
|
||||||
struct bsv_state
|
|
||||||
{
|
|
||||||
/* Movie playback/recording support. */
|
|
||||||
char movie_path[PATH_MAX_LENGTH];
|
|
||||||
/* Immediate playback/recording. */
|
|
||||||
char movie_start_path[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
bool movie_start_recording;
|
|
||||||
bool movie_start_playback;
|
|
||||||
bool movie_playback;
|
|
||||||
bool eof_exit;
|
|
||||||
bool movie_end;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bsv_movie
|
|
||||||
{
|
|
||||||
intfstream_t *file;
|
|
||||||
uint8_t *state;
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
bool playback;
|
|
||||||
bool first_rewind;
|
|
||||||
bool did_rewind;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct video_pixel_scaler
|
typedef struct video_pixel_scaler
|
||||||
{
|
{
|
||||||
struct scaler_ctx *scaler;
|
struct scaler_ctx *scaler;
|
||||||
@ -1378,10 +1332,6 @@ struct input_remote
|
|||||||
bool state[RARCH_BIND_LIST_END];
|
bool state[RARCH_BIND_LIST_END];
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
|
||||||
typedef struct bsv_movie bsv_movie_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct input_remote input_remote_t;
|
typedef struct input_remote input_remote_t;
|
||||||
|
|
||||||
typedef struct input_remote_state
|
typedef struct input_remote_state
|
||||||
@ -1822,9 +1772,6 @@ struct rarch_state
|
|||||||
const input_device_driver_t *joypad; /* ptr alignment */
|
const input_device_driver_t *joypad; /* ptr alignment */
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
const input_device_driver_t *sec_joypad; /* ptr alignment */
|
const input_device_driver_t *sec_joypad; /* ptr alignment */
|
||||||
#endif
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
|
||||||
bsv_movie_t *bsv_movie_state_handle; /* ptr alignment */
|
|
||||||
#endif
|
#endif
|
||||||
gfx_display_t dispgfx; /* ptr alignment */
|
gfx_display_t dispgfx; /* ptr alignment */
|
||||||
input_keyboard_press_t keyboard_press_cb; /* ptr alignment */
|
input_keyboard_press_t keyboard_press_cb; /* ptr alignment */
|
||||||
@ -1987,9 +1934,6 @@ struct rarch_state
|
|||||||
retro_bits_t has_set_libretro_device; /* uint32_t alignment */
|
retro_bits_t has_set_libretro_device; /* uint32_t alignment */
|
||||||
input_mapper_t input_driver_mapper; /* uint32_t alignment */
|
input_mapper_t input_driver_mapper; /* uint32_t alignment */
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
|
||||||
struct bsv_state bsv_movie_state; /* char alignment */
|
|
||||||
#endif
|
|
||||||
char cached_video_driver[32];
|
char cached_video_driver[32];
|
||||||
char video_driver_title_buf[64];
|
char video_driver_title_buf[64];
|
||||||
char video_driver_gpu_device_string[128];
|
char video_driver_gpu_device_string[128];
|
||||||
|
@ -131,9 +131,9 @@ static bool video_driver_find_driver(
|
|||||||
const char *prefix, bool verbosity_enabled);
|
const char *prefix, bool verbosity_enabled);
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
#ifdef HAVE_BSV_MOVIE
|
||||||
static void bsv_movie_deinit(struct rarch_state *p_rarch);
|
static void bsv_movie_deinit(runloop_state_t *p_runloop);
|
||||||
static bool bsv_movie_init(struct rarch_state *p_rarch);
|
static bool bsv_movie_init(runloop_state_t *p_runloop);
|
||||||
static bool bsv_movie_check(struct rarch_state *p_rarch,
|
static bool bsv_movie_check(runloop_state_t *p_runloop,
|
||||||
settings_t *settings);
|
settings_t *settings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user