(rewind.c) Updates

This commit is contained in:
twinaphex 2015-07-02 18:23:18 +02:00
parent 25466ea19f
commit e0bf3b4ae4
5 changed files with 20 additions and 22 deletions

View File

@ -692,8 +692,6 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
if (audio_driver_write(output_data, output_frames * output_size * 2) < 0)
{
RARCH_ERR(RETRO_LOG_AUDIO_WRITE_FAILED);
driver->audio_active = false;
return false;
}

View File

@ -83,8 +83,6 @@
#define TERM_STR "\n"
#define RETRO_MSG_TAKE_SCREENSHOT_ERROR "Cannot take screenshot. GPU rendering is used and read_viewport is not supported."
#define RETRO_MSG_AUDIO_WRITE_FAILED "Audio backend failed to write. Will continue without sound."
#define RETRO_MSG_MOVIE_STARTED_INIT_NETPLAY_FAILED "Movie playback has started. Cannot start netplay."
#define RETRO_MSG_INIT_NETPLAY_FAILED "Failed to initialize netplay."
#define RETRO_MSG_INIT_AUTOSAVE_FAILED "Could not initialize autosave."
@ -92,16 +90,7 @@
#define RETRO_MSG_MOVIE_PLAYBACK_ENDED "Movie playback ended."
#define RETRO_MSG_LIBRETRO_ABI_BREAK RETRO_FRONTEND " is compiled against a different version of libretro than this libretro implementation."
#define RETRO_MSG_RESETTING_CONTENT "Resetting content."
#define RETRO_MSG_REWIND_INIT "Initializing rewind buffer with size: "
#define RETRO_MSG_REWIND_INIT_FAILED "Failed to initialize rewind buffer. Rewinding will be disabled"
#define RETRO_MSG_REWIND_INIT_FAILED_NO_SAVESTATES "Implementation does not support save states. Cannot use rewind."
#define RETRO_MSG_REWIND_INIT_FAILED_THREADED_AUDIO "Implementation uses threaded audio. Cannot use rewind."
#define RETRO_LOG_INIT_RECORDING_FAILED RETRO_MSG_INIT_RECORDING_FAILED TERM_STR
#define RETRO_LOG_TAKE_SCREENSHOT RETRO_MSG_TAKE_SCREENSHOT TERM_STR
#define RETRO_LOG_TAKE_SCREENSHOT_FAILED RETRO_MSG_TAKE_SCREENSHOT_FAILED TERM_STR
#define RETRO_LOG_TAKE_SCREENSHOT_ERROR RETRO_MSG_TAKE_SCREENSHOT_ERROR TERM_STR
#define RETRO_LOG_AUDIO_WRITE_FAILED RETRO_MSG_AUDIO_WRITE_FAILED TERM_STR
#define RETRO_LOG_MOVIE_STARTED_INIT_NETPLAY_FAILED RETRO_MSG_MOVIE_STARTED_INIT_NETPLAY_FAILED TERM_STR
#define RETRO_LOG_INIT_NETPLAY_FAILED RETRO_MSG_INIT_NETPLAY_FAILED TERM_STR
#define RETRO_LOG_INIT_AUTOSAVE_FAILED RETRO_MSG_INIT_AUTOSAVE_FAILED TERM_STR
@ -111,9 +100,5 @@
#define RETRO_LOG_MOVIE_PLAYBACK_ENDED RETRO_MSG_MOVIE_PLAYBACK_ENDED TERM_STR
#define RETRO_LOG_LIBRETRO_ABI_BREAK RETRO_MSG_LIBRETRO_ABI_BREAK RETRO_FRONTEND TERM_STR
#define RETRO_LOG_RESETTING_CONTENT RETRO_MSG_RESETTING_CONTENT TERM_STR
#define RETRO_LOG_REWIND_INIT RETRO_MSG_REWIND_INIT TERM_STR
#define RETRO_LOG_REWIND_INIT_FAILED RETRO_MSG_REWIND_INIT_FAILED TERM_STR
#define RETRO_LOG_REWIND_INIT_FAILED_NO_SAVESTATES RETRO_MSG_REWIND_INIT_FAILED_NO_SAVESTATES TERM_STR
#define RETRO_LOG_REWIND_INIT_FAILED_THREADED_AUDIO RETRO_MSG_REWIND_INIT_FAILED_THREADED_AUDIO TERM_STR
#endif

View File

@ -20,6 +20,14 @@ const char *msg_hash_to_str_us(uint32_t hash)
{
switch (hash)
{
case MSG_REWIND_INIT_FAILED_NO_SAVESTATES:
return "Implementation does not support save states. Cannot use rewind.";
case MSG_REWIND_INIT_FAILED_THREADED_AUDIO:
return "Implementation uses threaded audio. Cannot use rewind.";
case MSG_REWIND_INIT_FAILED:
return "Failed to initialize rewind buffer. Rewinding will be disabled.";
case MSG_REWIND_INIT:
return "Initializing rewind buffer with size";
case MSG_CUSTOM_TIMING_GIVEN:
return "Custom timing given";
case MSG_VIEWPORT_SIZE_CALCULATION_FAILED:

View File

@ -31,6 +31,11 @@
#define MSG_RECORDING_TERMINATED_DUE_TO_RESIZE 0x361a07feU
#define MSG_FAILED_TO_START_RECORDING 0x90c3e2d5U
#define MSG_REWIND_INIT 0xf7732001U
#define MSG_REWIND_INIT_FAILED 0x9c1db0a6U
#define MSG_REWIND_INIT_FAILED_THREADED_AUDIO 0x359001b6U
#define MSG_REWIND_INIT_FAILED_NO_SAVESTATES 0x979b9cc3U
#define MSG_DETECTED_VIEWPORT_OF 0xdf7002baU
#define MSG_RECORDING_TO 0x189fd324U
#define MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING 0x7f9f7659U

View File

@ -21,9 +21,9 @@
#include <stdlib.h>
#include <string.h>
#include <retro_inline.h>
#include "intl/intl.h"
#include "dynamic.h"
#include "general.h"
#include "msg_hash.h"
#ifndef UINT16_MAX
#define UINT16_MAX 0xffff
@ -565,7 +565,7 @@ void init_rewind(void)
if (audio_driver_has_callback())
{
RARCH_ERR(RETRO_LOG_REWIND_INIT_FAILED_THREADED_AUDIO);
RARCH_ERR("%s.\n", msg_hash_to_str(MSG_REWIND_INIT_FAILED));
return;
}
@ -573,18 +573,20 @@ void init_rewind(void)
if (!global->rewind.size)
{
RARCH_ERR(RETRO_LOG_REWIND_INIT_FAILED_NO_SAVESTATES);
RARCH_ERR("%s.\n",
msg_hash_to_str(MSG_REWIND_INIT_FAILED_THREADED_AUDIO));
return;
}
RARCH_LOG(RETRO_MSG_REWIND_INIT "%u MB\n",
RARCH_LOG("%s: %u MB\n",
msg_hash_to_str(MSG_REWIND_INIT),
(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);
RARCH_WARN("%s.\n", msg_hash_to_str(MSG_REWIND_INIT_FAILED));
state_manager_push_where(global->rewind.state, &state);
pretro_serialize(state, global->rewind.size);