Rewinding code should not be a forced built-in dependency

This commit is contained in:
libretroadmin 2023-03-17 16:08:41 +01:00
parent 1581ece9ea
commit 2902d11b1a
5 changed files with 50 additions and 13 deletions

View File

@ -174,12 +174,8 @@ LRESULT CALLBACK wnd_proc_d3d_common(HWND hwnd, UINT message,
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)
LRESULT CALLBACK wnd_proc_wgl_dinput(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_wgl_winraw(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_wgl_common(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
#endif
#if defined(HAVE_VULKAN)

View File

@ -84,6 +84,12 @@
#endif
#endif
/* Forward declarations */
LRESULT CALLBACK wnd_proc_wgl_common(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_wgl_dinput(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
static BOOL (APIENTRY *p_swap_interval)(int);
enum wgl_flags

View File

@ -4795,8 +4795,12 @@ void bsv_movie_next_frame(input_driver_state_t *input_st)
unsigned checkpoint_interval = settings->uints.replay_checkpoint_interval;
bsv_movie_t *handle = input_st->bsv_movie_state_handle;
if (!handle || state_manager_frame_is_reversed())
if (!handle)
return;
#ifdef HAVE_REWIND
if (state_manager_frame_is_reversed())
return;
#endif
if (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_RECORDING)
{

View File

@ -685,7 +685,12 @@ static bool content_write_serialized_state(void* buffer,
#ifdef HAVE_BSV_MOVIE
{
input_driver_state_t *input_st = input_state_get_ptr();
if (!rewind && input_st->bsv_movie_state.flags & (BSV_FLAG_MOVIE_RECORDING | BSV_FLAG_MOVIE_PLAYBACK) && !state_manager_frame_is_reversed())
#ifdef HAVE_REWIND
bool frame_is_reversed = state_manager_frame_is_reversed();
#else
bool frame_is_reversed = false;
#endif
if (!rewind && input_st->bsv_movie_state.flags & (BSV_FLAG_MOVIE_RECORDING | BSV_FLAG_MOVIE_PLAYBACK) && !frame_is_reversed)
{
content_write_block_header(output,
RASTATE_REPLAY_BLOCK, size->replay_size);
@ -1128,13 +1133,19 @@ static bool content_load_rastate1(unsigned char* input, size_t size)
#ifdef HAVE_BSV_MOVIE
{
input_driver_state_t *input_st = input_state_get_ptr();
if (BSV_MOVIE_IS_RECORDING() && !seen_replay && !state_manager_frame_is_reversed())
#ifdef HAVE_REWIND
bool frame_is_reversed = state_manager_frame_is_reversed();
#else
bool frame_is_reversed = false;
#endif
if (BSV_MOVIE_IS_RECORDING() && !seen_replay && !frame_is_reversed)
{
/* TODO OSD message */
RARCH_ERR("[Replay] Can't load state without replay data during recording.\n");
return false;
}
if (BSV_MOVIE_IS_PLAYBACK_ON() && !seen_replay && !state_manager_frame_is_reversed())
if (BSV_MOVIE_IS_PLAYBACK_ON() && !seen_replay && !frame_is_reversed)
{
/* TODO OSD message */
RARCH_WARN("[Replay] Loading state without replay data during replay will cancel replay.\n");
@ -1158,7 +1169,12 @@ static bool content_load_rastate1(unsigned char* input, size_t size)
else if (memcmp(marker, RASTATE_REPLAY_BLOCK, 4) == 0)
{
input_driver_state_t *input_st = input_state_get_ptr();
if (state_manager_frame_is_reversed() || replay_set_serialized_data((void*)input))
#ifdef HAVE_REWIND
bool frame_is_reversed = state_manager_frame_is_reversed();
#else
bool frame_is_reversed = false;
#endif
if (frame_is_reversed || replay_set_serialized_data((void*)input))
seen_replay = true;
else
return false;
@ -1180,8 +1196,15 @@ static bool content_load_rastate1(unsigned char* input, size_t size)
rcheevos_set_serialized_data(NULL);
#endif
#ifdef HAVE_BSV_MOVIE
if (!seen_replay && !state_manager_frame_is_reversed())
replay_set_serialized_data(NULL);
{
#ifdef HAVE_REWIND
bool frame_is_reversed = state_manager_frame_is_reversed();
#else
bool frame_is_reversed = false;
#endif
if (!seen_replay && !frame_is_reversed)
replay_set_serialized_data(NULL);
}
#endif
return true;
@ -1203,8 +1226,15 @@ bool content_deserialize_state(
rcheevos_set_serialized_data(NULL);
#endif
#ifdef HAVE_BSV_MOVIE
if(!state_manager_frame_is_reversed())
replay_set_serialized_data(NULL);
{
#ifdef HAVE_REWIND
bool frame_is_reversed = state_manager_frame_is_reversed();
#else
bool frame_is_reversed = false;
#endif
if (!frame_is_reversed)
replay_set_serialized_data(NULL);
}
#endif
}
else

View File

@ -13,6 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <compat/strl.h>
#include <retro_miscellaneous.h>