(command.c) Translatable strings

This commit is contained in:
twinaphex 2015-07-02 00:29:02 +02:00
parent cfe89eb148
commit 934bf2cda1
3 changed files with 26 additions and 7 deletions

View File

@ -27,10 +27,10 @@
#include <compat/posix_string.h>
#include <file/file_path.h>
#include <retro_miscellaneous.h>
#include <rhash.h>
#include <net/net_compat.h>
#include "msg_hash.h"
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
#include "netplay.h"
#endif
@ -230,7 +230,7 @@ static bool cmd_set_shader(const char *arg)
char msg[PATH_MAX_LENGTH] = {0};
enum rarch_shader_type type = RARCH_SHADER_NONE;
const char *ext = path_get_extension(arg);
uint32_t ext_hash = djb2_calculate(ext);
uint32_t ext_hash = msg_hash_calculate(ext);
switch (ext_hash)
{
@ -248,7 +248,9 @@ static bool cmd_set_shader(const char *arg)
snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg);
rarch_main_msg_queue_push(msg, 1, 120, true);
RARCH_LOG("Applying shader \"%s\".\n", arg);
RARCH_LOG("%s \"%s\".\n",
msg_hash_to_str(MSG_APPLYING_SHADER),
arg);
return video_driver_set_shader(type, arg);
}
@ -314,7 +316,10 @@ static void parse_sub_msg(rarch_cmd_t *handle, const char *tok)
handle->state[map[index].id] = true;
}
else
RARCH_WARN("Unrecognized command \"%s\" received.\n", tok);
RARCH_WARN("%s \"%s\" %s.\n",
msg_hash_to_str(MSG_UNRECOGNIZED_COMMAND),
tok,
msg_hash_to_str(MSG_RECEIVED));
}
static void parse_msg(rarch_cmd_t *handle, char *buf)
@ -619,7 +624,7 @@ bool network_cmd_send(const char *cmd_)
const char *host = NULL;
const char *port_ = NULL;
global_t *global = global_get_ptr();
bool old_verbose = global->verbosity;
bool old_verbose = global ? global->verbosity : false;
uint16_t port = DEFAULT_NETWORK_CMD_PORT;
if (!network_init())
@ -648,7 +653,8 @@ bool network_cmd_send(const char *cmd_)
if (port_)
port = strtoul(port_, NULL, 0);
RARCH_LOG("Sending command: \"%s\" to %s:%hu\n",
RARCH_LOG("%s: \"%s\" to %s:%hu\n",
msg_hash_to_str(MSG_SENDING_COMMAND),
cmd, host, (unsigned short)port);
ret = verify_command(cmd) && send_udp_packet(host, port, cmd);

View File

@ -20,6 +20,12 @@ const char *msg_hash_to_str_us(uint32_t hash)
{
switch (hash)
{
case MSG_RECEIVED:
return "received";
case MSG_UNRECOGNIZED_COMMAND:
return "Unrecognized command";
case MSG_SENDING_COMMAND:
return "Sending command";
case MSG_GOT_INVALID_DISK_INDEX:
return "Got invalid disk index.";
case MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY:

View File

@ -21,6 +21,13 @@
#include <stdint.h>
#include <stddef.h>
#define MSG_RECEIVED 0xfe0c06acU
#define MSG_UNRECOGNIZED_COMMAND 0x946b8a50U
#define MSG_SENDING_COMMAND 0x562cf28bU
#define MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT 0x5aa753b8U
#define MSG_REWINDING 0xccbeec2cU