mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 00:40:09 +00:00
Update msg_hash.c
This commit is contained in:
parent
42b7c15129
commit
d4dcf784c9
@ -20,6 +20,16 @@ const char *msg_hash_to_str_us(uint32_t hash)
|
|||||||
{
|
{
|
||||||
switch (hash)
|
switch (hash)
|
||||||
{
|
{
|
||||||
|
case MSG_DOWNLOAD_PROGRESS:
|
||||||
|
return "Download progress";
|
||||||
|
case MSG_COULD_NOT_PROCESS_ZIP_FILE:
|
||||||
|
return "Could not process ZIP file.";
|
||||||
|
case MSG_DOWNLOAD_COMPLETE:
|
||||||
|
return "Download complete";
|
||||||
|
case MSG_SCANNING_OF_DIRECTORY_FINISHED:
|
||||||
|
return "Scanning of directory finished";
|
||||||
|
case MSG_SCANNING:
|
||||||
|
return "Scanning";
|
||||||
case MSG_REDIRECTING_CHEATFILE_TO:
|
case MSG_REDIRECTING_CHEATFILE_TO:
|
||||||
return "Redirecting cheat file to";
|
return "Redirecting cheat file to";
|
||||||
case MSG_REDIRECTING_SAVEFILE_TO:
|
case MSG_REDIRECTING_SAVEFILE_TO:
|
||||||
|
@ -41,6 +41,13 @@
|
|||||||
#define MSG_REDIRECTING_SAVEFILE_TO 0x868c54a5U
|
#define MSG_REDIRECTING_SAVEFILE_TO 0x868c54a5U
|
||||||
#define MSG_REDIRECTING_CHEATFILE_TO 0xd5f1b27bU
|
#define MSG_REDIRECTING_CHEATFILE_TO 0xd5f1b27bU
|
||||||
|
|
||||||
|
#define MSG_SCANNING 0x4c547516U
|
||||||
|
#define MSG_SCANNING_OF_DIRECTORY_FINISHED 0x399632a7U
|
||||||
|
|
||||||
|
#define MSG_DOWNLOAD_COMPLETE 0x4b9c4f75U
|
||||||
|
#define MSG_COULD_NOT_PROCESS_ZIP_FILE 0xc18c89bbU
|
||||||
|
#define MSG_DOWNLOAD_PROGRESS 0x35ed9411U
|
||||||
|
|
||||||
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);
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
#include <compat/strcasestr.h>
|
#include <compat/strcasestr.h>
|
||||||
#include <compat/strl.h>
|
#include <compat/strl.h>
|
||||||
|
|
||||||
#include <rhash.h>
|
|
||||||
|
|
||||||
#include "../dir_list_special.h"
|
#include "../dir_list_special.h"
|
||||||
#include "../file_ops.h"
|
#include "../file_ops.h"
|
||||||
|
#include "../msg_hash.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
#include "../runloop_data.h"
|
#include "../runloop_data.h"
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
@ -58,11 +56,14 @@ static int database_info_iterate_start
|
|||||||
|
|
||||||
snprintf(msg, sizeof(msg),
|
snprintf(msg, sizeof(msg),
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
"%Iu/%Iu: Scanning %s...\n",
|
"%Iu/%Iu: %s %s...\n",
|
||||||
#else
|
#else
|
||||||
"%zu/%zu: Scanning %s...\n",
|
"%zu/%zu: %s %s...\n",
|
||||||
#endif
|
#endif
|
||||||
db->list_ptr, db->list->size, name);
|
db->list_ptr,
|
||||||
|
db->list->size,
|
||||||
|
msg_hash_to_str(MSG_SCANNING),
|
||||||
|
name);
|
||||||
|
|
||||||
if (msg[0] != '\0')
|
if (msg[0] != '\0')
|
||||||
rarch_main_msg_queue_push(msg, 1, 180, true);
|
rarch_main_msg_queue_push(msg, 1, 180, true);
|
||||||
@ -85,7 +86,7 @@ static int database_info_iterate_playlist(
|
|||||||
|
|
||||||
path_parent_dir(parent_dir);
|
path_parent_dir(parent_dir);
|
||||||
|
|
||||||
extension_hash = djb2_calculate(path_get_extension(name));
|
extension_hash = msg_hash_calculate(path_get_extension(name));
|
||||||
|
|
||||||
switch (extension_hash)
|
switch (extension_hash)
|
||||||
{
|
{
|
||||||
@ -151,13 +152,6 @@ static int database_info_list_iterate_new(database_state_handle_t *db_state, con
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO/FIXME -
|
|
||||||
* * - What 'core' to bind a playlist entry to if
|
|
||||||
* we are in Load Content (Detect Core)? Let the user
|
|
||||||
* choose the core to be loaded with it upon selecting
|
|
||||||
* the playlist entry?
|
|
||||||
* * - Implement ZIP handling.
|
|
||||||
**/
|
|
||||||
static int database_info_list_iterate_found_match(
|
static int database_info_list_iterate_found_match(
|
||||||
database_state_handle_t *db_state,
|
database_state_handle_t *db_state,
|
||||||
database_info_handle_t *db,
|
database_info_handle_t *db,
|
||||||
@ -168,13 +162,14 @@ static int database_info_list_iterate_found_match(
|
|||||||
char db_playlist_path[PATH_MAX_LENGTH] = {0};
|
char db_playlist_path[PATH_MAX_LENGTH] = {0};
|
||||||
char db_playlist_base_str[PATH_MAX_LENGTH] = {0};
|
char db_playlist_base_str[PATH_MAX_LENGTH] = {0};
|
||||||
char entry_path_str[PATH_MAX_LENGTH] = {0};
|
char entry_path_str[PATH_MAX_LENGTH] = {0};
|
||||||
content_playlist_t *playlist = NULL;
|
content_playlist_t *playlist = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
const char *db_path = db_state->list->elems[db_state->list_index].data;
|
const char *db_path = db_state->list->elems[db_state->list_index].data;
|
||||||
const char *entry_path = db ? db->list->elems[db->list_ptr].data : NULL;
|
const char *entry_path = db ? db->list->elems[db->list_ptr].data : NULL;
|
||||||
database_info_t *db_info_entry = &db_state->info->list[db_state->entry_index];
|
database_info_t *db_info_entry = &db_state->info->list[db_state->entry_index];
|
||||||
|
|
||||||
fill_short_pathname_representation(db_playlist_base_str, db_path, sizeof(db_playlist_base_str));
|
fill_short_pathname_representation(db_playlist_base_str,
|
||||||
|
db_path, sizeof(db_playlist_base_str));
|
||||||
|
|
||||||
path_remove_extension(db_playlist_base_str);
|
path_remove_extension(db_playlist_base_str);
|
||||||
|
|
||||||
@ -205,7 +200,8 @@ static int database_info_list_iterate_found_match(
|
|||||||
RARCH_LOG("entry path str: %s\n", entry_path_str);
|
RARCH_LOG("entry path str: %s\n", entry_path_str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
content_playlist_push(playlist, entry_path_str, db_info_entry->name, "DETECT", "DETECT", db_crc, db_playlist_base_str);
|
content_playlist_push(playlist, entry_path_str,
|
||||||
|
db_info_entry->name, "DETECT", "DETECT", db_crc, db_playlist_base_str);
|
||||||
|
|
||||||
content_playlist_write_file(playlist);
|
content_playlist_write_file(playlist);
|
||||||
content_playlist_free(playlist);
|
content_playlist_free(playlist);
|
||||||
@ -296,9 +292,6 @@ static int database_info_iterate_playlist_zip(
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int database_info_iterate(database_state_handle_t *state, database_info_handle_t *db)
|
static int database_info_iterate(database_state_handle_t *state, database_info_handle_t *db)
|
||||||
{
|
{
|
||||||
const char *name = db ? db->list->elems[db->list_ptr].data : NULL;
|
const char *name = db ? db->list->elems[db->list_ptr].data : NULL;
|
||||||
@ -342,7 +335,7 @@ static int database_info_poll(db_handle_t *db)
|
|||||||
if (str_list->size > 0)
|
if (str_list->size > 0)
|
||||||
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));
|
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));
|
||||||
if (str_list->size > 1)
|
if (str_list->size > 1)
|
||||||
cb_type_hash = djb2_calculate(str_list->elems[1].data);
|
cb_type_hash = msg_hash_calculate(str_list->elems[1].data);
|
||||||
|
|
||||||
switch (cb_type_hash)
|
switch (cb_type_hash)
|
||||||
{
|
{
|
||||||
@ -413,7 +406,7 @@ void rarch_main_data_db_iterate(bool is_thread, void *data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rarch_main_msg_queue_push("Scanning of directory finished.\n", 0, 180, true);
|
rarch_main_msg_queue_push_new(MSG_SCANNING_OF_DIRECTORY_FINISHED, 0, 180, true);
|
||||||
db->status = DATABASE_STATUS_FREE;
|
db->status = DATABASE_STATUS_FREE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include <string/string_list.h>
|
#include <string/string_list.h>
|
||||||
#include <compat/strl.h>
|
#include <compat/strl.h>
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
#include <rhash.h>
|
|
||||||
#include <net/net_compat.h>
|
#include <net/net_compat.h>
|
||||||
|
|
||||||
#include "../file_ops.h"
|
#include "../file_ops.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
#include "../msg_hash.h"
|
||||||
#include "../runloop_data.h"
|
#include "../runloop_data.h"
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
|
|
||||||
@ -102,10 +102,10 @@ static int cb_generic_download(void *data, size_t len,
|
|||||||
if (!write_file(output_path, data, len))
|
if (!write_file(output_path, data, len))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
snprintf(msg, sizeof(msg), "Download complete: %s.",
|
snprintf(msg, sizeof(msg), "%s: %s.",
|
||||||
|
msg_hash_to_str(MSG_DOWNLOAD_COMPLETE),
|
||||||
core_updater_path);
|
core_updater_path);
|
||||||
|
|
||||||
|
|
||||||
rarch_main_msg_queue_push(msg, 1, 90, true);
|
rarch_main_msg_queue_push(msg, 1, 90, true);
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
@ -118,7 +118,7 @@ static int cb_generic_download(void *data, size_t len,
|
|||||||
{
|
{
|
||||||
if (!zlib_parse_file(output_path, NULL, zlib_extract_core_callback,
|
if (!zlib_parse_file(output_path, NULL, zlib_extract_core_callback,
|
||||||
(void*)dir_path))
|
(void*)dir_path))
|
||||||
RARCH_LOG("Could not process ZIP file.\n");
|
RARCH_LOG(msg_hash_to_str(MSG_COULD_NOT_PROCESS_ZIP_FILE));
|
||||||
|
|
||||||
if (path_file_exists(output_path))
|
if (path_file_exists(output_path))
|
||||||
remove(output_path);
|
remove(output_path);
|
||||||
@ -251,7 +251,7 @@ static int cb_http_conn_default(void *data_, size_t len)
|
|||||||
|
|
||||||
if (http->connection.elem1[0] != '\0')
|
if (http->connection.elem1[0] != '\0')
|
||||||
{
|
{
|
||||||
uint32_t label_hash = djb2_calculate(http->connection.elem1);
|
uint32_t label_hash = msg_hash_calculate(http->connection.elem1);
|
||||||
|
|
||||||
switch (label_hash)
|
switch (label_hash)
|
||||||
{
|
{
|
||||||
@ -352,27 +352,29 @@ static int rarch_main_data_http_iterate_poll(http_handle_t *http)
|
|||||||
**/
|
**/
|
||||||
static int rarch_main_data_http_iterate_transfer(void *data)
|
static int rarch_main_data_http_iterate_transfer(void *data)
|
||||||
{
|
{
|
||||||
http_handle_t *http = (http_handle_t*)data;
|
http_handle_t *http = (http_handle_t*)data;
|
||||||
size_t pos = 0, tot = 0;
|
size_t pos = 0, tot = 0;
|
||||||
int percent = 0;
|
int percent = 0;
|
||||||
if (!net_http_update(http->handle, &pos, &tot))
|
|
||||||
{
|
if (!net_http_update(http->handle, &pos, &tot))
|
||||||
if(tot != 0)
|
{
|
||||||
percent=(unsigned long long)pos*100/(unsigned long long)tot;
|
if(tot != 0)
|
||||||
else
|
percent = (unsigned long long)pos * 100
|
||||||
percent=0;
|
/ (unsigned long long)tot;
|
||||||
|
|
||||||
if (percent > 0)
|
if (percent > 0)
|
||||||
{
|
{
|
||||||
char tmp[PATH_MAX_LENGTH] = {0};
|
char tmp[PATH_MAX_LENGTH] = {0};
|
||||||
snprintf(tmp, sizeof(tmp), "Download progress: %d%%", percent);
|
snprintf(tmp, sizeof(tmp), "%s: %d%%",
|
||||||
data_runloop_osd_msg(tmp, sizeof(tmp));
|
msg_hash_to_str(MSG_DOWNLOAD_PROGRESS),
|
||||||
}
|
percent);
|
||||||
|
data_runloop_osd_msg(tmp, sizeof(tmp));
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
return -1;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rarch_main_data_http_iterate(bool is_thread, void *data)
|
void rarch_main_data_http_iterate(bool is_thread, void *data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user