Move init_rewind to rewind.c

This commit is contained in:
twinaphex 2015-04-11 13:36:33 +02:00
parent 7f56e5c214
commit 40c64b3302
3 changed files with 49 additions and 45 deletions

View file

@ -920,51 +920,6 @@ static void init_cheats(void)
/* TODO/FIXME - add some stuff here. */
}
static void init_rewind(void)
{
void *state = NULL;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
(void)driver;
#ifdef HAVE_NETPLAY
if (driver->netplay_data)
return;
#endif
if (!settings->rewind_enable || global->rewind.state)
return;
if (global->system.audio_callback.callback)
{
RARCH_ERR(RETRO_LOG_REWIND_INIT_FAILED_THREADED_AUDIO);
return;
}
global->rewind.size = pretro_serialize_size();
if (!global->rewind.size)
{
RARCH_ERR(RETRO_LOG_REWIND_INIT_FAILED_NO_SAVESTATES);
return;
}
RARCH_LOG(RETRO_MSG_REWIND_INIT "%u MB\n",
(unsigned)(settings->rewind_buffer_size / 1000000));
global->rewind.state = state_manager_new(global->rewind.size,
settings->rewind_buffer_size);
if (!global->rewind.state)
RARCH_WARN(RETRO_LOG_REWIND_INIT_FAILED);
state_manager_push_where(global->rewind.state, &state);
pretro_serialize(state, global->rewind.size);
state_manager_push_do(global->rewind.state);
}
static void init_movie(void)
{
settings_t *settings = config_get_ptr();

View file

@ -22,6 +22,8 @@
#include <stdint.h>
#include <string.h>
#include <retro_inline.h>
#include "intl/intl.h"
#include "dynamic.h"
#ifndef UINT16_MAX
#define UINT16_MAX 0xffff
@ -522,3 +524,48 @@ void state_manager_capacity(state_manager_t *state,
if (full)
*full = remaining <= state->maxcompsize * 2;
}
void init_rewind(void)
{
void *state = NULL;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
(void)driver;
#ifdef HAVE_NETPLAY
if (driver->netplay_data)
return;
#endif
if (!settings->rewind_enable || global->rewind.state)
return;
if (global->system.audio_callback.callback)
{
RARCH_ERR(RETRO_LOG_REWIND_INIT_FAILED_THREADED_AUDIO);
return;
}
global->rewind.size = pretro_serialize_size();
if (!global->rewind.size)
{
RARCH_ERR(RETRO_LOG_REWIND_INIT_FAILED_NO_SAVESTATES);
return;
}
RARCH_LOG(RETRO_MSG_REWIND_INIT "%u MB\n",
(unsigned)(settings->rewind_buffer_size / 1000000));
global->rewind.state = state_manager_new(global->rewind.size,
settings->rewind_buffer_size);
if (!global->rewind.state)
RARCH_WARN(RETRO_LOG_REWIND_INIT_FAILED);
state_manager_push_where(global->rewind.state, &state);
pretro_serialize(state, global->rewind.size);
state_manager_push_do(global->rewind.state);
}

View file

@ -40,6 +40,8 @@ void state_manager_push_do(state_manager_t *state);
void state_manager_capacity(state_manager_t *state,
unsigned int *entries, size_t *bytes, bool *full);
void init_rewind(void);
#ifdef __cplusplus
}
#endif