mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
Split off user_language from settings struct
This commit is contained in:
parent
15142be8ee
commit
eddb655eb9
@ -1354,7 +1354,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("netplay_input_latency_frames_range",&settings->uints.netplay_input_latency_frames_range, true, 0, false);
|
||||
#endif
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
SETTING_UINT("user_language", &settings->uints.user_language, true, RETRO_LANGUAGE_ENGLISH, false);
|
||||
SETTING_UINT("user_language", msg_hash_get_uint(MSG_HASH_USER_LANGUAGE), true, RETRO_LANGUAGE_ENGLISH, false);
|
||||
#endif
|
||||
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
|
||||
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
|
||||
|
@ -282,9 +282,6 @@ typedef struct settings
|
||||
unsigned autosave_interval;
|
||||
unsigned network_cmd_port;
|
||||
unsigned network_remote_base_port;
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
unsigned user_language;
|
||||
#endif
|
||||
unsigned video_window_x;
|
||||
unsigned video_window_y;
|
||||
unsigned video_monitor_index;
|
||||
|
@ -1077,9 +1077,11 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_LANGUAGE:
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
*(unsigned *)data = settings->uints.user_language;
|
||||
RARCH_LOG("Environ GET_LANGUAGE: \"%u\".\n",
|
||||
settings->uints.user_language);
|
||||
{
|
||||
unsigned user_lang = *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE);
|
||||
*(unsigned *)data = user_lang;
|
||||
RARCH_LOG("Environ GET_LANGUAGE: \"%u\".\n", user_lang);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -512,7 +512,6 @@ static void setting_get_string_representation_uint_user_language(void *data,
|
||||
char *s, size_t len)
|
||||
{
|
||||
const char *modes[RETRO_LANGUAGE_LAST];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
modes[RETRO_LANGUAGE_ENGLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ENGLISH);
|
||||
modes[RETRO_LANGUAGE_JAPANESE] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_JAPANESE);
|
||||
@ -531,8 +530,7 @@ static void setting_get_string_representation_uint_user_language(void *data,
|
||||
modes[RETRO_LANGUAGE_POLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_POLISH);
|
||||
modes[RETRO_LANGUAGE_VIETNAMESE] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE);
|
||||
|
||||
if (settings)
|
||||
strlcpy(s, modes[settings->uints.user_language], len);
|
||||
strlcpy(s, modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], len);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -6220,7 +6218,7 @@ static bool setting_append_list(
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->uints.user_language,
|
||||
msg_hash_get_uint(MSG_HASH_USER_LANGUAGE),
|
||||
MENU_ENUM_LABEL_USER_LANGUAGE,
|
||||
MENU_ENUM_LABEL_VALUE_USER_LANGUAGE,
|
||||
def_user_language,
|
||||
|
41
msg_hash.c
41
msg_hash.c
@ -27,18 +27,14 @@
|
||||
|
||||
#include "msg_hash.h"
|
||||
|
||||
#include "configuration.h"
|
||||
static unsigned uint_user_language;
|
||||
|
||||
int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
{
|
||||
int ret = -1;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
goto end;
|
||||
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
switch (settings->uints.user_language)
|
||||
switch (uint_user_language)
|
||||
{
|
||||
case RETRO_LANGUAGE_FRENCH:
|
||||
ret = menu_hash_get_help_fr_enum(msg, s, len);
|
||||
@ -87,20 +83,15 @@ int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
if (ret == 0)
|
||||
return ret;
|
||||
|
||||
end:
|
||||
return menu_hash_get_help_us_enum(msg, s, len);
|
||||
}
|
||||
|
||||
const char *msg_hash_to_str(enum msg_hash_enums msg)
|
||||
{
|
||||
const char *ret = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
goto end;
|
||||
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
switch (settings->uints.user_language)
|
||||
switch (uint_user_language)
|
||||
{
|
||||
case RETRO_LANGUAGE_FRENCH:
|
||||
ret = msg_hash_to_str_fr(msg);
|
||||
@ -152,7 +143,6 @@ const char *msg_hash_to_str(enum msg_hash_enums msg)
|
||||
if (ret && (memcmp(ret, "null", 4) != 0))
|
||||
return ret;
|
||||
|
||||
end:
|
||||
return msg_hash_to_str_us(msg);
|
||||
}
|
||||
|
||||
@ -379,3 +369,28 @@ enum msg_file_type msg_hash_to_file_type(uint32_t hash)
|
||||
|
||||
return FILE_TYPE_NONE;
|
||||
}
|
||||
|
||||
unsigned *msg_hash_get_uint(enum msg_hash_action type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MSG_HASH_USER_LANGUAGE:
|
||||
return &uint_user_language;
|
||||
case MSG_HASH_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void msg_hash_set_uint(enum msg_hash_action type, unsigned val)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MSG_HASH_USER_LANGUAGE:
|
||||
uint_user_language = val;
|
||||
break;
|
||||
case MSG_HASH_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
10
msg_hash.h
10
msg_hash.h
@ -29,6 +29,12 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
enum msg_hash_action
|
||||
{
|
||||
MSG_HASH_NONE = 0,
|
||||
MSG_HASH_USER_LANGUAGE
|
||||
};
|
||||
|
||||
enum msg_file_type
|
||||
{
|
||||
FILE_TYPE_NONE = 0,
|
||||
@ -1875,6 +1881,10 @@ int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len);
|
||||
|
||||
enum msg_file_type msg_hash_to_file_type(uint32_t hash);
|
||||
|
||||
unsigned *msg_hash_get_uint(enum msg_hash_action type);
|
||||
|
||||
void msg_hash_set_uint(enum msg_hash_action type, unsigned val);
|
||||
|
||||
uint32_t msg_hash_calculate(const char *s);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user