mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
Update msg_hash code
This commit is contained in:
parent
a4aee891aa
commit
42b7c15129
@ -20,10 +20,26 @@ const char *msg_hash_to_str_us(uint32_t hash)
|
|||||||
{
|
{
|
||||||
switch (hash)
|
switch (hash)
|
||||||
{
|
{
|
||||||
case MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT:
|
case MSG_REDIRECTING_CHEATFILE_TO:
|
||||||
return "Restarting recording due to driver reinit.";
|
return "Redirecting cheat file to";
|
||||||
|
case MSG_REDIRECTING_SAVEFILE_TO:
|
||||||
|
return "Redirecting save file to";
|
||||||
|
case MSG_REDIRECTING_SAVESTATE_TO:
|
||||||
|
return "Redirecting savestate to";
|
||||||
|
case MSG_SHADER:
|
||||||
|
return "Shader";
|
||||||
|
case MSG_APPLYING_SHADER:
|
||||||
|
return "Applying shader";
|
||||||
|
case MSG_FAILED_TO_APPLY_SHADER:
|
||||||
|
return "Failed to apply shader.";
|
||||||
|
case MSG_STARTING_MOVIE_RECORD_TO:
|
||||||
|
return "Starting movie record to";
|
||||||
case MSG_FAILED_TO_START_MOVIE_RECORD:
|
case MSG_FAILED_TO_START_MOVIE_RECORD:
|
||||||
return "Failed to start movie record.";
|
return "Failed to start movie record.";
|
||||||
|
case MSG_STATE_SLOT:
|
||||||
|
return "State slot";
|
||||||
|
case MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT:
|
||||||
|
return "Restarting recording due to driver reinit.";
|
||||||
case MSG_SLOW_MOTION:
|
case MSG_SLOW_MOTION:
|
||||||
return "Slow motion.";
|
return "Slow motion.";
|
||||||
case MSG_SLOW_MOTION_REWIND:
|
case MSG_SLOW_MOTION_REWIND:
|
||||||
|
14
msg_hash.h
14
msg_hash.h
@ -29,6 +29,18 @@
|
|||||||
#define MSG_REWIND_REACHED_END 0x4f1aab8fU
|
#define MSG_REWIND_REACHED_END 0x4f1aab8fU
|
||||||
#define MSG_FAILED_TO_START_MOVIE_RECORD 0x61221776U
|
#define MSG_FAILED_TO_START_MOVIE_RECORD 0x61221776U
|
||||||
|
|
||||||
|
#define MSG_STATE_SLOT 0x27b67f67U
|
||||||
|
#define MSG_STARTING_MOVIE_RECORD_TO 0x6a7e0d50U
|
||||||
|
#define MSG_FAILED_TO_START_MOVIE_RECORD 0x61221776U
|
||||||
|
|
||||||
|
#define MSG_FAILED_TO_APPLY_SHADER 0x2094eb67U
|
||||||
|
#define MSG_APPLYING_SHADER 0x35599b7fU
|
||||||
|
#define MSG_SHADER 0x1bb1211cU
|
||||||
|
|
||||||
|
#define MSG_REDIRECTING_SAVESTATE_TO 0x8d98f7a6U
|
||||||
|
#define MSG_REDIRECTING_SAVEFILE_TO 0x868c54a5U
|
||||||
|
#define MSG_REDIRECTING_CHEATFILE_TO 0xd5f1b27bU
|
||||||
|
|
||||||
const char *msg_hash_to_str(uint32_t hash);
|
const char *msg_hash_to_str(uint32_t hash);
|
||||||
|
|
||||||
const char *msg_hash_to_str_fr(uint32_t hash);
|
const char *msg_hash_to_str_fr(uint32_t hash);
|
||||||
@ -47,5 +59,7 @@ const char *msg_hash_to_str_nl(uint32_t hash);
|
|||||||
|
|
||||||
const char *msg_hash_to_str_us(uint32_t hash);
|
const char *msg_hash_to_str_us(uint32_t hash);
|
||||||
|
|
||||||
|
uint32_t msg_hash_calculate(const char *s);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
30
retroarch.c
30
retroarch.c
@ -22,10 +22,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
|
||||||
#ifdef HAVE_FFMPEG
|
|
||||||
#include <rhash.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
#include <xtl.h>
|
#include <xtl.h>
|
||||||
@ -40,7 +36,7 @@
|
|||||||
#include <compat/posix_string.h>
|
#include <compat/posix_string.h>
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
|
|
||||||
#include <rhash.h>
|
#include "msg_hash.h"
|
||||||
|
|
||||||
#include "libretro_version_1.h"
|
#include "libretro_version_1.h"
|
||||||
#include "dynamic.h"
|
#include "dynamic.h"
|
||||||
@ -305,7 +301,8 @@ static void set_special_paths(char **argv, unsigned num_content)
|
|||||||
{
|
{
|
||||||
fill_pathname_dir(global->savestate_name, global->basename,
|
fill_pathname_dir(global->savestate_name, global->basename,
|
||||||
".state", sizeof(global->savestate_name));
|
".state", sizeof(global->savestate_name));
|
||||||
RARCH_LOG("Redirecting save state to \"%s\".\n",
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO),
|
||||||
global->savestate_name);
|
global->savestate_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +322,7 @@ void set_paths_redirect(const char *path)
|
|||||||
|
|
||||||
uint32_t global_library_name_hash = ((global && info->info.library_name &&
|
uint32_t global_library_name_hash = ((global && info->info.library_name &&
|
||||||
(info->info.library_name[0] != '\0'))
|
(info->info.library_name[0] != '\0'))
|
||||||
? djb2_calculate(info->info.library_name) : 0);
|
? msg_hash_calculate(info->info.library_name) : 0);
|
||||||
|
|
||||||
if(
|
if(
|
||||||
global_library_name_hash != 0 &&
|
global_library_name_hash != 0 &&
|
||||||
@ -381,21 +378,27 @@ void set_paths_redirect(const char *path)
|
|||||||
{
|
{
|
||||||
fill_pathname_dir(global->savefile_name, global->basename,
|
fill_pathname_dir(global->savefile_name, global->basename,
|
||||||
".srm", sizeof(global->savefile_name));
|
".srm", sizeof(global->savefile_name));
|
||||||
RARCH_LOG("Redirecting save file to \"%s\".\n", global->savefile_name);
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO),
|
||||||
|
global->savefile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path_is_directory(global->savestate_name))
|
if (path_is_directory(global->savestate_name))
|
||||||
{
|
{
|
||||||
fill_pathname_dir(global->savestate_name, global->basename,
|
fill_pathname_dir(global->savestate_name, global->basename,
|
||||||
".state", sizeof(global->savestate_name));
|
".state", sizeof(global->savestate_name));
|
||||||
RARCH_LOG("Redirecting save state to \"%s\".\n", global->savestate_name);
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO),
|
||||||
|
global->savestate_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path_is_directory(global->cheatfile_name))
|
if (path_is_directory(global->cheatfile_name))
|
||||||
{
|
{
|
||||||
fill_pathname_dir(global->cheatfile_name, global->basename,
|
fill_pathname_dir(global->cheatfile_name, global->basename,
|
||||||
".state", sizeof(global->cheatfile_name));
|
".state", sizeof(global->cheatfile_name));
|
||||||
RARCH_LOG("Redirecting cheat file to \"%s\".\n", global->cheatfile_name);
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_REDIRECTING_CHEATFILE_TO),
|
||||||
|
global->cheatfile_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +432,7 @@ void rarch_set_paths(const char *path)
|
|||||||
|
|
||||||
enum rarch_content_type rarch_path_is_media_type(const char *path)
|
enum rarch_content_type rarch_path_is_media_type(const char *path)
|
||||||
{
|
{
|
||||||
uint32_t hash_ext = djb2_calculate(path_get_extension(path));
|
uint32_t hash_ext = msg_hash_calculate(path_get_extension(path));
|
||||||
|
|
||||||
switch (hash_ext)
|
switch (hash_ext)
|
||||||
{
|
{
|
||||||
@ -965,7 +968,8 @@ static void rarch_init_savefile_paths(void)
|
|||||||
{
|
{
|
||||||
fill_pathname_dir(global->savefile_name, global->basename, ".srm",
|
fill_pathname_dir(global->savefile_name, global->basename, ".srm",
|
||||||
sizeof(global->savefile_name));
|
sizeof(global->savefile_name));
|
||||||
RARCH_LOG("Redirecting save file to \"%s\".\n",
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO),
|
||||||
global->savefile_name);
|
global->savefile_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1530,7 +1534,7 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
|
|||||||
size_t supported = 0;
|
size_t supported = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
uint32_t menu_label_hash = djb2_calculate(menu_label);
|
uint32_t menu_label_hash = msg_hash_calculate(menu_label);
|
||||||
|
|
||||||
fill_pathname_join(s, dir, path, len);
|
fill_pathname_join(s, dir, path, len);
|
||||||
|
|
||||||
|
22
runloop.c
22
runloop.c
@ -142,7 +142,8 @@ static void check_stateslots(bool pressed_increase, bool pressed_decrease)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
snprintf(msg, sizeof(msg), "State slot: %d",
|
snprintf(msg, sizeof(msg), "%s: %d",
|
||||||
|
msg_hash_to_str(MSG_STATE_SLOT),
|
||||||
settings->state_slot);
|
settings->state_slot);
|
||||||
|
|
||||||
rarch_main_msg_queue_push(msg, 1, 180, true);
|
rarch_main_msg_queue_push(msg, 1, 180, true);
|
||||||
@ -268,7 +269,9 @@ static bool check_movie_init(void)
|
|||||||
strlcpy(path, global->bsv.movie_path, sizeof(path));
|
strlcpy(path, global->bsv.movie_path, sizeof(path));
|
||||||
strlcat(path, ".bsv", sizeof(path));
|
strlcat(path, ".bsv", sizeof(path));
|
||||||
|
|
||||||
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\".", path);
|
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
||||||
|
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||||
|
path);
|
||||||
|
|
||||||
global->bsv.movie = bsv_movie_init(path, RARCH_MOVIE_RECORD);
|
global->bsv.movie = bsv_movie_init(path, RARCH_MOVIE_RECORD);
|
||||||
|
|
||||||
@ -279,14 +282,16 @@ static bool check_movie_init(void)
|
|||||||
if (global->bsv.movie)
|
if (global->bsv.movie)
|
||||||
{
|
{
|
||||||
rarch_main_msg_queue_push(msg, 1, 180, true);
|
rarch_main_msg_queue_push(msg, 1, 180, true);
|
||||||
RARCH_LOG("Starting movie record to \"%s\".\n", path);
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||||
|
path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rarch_main_msg_queue_push_new(
|
rarch_main_msg_queue_push_new(
|
||||||
MSG_FAILED_TO_START_MOVIE_RECORD,
|
MSG_FAILED_TO_START_MOVIE_RECORD,
|
||||||
1, 180, true);
|
1, 180, true);
|
||||||
RARCH_ERR("Failed to start movie record.\n");
|
RARCH_ERR(msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -411,13 +416,16 @@ static void check_shader_dir(bool pressed_next, bool pressed_prev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(msg, sizeof(msg), "Shader #%u: \"%s\".",
|
snprintf(msg, sizeof(msg), "%s #%u: \"%s\".",
|
||||||
|
msg_hash_to_str(MSG_SHADER),
|
||||||
(unsigned)global->shader_dir.ptr, shader);
|
(unsigned)global->shader_dir.ptr, shader);
|
||||||
rarch_main_msg_queue_push(msg, 1, 120, true);
|
rarch_main_msg_queue_push(msg, 1, 120, true);
|
||||||
RARCH_LOG("Applying shader \"%s\".\n", shader);
|
RARCH_LOG("%s \"%s\".\n",
|
||||||
|
msg_hash_to_str(MSG_APPLYING_SHADER),
|
||||||
|
shader);
|
||||||
|
|
||||||
if (!video_driver_set_shader(type, shader))
|
if (!video_driver_set_shader(type, shader))
|
||||||
RARCH_WARN("Failed to apply shader.\n");
|
RARCH_WARN(msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
|
Loading…
x
Reference in New Issue
Block a user