mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 19:21:27 +00:00
state_manager_check_rewind - cleanup
This commit is contained in:
parent
7594f6d4d7
commit
e626008f91
@ -20,13 +20,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <retro_inline.h>
|
#include <retro_inline.h>
|
||||||
|
#include <compat/strl.h>
|
||||||
#include <algorithms/mismatch.h>
|
#include <algorithms/mismatch.h>
|
||||||
|
|
||||||
#include "state_manager.h"
|
#include "state_manager.h"
|
||||||
#include "../msg_hash.h"
|
#include "../msg_hash.h"
|
||||||
#include "../movie.h"
|
#include "../movie.h"
|
||||||
#include "../core.h"
|
#include "../core.h"
|
||||||
#include "../runloop.h"
|
|
||||||
#include "../performance_counters.h"
|
#include "../performance_counters.h"
|
||||||
#include "../verbosity.h"
|
#include "../verbosity.h"
|
||||||
#include "../audio/audio_driver.h"
|
#include "../audio/audio_driver.h"
|
||||||
@ -577,9 +577,11 @@ void state_manager_event_deinit(void)
|
|||||||
*
|
*
|
||||||
* Checks if rewind toggle/hold was being pressed and/or held.
|
* Checks if rewind toggle/hold was being pressed and/or held.
|
||||||
**/
|
**/
|
||||||
void state_manager_check_rewind(bool pressed,
|
bool state_manager_check_rewind(bool pressed,
|
||||||
unsigned rewind_granularity, bool is_paused)
|
unsigned rewind_granularity, bool is_paused,
|
||||||
|
char *s, size_t len, unsigned *time)
|
||||||
{
|
{
|
||||||
|
bool ret = false;
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
|
|
||||||
if (state_manager_frame_is_reversed())
|
if (state_manager_frame_is_reversed())
|
||||||
@ -591,11 +593,11 @@ void state_manager_check_rewind(bool pressed,
|
|||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
first = false;
|
first = false;
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rewind_state.state)
|
if (!rewind_state.state)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (pressed)
|
if (pressed)
|
||||||
{
|
{
|
||||||
@ -609,9 +611,10 @@ void state_manager_check_rewind(bool pressed,
|
|||||||
|
|
||||||
audio_driver_setup_rewind();
|
audio_driver_setup_rewind();
|
||||||
|
|
||||||
runloop_msg_queue_push(
|
strlcpy(s, msg_hash_to_str(MSG_REWINDING), len);
|
||||||
msg_hash_to_str(MSG_REWINDING), 0,
|
|
||||||
is_paused ? 1 : 30, true);
|
*time = is_paused ? 1 : 30;
|
||||||
|
ret = true;
|
||||||
|
|
||||||
serial_info.data_const = buf;
|
serial_info.data_const = buf;
|
||||||
serial_info.size = rewind_state.size;
|
serial_info.size = rewind_state.size;
|
||||||
@ -627,9 +630,13 @@ void state_manager_check_rewind(bool pressed,
|
|||||||
serial_info.data_const = buf;
|
serial_info.data_const = buf;
|
||||||
serial_info.size = rewind_state.size;
|
serial_info.size = rewind_state.size;
|
||||||
core_unserialize(&serial_info);
|
core_unserialize(&serial_info);
|
||||||
runloop_msg_queue_push(
|
|
||||||
|
strlcpy(s,
|
||||||
msg_hash_to_str(MSG_REWIND_REACHED_END),
|
msg_hash_to_str(MSG_REWIND_REACHED_END),
|
||||||
0, 30, true);
|
len);
|
||||||
|
|
||||||
|
*time = 30;
|
||||||
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -662,4 +669,6 @@ void state_manager_check_rewind(bool pressed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
core_set_rewind_callbacks();
|
core_set_rewind_callbacks();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,9 @@ void state_manager_event_init(unsigned rewind_buffer_size);
|
|||||||
*
|
*
|
||||||
* Checks if rewind toggle/hold was being pressed and/or held.
|
* Checks if rewind toggle/hold was being pressed and/or held.
|
||||||
**/
|
**/
|
||||||
void state_manager_check_rewind(bool pressed, unsigned rewind_granularity, bool is_paused);
|
bool state_manager_check_rewind(bool pressed,
|
||||||
|
unsigned rewind_granularity, bool is_paused,
|
||||||
|
char *s, size_t len, unsigned *time);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
|
12
runloop.c
12
runloop.c
@ -967,8 +967,16 @@ static enum runloop_state runloop_check_state(
|
|||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (!settings->cheevos.hardcore_mode_enable)
|
if (!settings->cheevos.hardcore_mode_enable)
|
||||||
#endif
|
#endif
|
||||||
state_manager_check_rewind(runloop_cmd_press(current_input, RARCH_REWIND),
|
{
|
||||||
settings->rewind_granularity, runloop_paused);
|
char s[128];
|
||||||
|
unsigned t = 0;
|
||||||
|
|
||||||
|
s[0] = '\0';
|
||||||
|
|
||||||
|
if (state_manager_check_rewind(runloop_cmd_press(current_input, RARCH_REWIND),
|
||||||
|
settings->rewind_granularity, runloop_paused, s, sizeof(s), &t))
|
||||||
|
runloop_msg_queue_push(s, 0, t, true);
|
||||||
|
}
|
||||||
|
|
||||||
runloop_slowmotion = runloop_cmd_press(current_input, RARCH_SLOWMOTION);
|
runloop_slowmotion = runloop_cmd_press(current_input, RARCH_SLOWMOTION);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user