diff --git a/content.c b/content.c index c898a9cf0f..0a4550a2a9 100644 --- a/content.c +++ b/content.c @@ -33,8 +33,8 @@ #include #include #include -#include +#include "msg_hash.h" #include "content.h" #include "file_ops.h" #include "general.h" @@ -149,7 +149,9 @@ bool save_state(const char *path) void *data = NULL; size_t size = pretro_serialize_size(); - RARCH_LOG("Saving state: \"%s\".\n", path); + RARCH_LOG("%s: \"%s\".\n", + msg_hash_to_str(MSG_SAVING_STATE), + path); if (size == 0) return false; @@ -162,14 +164,18 @@ bool save_state(const char *path) return false; } - RARCH_LOG("State size: %d bytes.\n", (int)size); + RARCH_LOG("%s: %d bytes.\n", + msg_hash_to_str(MSG_STATE_SIZE), + (int)size); ret = pretro_serialize(data, size); if (ret) ret = write_file(path, data, size); if (!ret) - RARCH_ERR("Failed to save state to \"%s\".\n", path); + RARCH_ERR("%s \"%s\".\n", + msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), + path); free(data); @@ -195,7 +201,9 @@ bool load_state(const char *path) global_t *global = global_get_ptr(); bool ret = read_file(path, &buf, &size); - RARCH_LOG("Loading state: \"%s\".\n", path); + RARCH_LOG("%s: \"%s\".\n", + msg_hash_to_str(MSG_LOADING_STATE), + path); if (!ret || size < 0) { @@ -203,7 +211,9 @@ bool load_state(const char *path) return false; } - RARCH_LOG("State size: %u bytes.\n", (unsigned)size); + RARCH_LOG("%s: %u bytes.\n", + msg_hash_to_str(MSG_STATE_SIZE), + (unsigned)size); if (settings->block_sram_overwrite && global->savefiles && global->savefiles->size) @@ -318,7 +328,8 @@ void save_ram_file(const char *path, int type) if (!write_file(path, data, size)) { - RARCH_ERR("Failed to save SRAM.\n"); + RARCH_ERR("%s.\n", + msg_hash_to_str(MSG_FAILED_TO_SAVE_SRAM)); RARCH_WARN("Attempting to recover ...\n"); dump_to_file_desperate(data, size, type); return; diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index b825b82759..1fae1a589c 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -40,6 +40,10 @@ const char *msg_hash_to_str_us(uint32_t hash) return "to"; case MSG_SAVING_RAM_TYPE: return "Saving RAM type"; + case MSG_SAVING_STATE: + return "Saving state"; + case MSG_LOADING_STATE: + return "Loading state"; case MSG_FAILED_TO_LOAD_MOVIE_FILE: return "Failed to load movie file"; case MSG_GRAB_MOUSE_STATE: @@ -60,6 +64,12 @@ const char *msg_hash_to_str_us(uint32_t hash) return "Reset"; case MSG_FAILED_TO_LOAD_STATE: return "Failed to load state from"; + case MSG_FAILED_TO_SAVE_STATE_TO: + return "Failed to save state to"; + case MSG_FAILED_TO_SAVE_SRAM: + return "Failed to save SRAM"; + case MSG_STATE_SIZE: + return "State size"; case MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES: return "Core does not support save states."; case MSG_SAVED_STATE_TO_SLOT: diff --git a/msg_hash.h b/msg_hash.h index 78e356b6e7..d5ecf0fdec 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -24,6 +24,12 @@ #define MSG_RECEIVED 0xfe0c06acU +#define MSG_SAVING_STATE 0xe4f3eb4dU +#define MSG_LOADING_STATE 0x68d8d483U +#define MSG_FAILED_TO_SAVE_STATE_TO 0xcc005f3cU +#define MSG_FAILED_TO_SAVE_SRAM 0x0f72de6cU +#define MSG_STATE_SIZE 0x27b67400U + #define MSG_UNRECOGNIZED_COMMAND 0x946b8a50U #define MSG_SENDING_COMMAND 0x562cf28bU