Cleanups -

* Less string copies
* Some general cleanups
* Add extra param to runloop_message_queue_push so we can pass size_t
of the message
* Consistent conventions for local variable usage for certain things
This commit is contained in:
LibretroAdmin 2024-12-27 15:13:45 +01:00
parent ed58e4a8d8
commit 18c85b5ccd
49 changed files with 1399 additions and 1255 deletions

View File

@ -135,8 +135,9 @@ static void *sdl_microphone_open_mic(void *driver_context,
#if __APPLE__ #if __APPLE__
if (!string_is_equal(audio_driver_get_ident(), "sdl2")) if (!string_is_equal(audio_driver_get_ident(), "sdl2"))
{ {
runloop_msg_queue_push( const char *msg = msg_hash_to_str(MSG_SDL2_MIC_NEEDS_SDL2_AUDIO),msg_hash_to_str(MSG_SDL2_MIC_NEEDS_SDL2_AUDIO);
msg_hash_to_str(MSG_SDL2_MIC_NEEDS_SDL2_AUDIO), 1, 100, true, NULL, runloop_msg_queue_push(msg, strlen(msg),
1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return NULL; return NULL;
} }
@ -155,7 +156,7 @@ static void *sdl_microphone_open_mic(void *driver_context,
/* Only print SDL audio devices if verbose logging is enabled */ /* Only print SDL audio devices if verbose logging is enabled */
if (verbosity_is_enabled()) if (verbosity_is_enabled())
{ {
int i; int i;
int num_available_microphones = SDL_GetNumAudioDevices(true); int num_available_microphones = SDL_GetNumAudioDevices(true);
RARCH_DBG("[SDL mic]: %d audio capture devices found:\n", num_available_microphones); RARCH_DBG("[SDL mic]: %d audio capture devices found:\n", num_available_microphones);

View File

@ -40,6 +40,7 @@ static void bluetoothctl_free(void *data)
static void bluetoothctl_scan(void *data) static void bluetoothctl_scan(void *data)
{ {
char line[512]; char line[512];
const char *msg;
union string_list_elem_attr attr; union string_list_elem_attr attr;
FILE *dev_file = NULL; FILE *dev_file = NULL;
bluetoothctl_t *btctl = (bluetoothctl_t*) data; bluetoothctl_t *btctl = (bluetoothctl_t*) data;
@ -53,7 +54,9 @@ static void bluetoothctl_scan(void *data)
pclose(popen("bluetoothctl --timeout 10 scan on", "r")); pclose(popen("bluetoothctl --timeout 10 scan on", "r"));
runloop_msg_queue_push(msg_hash_to_str(MSG_BLUETOOTH_SCAN_COMPLETE), msg = msg_hash_to_str(MSG_BLUETOOTH_SCAN_COMPLETE);
runloop_msg_queue_push(msg, strlen(msg),
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
@ -199,6 +202,7 @@ static bool bluetoothctl_connect_device(void *data, unsigned idx)
static bool bluetoothctl_remove_device(void *data, unsigned idx) static bool bluetoothctl_remove_device(void *data, unsigned idx)
{ {
unsigned i; unsigned i;
const char *msg = NULL;
bluetoothctl_t *btctl = (bluetoothctl_t*) data; bluetoothctl_t *btctl = (bluetoothctl_t*) data;
char device[18] = {0}; char device[18] = {0};
const char *line = btctl->lines->elems[idx].data; const char *line = btctl->lines->elems[idx].data;
@ -208,8 +212,7 @@ static bool bluetoothctl_remove_device(void *data, unsigned idx)
* $ bluetoothctl devices * $ bluetoothctl devices
* 'Device (mac address) (device name)' * 'Device (mac address) (device name)'
*/ */
list = string_split(line, " "); if (!(list = string_split(line, " ")))
if (!list)
return false; return false;
if (list->size == 0) if (list->size == 0)
@ -227,7 +230,9 @@ static bool bluetoothctl_remove_device(void *data, unsigned idx)
pclose(popen(btctl->command, "r")); pclose(popen(btctl->command, "r"));
runloop_msg_queue_push(msg_hash_to_str(MSG_BLUETOOTH_PAIRING_REMOVED), msg = msg_hash_to_str(MSG_BLUETOOTH_PAIRING_REMOVED);
runloop_msg_queue_push(msg, strlen(msg),
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);

View File

@ -276,18 +276,18 @@ static int get_default_adapter(bluez_t *bluez, DBusMessage *reply)
do do
{ {
/* empty array? */ /* empty array? */
if (DBUS_TYPE_INVALID == if (DBUS_TYPE_INVALID ==
dbus_message_iter_get_arg_type(&array_2_iter)) dbus_message_iter_get_arg_type(&array_2_iter))
continue; continue;
/* a{oa{...}} */ /* a{oa{...}} */
if (DBUS_TYPE_DICT_ENTRY != if (DBUS_TYPE_DICT_ENTRY !=
dbus_message_iter_get_arg_type(&array_2_iter)) dbus_message_iter_get_arg_type(&array_2_iter))
return 1; return 1;
dbus_message_iter_recurse(&array_2_iter, &dict_2_iter); dbus_message_iter_recurse(&array_2_iter, &dict_2_iter);
/* a{oa{s...}} */ /* a{oa{s...}} */
if (DBUS_TYPE_STRING != if (DBUS_TYPE_STRING !=
dbus_message_iter_get_arg_type(&dict_2_iter)) dbus_message_iter_get_arg_type(&dict_2_iter))
return 1; return 1;
dbus_message_iter_get_basic(&dict_2_iter, &interface_name); dbus_message_iter_get_basic(&dict_2_iter, &interface_name);
@ -327,14 +327,14 @@ static int read_scanned_devices (bluez_t *bluez, DBusMessage *reply)
do do
{ {
/* a{...} */ /* a{...} */
if (DBUS_TYPE_DICT_ENTRY != if (DBUS_TYPE_DICT_ENTRY !=
dbus_message_iter_get_arg_type(&array_1_iter)) dbus_message_iter_get_arg_type(&array_1_iter))
return 1; return 1;
dbus_message_iter_recurse(&array_1_iter, &dict_1_iter); dbus_message_iter_recurse(&array_1_iter, &dict_1_iter);
/* a{o...} */ /* a{o...} */
if (DBUS_TYPE_OBJECT_PATH != if (DBUS_TYPE_OBJECT_PATH !=
dbus_message_iter_get_arg_type(&dict_1_iter)) dbus_message_iter_get_arg_type(&dict_1_iter))
return 1; return 1;
@ -344,7 +344,7 @@ static int read_scanned_devices (bluez_t *bluez, DBusMessage *reply)
return 1; return 1;
/* a{oa} */ /* a{oa} */
if (DBUS_TYPE_ARRAY != if (DBUS_TYPE_ARRAY !=
dbus_message_iter_get_arg_type(&dict_1_iter)) dbus_message_iter_get_arg_type(&dict_1_iter))
return 1; return 1;
@ -352,18 +352,18 @@ static int read_scanned_devices (bluez_t *bluez, DBusMessage *reply)
do do
{ {
/* empty array? */ /* empty array? */
if (DBUS_TYPE_INVALID == if (DBUS_TYPE_INVALID ==
dbus_message_iter_get_arg_type(&array_2_iter)) dbus_message_iter_get_arg_type(&array_2_iter))
continue; continue;
/* a{oa{...}} */ /* a{oa{...}} */
if (DBUS_TYPE_DICT_ENTRY != if (DBUS_TYPE_DICT_ENTRY !=
dbus_message_iter_get_arg_type(&array_2_iter)) dbus_message_iter_get_arg_type(&array_2_iter))
return 1; return 1;
dbus_message_iter_recurse(&array_2_iter, &dict_2_iter); dbus_message_iter_recurse(&array_2_iter, &dict_2_iter);
/* a{oa{s...}} */ /* a{oa{s...}} */
if (DBUS_TYPE_STRING != if (DBUS_TYPE_STRING !=
dbus_message_iter_get_arg_type(&dict_2_iter)) dbus_message_iter_get_arg_type(&dict_2_iter))
return 1; return 1;
dbus_message_iter_get_basic(&dict_2_iter, &interface_name); dbus_message_iter_get_basic(&dict_2_iter, &interface_name);
@ -390,13 +390,13 @@ static int read_scanned_devices (bluez_t *bluez, DBusMessage *reply)
continue; continue;
/* a{oa{sa{...}}} */ /* a{oa{sa{...}}} */
if (DBUS_TYPE_DICT_ENTRY != if (DBUS_TYPE_DICT_ENTRY !=
dbus_message_iter_get_arg_type(&array_3_iter)) dbus_message_iter_get_arg_type(&array_3_iter))
return 1; return 1;
dbus_message_iter_recurse(&array_3_iter, &dict_3_iter); dbus_message_iter_recurse(&array_3_iter, &dict_3_iter);
/* a{oa{sa{s...}}} */ /* a{oa{sa{s...}}} */
if (DBUS_TYPE_STRING != if (DBUS_TYPE_STRING !=
dbus_message_iter_get_arg_type(&dict_3_iter)) dbus_message_iter_get_arg_type(&dict_3_iter))
return 1; return 1;
@ -406,7 +406,7 @@ static int read_scanned_devices (bluez_t *bluez, DBusMessage *reply)
if (!dbus_message_iter_next(&dict_3_iter)) if (!dbus_message_iter_next(&dict_3_iter))
return 1; return 1;
/* a{oa{sa{sv}}} */ /* a{oa{sa{sv}}} */
if (DBUS_TYPE_VARIANT != if (DBUS_TYPE_VARIANT !=
dbus_message_iter_get_arg_type(&dict_3_iter)) dbus_message_iter_get_arg_type(&dict_3_iter))
return 1; return 1;
@ -606,7 +606,9 @@ static bool bluez_connect_device(void *data, unsigned i)
static bool bluez_remove_device(void *data, unsigned i) static bool bluez_remove_device(void *data, unsigned i)
{ {
bluez_t *bluez = (bluez_t*)data; const char *msg = NULL;
bluez_t *bluez = (bluez_t*)data;
bluez_dbus_connect(bluez); bluez_dbus_connect(bluez);
/* Disconnect the device */ /* Disconnect the device */
@ -616,7 +618,9 @@ static bool bluez_remove_device(void *data, unsigned i)
if (device_method(bluez, bluez->devices->data[i].path, "RemoveDevice")) if (device_method(bluez, bluez->devices->data[i].path, "RemoveDevice"))
return false; return false;
runloop_msg_queue_push(msg_hash_to_str(MSG_BLUETOOTH_PAIRING_REMOVED), msg = msg_hash_to_str(MSG_BLUETOOTH_PAIRING_REMOVED);
runloop_msg_queue_push(msg, strlen(msg),
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);

View File

@ -1,146 +1,149 @@
/* RetroArch - A frontend for libretro. /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2021 - Daniel De Matteis * Copyright (C) 2011-2021 - Daniel De Matteis
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found- * of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version. * ation, either version 3 of the License, or (at your option) any later version.
* *
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details. * PURPOSE. See the GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along with RetroArch. * You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h> #include <stdint.h>
#include <libretro.h> #include <libretro.h>
#include <string/stdstring.h>
#include "../configuration.h"
#include "../driver.h" #include "../configuration.h"
#include "../list_special.h" #include "../driver.h"
#include "../runloop.h" #include "../list_special.h"
#include "../verbosity.h" #include "../runloop.h"
#include "../verbosity.h"
#include "camera_driver.h"
#include "camera_driver.h"
static void *nullcamera_init(const char *device, uint64_t caps,
unsigned width, unsigned height) { return (void*)-1; } static void *nullcamera_init(const char *device, uint64_t caps,
static void nullcamera_free(void *data) { } unsigned width, unsigned height) { return (void*)-1; }
static void nullcamera_stop(void *data) { } static void nullcamera_free(void *data) { }
static bool nullcamera_start(void *data) { return true; } static void nullcamera_stop(void *data) { }
static bool nullcamera_poll(void *a, static bool nullcamera_start(void *data) { return true; }
retro_camera_frame_raw_framebuffer_t b, static bool nullcamera_poll(void *a,
retro_camera_frame_opengl_texture_t c) { return true; } retro_camera_frame_raw_framebuffer_t b,
retro_camera_frame_opengl_texture_t c) { return true; }
static camera_driver_t camera_null = {
nullcamera_init, static camera_driver_t camera_null = {
nullcamera_free, nullcamera_init,
nullcamera_start, nullcamera_free,
nullcamera_stop, nullcamera_start,
nullcamera_poll, nullcamera_stop,
"null", nullcamera_poll,
}; "null",
};
const camera_driver_t *camera_drivers[] = {
#ifdef HAVE_V4L2 const camera_driver_t *camera_drivers[] = {
&camera_v4l2, #ifdef HAVE_V4L2
#endif &camera_v4l2,
#ifdef EMSCRIPTEN #endif
&camera_rwebcam, #ifdef EMSCRIPTEN
#endif &camera_rwebcam,
#ifdef ANDROID #endif
&camera_android, #ifdef ANDROID
#endif &camera_android,
&camera_null, #endif
NULL, &camera_null,
}; NULL,
};
static camera_driver_state_t camera_driver_st = {0};
static camera_driver_state_t camera_driver_st = {0};
camera_driver_state_t *camera_state_get_ptr(void)
{ camera_driver_state_t *camera_state_get_ptr(void)
return &camera_driver_st; {
} return &camera_driver_st;
}
/**
* config_get_camera_driver_options: /**
* * config_get_camera_driver_options:
* Get an enumerated list of all camera driver names, *
* separated by '|'. * Get an enumerated list of all camera driver names,
* * separated by '|'.
* Returns: string listing of all camera driver names, *
* separated by '|'. * Returns: string listing of all camera driver names,
**/ * separated by '|'.
const char *config_get_camera_driver_options(void) **/
{ const char *config_get_camera_driver_options(void)
return char_list_new_special(STRING_LIST_CAMERA_DRIVERS, NULL); {
} return char_list_new_special(STRING_LIST_CAMERA_DRIVERS, NULL);
}
bool driver_camera_start(void)
{ bool driver_camera_start(void)
camera_driver_state_t *camera_st = &camera_driver_st; {
if ( camera_st camera_driver_state_t *camera_st = &camera_driver_st;
&& camera_st->data if ( camera_st
&& camera_st->driver && camera_st->data
&& camera_st->driver->start) && camera_st->driver
{ && camera_st->driver->start)
settings_t *settings = config_get_ptr(); {
bool camera_allow = settings->bools.camera_allow; settings_t *settings = config_get_ptr();
if (camera_allow) bool camera_allow = settings->bools.camera_allow;
return camera_st->driver->start(camera_st->data); if (camera_allow)
return camera_st->driver->start(camera_st->data);
runloop_msg_queue_push(
"Camera is explicitly disabled.\n", 1, 180, false, runloop_msg_queue_push(
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); "Camera is explicitly disabled.\n",
} STRLEN_CONST("Camera is explicitly disabled.\n"),
return true; 1, 180, false,
} NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
void driver_camera_stop(void) return true;
{ }
camera_driver_state_t *camera_st = &camera_driver_st;
if ( camera_st->driver void driver_camera_stop(void)
&& camera_st->driver->stop {
&& camera_st->data) camera_driver_state_t *camera_st = &camera_driver_st;
camera_st->driver->stop(camera_st->data); if ( camera_st->driver
} && camera_st->driver->stop
&& camera_st->data)
bool camera_driver_find_driver(const char *prefix, camera_st->driver->stop(camera_st->data);
bool verbosity_enabled) }
{
settings_t *settings = config_get_ptr(); bool camera_driver_find_driver(const char *prefix,
camera_driver_state_t bool verbosity_enabled)
*camera_st = &camera_driver_st; {
int i = (int)driver_find_index( settings_t *settings = config_get_ptr();
"camera_driver", camera_driver_state_t
settings->arrays.camera_driver); *camera_st = &camera_driver_st;
int i = (int)driver_find_index(
if (i >= 0) "camera_driver",
camera_st->driver = (const camera_driver_t*)camera_drivers[i]; settings->arrays.camera_driver);
else
{ if (i >= 0)
if (verbosity_enabled) camera_st->driver = (const camera_driver_t*)camera_drivers[i];
{ else
unsigned d; {
RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix, if (verbosity_enabled)
settings->arrays.camera_driver); {
RARCH_LOG_OUTPUT("Available %ss are:\n", prefix); unsigned d;
for (d = 0; camera_drivers[d]; d++) RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
{ settings->arrays.camera_driver);
if (camera_drivers[d]) RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
{ for (d = 0; camera_drivers[d]; d++)
RARCH_LOG_OUTPUT("\t%s\n", camera_drivers[d]->ident); {
} if (camera_drivers[d])
} {
RARCH_LOG_OUTPUT("\t%s\n", camera_drivers[d]->ident);
RARCH_WARN("Going to default to first %s...\n", prefix); }
} }
if (!(camera_st->driver = (const camera_driver_t*)camera_drivers[0])) RARCH_WARN("Going to default to first %s...\n", prefix);
return false; }
}
return true; if (!(camera_st->driver = (const camera_driver_t*)camera_drivers[0]))
} return false;
}
return true;
}

View File

@ -68,10 +68,12 @@ unsigned cheat_manager_get_size(void)
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
static void cheat_manager_pause_cheevos(void) static void cheat_manager_pause_cheevos(void)
{ {
const char *msg = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED_CHEAT);
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED_CHEAT), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, strlen(msg), 1, 180, true, NULL,
RARCH_LOG("%s\n", msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED_CHEAT)); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", msg);
} }
#endif #endif
@ -104,8 +106,10 @@ void cheat_manager_apply_cheats(void)
if (cheat_st->size > 0 && settings->bools.notification_show_cheats_applied) if (cheat_st->size > 0 && settings->bools.notification_show_cheats_applied)
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_APPLYING_CHEAT), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_APPLYING_CHEAT);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_APPLYING_CHEAT)); runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", _msg);
} }
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
@ -604,13 +608,14 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx) void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
{ {
size_t _len;
char msg[256]; char msg[256];
if (!handle || !handle->cheats || handle->size == 0) if (!handle || !handle->cheats || handle->size == 0)
return; return;
/* TODO/FIXME - localize */ /* TODO/FIXME - localize */
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
"Cheat: #%u [%s]: %s", "Cheat: #%u [%s]: %s",
handle_idx, handle_idx,
handle->cheats[handle_idx].state handle->cheats[handle_idx].state
@ -620,7 +625,8 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
? (handle->cheats[handle_idx].desc) ? (handle->cheats[handle_idx].desc)
: (handle->cheats[handle_idx].code) : (handle->cheats[handle_idx].code)
); );
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s\n", msg); RARCH_LOG("%s\n", msg);
} }
@ -848,7 +854,9 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w
meminfo.id = RETRO_MEMORY_SYSTEM_RAM; meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
if (!core_get_memory(&meminfo)) if (!core_get_memory(&meminfo))
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_CHEAT_INIT_FAIL);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -877,6 +885,7 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w
if (is_search_initialization) if (is_search_initialization)
{ {
const char *msg = NULL;
if (cheat_st->prev_memory_buf) if (cheat_st->prev_memory_buf)
{ {
free(cheat_st->prev_memory_buf); free(cheat_st->prev_memory_buf);
@ -888,7 +897,9 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w
if (!cheat_st->prev_memory_buf) if (!cheat_st->prev_memory_buf)
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_CHEAT_INIT_FAIL);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -903,9 +914,11 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w
if (!cheat_st->matches) if (!cheat_st->matches)
{ {
const char *_msg = msg_hash_to_str(MSG_CHEAT_INIT_FAIL);
free(cheat_st->prev_memory_buf); free(cheat_st->prev_memory_buf);
cheat_st->prev_memory_buf = NULL; cheat_st->prev_memory_buf = NULL;
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -921,7 +934,9 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w
offset += cheat_st->memory_size_list[i]; offset += cheat_st->memory_size_list[i];
} }
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); msg = msg_hash_to_str(MSG_CHEAT_INIT_SUCCESS);
runloop_msg_queue_push(msg, strlen(msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
cheat_st->memory_search_initialized = true; cheat_st->memory_search_initialized = true;
} }
@ -1000,6 +1015,7 @@ static void cheat_manager_setup_search_meta(
static int cheat_manager_search(enum cheat_search_type search_type) static int cheat_manager_search(enum cheat_search_type search_type)
{ {
size_t _len;
char msg[100]; char msg[100];
cheat_manager_t *cheat_st = &cheat_manager_state; cheat_manager_t *cheat_st = &cheat_manager_state;
unsigned char *curr = cheat_st->curr_memory_buf; unsigned char *curr = cheat_st->curr_memory_buf;
@ -1018,8 +1034,8 @@ static int cheat_manager_search(enum cheat_search_type search_type)
if (cheat_st->num_memory_buffers == 0 || !prev || !cheat_st->matches) if (cheat_st->num_memory_buffers == 0 || !prev || !cheat_st->matches)
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED), const char *msg = msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED);
1, 180, true, NULL, runloop_msg_queue_push(msg, strlen(msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -1125,10 +1141,9 @@ static int cheat_manager_search(enum cheat_search_type search_type)
offset += cheat_st->memory_size_list[i]; offset += cheat_st->memory_size_list[i];
} }
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_st->num_matches); _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_st->num_matches);
msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
@ -1209,6 +1224,7 @@ bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int ad
int cheat_manager_add_matches(const char *path, int cheat_manager_add_matches(const char *path,
const char *label, unsigned type, size_t menuidx, size_t entry_idx) const char *label, unsigned type, size_t menuidx, size_t entry_idx)
{ {
size_t _len;
char msg[100]; char msg[100];
unsigned byte_part = 0; unsigned byte_part = 0;
unsigned int idx = 0; unsigned int idx = 0;
@ -1225,7 +1241,9 @@ int cheat_manager_add_matches(const char *path,
if (cheat_st->num_matches + cheat_st->size > 100) if (cheat_st->num_matches + cheat_st->size > 100)
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
cheat_manager_setup_search_meta(cheat_st->search_bit_size, &bytes_per_item, &mask, &bits); cheat_manager_setup_search_meta(cheat_st->search_bit_size, &bytes_per_item, &mask, &bits);
@ -1263,7 +1281,9 @@ int cheat_manager_add_matches(const char *path,
if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, (mask << (byte_part * bits)), if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, (mask << (byte_part * bits)),
cheat_st->big_endian, curr_val)) cheat_st->big_endian, curr_val))
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
} }
@ -1276,7 +1296,9 @@ int cheat_manager_add_matches(const char *path,
if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, 0xFF, if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, 0xFF,
cheat_st->big_endian, curr_val)) cheat_st->big_endian, curr_val))
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
} }
@ -1285,10 +1307,9 @@ int cheat_manager_add_matches(const char *path,
} }
} }
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_st->num_matches); _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_st->num_matches);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
@ -1677,19 +1698,32 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
case CHEAT_MATCH_ACTION_TYPE_COPY: case CHEAT_MATCH_ACTION_TYPE_COPY:
if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, (mask << (byte_part * bits)), if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, (mask << (byte_part * bits)),
cheat_st->big_endian, curr_val)) cheat_st->big_endian, curr_val))
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); {
const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); {
const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return; return;
case CHEAT_MATCH_ACTION_TYPE_DELETE: case CHEAT_MATCH_ACTION_TYPE_DELETE:
if (bits < 8) {
*(cheat_st->matches + idx) = *(cheat_st->matches + idx) & const char *_msg;
if (bits < 8)
*(cheat_st->matches + idx) = *(cheat_st->matches + idx) &
((~(mask << (byte_part * bits))) & 0xFF); ((~(mask << (byte_part * bits))) & 0xFF);
else else
memset(cheat_st->matches + idx, 0, bytes_per_item); memset(cheat_st->matches + idx, 0, bytes_per_item);
if (cheat_st->num_matches > 0) if (cheat_st->num_matches > 0)
cheat_st->num_matches--; cheat_st->num_matches--;
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); _msg = msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return; return;
} }
return; return;
@ -1717,20 +1751,33 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
case CHEAT_MATCH_ACTION_TYPE_COPY: case CHEAT_MATCH_ACTION_TYPE_COPY:
if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, 0xFF, if (!cheat_manager_add_new_code(cheat_st->search_bit_size, idx, 0xFF,
cheat_st->big_endian, curr_val)) cheat_st->big_endian, curr_val))
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); {
const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); {
const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return; return;
case CHEAT_MATCH_ACTION_TYPE_DELETE: case CHEAT_MATCH_ACTION_TYPE_DELETE:
if (bits < 8) {
*(cheat_st->matches + idx) = *(cheat_st->matches + idx) & const char *_msg;
if (bits < 8)
*(cheat_st->matches + idx) = *(cheat_st->matches + idx) &
((~(mask << (byte_part * bits))) & 0xFF); ((~(mask << (byte_part * bits))) & 0xFF);
else else
memset(cheat_st->matches + idx, 0, bytes_per_item); memset(cheat_st->matches + idx, 0, bytes_per_item);
if (cheat_st->num_matches > 0) if (cheat_st->num_matches > 0)
cheat_st->num_matches--; cheat_st->num_matches--;
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); _msg = msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS);
return; runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return;
}
} }
} }

View File

@ -230,8 +230,7 @@ static void rcheevos_show_mastery_placard(void)
{ {
const rc_client_game_t* game = rc_client_get_game_info(rcheevos_locals.client); const rc_client_game_t* game = rc_client_get_game_info(rcheevos_locals.client);
char title[256]; char title[256];
size_t _len = snprintf(title, sizeof(title),
snprintf(title, sizeof(title),
msg_hash_to_str(rc_client_get_hardcore_enabled(rcheevos_locals.client) msg_hash_to_str(rc_client_get_hardcore_enabled(rcheevos_locals.client)
? MSG_CHEEVOS_MASTERED_GAME ? MSG_CHEEVOS_MASTERED_GAME
: MSG_CHEEVOS_COMPLETED_GAME), : MSG_CHEEVOS_COMPLETED_GAME),
@ -246,9 +245,9 @@ static void rcheevos_show_mastery_placard(void)
const char* displayname = rc_client_get_user_info(rcheevos_locals.client)->display_name; const char* displayname = rc_client_get_user_info(rcheevos_locals.client)->display_name;
const bool content_runtime_log = settings->bools.content_runtime_log; const bool content_runtime_log = settings->bools.content_runtime_log;
const bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate; const bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate;
size_t len = strlcpy(msg, displayname, sizeof(msg)); size_t __len = strlcpy(msg, displayname, sizeof(msg));
if (len < sizeof(msg) - 12 if (__len < sizeof(msg) - 12
&& (content_runtime_log || content_runtime_log_aggr)) && (content_runtime_log || content_runtime_log_aggr))
{ {
const char* content_path = path_get(RARCH_PATH_CONTENT); const char* content_path = path_get(RARCH_PATH_CONTENT);
@ -265,21 +264,22 @@ static void rcheevos_show_mastery_placard(void)
runtime_log_add_runtime_usec(runtime_log, runtime_log_add_runtime_usec(runtime_log,
runloop_state->core_runtime_usec); runloop_state->core_runtime_usec);
len += strlcpy(msg + len, " | ", sizeof(msg) - len); __len += strlcpy(msg + __len, " | ", sizeof(msg) - __len);
runtime_log_get_runtime_str(runtime_log, msg + len, sizeof(msg) - len); runtime_log_get_runtime_str(runtime_log, msg + __len, sizeof(msg) - __len);
msg[sizeof(msg) - 1] = '\0'; msg[sizeof(msg) - 1] = '\0';
free(runtime_log); free(runtime_log);
} }
} }
len = strlcpy(badge_name, "i", sizeof(badge_name)); __len = strlcpy(badge_name, "i", sizeof(badge_name));
strlcpy(badge_name + len, game->badge_name, sizeof(badge_name) - len); strlcpy(badge_name + __len, game->badge_name, sizeof(badge_name) - __len);
gfx_widgets_push_achievement(title, msg, badge_name); gfx_widgets_push_achievement(title, msg, badge_name);
} }
else else
#endif #endif
runloop_msg_queue_push(title, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(title, _len, 0, 3 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -321,10 +321,10 @@ static void rcheevos_award_achievement(const rc_client_achievement_t* cheevo)
size_t _len = strlcpy(buffer, msg_hash_to_str(MSG_ACHIEVEMENT_UNLOCKED), size_t _len = strlcpy(buffer, msg_hash_to_str(MSG_ACHIEVEMENT_UNLOCKED),
sizeof(buffer)); sizeof(buffer));
_len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len); _len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len);
strlcpy(buffer + _len, cheevo->title, sizeof(buffer) - _len); _len += strlcpy(buffer + _len, cheevo->title, sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, runloop_msg_queue_push(buffer, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(cheevo->description, 0, 3 * 60, false, NULL, runloop_msg_queue_push(cheevo->description, strlen(cheevo->description), 0, 3 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -377,24 +377,25 @@ static void rcheevos_lboard_submitted(const rc_client_leaderboard_t* lboard, con
const settings_t* settings = config_get_ptr(); const settings_t* settings = config_get_ptr();
if (lboard && settings->bools.cheevos_visibility_lboard_submit) if (lboard && settings->bools.cheevos_visibility_lboard_submit)
{ {
size_t _len;
char buffer[256]; char buffer[256];
if (scoreboard) if (scoreboard)
{ {
char addendum[64]; _len = snprintf(buffer, sizeof(buffer), msg_hash_to_str(MSG_LEADERBOARD_SUBMISSION),
const size_t len = snprintf(buffer, sizeof(buffer), msg_hash_to_str(MSG_LEADERBOARD_SUBMISSION),
scoreboard->submitted_score, lboard->title); scoreboard->submitted_score, lboard->title);
_len += strlcpy(buffer + _len, " (", sizeof(buffer) - _len);
if (strcmp(scoreboard->best_score, scoreboard->submitted_score) == 0) if (strcmp(scoreboard->best_score, scoreboard->submitted_score) == 0)
snprintf(addendum, sizeof(addendum), msg_hash_to_str(MSG_LEADERBOARD_RANK), scoreboard->new_rank); _len += snprintf(buffer + _len, sizeof(buffer) - _len,
msg_hash_to_str(MSG_LEADERBOARD_RANK), scoreboard->new_rank);
else else
snprintf(addendum, sizeof(addendum), msg_hash_to_str(MSG_LEADERBOARD_BEST), scoreboard->best_score); _len += snprintf(buffer + _len, sizeof(buffer) - _len,
snprintf(buffer + len, sizeof(buffer) - len, " (%s)", addendum); msg_hash_to_str(MSG_LEADERBOARD_BEST), scoreboard->best_score);
_len += strlcpy(buffer + _len, ")", sizeof(buffer) - _len);
} }
else else
{ _len = snprintf(buffer, sizeof(buffer), msg_hash_to_str(MSG_LEADERBOARD_SUBMISSION),
snprintf(buffer, sizeof(buffer), msg_hash_to_str(MSG_LEADERBOARD_SUBMISSION),
lboard->tracker_value, lboard->title); lboard->tracker_value, lboard->title);
} runloop_msg_queue_push(buffer, _len, 0, 2 * 60, false, NULL,
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -405,9 +406,10 @@ static void rcheevos_lboard_canceled(const rc_client_leaderboard_t* lboard)
if (lboard && settings->bools.cheevos_visibility_lboard_cancel) if (lboard && settings->bools.cheevos_visibility_lboard_cancel)
{ {
char buffer[256]; char buffer[256];
snprintf(buffer, sizeof(buffer), "%s: %s", size_t _len = strlcpy(buffer, msg_hash_to_str(MSG_LEADERBOARD_FAILED), sizeof(buffer));
msg_hash_to_str(MSG_LEADERBOARD_FAILED), lboard->title); _len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, _len += strlcpy(buffer + _len, lboard->title, sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -423,10 +425,10 @@ static void rcheevos_lboard_started(const rc_client_leaderboard_t* lboard)
_len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len); _len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy(buffer + _len, lboard->title, sizeof(buffer) - _len); _len += strlcpy(buffer + _len, lboard->title, sizeof(buffer) - _len);
if (lboard->description && *lboard->description) if (lboard->description && *lboard->description)
snprintf(buffer + _len, sizeof(buffer) - _len, "- %s", _len += snprintf(buffer + _len, sizeof(buffer) - _len, "- %s",
lboard->description); lboard->description);
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, runloop_msg_queue_push(buffer, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -487,7 +489,7 @@ static void rcheevos_server_error(const char* api_name, const char* message)
size_t _len = strlcpy(buffer, api_name, sizeof(buffer)); size_t _len = strlcpy(buffer, api_name, sizeof(buffer));
_len += strlcpy(buffer + _len, " failed: ", sizeof(buffer) - _len); _len += strlcpy(buffer + _len, " failed: ", sizeof(buffer) - _len);
_len += strlcpy(buffer + _len, message, sizeof(buffer) - _len); _len += strlcpy(buffer + _len, message, sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL, runloop_msg_queue_push(buffer, _len, 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
} }
@ -497,8 +499,8 @@ static void rcheevos_server_disconnected(void)
/* always show message - even with widget. it helps the user understand what the widget is for */ /* always show message - even with widget. it helps the user understand what the widget is for */
{ {
const char* message = msg_hash_to_str(MENU_ENUM_LABEL_CHEEVOS_SERVER_DISCONNECTED); const char *_msg = msg_hash_to_str(MENU_ENUM_LABEL_CHEEVOS_SERVER_DISCONNECTED);
runloop_msg_queue_push(message, 0, 3 * 60, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
} }
@ -513,8 +515,8 @@ static void rcheevos_server_reconnected(void)
CHEEVOS_LOG(RCHEEVOS_TAG "All pending requests synced to RetroAchievements server\n"); CHEEVOS_LOG(RCHEEVOS_TAG "All pending requests synced to RetroAchievements server\n");
{ {
const char* message = msg_hash_to_str(MENU_ENUM_LABEL_CHEEVOS_SERVER_RECONNECTED); const char *_msg = msg_hash_to_str(MENU_ENUM_LABEL_CHEEVOS_SERVER_RECONNECTED);
runloop_msg_queue_push(message, 0, 3 * 60, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
} }
@ -776,10 +778,10 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
if (rcheevos_is_game_loaded()) if (rcheevos_is_game_loaded())
{ {
const char* msg = msg_hash_to_str( const char *_msg = msg_hash_to_str(
MSG_CHEEVOS_HARDCORE_MODE_ENABLE); MSG_CHEEVOS_HARDCORE_MODE_ENABLE);
CHEEVOS_LOG("%s\n", msg); CHEEVOS_LOG("%s\n", _msg);
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
rcheevos_enforce_hardcore_settings(); rcheevos_enforce_hardcore_settings();
@ -878,12 +880,13 @@ void rcheevos_validate_config_settings(void)
* it'll wait for the next vsync event, effectively halfing the fps. the * it'll wait for the next vsync event, effectively halfing the fps. the
* auto setting should achieve the most accurate frame rate anyway, so * auto setting should achieve the most accurate frame rate anyway, so
* disallow any manual values */ * disallow any manual values */
if (!settings->bools.video_frame_delay_auto && settings->uints.video_frame_delay != 0) { if (!settings->bools.video_frame_delay_auto && settings->uints.video_frame_delay != 0)
{
const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_MANUAL_FRAME_DELAY); const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_MANUAL_FRAME_DELAY);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_MANUAL_FRAME_DELAY)); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_MANUAL_FRAME_DELAY));
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(error, 0, 4 * 60, false, NULL, runloop_msg_queue_push(error, strlen(error), 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return; return;
} }
@ -896,24 +899,26 @@ void rcheevos_validate_config_settings(void)
* allow 1 even though that could be potentially abused on monitors * allow 1 even though that could be potentially abused on monitors
* running at less than 60Hz because 1 is the default value - many users * running at less than 60Hz because 1 is the default value - many users
* wouldn't know how to change it to auto. */ * wouldn't know how to change it to auto. */
if (settings->uints.video_swap_interval > 1) { if (settings->uints.video_swap_interval > 1)
{
const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_VSYNC_SWAP_INTERVAL); const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_VSYNC_SWAP_INTERVAL);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_VSYNC_SWAP_INTERVAL)); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_VSYNC_SWAP_INTERVAL));
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(error, 0, 4 * 60, false, NULL, runloop_msg_queue_push(error, strlen(error), 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return; return;
} }
/* this causes N blank frames to be rendered between real frames, thus /* this causes N blank frames to be rendered between real frames, thus
* can slow down the actual number of rendered frames per second. */ * can slow down the actual number of rendered frames per second. */
if (settings->uints.video_black_frame_insertion > 0) { if (settings->uints.video_black_frame_insertion > 0)
{
const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_BLACK_FRAME_INSERTION); const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_BLACK_FRAME_INSERTION);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_BLACK_FRAME_INSERTION)); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_BLACK_FRAME_INSERTION));
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(error, 0, 4 * 60, false, NULL, runloop_msg_queue_push(error, strlen(error), 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return; return;
} }
@ -921,12 +926,13 @@ void rcheevos_validate_config_settings(void)
/* this causes N dupe frames to be rendered between real frames, for /* this causes N dupe frames to be rendered between real frames, for
the purposes of shaders that update faster than content. Thus the purposes of shaders that update faster than content. Thus
* can slow down the actual number of rendered frames per second. */ * can slow down the actual number of rendered frames per second. */
if (settings->uints.video_shader_subframes > 1) { if (settings->uints.video_shader_subframes > 1)
{
const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_SHADER_SUBFRAMES); const char* error = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_SHADER_SUBFRAMES);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_SHADER_SUBFRAMES)); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_SHADER_SUBFRAMES));
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(error, 0, 4 * 60, false, NULL, runloop_msg_queue_push(error, strlen(error), 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return; return;
} }
@ -944,14 +950,14 @@ void rcheevos_validate_config_settings(void)
if (!rc_libretro_is_setting_allowed(disallowed_settings, key, val)) if (!rc_libretro_is_setting_allowed(disallowed_settings, key, val))
{ {
char buffer[128]; char buffer[128];
snprintf(buffer, sizeof(buffer), size_t _len = snprintf(buffer, sizeof(buffer),
msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_SETTING_NOT_ALLOWED), key, val); msg_hash_to_str_us(MSG_CHEEVOS_HARDCORE_PAUSED_SETTING_NOT_ALLOWED), key, val);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer);
snprintf(buffer, sizeof(buffer), _len = snprintf(buffer, sizeof(buffer),
msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_SETTING_NOT_ALLOWED), key, val); msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_SETTING_NOT_ALLOWED), key, val);
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL, runloop_msg_queue_push(buffer, _len, 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return; return;
} }
@ -966,13 +972,13 @@ void rcheevos_validate_config_settings(void)
if (console_id && !rc_libretro_is_system_allowed(sysinfo->library_name, console_id)) if (console_id && !rc_libretro_is_system_allowed(sysinfo->library_name, console_id))
{ {
char buffer[256]; char buffer[256];
snprintf(buffer, sizeof(buffer), size_t _len = snprintf(buffer, sizeof(buffer),
msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_SYSTEM_NOT_FOR_CORE), msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_SYSTEM_NOT_FOR_CORE),
rc_console_name(console_id), sysinfo->library_name); rc_console_name(console_id), sysinfo->library_name);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer);
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(buffer, 0, 4 * 60, false, NULL, runloop_msg_queue_push(buffer, _len, 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return; return;
} }
@ -1208,7 +1214,7 @@ static void rc_hash_reset_cdreader_hooks(void)
static void rcheevos_show_game_placard(void) static void rcheevos_show_game_placard(void)
{ {
size_t len; size_t _len;
char msg[256]; char msg[256];
rc_client_user_game_summary_t summary; rc_client_user_game_summary_t summary;
const settings_t* settings = config_get_ptr(); const settings_t* settings = config_get_ptr();
@ -1221,37 +1227,37 @@ static void rcheevos_show_game_placard(void)
if (summary.num_core_achievements == 0) if (summary.num_core_achievements == 0)
{ {
if (summary.num_unofficial_achievements == 0) if (summary.num_unofficial_achievements == 0)
len = snprintf(msg, sizeof(msg), "%s", msg_hash_to_str(MSG_CHEEVOS_GAME_HAS_NO_ACHIEVEMENTS)); _len = snprintf(msg, sizeof(msg), "%s", msg_hash_to_str(MSG_CHEEVOS_GAME_HAS_NO_ACHIEVEMENTS));
else else
len = snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_UNOFFICIAL_ACHIEVEMENTS_ACTIVATED), msg_hash_to_str(MSG_CHEEVOS_UNOFFICIAL_ACHIEVEMENTS_ACTIVATED),
(int)summary.num_unofficial_achievements); (int)summary.num_unofficial_achievements);
} }
else if (rc_client_get_encore_mode_enabled(rcheevos_locals.client)) else if (rc_client_get_encore_mode_enabled(rcheevos_locals.client))
len = snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED), msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED),
(int)summary.num_core_achievements); (int)summary.num_core_achievements);
else else
len = snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED), msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED),
(int)summary.num_unlocked_achievements, (int)summary.num_unlocked_achievements,
(int)summary.num_core_achievements); (int)summary.num_core_achievements);
if (summary.num_unsupported_achievements) if (summary.num_unsupported_achievements)
{ {
if (len < sizeof(msg) - 4) if (_len < sizeof(msg) - 4)
{ {
msg[len++] = ' '; msg[_len++] = ' ';
msg[len++] = '('; msg[_len++] = '(';
len += snprintf(&msg[len], sizeof(msg) - len, _len += snprintf(&msg[_len], sizeof(msg) - _len,
msg_hash_to_str(MSG_CHEEVOS_UNSUPPORTED_COUNT), msg_hash_to_str(MSG_CHEEVOS_UNSUPPORTED_COUNT),
(int)summary.num_unsupported_achievements); (int)summary.num_unsupported_achievements);
if (len < sizeof(msg) - 1) if (_len < sizeof(msg) - 1)
{ {
msg[len++] = ')'; msg[_len++] = ')';
msg[len] = '\0'; msg[_len] = '\0';
} }
} }
} }
@ -1267,14 +1273,14 @@ static void rcheevos_show_game_placard(void)
if (gfx_widgets_ready()) if (gfx_widgets_ready())
{ {
char badge_name[32]; char badge_name[32];
size_t _len = strlcpy(badge_name, "i", sizeof(badge_name)); size_t __len = strlcpy(badge_name, "i", sizeof(badge_name));
_len += strlcpy(badge_name + _len, game->badge_name, __len += strlcpy(badge_name + __len, game->badge_name,
sizeof(badge_name) - _len); sizeof(badge_name) - __len);
gfx_widgets_push_achievement(game->title, msg, badge_name); gfx_widgets_push_achievement(game->title, msg, badge_name);
} }
else else
#endif #endif
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL, runloop_msg_queue_push(msg, _len, 0, 3 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -1341,7 +1347,7 @@ static void rcheevos_client_login_callback(int result,
sizeof(msg)); sizeof(msg));
_len += strlcpy(msg + _len, error_message, sizeof(msg) - _len); _len += strlcpy(msg + _len, error_message, sizeof(msg) - _len);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg);
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, runloop_msg_queue_push(msg, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return; return;
} }
@ -1371,9 +1377,9 @@ static void rcheevos_client_login_callback(int result,
if (settings->bools.cheevos_visibility_account) if (settings->bools.cheevos_visibility_account)
{ {
char msg[128]; char msg[128];
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEEVOS_LOGGED_IN_AS_USER), size_t _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEEVOS_LOGGED_IN_AS_USER),
user->display_name); user->display_name);
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, runloop_msg_queue_push(msg, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -1403,6 +1409,7 @@ static void rcheevos_client_load_game_callback(int result,
if (result != RC_OK || !game) if (result != RC_OK || !game)
{ {
size_t _len;
if (result == RC_NO_GAME_LOADED) if (result == RC_NO_GAME_LOADED)
{ {
CHEEVOS_LOG(RCHEEVOS_TAG "Game not recognized, pausing hardcore\n"); CHEEVOS_LOG(RCHEEVOS_TAG "Game not recognized, pausing hardcore\n");
@ -1411,18 +1418,18 @@ static void rcheevos_client_load_game_callback(int result,
if (!settings->bools.cheevos_verbose_enable) if (!settings->bools.cheevos_verbose_enable)
return; return;
snprintf(msg, sizeof(msg), "%s", msg_hash_to_str(MSG_CHEEVOS_GAME_NOT_IDENTIFIED)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEEVOS_GAME_NOT_IDENTIFIED), sizeof(msg));
} }
else else
{ {
if (!error_message) if (!error_message)
error_message = "Unknown error"; error_message = "Unknown error";
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEEVOS_GAME_LOAD_FAILED), error_message); _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEEVOS_GAME_LOAD_FAILED), error_message);
CHEEVOS_LOG(RCHEEVOS_TAG "Game load failed: %s\n", error_message); CHEEVOS_LOG(RCHEEVOS_TAG "Game load failed: %s\n", error_message);
} }
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, runloop_msg_queue_push(msg, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return; return;
} }
@ -1437,9 +1444,12 @@ static void rcheevos_client_load_game_callback(int result,
CHEEVOS_ERR(RCHEEVOS_TAG "No memory exposed by core\n"); CHEEVOS_ERR(RCHEEVOS_TAG "No memory exposed by core\n");
if (settings && settings->bools.cheevos_verbose_enable) if (settings && settings->bools.cheevos_verbose_enable)
runloop_msg_queue_push(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CANNOT_ACTIVATE_ACHIEVEMENTS_WITH_THIS_CORE), {
0, 4 * 60, false, NULL, const char *_msg = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CANNOT_ACTIVATE_ACHIEVEMENTS_WITH_THIS_CORE);
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); runloop_msg_queue_push(_msg, strlen(_msg),
0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
}
rcheevos_unload(); rcheevos_unload();
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
@ -1522,7 +1532,10 @@ bool rcheevos_load(const void *data)
if (string_is_empty(settings->arrays.cheevos_username)) if (string_is_empty(settings->arrays.cheevos_username))
{ {
CHEEVOS_LOG(RCHEEVOS_TAG "Cannot login (no username)\n"); CHEEVOS_LOG(RCHEEVOS_TAG "Cannot login (no username)\n");
runloop_msg_queue_push("Missing RetroAchievements account information.", 0, 5 * 60, false, NULL, runloop_msg_queue_push(
"Missing RetroAchievements account information.",
STRLEN_CONST("Missing RetroAchievements account information."),
0, 5 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
return false; return false;
@ -1612,6 +1625,7 @@ bool rcheevos_load(const void *data)
static void rcheevos_client_change_media_callback(int result, static void rcheevos_client_change_media_callback(int result,
const char* error_message, rc_client_t* client, void* userdata) const char* error_message, rc_client_t* client, void* userdata)
{ {
size_t _len;
char msg[256]; char msg[256];
if (result == RC_OK || result == RC_NO_GAME_LOADED) if (result == RC_OK || result == RC_NO_GAME_LOADED)
@ -1619,7 +1633,7 @@ static void rcheevos_client_change_media_callback(int result,
if (result == RC_HARDCORE_DISABLED) if (result == RC_HARDCORE_DISABLED)
{ {
strlcpy(msg, error_message, sizeof(msg)); _len = strlcpy(msg, error_message, sizeof(msg));
rcheevos_hardcore_enabled_changed(); rcheevos_hardcore_enabled_changed();
} }
else else
@ -1627,11 +1641,11 @@ static void rcheevos_client_change_media_callback(int result,
if (!error_message) if (!error_message)
error_message = "Unknown error"; error_message = "Unknown error";
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEEVOS_CHANGE_MEDIA_FAILED), error_message); _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEEVOS_CHANGE_MEDIA_FAILED), error_message);
CHEEVOS_LOG(RCHEEVOS_TAG "Change media failed: %s\n", error_message); CHEEVOS_LOG(RCHEEVOS_TAG "Change media failed: %s\n", error_message);
} }
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, runloop_msg_queue_push(msg, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }

View File

@ -74,8 +74,10 @@ static void command_post_state_loaded(void)
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
if (rcheevos_hardcore_active()) if (rcheevos_hardcore_active())
{ {
const char *_msg = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED);
rcheevos_pause_hardcore(); rcheevos_pause_hardcore();
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED), 0, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 0, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
#endif #endif
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
@ -683,7 +685,7 @@ bool command_network_send(const char *cmd_)
bool command_show_osd_msg(command_t *cmd, const char* arg) bool command_show_osd_msg(command_t *cmd, const char* arg)
{ {
runloop_msg_queue_push(arg, 1, 180, false, NULL, runloop_msg_queue_push(arg, strlen(arg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return true; return true;
} }
@ -1060,7 +1062,7 @@ void command_event_set_volume(
audio_driver_mute_enable); audio_driver_mute_enable);
else else
#endif #endif
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[Audio]: %s\n", msg); RARCH_LOG("[Audio]: %s\n", msg);
@ -1096,7 +1098,8 @@ void command_event_set_mixer_volume(
msg[++_len] = 'd'; msg[++_len] = 'd';
msg[++_len] = 'B'; msg[++_len] = 'B';
msg[++_len] = '\0'; msg[++_len] = '\0';
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[Audio]: %s\n", msg); RARCH_LOG("[Audio]: %s\n", msg);
@ -1855,6 +1858,7 @@ bool command_event_save_core_config(
const char *dir_menu_config, const char *dir_menu_config,
const char *rarch_path_config) const char *rarch_path_config)
{ {
size_t _len;
char msg[128]; char msg[128];
char config_dir[DIR_MAX_LENGTH]; char config_dir[DIR_MAX_LENGTH];
char config_path[PATH_MAX_LENGTH]; char config_path[PATH_MAX_LENGTH];
@ -1874,8 +1878,10 @@ bool command_event_save_core_config(
if (string_is_empty(config_dir)) if (string_is_empty(config_dir))
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET);
RARCH_ERR("[Config]: %s\n", msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET)); runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_ERR("[Config]: %s\n", _msg);
return false; return false;
} }
@ -1932,10 +1938,11 @@ bool command_event_save_core_config(
#ifdef HAVE_CONFIGFILE #ifdef HAVE_CONFIGFILE
command_event_save_config(config_path, msg, sizeof(msg)); command_event_save_config(config_path, msg, sizeof(msg));
_len = strlen(msg);
#endif #endif
if (!string_is_empty(msg)) if (_len > 0)
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (overrides_active) if (overrides_active)
@ -1955,23 +1962,31 @@ void command_event_save_current_config(enum override_type type)
default: default:
case OVERRIDE_NONE: case OVERRIDE_NONE:
{ {
size_t _len;
char msg[256]; char msg[256];
msg[0] = '\0'; msg[0] = '\0';
if (path_is_empty(RARCH_PATH_CONFIG)) if (path_is_empty(RARCH_PATH_CONFIG))
{ {
strlcpy(msg, "Config directory not set, cannot save configuration.", sizeof(msg)); _len = strlcpy(msg, "Config directory not set, cannot save configuration.", sizeof(msg));
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
else else
{ {
if (runloop_st->flags & RUNLOOP_FLAG_OVERRIDES_ACTIVE) if (runloop_st->flags & RUNLOOP_FLAG_OVERRIDES_ACTIVE)
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ACTIVE_NOT_SAVING), sizeof(msg)); {
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ACTIVE_NOT_SAVING), sizeof(msg));
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
{
command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg)); command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
runloop_msg_queue_push(msg, strlen(msg), 1, 180, true, NULL,
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
} }
break; break;
@ -1979,28 +1994,31 @@ void command_event_save_current_config(enum override_type type)
case OVERRIDE_CORE: case OVERRIDE_CORE:
case OVERRIDE_CONTENT_DIR: case OVERRIDE_CONTENT_DIR:
{ {
size_t _len;
char msg[256]; char msg[256];
int8_t ret = config_save_overrides(type, &runloop_st->system, false, NULL); int8_t ret = config_save_overrides(type, &runloop_st->system, false, NULL);
switch (ret) switch (ret)
{ {
case 1: case 1:
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg)); _len = strlcpy(msg,
msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg));
/* set overrides to active so the original config can be /* set overrides to active so the original config can be
restored after closing content */ restored after closing content */
runloop_st->flags |= RUNLOOP_FLAG_OVERRIDES_ACTIVE; runloop_st->flags |= RUNLOOP_FLAG_OVERRIDES_ACTIVE;
break; break;
case -1: case -1:
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_NOT_SAVED), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_NOT_SAVED), sizeof(msg));
break; break;
default: default:
case 0: case 0:
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg));
break; break;
} }
RARCH_LOG("[Overrides]: %s\n", msg); RARCH_LOG("[Overrides]: %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_MENU #ifdef HAVE_MENU
{ {
@ -2027,14 +2045,15 @@ void command_event_remove_current_config(enum override_type type)
case OVERRIDE_CORE: case OVERRIDE_CORE:
case OVERRIDE_CONTENT_DIR: case OVERRIDE_CONTENT_DIR:
{ {
size_t _len;
char msg[256]; char msg[256];
if (config_save_overrides(type, &runloop_st->system, true, NULL)) if (config_save_overrides(type, &runloop_st->system, true, NULL))
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_REMOVED_SUCCESSFULLY), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_REMOVED_SUCCESSFULLY), sizeof(msg));
else else
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_REMOVING), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_REMOVING), sizeof(msg));
RARCH_LOG("[Overrides]: %s\n", msg); RARCH_LOG("[Overrides]: %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_MENU #ifdef HAVE_MENU
{ {
@ -2053,10 +2072,10 @@ bool command_event_main_state(unsigned cmd)
{ {
char msg[128]; char msg[128];
char state_path[16384]; char state_path[16384];
size_t _len = 0;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool savestates_enabled = core_info_current_supports_savestate(); bool savestates_enabled = core_info_current_supports_savestate();
bool ret = false; bool ret = false;
bool push_msg = true;
state_path[0] = msg[0] = '\0'; state_path[0] = msg[0] = '\0';
@ -2107,7 +2126,6 @@ bool command_event_main_state(unsigned cmd)
video_st->frame_time_count = 0; video_st->frame_time_count = 0;
ret = true; ret = true;
push_msg = false;
} }
break; break;
case CMD_EVENT_LOAD_STATE: case CMD_EVENT_LOAD_STATE:
@ -2125,7 +2143,6 @@ bool command_event_main_state(unsigned cmd)
ret = true; ret = true;
} }
} }
push_msg = false;
break; break;
case CMD_EVENT_UNDO_LOAD_STATE: case CMD_EVENT_UNDO_LOAD_STATE:
{ {
@ -2144,25 +2161,27 @@ bool command_event_main_state(unsigned cmd)
} }
#endif #endif
command_event_undo_load_state(msg, sizeof(msg)); command_event_undo_load_state(msg, sizeof(msg));
_len = strlen(msg);
ret = true; ret = true;
break; break;
} }
case CMD_EVENT_UNDO_SAVE_STATE: case CMD_EVENT_UNDO_SAVE_STATE:
command_event_undo_save_state(msg, sizeof(msg)); command_event_undo_save_state(msg, sizeof(msg));
_len = strlen(msg);
ret = true; ret = true;
break; break;
} }
} }
else else
strlcpy(msg, msg_hash_to_str( _len = strlcpy(msg, msg_hash_to_str(
MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES), sizeof(msg)); MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES), sizeof(msg));
if (push_msg) if (_len > 0)
runloop_msg_queue_push(msg, 2, 180, true, NULL, {
runloop_msg_queue_push(msg, _len, 2, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (!string_is_empty(msg))
RARCH_LOG("[State]: %s\n", msg); RARCH_LOG("[State]: %s\n", msg);
}
return ret; return ret;
} }

View File

@ -4467,9 +4467,11 @@ bool config_load_override(void *data)
if (settings->bools.notification_show_config_override_load if (settings->bools.notification_show_config_override_load
&& show_notification) && show_notification)
runloop_msg_queue_push(msg_hash_to_str(MSG_CONFIG_OVERRIDE_LOADED), {
1, 100, false, const char *_msg = msg_hash_to_str(MSG_CONFIG_OVERRIDE_LOADED);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
/* Reset save paths. */ /* Reset save paths. */
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL); retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL);
@ -4521,9 +4523,11 @@ bool config_load_override_file(const char *config_path)
if (settings->bools.notification_show_config_override_load if (settings->bools.notification_show_config_override_load
&& show_notification) && show_notification)
runloop_msg_queue_push(msg_hash_to_str(MSG_CONFIG_OVERRIDE_LOADED), {
1, 100, false, const char *_msg = msg_hash_to_str(MSG_CONFIG_OVERRIDE_LOADED);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
/* Reset save paths. */ /* Reset save paths. */
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL); retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL);
@ -4729,9 +4733,11 @@ bool config_load_remap(const char *directory_input_remapping,
success: success:
if (notification_show_remap_load) if (notification_show_remap_load)
runloop_msg_queue_push( {
msg_hash_to_str(msg_remap_loaded), 1, 100, false, const char *_msg = msg_hash_to_str(msg_remap_loaded);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return true; return true;
} }
@ -6384,7 +6390,7 @@ void input_config_parse_mouse_button(
fill_pathname_join_delim(key, s, "mbtn", '_', sizeof(key)); fill_pathname_join_delim(key, s, "mbtn", '_', sizeof(key));
if (config_get_array(conf, key, tmp, sizeof(tmp))) if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0)
{ {
bind->mbutton = NO_BTN; bind->mbutton = NO_BTN;
@ -6455,7 +6461,7 @@ void input_config_parse_joy_axis(
fill_pathname_join_delim(key_label, s, fill_pathname_join_delim(key_label, s,
"axis_label", '_', sizeof(key_label)); "axis_label", '_', sizeof(key_label));
if (config_get_array(conf, key, tmp, sizeof(tmp))) if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0)
{ {
if ( tmp[0] == 'n' if ( tmp[0] == 'n'
&& tmp[1] == 'u' && tmp[1] == 'u'
@ -6546,7 +6552,7 @@ void input_config_parse_joy_button(
fill_pathname_join_delim(key_label, s, fill_pathname_join_delim(key_label, s,
"btn_label", '_', sizeof(key_label)); "btn_label", '_', sizeof(key_label));
if (config_get_array(conf, key, tmp, sizeof(tmp))) if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0)
{ {
btn = tmp; btn = tmp;
if ( btn[0] == 'n' if ( btn[0] == 'n'

View File

@ -338,15 +338,14 @@ bool disk_control_set_eject_state(
{ {
bool error = false; bool error = false;
char msg[128]; char msg[128];
size_t _len;
msg[0] = '\0';
if (!disk_control || !disk_control->cb.set_eject_state) if (!disk_control || !disk_control->cb.set_eject_state)
return false; return false;
/* Set eject state */ /* Set eject state */
if (disk_control->cb.set_eject_state(eject)) if (disk_control->cb.set_eject_state(eject))
strlcpy( _len = strlcpy(
msg, msg,
eject eject
? msg_hash_to_str(MSG_DISK_EJECTED) ? msg_hash_to_str(MSG_DISK_EJECTED)
@ -355,7 +354,7 @@ bool disk_control_set_eject_state(
else else
{ {
error = true; error = true;
strlcpy( _len = strlcpy(
msg, msg,
eject eject
? msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_EJECT) ? msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_EJECT)
@ -363,7 +362,7 @@ bool disk_control_set_eject_state(
sizeof(msg)); sizeof(msg));
} }
if (!string_is_empty(msg)) if (_len > 0)
{ {
if (error) if (error)
RARCH_ERR("[Disc]: %s\n", msg); RARCH_ERR("[Disc]: %s\n", msg);
@ -373,8 +372,7 @@ bool disk_control_set_eject_state(
/* Errors should always be displayed */ /* Errors should always be displayed */
if (verbosity || error) if (verbosity || error)
runloop_msg_queue_push( runloop_msg_queue_push(
msg, 1, error ? 180 : 60, msg, _len, 1, error ? 180 : 60, true, NULL,
true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -446,11 +444,8 @@ bool disk_control_set_index(
/* Errors should always be displayed */ /* Errors should always be displayed */
if (verbosity || error) if (verbosity || error)
runloop_msg_queue_push( runloop_msg_queue_push(msg, strlen(msg), 1, msg_duration, true, NULL,
msg, 1, msg_duration, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO);
} }
/* If operation was successful, update disk /* If operation was successful, update disk
@ -634,13 +629,13 @@ bool disk_control_append_image(
msg[ _len] = ':'; msg[ _len] = ':';
msg[++_len] = ' '; msg[++_len] = ' ';
msg[++_len] = '\0'; msg[++_len] = '\0';
strlcpy(msg + _len, image_filename, sizeof(msg) - _len); _len += strlcpy(msg + _len, image_filename, sizeof(msg) - _len);
RARCH_LOG("[Disc]: %s\n", msg); RARCH_LOG("[Disc]: %s\n", msg);
/* This message should always be displayed, since /* This message should always be displayed, since
* the menu itself does not provide sufficient * the menu itself does not provide sufficient
* visual feedback */ * visual feedback */
runloop_msg_queue_push(msg, 0, 120, true, NULL, runloop_msg_queue_push(msg, _len, 0, 120, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return true; return true;
@ -664,11 +659,9 @@ error:
msg[ _len] = ':'; msg[ _len] = ':';
msg[++_len] = ' '; msg[++_len] = ' ';
msg[++_len] = '\0'; msg[++_len] = '\0';
strlcpy(msg + _len, image_filename, sizeof(msg) - _len); _len += strlcpy(msg + _len, image_filename, sizeof(msg) - _len);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 0, 180, true, NULL,
msg, 0, 180,
true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false; return false;
@ -806,6 +799,7 @@ bool disk_control_verify_initial_index(
/* If current disk is incorrect, notify user */ /* If current disk is incorrect, notify user */
if (!success && enabled) if (!success && enabled)
{ {
const char *_msg = msg_hash_to_str(MSG_FAILED_TO_SET_INITIAL_DISK);
RARCH_ERR( RARCH_ERR(
"[Disc]: Failed to set initial disc index:\n> Expected" "[Disc]: Failed to set initial disc index:\n> Expected"
" [%u] %s\n> Detected [%u] %s\n", " [%u] %s\n> Detected [%u] %s\n",
@ -816,10 +810,7 @@ bool disk_control_verify_initial_index(
/* Ignore 'verbosity' setting - errors should /* Ignore 'verbosity' setting - errors should
* always be displayed */ * always be displayed */
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 0, 60, true, NULL,
msg_hash_to_str(MSG_FAILED_TO_SET_INITIAL_DISK),
0, 60,
true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
/* Since a failure here typically means that the /* Since a failure here typically means that the
@ -861,9 +852,7 @@ bool disk_control_verify_initial_index(
* we do not want to 'overwrite' them */ * we do not want to 'overwrite' them */
if (verbosity) if (verbosity)
runloop_msg_queue_push( runloop_msg_queue_push(
msg, msg, strlen(msg), 0, msg_duration, false, NULL,
0, msg_duration,
false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS

View File

@ -179,6 +179,7 @@ static void msg_widget_msg_transition_animation_done(void *userdata)
void gfx_widgets_msg_queue_push( void gfx_widgets_msg_queue_push(
retro_task_t *task, retro_task_t *task,
const char *msg, const char *msg,
size_t len,
unsigned duration, unsigned duration,
char *title, char *title,
enum message_queue_icon icon, enum message_queue_icon icon,
@ -203,7 +204,6 @@ void gfx_widgets_msg_queue_push(
if (!msg_widget) if (!msg_widget)
{ {
const char *title = msg; const char *title = msg;
size_t title_length = strlen(title);
msg_widget = (disp_widget_msg_t*)malloc(sizeof(*msg_widget)); msg_widget = (disp_widget_msg_t*)malloc(sizeof(*msg_widget));
@ -245,8 +245,7 @@ void gfx_widgets_msg_queue_push(
{ {
title = msg_widget->msg = strdup(task->title); title = msg_widget->msg = strdup(task->title);
msg_widget->msg_new = strdup(title); msg_widget->msg_new = strdup(title);
title_length = strlen(title); msg_widget->msg_len = len;
msg_widget->msg_len = title_length;
if (!string_is_empty(task->error)) if (!string_is_empty(task->error))
msg_widget->flags |= DISPWIDG_FLAG_TASK_ERROR; msg_widget->flags |= DISPWIDG_FLAG_TASK_ERROR;
@ -288,11 +287,11 @@ void gfx_widgets_msg_queue_push(
unsigned text_width = font_driver_get_message_width( unsigned text_width = font_driver_get_message_width(
p_dispwidget->gfx_widget_fonts.msg_queue.font, p_dispwidget->gfx_widget_fonts.msg_queue.font,
title, title,
title_length, len,
1.0f); 1.0f);
msg_widget->text_height = p_dispwidget->gfx_widget_fonts.msg_queue.line_height; msg_widget->text_height = p_dispwidget->gfx_widget_fonts.msg_queue.line_height;
/* 1 byte uses for inserting '\n' */ /* 1 byte uses for inserting '\n' */
msg_len = title_length + 1 + 1; msg_len = len + 1 + 1;
if (!(msg = (char *)malloc(msg_len))) if (!(msg = (char *)malloc(msg_len)))
return; return;
msg[0] = '\0'; msg[0] = '\0';
@ -308,24 +307,22 @@ void gfx_widgets_msg_queue_push(
if ((text_width - (text_width >> 2)) < width) if ((text_width - (text_width >> 2)) < width)
width = text_width - (text_width >> 2); width = text_width - (text_width >> 2);
word_wrap(msg, msg_len, title, title_length, word_wrap(msg, msg_len, title, len,
(int)((title_length * width) / text_width), (int)((len * width) / text_width),
100, 2); 100, 2);
/* Recalculate widget width with longest wrapped line */ /* Recalculate widget width with longest wrapped line */
wrap_length = string_index_last_occurance(msg, '\n'); wrap_length = string_index_last_occurance(msg, '\n');
if (wrap_length) if (wrap_length)
{ {
title_length -= wrap_length; len -= wrap_length;
if (title_length < wrap_length) if (len < wrap_length)
title_length = wrap_length; len = wrap_length;
text_width = font_driver_get_message_width( text_width = font_driver_get_message_width(
p_dispwidget->gfx_widget_fonts.msg_queue.font, p_dispwidget->gfx_widget_fonts.msg_queue.font,
title, title, len, 1.0f);
title_length,
1.0f);
width = text_width; width = text_width;
} }
@ -358,7 +355,7 @@ void gfx_widgets_msg_queue_push(
if (!string_is_equal(task->title, msg_widget->msg_new)) if (!string_is_equal(task->title, msg_widget->msg_new))
{ {
size_t len; size_t _len;
unsigned new_width; unsigned new_width;
if (msg_widget->msg_new) if (msg_widget->msg_new)
@ -369,14 +366,14 @@ void gfx_widgets_msg_queue_push(
title = msg_widget->msg_new = strdup(task->title); title = msg_widget->msg_new = strdup(task->title);
len = strlen(title); _len = strlen(title);
new_width = font_driver_get_message_width( new_width = font_driver_get_message_width(
p_dispwidget->gfx_widget_fonts.msg_queue.font, p_dispwidget->gfx_widget_fonts.msg_queue.font,
title, title,
len, _len,
1.0f); 1.0f);
msg_widget->msg_len = len; msg_widget->msg_len = _len;
msg_widget->msg_transition_animation = 0; msg_widget->msg_transition_animation = 0;
if (!((task->flags & RETRO_TASK_FLG_ALTERNATIVE_LOOK) > 0)) if (!((task->flags & RETRO_TASK_FLG_ALTERNATIVE_LOOK) > 0))

View File

@ -351,6 +351,7 @@ void gfx_widgets_deinit(bool widgets_persisting);
void gfx_widgets_msg_queue_push( void gfx_widgets_msg_queue_push(
retro_task_t *task, const char *msg, retro_task_t *task, const char *msg,
size_t len,
unsigned duration, unsigned duration,
char *title, char *title,
enum message_queue_icon icon, enum message_queue_icon icon,

View File

@ -795,6 +795,7 @@ static void video_monitor_compute_fps_statistics(uint64_t
void video_monitor_set_refresh_rate(float hz) void video_monitor_set_refresh_rate(float hz)
{ {
size_t _len;
char msg[256]; char msg[256];
char rate[8]; char rate[8];
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -804,13 +805,13 @@ void video_monitor_set_refresh_rate(float hz)
return; return;
snprintf(rate, sizeof(rate), "%.3f", hz); snprintf(rate, sizeof(rate), "%.3f", hz);
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_VIDEO_REFRESH_RATE_CHANGED), rate); msg_hash_to_str(MSG_VIDEO_REFRESH_RATE_CHANGED), rate);
/* Message is visible for twice the usual duration */ /* Message is visible for twice the usual duration */
/* as modeswitch will cause monitors to go blank for a while */ /* as modeswitch will cause monitors to go blank for a while */
if (settings->bools.notification_show_refresh_rate) if (settings->bools.notification_show_refresh_rate)
runloop_msg_queue_push(msg, 1, 360, false, NULL, runloop_msg_queue_push(msg, _len, 1, 360, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[Video]: %s\n", msg); RARCH_LOG("[Video]: %s\n", msg);
@ -1070,12 +1071,11 @@ void recording_dump_frame(
if ( (vp.width != record_st->gpu_width) if ( (vp.width != record_st->gpu_width)
|| (vp.height != record_st->gpu_height)) || (vp.height != record_st->gpu_height))
{ {
const char *recording_failed_str = const char *_msg =
msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE); msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE);
RARCH_WARN("[Recording]: %s\n", recording_failed_str); RARCH_WARN("[Recording]: %s\n", _msg);
runloop_msg_queue_push(recording_failed_str, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true,
1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
command_event(CMD_EVENT_RECORD_DEINIT, NULL); command_event(CMD_EVENT_RECORD_DEINIT, NULL);
return; return;
@ -4041,6 +4041,7 @@ void video_driver_frame(const void *data, unsigned width,
gfx_widgets_msg_queue_push( gfx_widgets_msg_queue_push(
NULL, NULL,
msg_entry.msg, msg_entry.msg,
strlen(msg_entry.msg),
roundf((float)msg_entry.duration / 60.0f * 1000.0f), roundf((float)msg_entry.duration / 60.0f * 1000.0f),
msg_entry.title, msg_entry.title,
msg_entry.icon, msg_entry.icon,
@ -4253,7 +4254,8 @@ void video_driver_frame(const void *data, unsigned width,
else else
#endif #endif
{ {
runloop_msg_queue_push(status_text, 2, 1, true, NULL, /* TODO/FIXME - get rid of strlen here */
runloop_msg_queue_push(status_text, strlen(status_text), 2, 1, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }

View File

@ -142,7 +142,7 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
name[0] = '\0'; name[0] = '\0';
strlcpy(key, "filter", sizeof(key)); strlcpy(key, "filter", sizeof(key));
if (!config_get_array(filt->conf, key, name, sizeof(name))) if (config_get_array(filt->conf, key, name, sizeof(name)) == 0)
{ {
RARCH_ERR("Could not find 'filter' array in config.\n"); RARCH_ERR("Could not find 'filter' array in config.\n");
return false; return false;

View File

@ -686,7 +686,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
_len = strlcpy(shader_var, "shader", sizeof(shader_var)); _len = strlcpy(shader_var, "shader", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len); strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (!config_get_path(conf, shader_var, tmp_path, sizeof(tmp_path))) if (config_get_path(conf, shader_var, tmp_path, sizeof(tmp_path)) == 0)
{ {
RARCH_ERR("[Shaders]: Couldn't parse shader source \"%s\".\n", shader_var); RARCH_ERR("[Shaders]: Couldn't parse shader source \"%s\".\n", shader_var);
return false; return false;
@ -758,23 +758,28 @@ static bool video_shader_parse_pass(config_file_t *conf,
scale = &pass->fbo; scale = &pass->fbo;
_len = strlcpy(shader_var, "scale_type", sizeof(shader_var)); _len = strlcpy(shader_var, "scale_type", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len); strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
config_get_array(conf, shader_var, scale_type, sizeof(scale_type)); if (config_get_array(conf, shader_var, scale_type, sizeof(scale_type)) > 0)
_len = strlcpy(shader_var, "scale_type_x", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
config_get_array(conf, shader_var, scale_type_x, sizeof(scale_type_x));
_len = strlcpy(shader_var, "scale_type_y", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
config_get_array(conf, shader_var, scale_type_y, sizeof(scale_type_y));
if (*scale_type)
{ {
strlcpy(scale_type_x, scale_type, sizeof(scale_type_x)); strlcpy(scale_type_x, scale_type, sizeof(scale_type_x));
strlcpy(scale_type_y, scale_type, sizeof(scale_type_y)); strlcpy(scale_type_y, scale_type, sizeof(scale_type_y));
} }
else if (!*scale_type_x && !*scale_type_y) else
return true; {
size_t __len_x, __len_y;
_len = strlcpy(shader_var, "scale_type_x", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
__len_x = config_get_array(conf, shader_var, scale_type_x, sizeof(scale_type_x));
_len = strlcpy(shader_var, "scale_type_y", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
__len_y = config_get_array(conf, shader_var, scale_type_y, sizeof(scale_type_y));
if (__len_x == 0 && __len_y == 0)
return true;
}
scale->flags |= FBO_SCALE_FLAG_VALID; scale->flags |= FBO_SCALE_FLAG_VALID;
scale->type_x = RARCH_SCALE_INPUT; scale->type_x = RARCH_SCALE_INPUT;
@ -923,13 +928,14 @@ static bool video_shader_parse_textures(config_file_t *conf,
return false; return false;
} }
config_get_path(conf, id, texture_path, sizeof(texture_path)); if (config_get_path(conf, id, texture_path, sizeof(texture_path)) > 0)
{
/* Get the absolute path and replace wildcards in the path */ /* Get the absolute path and replace wildcards in the path */
fill_pathname_expanded_and_absolute(shader->lut[shader->luts].path, fill_pathname_expanded_and_absolute(shader->lut[shader->luts].path,
PATH_MAX_LENGTH, conf->path, texture_path); PATH_MAX_LENGTH, conf->path, texture_path);
video_shader_replace_wildcards(shader->lut[shader->luts].path, video_shader_replace_wildcards(shader->lut[shader->luts].path,
PATH_MAX_LENGTH, conf->path); PATH_MAX_LENGTH, conf->path);
}
strlcpy(shader->lut[shader->luts].id, id, strlcpy(shader->lut[shader->luts].id, id,
sizeof(shader->lut[shader->luts].id)); sizeof(shader->lut[shader->luts].id));
@ -1328,16 +1334,18 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
/* Step through the textures in the shader */ /* Step through the textures in the shader */
for (i = 0; i < shader->luts; i++) for (i = 0; i < shader->luts; i++)
{ {
size_t _len;
char k[128];
fill_pathname_abbreviated_or_relative(tmp_rel, fill_pathname_abbreviated_or_relative(tmp_rel,
tmp_base, shader->lut[i].path, PATH_MAX_LENGTH); tmp_base, shader->lut[i].path, PATH_MAX_LENGTH);
pathname_make_slashes_portable(tmp_rel); pathname_make_slashes_portable(tmp_rel);
config_set_string(conf, shader->lut[i].id, tmp_rel); config_set_string(conf, shader->lut[i].id, tmp_rel);
_len = strlcpy(k, shader->lut[i].id, sizeof(k));
/* Linear filter ON or OFF */ /* Linear filter ON or OFF */
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC) if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{ {
char k[128];
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k));
strlcpy(k + _len, "_linear", sizeof(k) - _len); strlcpy(k + _len, "_linear", sizeof(k) - _len);
config_set_string(conf, k, config_set_string(conf, k,
(shader->lut[i].filter == RARCH_FILTER_LINEAR) (shader->lut[i].filter == RARCH_FILTER_LINEAR)
@ -1346,23 +1354,15 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
} }
/* Wrap Mode */ /* Wrap Mode */
{ strlcpy(k + _len, "_wrap_mode", sizeof(k) - _len);
char k[128]; config_set_string(conf, k,
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k)); video_shader_wrap_mode_to_str(shader->lut[i].wrap));
strlcpy(k + _len, "_wrap_mode", sizeof(k) - _len);
config_set_string(conf, k,
video_shader_wrap_mode_to_str(shader->lut[i].wrap));
}
/* Mipmap On or Off */ /* Mipmap On or Off */
{ strlcpy(k + _len, "_mipmap", sizeof(k) - _len);
char k[128]; config_set_string(conf, k, shader->lut[i].mipmap
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k)); ? "true"
strlcpy(k + _len, "_mipmap", sizeof(k) - _len); : "false");
config_set_string(conf, k, shader->lut[i].mipmap
? "true"
: "false");
}
} }
} }
@ -2172,13 +2172,16 @@ static bool video_shader_override_values(config_file_t *override_conf,
char *tex_path = (char*)malloc(PATH_MAX_LENGTH); char *tex_path = (char*)malloc(PATH_MAX_LENGTH);
/* Texture path from the config */ /* Texture path from the config */
config_get_path(override_conf, shader->lut[i].id, tex_path, PATH_MAX_LENGTH); if (config_get_path(override_conf, shader->lut[i].id, tex_path, PATH_MAX_LENGTH) > 0)
{
/* Get the absolute path and replace wildcards in the path */
fill_pathname_expanded_and_absolute(override_tex_path, PATH_MAX_LENGTH,
override_conf->path, tex_path);
video_shader_replace_wildcards(override_tex_path, PATH_MAX_LENGTH,
override_conf->path);
}
/* Get the absolute path and replace wildcards in the path */ free(tex_path);
fill_pathname_expanded_and_absolute(override_tex_path, PATH_MAX_LENGTH,
override_conf->path, tex_path);
video_shader_replace_wildcards(override_tex_path, PATH_MAX_LENGTH,
override_conf->path);
strlcpy(shader->lut[i].path, override_tex_path, sizeof(shader->lut[i].path)); strlcpy(shader->lut[i].path, override_tex_path, sizeof(shader->lut[i].path));
@ -2188,7 +2191,6 @@ static bool video_shader_override_values(config_file_t *override_conf,
shader->lut[i].path); shader->lut[i].path);
#endif #endif
free(tex_path);
return_val = true; return_val = true;
} }
} }
@ -2894,31 +2896,35 @@ static bool video_shader_load_shader_preset_internal(
flags.flags = 0; flags.flags = 0;
video_context_driver_get_flags(&flags); video_context_driver_get_flags(&flags);
for (i = 0; i < (int)ARRAY_SIZE(types); i++) if (!string_is_empty(core_name))
{ {
if (!BIT32_GET(flags.flags, video_shader_type_to_flag(types[i]))) for (i = 0; i < (int)ARRAY_SIZE(types); i++)
continue; {
if (!BIT32_GET(flags.flags, video_shader_type_to_flag(types[i])))
/* Concatenate strings into full paths */ continue;
if (!string_is_empty(core_name))
fill_pathname_join_special_ext(s, fill_pathname_join_special_ext(s,
shader_directory, core_name, shader_directory, core_name,
special_name, special_name,
video_shader_get_preset_extension(types[i]), video_shader_get_preset_extension(types[i]),
len); len);
else if (path_is_valid(s))
{ return true;
size_t _len;
if (string_is_empty(special_name))
break;
_len = fill_pathname_join(s, shader_directory, special_name, len);
strlcpy(s + _len, video_shader_get_preset_extension(types[i]), len - _len);
} }
if (path_is_valid(s))
return true;
} }
else if (!string_is_empty(special_name))
{
for (i = 0; i < (int)ARRAY_SIZE(types); i++)
{
if (BIT32_GET(flags.flags, video_shader_type_to_flag(types[i])))
{
size_t _len = fill_pathname_join(s, shader_directory, special_name, len);
strlcpy(s + _len, video_shader_get_preset_extension(types[i]), len - _len);
if (path_is_valid(s))
return true;
}
}
}
return false; return false;
} }
@ -3084,6 +3090,7 @@ bool video_shader_apply_shader(
const char *preset_path, const char *preset_path,
bool message) bool message)
{ {
size_t _len;
char msg[NAME_MAX_LENGTH]; char msg[NAME_MAX_LENGTH];
video_driver_state_t *video_st = video_state_get_ptr(); video_driver_state_t *video_st = video_state_get_ptr();
runloop_state_t *runloop_st = runloop_state_get_ptr(); runloop_state_t *runloop_st = runloop_state_get_ptr();
@ -3128,7 +3135,7 @@ bool video_shader_apply_shader(
{ {
/* Display message */ /* Display message */
const char *msg_shader = msg_hash_to_str(MSG_SHADER); const char *msg_shader = msg_hash_to_str(MSG_SHADER);
size_t _len = strlcpy(msg, msg_shader, sizeof(msg)); _len = strlcpy(msg, msg_shader, sizeof(msg));
msg[ _len] = ':'; msg[ _len] = ':';
msg[++_len] = ' '; msg[++_len] = ' ';
if (preset_file) if (preset_file)
@ -3143,7 +3150,7 @@ bool video_shader_apply_shader(
else else
{ {
msg[++_len] = '\0'; msg[++_len] = '\0';
strlcpy(msg + _len, _len += strlcpy(msg + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE),
sizeof(msg) - _len); sizeof(msg) - _len);
} }
@ -3153,7 +3160,7 @@ bool video_shader_apply_shader(
gfx_widget_set_generic_message(msg, 2000); gfx_widget_set_generic_message(msg, 2000);
else else
#endif #endif
runloop_msg_queue_push(msg, 1, 120, true, NULL, runloop_msg_queue_push(msg, _len, 1, 120, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -3171,14 +3178,13 @@ bool video_shader_apply_shader(
#endif #endif
/* Display error message */ /* Display error message */
fill_pathname_join_delim(msg, _len = fill_pathname_join_delim(msg,
msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER_PRESET), msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER_PRESET),
preset_file ? preset_file : "null", preset_file ? preset_file : "null",
' ', ' ',
sizeof(msg)); sizeof(msg));
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
msg, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return false; return false;
} }

View File

@ -6176,21 +6176,19 @@ bool replay_set_serialized_data(void* buf)
{ {
if (recording) if (recording)
{ {
const char *str = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_FAILED_INCOMPAT); const char *_msg = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_FAILED_INCOMPAT);
runloop_msg_queue_push(str, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1, 180, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); RARCH_ERR("[Replay] %s.\n", _msg);
RARCH_ERR("[Replay] %s.\n", str);
return false; return false;
} }
if (playback) if (playback)
{ {
const char *str = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_HALT_INCOMPAT); const char *_msg = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_HALT_INCOMPAT);
runloop_msg_queue_push(str, runloop_msg_queue_push(_msg, sizeof(_msg), 1, 180, true, NULL,
1, 180, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); RARCH_WARN("[Replay] %s.\n", _msg);
RARCH_WARN("[Replay] %s.\n", str);
movie_stop(input_st); movie_stop(input_st);
} }
} }
@ -6236,21 +6234,19 @@ bool replay_set_serialized_data(void* buf)
/* otherwise, if recording do not allow the load */ /* otherwise, if recording do not allow the load */
if (recording) if (recording)
{ {
const char *str = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_FAILED_INCOMPAT); const char *_msg = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_FAILED_INCOMPAT);
runloop_msg_queue_push(str, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1, 180, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); RARCH_ERR("[Replay] %s.\n", _msg);
RARCH_ERR("[Replay] %s.\n", str);
return false; return false;
} }
/* if in playback, halt playback and go to that state normally */ /* if in playback, halt playback and go to that state normally */
if (playback) if (playback)
{ {
const char *str = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_HALT_INCOMPAT); const char *_msg = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_HALT_INCOMPAT);
runloop_msg_queue_push(str, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1, 180, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); RARCH_WARN("[Replay] %s.\n", _msg);
RARCH_WARN("[Replay] %s.\n", str);
movie_stop(input_st); movie_stop(input_st);
} }
} }

View File

@ -112,7 +112,7 @@ static bool create_filter_graph(retro_dsp_filter_t *dsp, float sample_rate)
snprintf(key, sizeof(key), "filter%u", i); snprintf(key, sizeof(key), "filter%u", i);
if (!config_get_array(dsp->conf, key, name, sizeof(name))) if (config_get_array(dsp->conf, key, name, sizeof(name)) == 0)
return false; return false;
dsp->instances[i].impl = find_implementation(dsp, name); dsp->instances[i].impl = find_implementation(dsp, name);

View File

@ -355,12 +355,7 @@ static void config_file_add_child_list(config_file_t *parent,
static void config_file_get_realpath(char *s, size_t len, static void config_file_get_realpath(char *s, size_t len,
char *path, const char *config_path) char *path, const char *config_path)
{ {
#ifdef _WIN32 #if !defined(_WIN32) && !defined(__PSL1GHT__) && !defined(__PS3__)
if (!string_is_empty(config_path))
fill_pathname_resolve_relative(s, config_path,
path, len);
#else
#if !defined(__PSL1GHT__) && !defined(__PS3__)
if (*path == '~') if (*path == '~')
{ {
const char *home = getenv("HOME"); const char *home = getenv("HOME");
@ -374,9 +369,11 @@ static void config_file_get_realpath(char *s, size_t len,
} }
else else
#endif #endif
{
if (!string_is_empty(config_path)) if (!string_is_empty(config_path))
fill_pathname_resolve_relative(s, config_path, path, len); fill_pathname_resolve_relative(s, config_path,
#endif path, len);
}
} }
static void config_file_add_sub_conf(config_file_t *conf, char *path, static void config_file_add_sub_conf(config_file_t *conf, char *path,
@ -1163,37 +1160,33 @@ bool config_get_string(config_file_t *conf, const char *key, char **str)
* Extracts a string to a preallocated buffer. * Extracts a string to a preallocated buffer.
* Avoid memory allocation. * Avoid memory allocation.
**/ **/
bool config_get_config_path(config_file_t *conf, char *s, size_t len) size_t config_get_config_path(config_file_t *conf, char *s, size_t len)
{ {
if (conf) if (conf)
return strlcpy(s, conf->path, len); return strlcpy(s, conf->path, len);
return false; return 0;
} }
bool config_get_array(config_file_t *conf, const char *key, size_t config_get_array(config_file_t *conf, const char *key,
char *buf, size_t size) char *buf, size_t size)
{ {
const struct config_entry_list *entry = config_get_entry(conf, key); const struct config_entry_list *entry = config_get_entry(conf, key);
if (entry) if (entry)
return strlcpy(buf, entry->value, size) < size; return strlcpy(buf, entry->value, size) < size;
return false; return 0;
} }
bool config_get_path(config_file_t *conf, const char *key, size_t config_get_path(config_file_t *conf, const char *key,
char *buf, size_t size) char *buf, size_t size)
{ {
#if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL) #if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL)
if (config_get_array(conf, key, buf, size)) return config_get_array(conf, key, buf, size);
return true;
#else #else
const struct config_entry_list *entry = config_get_entry(conf, key); const struct config_entry_list *entry = config_get_entry(conf, key);
if (entry) if (entry)
{ return fill_pathname_expand_special(buf, entry->value, size);
fill_pathname_expand_special(buf, entry->value, size);
return true;
}
#endif #endif
return false; return 0;
} }
/** /**

View File

@ -263,7 +263,7 @@ bool config_get_char(config_file_t *conf, const char *entry, char *in);
bool config_get_string(config_file_t *conf, const char *entry, char **in); bool config_get_string(config_file_t *conf, const char *entry, char **in);
/* Extracts a string to a preallocated buffer. Avoid memory allocation. */ /* Extracts a string to a preallocated buffer. Avoid memory allocation. */
bool config_get_array(config_file_t *conf, const char *entry, char *s, size_t len); size_t config_get_array(config_file_t *conf, const char *entry, char *s, size_t len);
/** /**
* config_get_config_path: * config_get_config_path:
@ -274,11 +274,11 @@ bool config_get_array(config_file_t *conf, const char *entry, char *s, size_t le
* Hidden non-leaf function cost: * Hidden non-leaf function cost:
* - Calls strlcpy * - Calls strlcpy
**/ **/
bool config_get_config_path(config_file_t *conf, char *s, size_t len); size_t config_get_config_path(config_file_t *conf, char *s, size_t len);
/* Extracts a string to a preallocated buffer. Avoid memory allocation. /* Extracts a string to a preallocated buffer. Avoid memory allocation.
* Recognized magic like ~/. Similar to config_get_array() otherwise. */ * Recognized magic like ~/. Similar to config_get_array() otherwise. */
bool config_get_path(config_file_t *conf, const char *entry, char *s, size_t len); size_t config_get_path(config_file_t *conf, const char *entry, char *s, size_t len);
/** /**
* config_get_bool: * config_get_bool:

View File

@ -2881,6 +2881,7 @@ static int action_ok_playlist_entry_collection(const char *path,
error: error:
runloop_msg_queue_push( runloop_msg_queue_push(
"File could not be loaded from playlist.\n", "File could not be loaded from playlist.\n",
STRLEN_CONST("File could not be loaded from playlist.\n"),
1, 100, true, 1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
@ -2973,12 +2974,11 @@ static int action_ok_load_cdrom(const char *path,
if (!cdrom_drive_has_media(label[0])) if (!cdrom_drive_has_media(label[0]))
{ {
const char *_msg = msg_hash_to_str(MSG_NO_DISC_INSERTED);
RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n"); RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n");
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
msg_hash_to_str(MSG_NO_DISC_INSERTED), MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return -1; return -1;
} }
@ -3013,12 +3013,11 @@ static int action_ok_load_cdrom(const char *path,
} }
else else
{ {
const char *_msg = msg_hash_to_str(MSG_LOAD_CORE_FIRST);
RARCH_LOG("[CDROM]: Cannot load disc without a core.\n"); RARCH_LOG("[CDROM]: Cannot load disc without a core.\n");
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
msg_hash_to_str(MSG_LOAD_CORE_FIRST), MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return -1; return -1;
} }
@ -3034,11 +3033,10 @@ static int action_ok_dump_cdrom(const char *path,
#ifdef HAVE_CDROM #ifdef HAVE_CDROM
if (!cdrom_drive_has_media(label[0])) if (!cdrom_drive_has_media(label[0]))
{ {
const char *_msg = msg_hash_to_str(MSG_NO_DISC_INSERTED);
RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n"); RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n");
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true,
msg_hash_to_str(MSG_NO_DISC_INSERTED),
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return -1; return -1;
@ -3296,18 +3294,18 @@ static void menu_input_st_string_cb_disable_kiosk_mode(void *userdata,
if (string_is_equal(label, path_kiosk_mode_password)) if (string_is_equal(label, path_kiosk_mode_password))
{ {
const char *_msg = msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD_OK);
settings->bools.kiosk_mode_enable = false; settings->bools.kiosk_mode_enable = false;
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD_OK), MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK), const char *_msg = msg_hash_to_str(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
menu_input_dialog_end(); menu_input_dialog_end();
@ -3325,18 +3323,18 @@ static void menu_input_st_string_cb_enable_settings(void *userdata,
if (string_is_equal(label, menu_content_show_settings_password)) if (string_is_equal(label, menu_content_show_settings_password))
{ {
const char *_msg = msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK);
settings->bools.menu_content_show_settings = true; settings->bools.menu_content_show_settings = true;
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK), MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK), const char *_msg = msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
menu_input_dialog_end(); menu_input_dialog_end();
@ -3392,15 +3390,17 @@ static void menu_input_st_string_cb_save_preset(void *userdata,
true); true);
if (ret) if (ret)
runloop_msg_queue_push( {
msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY), const char *_msg = msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET), const char *_msg = msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
menu_input_dialog_end(); menu_input_dialog_end();
@ -3458,17 +3458,17 @@ static int generic_action_ok_shader_preset_remove(const char *path,
dir_video_shader, dir_menu_config)) dir_video_shader, dir_menu_config))
{ {
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY);
msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET), const char *_msg = msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return 0; return 0;
} }
@ -3508,15 +3508,17 @@ static int generic_action_ok_shader_preset_save(const char *path,
if (menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type, if (menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type,
dir_video_shader, dir_menu_config, dir_video_shader, dir_menu_config,
true)) true))
runloop_msg_queue_push( {
msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY), const char *_msg = msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET), const char *_msg = msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return 0; return 0;
} }
@ -3763,6 +3765,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
if (action_type < ACTION_OK_REMAP_FILE_REMOVE_CORE) if (action_type < ACTION_OK_REMAP_FILE_REMOVE_CORE)
{ {
const char *_msg;
if ( !string_is_empty(remap_file_path) if ( !string_is_empty(remap_file_path)
&& input_remapping_save_file(remap_file_path)) && input_remapping_save_file(remap_file_path))
{ {
@ -3779,18 +3782,18 @@ static int generic_action_ok_remap_file_operation(const char *path,
break; break;
} }
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_REMAP_FILE_SAVED_SUCCESSFULLY);
msg_hash_to_str(MSG_REMAP_FILE_SAVED_SUCCESSFULLY), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); /* TODO/FIXME - localize */
RARCH_LOG("[Remap]: File saved successfully: \"%s\".\n",remap_file_path); RARCH_LOG("[Remap]: File saved successfully: \"%s\".\n",remap_file_path);
} }
else else
{ {
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_ERROR_SAVING_REMAP_FILE);
msg_hash_to_str(MSG_ERROR_SAVING_REMAP_FILE), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); /* TODO/FIXME - localize */
RARCH_ERR("[Remap]: File save unsuccessful: \"%s\".\n",remap_file_path); RARCH_ERR("[Remap]: File save unsuccessful: \"%s\".\n",remap_file_path);
} }
} }
@ -3799,6 +3802,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
if ( !string_is_empty(remap_file_path) if ( !string_is_empty(remap_file_path)
&& (filestream_delete(remap_file_path) == 0)) && (filestream_delete(remap_file_path) == 0))
{ {
const char *_msg;
uint32_t flags = runloop_get_flags(); uint32_t flags = runloop_get_flags();
switch (action_type) switch (action_type)
{ {
@ -3816,10 +3820,9 @@ static int generic_action_ok_remap_file_operation(const char *path,
break; break;
} }
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY);
msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
/* After removing a remap file, attempt to /* After removing a remap file, attempt to
* load any remaining remap file with the * load any remaining remap file with the
@ -3827,10 +3830,11 @@ static int generic_action_ok_remap_file_operation(const char *path,
config_load_remap(directory_input_remapping, sys_info); config_load_remap(directory_input_remapping, sys_info);
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_REMOVING_REMAP_FILE), const char *_msg = msg_hash_to_str(MSG_ERROR_REMOVING_REMAP_FILE);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
/* Refresh menu */ /* Refresh menu */
@ -3920,17 +3924,17 @@ static int action_ok_remap_file_remove_game(const char *path,
static int action_ok_remap_file_reset(const char *path, static int action_ok_remap_file_reset(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
const char *_msg = msg_hash_to_str(MSG_REMAP_FILE_RESET);
input_remapping_set_defaults(false); input_remapping_set_defaults(false);
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
msg_hash_to_str(MSG_REMAP_FILE_RESET), MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
static int action_ok_remap_file_flush(const char *path, static int action_ok_remap_file_flush(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
size_t _len;
char msg[128]; char msg[128];
runloop_state_t *runloop_st = runloop_state_get_ptr(); runloop_state_t *runloop_st = runloop_state_get_ptr();
const char *path_remapfile = runloop_st->name.remapfile; const char *path_remapfile = runloop_st->name.remapfile;
@ -3958,7 +3962,7 @@ static int action_ok_remap_file_flush(const char *path,
RARCH_LOG( RARCH_LOG(
"[Remaps]: Saved input remapping options to \"%s\".\n", "[Remaps]: Saved input remapping options to \"%s\".\n",
path_remapfile ? path_remapfile : "UNKNOWN"); path_remapfile ? path_remapfile : "UNKNOWN");
snprintf(msg, sizeof(msg), "%s \"%s\"", _len = snprintf(msg, sizeof(msg), "%s \"%s\"",
msg_hash_to_str(MSG_REMAP_FILE_FLUSHED), msg_hash_to_str(MSG_REMAP_FILE_FLUSHED),
remapfile); remapfile);
} }
@ -3968,14 +3972,13 @@ static int action_ok_remap_file_flush(const char *path,
RARCH_LOG( RARCH_LOG(
"[Remaps]: Failed to save input remapping options to \"%s\".\n", "[Remaps]: Failed to save input remapping options to \"%s\".\n",
path_remapfile ? path_remapfile : "UNKNOWN"); path_remapfile ? path_remapfile : "UNKNOWN");
snprintf(msg, sizeof(msg), "%s \"%s\"", _len = snprintf(msg, sizeof(msg), "%s \"%s\"",
msg_hash_to_str(MSG_REMAP_FILE_FLUSH_FAILED), msg_hash_to_str(MSG_REMAP_FILE_FLUSH_FAILED),
remapfile); remapfile);
} }
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
msg, 1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -4023,10 +4026,8 @@ static void menu_input_st_string_cb_override_file_save_as(
break; break;
} }
runloop_msg_queue_push( runloop_msg_queue_push(msg_str, strlen(msg_str), 1, 100, true, NULL,
msg_str, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
menu_input_dialog_end(); menu_input_dialog_end();
@ -4043,10 +4044,11 @@ static int action_ok_override_unload(const char *path,
{ {
#ifdef HAVE_CONFIGFILE #ifdef HAVE_CONFIGFILE
if (config_unload_override()) if (config_unload_override())
runloop_msg_queue_push( {
msg_hash_to_str(MSG_OVERRIDES_UNLOADED_SUCCESSFULLY), const char *_msg = msg_hash_to_str(MSG_OVERRIDES_UNLOADED_SUCCESSFULLY);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
#endif #endif
return 0; return 0;
} }
@ -4154,9 +4156,10 @@ static int action_ok_core_deferred_set(const char *new_core_path,
&entry); &entry);
/* Provide visual feedback */ /* Provide visual feedback */
_len = strlcpy(msg, msg_hash_to_str(MSG_SET_CORE_ASSOCIATION), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_SET_CORE_ASSOCIATION), sizeof(msg));
strlcpy(msg + _len, core_display_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, core_display_name, sizeof(msg) - _len);
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
menu_entries_pop_stack(&selection, 0, 1); menu_entries_pop_stack(&selection, 0, 1);
menu_st->selection_ptr = selection; menu_st->selection_ptr = selection;
@ -4191,10 +4194,10 @@ static int action_ok_set_switch_cpu_profile(const char *path,
clkrstCloseSession(&session); clkrstCloseSession(&session);
} }
/* TODO/FIXME - localize */ /* TODO/FIXME - localize */
_len = strlcpy(command, "Current clock set to", sizeof(command)); _len = strlcpy(command, "Current clock set to", sizeof(command));
snprintf(command + _len, sizeof(command) - _len, "%i", profile_clock); _len += snprintf(command + _len, sizeof(command) - _len, "%i", profile_clock);
runloop_msg_queue_push(command, 1, 90, true, NULL, runloop_msg_queue_push(command, _len, 1, 90, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return -1; return -1;
@ -4413,6 +4416,7 @@ static int action_ok_cheat_add_top(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
int i; int i;
size_t _len;
char msg[128]; char msg[128];
struct item_cheat tmp; struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
@ -4435,10 +4439,9 @@ static int action_ok_cheat_add_top(const char *path,
memcpy(&cheat_manager_state.cheats[0], &tmp, sizeof(struct item_cheat)); memcpy(&cheat_manager_state.cheats[0], &tmp, sizeof(struct item_cheat));
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_TOP_SUCCESS), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_TOP_SUCCESS), sizeof(msg));
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
@ -4447,6 +4450,7 @@ static int action_ok_cheat_add_top(const char *path,
static int action_ok_cheat_add_bottom(const char *path, static int action_ok_cheat_add_bottom(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
size_t _len;
char msg[128]; char msg[128];
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
unsigned int new_size = cheat_manager_get_size() + 1; unsigned int new_size = cheat_manager_get_size() + 1;
@ -4455,11 +4459,10 @@ static int action_ok_cheat_add_bottom(const char *path,
| MENU_ST_FLAG_PREVENT_POPULATE; | MENU_ST_FLAG_PREVENT_POPULATE;
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
strlcpy(msg, _len = strlcpy(msg,
msg_hash_to_str(MSG_CHEAT_ADD_BOTTOM_SUCCESS), sizeof(msg)); msg_hash_to_str(MSG_CHEAT_ADD_BOTTOM_SUCCESS), sizeof(msg));
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
@ -4468,6 +4471,7 @@ static int action_ok_cheat_add_bottom(const char *path,
static int action_ok_cheat_delete_all(const char *path, static int action_ok_cheat_delete_all(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
size_t _len;
char msg[128]; char msg[128];
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
@ -4476,11 +4480,10 @@ static int action_ok_cheat_delete_all(const char *path,
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE; | MENU_ST_FLAG_PREVENT_POPULATE;
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_DELETE_ALL_SUCCESS), _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_DELETE_ALL_SUCCESS),
sizeof(msg)); sizeof(msg));
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
@ -4490,6 +4493,7 @@ static int action_ok_cheat_add_new_after(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
int i; int i;
size_t _len;
char msg[128]; char msg[128];
struct item_cheat tmp; struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
@ -4512,10 +4516,11 @@ static int action_ok_cheat_add_new_after(const char *path,
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE; | MENU_ST_FLAG_PREVENT_POPULATE;
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_AFTER_SUCCESS), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_AFTER_SUCCESS),
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */ sizeof(msg));
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -4524,6 +4529,7 @@ static int action_ok_cheat_add_new_before(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
int i; int i;
size_t _len;
char msg[128]; char msg[128];
struct item_cheat tmp; struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
@ -4548,10 +4554,10 @@ static int action_ok_cheat_add_new_before(const char *path,
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE; | MENU_ST_FLAG_PREVENT_POPULATE;
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_BEFORE_SUCCESS), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_BEFORE_SUCCESS), sizeof(msg));
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -4560,8 +4566,9 @@ static int action_ok_cheat_copy_before(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
int i; int i;
struct item_cheat tmp; size_t _len;
char msg[128]; char msg[128];
struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
unsigned int new_size = cheat_manager_get_size() + 1; unsigned int new_size = cheat_manager_get_size() + 1;
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
@ -4585,10 +4592,10 @@ static int action_ok_cheat_copy_before(const char *path,
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE; | MENU_ST_FLAG_PREVENT_POPULATE;
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_COPY_BEFORE_SUCCESS), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_COPY_BEFORE_SUCCESS), sizeof(msg));
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -4597,6 +4604,7 @@ static int action_ok_cheat_copy_after(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
int i; int i;
size_t _len;
char msg[128]; char msg[128];
struct item_cheat tmp; struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
@ -4622,10 +4630,11 @@ static int action_ok_cheat_copy_after(const char *path,
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE; | MENU_ST_FLAG_PREVENT_POPULATE;
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_COPY_AFTER_SUCCESS), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_COPY_AFTER_SUCCESS),
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */ sizeof(msg));
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return 0; return 0;
} }
@ -4633,6 +4642,7 @@ static int action_ok_cheat_copy_after(const char *path,
static int action_ok_cheat_delete(const char *path, static int action_ok_cheat_delete(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
size_t _len;
char msg[128]; char msg[128];
size_t new_selection_ptr = 0; size_t new_selection_ptr = 0;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
@ -4663,10 +4673,10 @@ static int action_ok_cheat_delete(const char *path,
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_DELETE_SUCCESS), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_DELETE_SUCCESS), sizeof(msg));
msg[sizeof(msg) - 1] = 0; /* TODO/FIXME - is this necessary? */
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
new_selection_ptr = menu_st->selection_ptr; new_selection_ptr = menu_st->selection_ptr;
menu_entries_pop_stack(&new_selection_ptr, 0, 1); menu_entries_pop_stack(&new_selection_ptr, 0, 1);
@ -6682,6 +6692,7 @@ static int action_ok_push_netplay_refresh_lan(const char *path,
static int action_ok_push_netplay_kick(const char *path, const char *label, static int action_ok_push_netplay_kick(const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx) unsigned type, size_t idx, size_t entry_idx)
{ {
size_t _len;
char msg[128]; char msg[128];
netplay_client_info_t client; netplay_client_info_t client;
@ -6689,13 +6700,13 @@ static int action_ok_push_netplay_kick(const char *path, const char *label,
strlcpy(client.name, path, sizeof(client.name)); strlcpy(client.name, path, sizeof(client.name));
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_KICK_CLIENT, &client)) if (netplay_driver_ctl(RARCH_NETPLAY_CTL_KICK_CLIENT, &client))
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_KICKED_CLIENT_S), client.name); msg_hash_to_str(MSG_NETPLAY_KICKED_CLIENT_S), client.name);
else else
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_FAILED_TO_KICK_CLIENT_S), client.name); msg_hash_to_str(MSG_NETPLAY_FAILED_TO_KICK_CLIENT_S), client.name);
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return action_cancel_pop_default(NULL, NULL, 0, 0); return action_cancel_pop_default(NULL, NULL, 0, 0);
@ -6704,6 +6715,7 @@ static int action_ok_push_netplay_kick(const char *path, const char *label,
static int action_ok_push_netplay_ban(const char *path, const char *label, static int action_ok_push_netplay_ban(const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx) unsigned type, size_t idx, size_t entry_idx)
{ {
size_t _len;
char msg[128]; char msg[128];
netplay_client_info_t client; netplay_client_info_t client;
@ -6711,13 +6723,13 @@ static int action_ok_push_netplay_ban(const char *path, const char *label,
strlcpy(client.name, path, sizeof(client.name)); strlcpy(client.name, path, sizeof(client.name));
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_BAN_CLIENT, &client)) if (netplay_driver_ctl(RARCH_NETPLAY_CTL_BAN_CLIENT, &client))
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_BANNED_CLIENT_S), client.name); msg_hash_to_str(MSG_NETPLAY_BANNED_CLIENT_S), client.name);
else else
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_FAILED_TO_BAN_CLIENT_S), client.name); msg_hash_to_str(MSG_NETPLAY_FAILED_TO_BAN_CLIENT_S), client.name);
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return action_cancel_pop_default(NULL, NULL, 0, 0); return action_cancel_pop_default(NULL, NULL, 0, 0);
@ -7769,6 +7781,7 @@ static int action_ok_video_resolution(const char *path,
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc))) if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
{ {
size_t _len;
char msg[128]; char msg[128];
msg[0] = '\0'; msg[0] = '\0';
@ -7778,21 +7791,21 @@ static int action_ok_video_resolution(const char *path,
video_driver_set_video_mode(width, height, true); video_driver_set_video_mode(width, height, true);
#ifdef GEKKO #ifdef GEKKO
if (width == 0 || height == 0) if (width == 0 || height == 0)
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DEFAULT)); msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DEFAULT));
else else
#endif #endif
{ {
if (!string_is_empty(desc)) if (!string_is_empty(desc))
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DESC), msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DESC),
width, height, desc); width, height, desc);
else else
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_NO_DESC), msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_NO_DESC),
width, height); width, height);
} }
runloop_msg_queue_push(msg, 1, 100, true, NULL, runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -8078,18 +8091,15 @@ static void action_ok_netplay_enable_client_hostname_cb(void *userdata,
else if (!task_push_netplay_content_reload(line)) else if (!task_push_netplay_content_reload(line))
{ {
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
const char *_msg = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED);
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, (void*)line); command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, (void*)line);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 480, true, NULL,
runloop_msg_queue_push(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#else #else
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED);
msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED), runloop_msg_queue_push(_msg, strlen(_msg), 1, 480, true, NULL,
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#endif #endif
menu_input_dialog_end(); menu_input_dialog_end();
@ -8239,14 +8249,13 @@ int action_ok_core_lock(const char *path,
sizeof(msg)); sizeof(msg));
if (!string_is_empty(core_name)) if (!string_is_empty(core_name))
strlcpy(msg + _len, core_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, core_name, sizeof(msg) - _len);
/* Generate log + notification */ /* Generate log + notification */
RARCH_ERR("%s\n", msg); RARCH_ERR("%s\n", msg);
runloop_msg_queue_push(msg, runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
ret = -1; ret = -1;
} }
@ -8301,15 +8310,13 @@ int action_ok_core_set_standalone_exempt(const char *path,
sizeof(msg)); sizeof(msg));
if (!string_is_empty(core_name)) if (!string_is_empty(core_name))
strlcpy(msg + _len, core_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, core_name, sizeof(msg) - _len);
/* Generate log + notification */ /* Generate log + notification */
RARCH_ERR("%s\n", msg); RARCH_ERR("%s\n", msg);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
msg, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return -1; return -1;
} }
@ -8348,12 +8355,10 @@ static int action_ok_core_delete(const char *path,
_len = strlcpy(msg, msg_hash_to_str(MSG_CORE_DELETE_DISABLED), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CORE_DELETE_DISABLED), sizeof(msg));
if (!string_is_empty(core_name)) if (!string_is_empty(core_name))
strlcpy(msg + _len, core_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, core_name, sizeof(msg) - _len);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
msg, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
/* We do not consider this an 'error' - we are /* We do not consider this an 'error' - we are
* merely telling the user that this operation * merely telling the user that this operation
@ -8547,6 +8552,7 @@ static int action_ok_playlist_refresh(const char *path,
if (stat != MANUAL_CONTENT_SCAN_PLAYLIST_REFRESH_OK) if (stat != MANUAL_CONTENT_SCAN_PLAYLIST_REFRESH_OK)
{ {
size_t _len;
char msg[128]; char msg[128];
char system_name[256]; char system_name[256];
const char *msg_prefix = NULL; const char *msg_prefix = NULL;
@ -8601,10 +8607,10 @@ static int action_ok_playlist_refresh(const char *path,
* scan record */ * scan record */
if (string_is_empty(msg_subject)) if (string_is_empty(msg_subject))
msg_subject = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE); msg_subject = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE);
fill_pathname_join_special(msg, msg_prefix, msg_subject, sizeof(msg)); _len = fill_pathname_join_special(msg, msg_prefix, msg_subject, sizeof(msg));
RARCH_ERR(log_text, msg_subject); RARCH_ERR(log_text, msg_subject);
runloop_msg_queue_push(msg, 1, 150, true, runloop_msg_queue_push(msg, _len, 1, 150, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
/* Even though this is a failure condition, we /* Even though this is a failure condition, we
* let it fall-through to 0 here to suppress * let it fall-through to 0 here to suppress
* any refreshing of the menu (this can appear * any refreshing of the menu (this can appear

View File

@ -602,6 +602,7 @@ static int action_start_video_resolution(
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc))) if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
{ {
size_t _len;
char msg[128]; char msg[128];
msg[0] = '\0'; msg[0] = '\0';
@ -611,19 +612,20 @@ static int action_start_video_resolution(
video_driver_set_video_mode(width, height, true); video_driver_set_video_mode(width, height, true);
#ifdef GEKKO #ifdef GEKKO
if (width == 0 || height == 0) if (width == 0 || height == 0)
strlcpy(msg, "Resetting to: DEFAULT", sizeof(msg)); _len = strlcpy(msg, "Resetting to: DEFAULT", sizeof(msg));
else else
#endif #endif
{ {
if (!string_is_empty(desc)) if (!string_is_empty(desc))
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_RESETTING_DESC), _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_RESETTING_DESC),
width, height, desc); width, height, desc);
else else
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_RESETTING_NO_DESC), _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_RESETTING_NO_DESC),
width, height); width, height);
} }
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
#endif #endif
@ -712,15 +714,13 @@ static int action_start_core_lock(
_len = strlcpy(msg, msg_hash_to_str(MSG_CORE_UNLOCK_FAILED), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_CORE_UNLOCK_FAILED), sizeof(msg));
if (!string_is_empty(core_name)) if (!string_is_empty(core_name))
strlcpy(msg + _len, core_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, core_name, sizeof(msg) - _len);
/* Generate log + notification */ /* Generate log + notification */
RARCH_ERR("%s\n", msg); RARCH_ERR("%s\n", msg);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
msg, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
ret = -1; ret = -1;
} }
@ -772,15 +772,13 @@ static int action_start_core_set_standalone_exempt(
sizeof(msg)); sizeof(msg));
if (!string_is_empty(core_name)) if (!string_is_empty(core_name))
strlcpy(msg + _len, core_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, core_name, sizeof(msg) - _len);
/* Generate log + notification */ /* Generate log + notification */
RARCH_ERR("%s\n", msg); RARCH_ERR("%s\n", msg);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
msg, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return -1; return -1;
} }

View File

@ -1499,15 +1499,15 @@ static bool rgui_fonts_init(rgui_t *rgui)
rgui->fonts.jpn_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_JAPANESE); rgui->fonts.jpn_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_JAPANESE);
rgui->fonts.kor_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_KOREAN); rgui->fonts.kor_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_KOREAN);
if (!rgui->fonts.eng_10x10 || if ( !rgui->fonts.eng_10x10
!rgui->fonts.chn_10x10 || || !rgui->fonts.chn_10x10
!rgui->fonts.jpn_10x10 || || !rgui->fonts.jpn_10x10
!rgui->fonts.kor_10x10) || !rgui->fonts.kor_10x10)
{ {
const char *_msg = msg_hash_to_str(MSG_RGUI_MISSING_FONTS);
rgui_fonts_free(rgui); rgui_fonts_free(rgui);
*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH; *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH;
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 256, false, NULL,
msg_hash_to_str(MSG_RGUI_MISSING_FONTS), 1, 256, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto english; goto english;
} }
@ -1526,13 +1526,13 @@ static bool rgui_fonts_init(rgui_t *rgui)
rgui->fonts.eng_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_ENGLISH); rgui->fonts.eng_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_ENGLISH);
rgui->fonts.rus_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_RUSSIAN); rgui->fonts.rus_10x10 = bitmapfont_10x10_load(RETRO_LANGUAGE_RUSSIAN);
if (!rgui->fonts.eng_10x10 || if ( !rgui->fonts.eng_10x10
!rgui->fonts.rus_10x10) || !rgui->fonts.rus_10x10)
{ {
const char *_msg = msg_hash_to_str(MSG_RGUI_MISSING_FONTS);
rgui_fonts_free(rgui); rgui_fonts_free(rgui);
*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH; *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH;
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 256, false, NULL,
msg_hash_to_str(MSG_RGUI_MISSING_FONTS), 1, 256, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto english; goto english;
} }
@ -1565,13 +1565,13 @@ static bool rgui_fonts_init(rgui_t *rgui)
rgui->fonts.eng_6x10 = bitmapfont_6x10_load(RETRO_LANGUAGE_ENGLISH); rgui->fonts.eng_6x10 = bitmapfont_6x10_load(RETRO_LANGUAGE_ENGLISH);
rgui->fonts.lse_6x10 = bitmapfont_6x10_load(language); rgui->fonts.lse_6x10 = bitmapfont_6x10_load(language);
if (!rgui->fonts.eng_6x10 || if ( !rgui->fonts.eng_6x10
!rgui->fonts.lse_6x10) || !rgui->fonts.lse_6x10)
{ {
const char *_msg = msg_hash_to_str(MSG_RGUI_MISSING_FONTS);
rgui_fonts_free(rgui); rgui_fonts_free(rgui);
*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH; *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH;
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 256, false, NULL,
msg_hash_to_str(MSG_RGUI_MISSING_FONTS), 1, 256, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto english; goto english;
} }
@ -1589,13 +1589,15 @@ static bool rgui_fonts_init(rgui_t *rgui)
case RETRO_LANGUAGE_PERSIAN: case RETRO_LANGUAGE_PERSIAN:
case RETRO_LANGUAGE_HEBREW: case RETRO_LANGUAGE_HEBREW:
default: default:
{
const char *_msg = msg_hash_to_str(MSG_RGUI_INVALID_LANGUAGE);
/* We do not have fonts for these /* We do not have fonts for these
* languages - fallback to English */ * languages - fallback to English */
*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH; *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) = RETRO_LANGUAGE_ENGLISH;
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 256, false, NULL,
msg_hash_to_str(MSG_RGUI_INVALID_LANGUAGE), 1, 256, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto english; goto english;
}
} }
return true; return true;
@ -3147,9 +3149,6 @@ static void rgui_load_custom_theme(
particle_color = (normal_color & 0x00FFFFFF) | particle_color = (normal_color & 0x00FFFFFF) |
(bg_light_color & 0xFF000000); (bg_light_color & 0xFF000000);
config_get_array(conf, wallpaper_key,
wallpaper_file, sizeof(wallpaper_file));
success = true; success = true;
end: end:
@ -3166,8 +3165,10 @@ end:
theme_colors->shadow_color = (uint32_t)shadow_color; theme_colors->shadow_color = (uint32_t)shadow_color;
theme_colors->particle_color = (uint32_t)particle_color; theme_colors->particle_color = (uint32_t)particle_color;
/* Load wallpaper, if required */ /* Load wallpaper, if required */
if (!string_is_empty(wallpaper_file)) if (config_get_array(conf, wallpaper_key,
wallpaper_file, sizeof(wallpaper_file)) > 0)
{ {
char wallpaper_path[PATH_MAX_LENGTH]; char wallpaper_path[PATH_MAX_LENGTH];
wallpaper_path[0] = '\0'; wallpaper_path[0] = '\0';

View File

@ -12674,13 +12674,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
} }
else else
{ {
const char *_msg = msg_hash_to_str(MSG_NO_DISC_INSERTED);
/* TODO/FIXME - localize */ /* TODO/FIXME - localize */
RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n"); RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n");
runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
runloop_msg_queue_push( MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
msg_hash_to_str(MSG_NO_DISC_INSERTED),
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
if (count == 0) if (count == 0)
@ -12825,7 +12823,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
char text[128]; char text[128];
const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]); const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]);
/* TODO/FIXME - localize */ /* TODO/FIXME - localize */
runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", runloop_msg_queue_push(
"Warning : extended overclocking can damage the Switch",
STRLEN_CONST("Warning : extended overclocking can damage the Switch"),
1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
menu_entries_clear(info->list); menu_entries_clear(info->list);
{ {

View File

@ -1022,13 +1022,12 @@ static const char* explore_get_view_path(struct menu_state *menu_st, menu_list_t
static void explore_on_edit_views(enum msg_hash_enums msg) static void explore_on_edit_views(enum msg_hash_enums msg)
{ {
const char *_msg = msg_hash_to_str(msg);
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
if (menu_st->driver_ctx->environ_cb) if (menu_st->driver_ctx->environ_cb)
menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST, menu_st->driver_ctx->environ_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST,
NULL, menu_st->userdata); NULL, menu_st->userdata);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
runloop_msg_queue_push(msg_hash_to_str(msg),
1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -1070,15 +1069,14 @@ static void explore_action_saveview_complete(void *userdata, const char *name)
if (filestream_exists(lvwpath)) if (filestream_exists(lvwpath))
{ {
runloop_msg_queue_push(msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_VIEW_EXISTS), const char *_msg = msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_VIEW_EXISTS);
1, 360, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 360, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return; return;
} }
file = intfstream_open_file(lvwpath, if (!(file = intfstream_open_file(lvwpath,
RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE); RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE)))
if (!file)
{ {
RARCH_ERR("[explore view] Failed to write json file %s.\n", lvwpath); RARCH_ERR("[explore view] Failed to write json file %s.\n", lvwpath);
return; return;

View File

@ -2566,21 +2566,23 @@ static int setting_action_ok_bind_all_save_autoconfig(
map = settings->uints.input_joypad_index[index_offset]; map = settings->uints.input_joypad_index[index_offset];
name = input_config_get_device_name(map); name = input_config_get_device_name(map);
if (!string_is_empty(name) && if ( !string_is_empty(name)
config_save_autoconf_profile(name, index_offset)) && config_save_autoconf_profile(name, index_offset))
{ {
size_t _len;
char buf[128]; char buf[128];
char msg[NAME_MAX_LENGTH]; char msg[NAME_MAX_LENGTH];
config_get_autoconf_profile_filename(name, index_offset, buf, sizeof(buf)); config_get_autoconf_profile_filename(name, index_offset, buf, sizeof(buf));
snprintf(msg, sizeof(msg),msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY_NAMED), buf); _len = snprintf(msg, sizeof(msg),msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY_NAMED), buf);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 180, true,
msg, 1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_AUTOCONFIG_FILE_ERROR_SAVING), 1, 100, true, const char *_msg = msg_hash_to_str(MSG_AUTOCONFIG_FILE_ERROR_SAVING);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return 0; return 0;
} }
@ -8509,17 +8511,15 @@ static void general_write_handler(rarch_setting_t *setting)
if (!frontend_driver_set_gamemode(on) && on) if (!frontend_driver_set_gamemode(on) && on)
{ {
#ifdef __linux__
const char *_msg = msg_hash_to_str(MSG_FAILED_TO_ENTER_GAMEMODE_LINUX);
#else
const char *_msg = msg_hash_to_str(MSG_FAILED_TO_ENTER_GAMEMODE);
#endif
/* If we failed to enable game mode, display /* If we failed to enable game mode, display
* a notification and force disable the feature */ * a notification and force disable the feature */
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
#ifdef __linux__ MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
msg_hash_to_str(MSG_FAILED_TO_ENTER_GAMEMODE_LINUX),
#else
msg_hash_to_str(MSG_FAILED_TO_ENTER_GAMEMODE),
#endif
1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
configuration_set_bool(settings, configuration_set_bool(settings,
settings->bools.gamemode_enable, false); settings->bools.gamemode_enable, false);
} }
@ -9120,16 +9120,18 @@ static void general_write_handler(rarch_setting_t *setting)
switch (manual_content_scan_validate_dat_file_path()) switch (manual_content_scan_validate_dat_file_path())
{ {
case MANUAL_CONTENT_SCAN_DAT_FILE_INVALID: case MANUAL_CONTENT_SCAN_DAT_FILE_INVALID:
runloop_msg_queue_push( {
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_DAT_FILE_INVALID), const char *_msg = msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_DAT_FILE_INVALID);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
break; break;
case MANUAL_CONTENT_SCAN_DAT_FILE_TOO_LARGE: case MANUAL_CONTENT_SCAN_DAT_FILE_TOO_LARGE:
runloop_msg_queue_push( {
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_DAT_FILE_TOO_LARGE), const char *_msg = msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_DAT_FILE_TOO_LARGE);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
break; break;
default: default:
/* No action required */ /* No action required */
@ -9205,6 +9207,7 @@ static void general_write_handler(rarch_setting_t *setting)
if (!core_info_cache_force_refresh(!string_is_empty(path_libretro_info) ? if (!core_info_cache_force_refresh(!string_is_empty(path_libretro_info) ?
path_libretro_info : dir_libretro)) path_libretro_info : dir_libretro))
{ {
const char *_msg = msg_hash_to_str(MSG_CORE_INFO_CACHE_UNSUPPORTED);
/* core_info_cache_force_refresh() will fail /* core_info_cache_force_refresh() will fail
* if we cannot write to the the core_info * if we cannot write to the the core_info
* directory. This will typically only happen * directory. This will typically only happen
@ -9215,10 +9218,8 @@ static void general_write_handler(rarch_setting_t *setting)
* so we simply force-disable the feature */ * so we simply force-disable the feature */
configuration_set_bool(settings, configuration_set_bool(settings,
settings->bools.core_info_cache_enable, false); settings->bools.core_info_cache_enable, false);
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
msg_hash_to_str(MSG_CORE_INFO_CACHE_UNSUPPORTED), MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
break; break;

View File

@ -142,7 +142,7 @@ static bool connmanctl_tether_status(connman_t *connman)
/* Returns true if the tethering is active /* Returns true if the tethering is active
* false when tethering is not active * false when tethering is not active
*/ */
size_t ln_size; size_t ln_len;
FILE *command_file = NULL; FILE *command_file = NULL;
char ln[3] = {0}; char ln[3] = {0};
@ -163,18 +163,16 @@ static bool connmanctl_tether_status(connman_t *connman)
fgets(ln, sizeof(ln), command_file); fgets(ln, sizeof(ln), command_file);
ln_size = strlen(ln) - 1; ln_len = strlen(ln) - 1;
if (ln[ln_size] == '\n') if (ln[ln_len] == '\n')
ln[ln_size] = '\0'; ln[ln_len] = '\0';
RARCH_LOG("[CONNMANCTL] Tether Status: command: \"%s\", output: \"%s\"\n", RARCH_LOG("[CONNMANCTL] Tether Status: command: \"%s\", output: \"%s\"\n",
connman->command, ln); connman->command, ln);
pclose(command_file); pclose(command_file);
if (!ln) if (!ln || ln[0] == '0')
return false;
if (ln[0] == '0')
return false; return false;
if (ln[0] == '1') if (ln[0] == '1')
return true; return true;
@ -203,9 +201,9 @@ static void connmanctl_tether_toggle(
while (fgets(output, sizeof(output), command_file)) while (fgets(output, sizeof(output), command_file))
{ {
size_t output_size = strlen(output) - 1; size_t output_len = strlen(output) - 1;
if (output[output_size] == '\n') if (output[output_len] == '\n')
output[output_size] = '\0'; output[output_len] = '\0';
RARCH_LOG("[CONNMANCTL] Tether toggle: output: \"%s\"\n", RARCH_LOG("[CONNMANCTL] Tether toggle: output: \"%s\"\n",
output); output);
@ -213,7 +211,7 @@ static void connmanctl_tether_toggle(
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if (!widgets_active) if (!widgets_active)
#endif #endif
runloop_msg_queue_push(output, 1, 180, true, runloop_msg_queue_push(output, output_len, 1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -243,9 +241,9 @@ static void connmanctl_scan(void *data)
if (connmanctl_tether_status(connman)) if (connmanctl_tether_status(connman))
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_LOCALAP_SWITCHING_OFF), const char *_msg = msg_hash_to_str(MSG_LOCALAP_SWITCHING_OFF);
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
configuration_set_bool(settings, configuration_set_bool(settings,
settings->bools.localap_enable, false); settings->bools.localap_enable, false);
connmanctl_tether_toggle(connman, false, "", ""); connmanctl_tether_toggle(connman, false, "", "");
@ -253,9 +251,11 @@ static void connmanctl_scan(void *data)
pclose(popen("connmanctl scan wifi", "r")); pclose(popen("connmanctl scan wifi", "r"));
runloop_msg_queue_push(msg_hash_to_str(MSG_WIFI_SCAN_COMPLETE), {
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, const char *_msg = msg_hash_to_str(MSG_WIFI_SCAN_COMPLETE);
MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
/* Refresh now the services, to read the discovered networks */ /* Refresh now the services, to read the discovered networks */
connman->scan.scan_time = time(NULL); connman->scan.scan_time = time(NULL);
@ -379,9 +379,9 @@ static bool connmanctl_connect_ssid(
if (connmanctl_tether_status(connman)) if (connmanctl_tether_status(connman))
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_LOCALAP_SWITCHING_OFF), const char *_msg = msg_hash_to_str(MSG_LOCALAP_SWITCHING_OFF);
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
configuration_set_bool(settings, configuration_set_bool(settings,
settings->bools.localap_enable, false); settings->bools.localap_enable, false);
connmanctl_tether_toggle(connman, false, "", ""); connmanctl_tether_toggle(connman, false, "", "");
@ -416,13 +416,25 @@ static bool connmanctl_connect_ssid(
#endif #endif
{ {
if (success) if (success)
runloop_msg_queue_push("Connected", 1, 180, true, {
/* TODO/FIXME - localize */
runloop_msg_queue_push(
"Connected",
STRLEN_CONST("Connected"),
1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
runloop_msg_queue_push("Connection failed!", 1, 180, true, {
/* TODO/FIXME - localize */
runloop_msg_queue_push(
"Connection failed!",
STRLEN_CONST("Connection failed!"),
1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
return success; return success;
@ -466,21 +478,21 @@ static void connmanctl_get_connected_ssid(
connman->command, (ssid_size + 1) ? ssid : "<nothing_found>"); connman->command, (ssid_size + 1) ? ssid : "<nothing_found>");
} }
static void connmanctl_get_connected_servicename( static size_t connmanctl_get_connected_servicename(
connman_t *connman, char* servicename, size_t buffersize) connman_t *connman, char *s, size_t len)
{ {
/* Stores the service name of currently connected Wi-Fi /* Stores the service name of currently connected Wi-Fi
* network in servicename * network in @s
*/ */
FILE *command_file = NULL; FILE *command_file = NULL;
FILE *service_file = NULL; FILE *service_file = NULL;
char ln[3] = {0}; char ln[3] = {0};
char *temp; char *tmp;
if (buffersize < 1) if (len < 1)
return; return 0;
temp = (char*)malloc(sizeof(char) * buffersize); tmp = (char*)malloc(sizeof(char) * len);
/* Following command lists all stored services in /* Following command lists all stored services in
* connman settings folder, which are then used in * connman settings folder, which are then used in
@ -500,16 +512,16 @@ static void connmanctl_get_connected_servicename(
RARCH_LOG("[CONNMANCTL] Testing configured services for activity: command: \"%s\"\n", RARCH_LOG("[CONNMANCTL] Testing configured services for activity: command: \"%s\"\n",
connman->command); connman->command);
while (fgets(temp, buffersize, command_file)) while (fgets(tmp, len, command_file))
{ {
size_t ln_size; size_t ln_len;
size_t temp_size = strlen(temp) - 1; size_t tmp_len = strlen(tmp) - 1;
if ((temp_size + 1) > 0) if ((tmp_len + 1) > 0)
if (temp[temp_size] == '\n') if (tmp[tmp_len] == '\n')
temp[temp_size] = '\0'; tmp[tmp_len] = '\0';
if ((temp_size + 1) == 0) if ((tmp_len + 1) == 0)
{ {
RARCH_WARN("[CONNMANCTL] Service name empty.\n"); RARCH_WARN("[CONNMANCTL] Service name empty.\n");
continue; continue;
@ -523,37 +535,39 @@ static void connmanctl_get_connected_servicename(
connmanctl services %s | \ connmanctl services %s | \
grep \"^ State = \\(online\\|ready\\)\" | \ grep \"^ State = \\(online\\|ready\\)\" | \
wc -l", wc -l",
temp); tmp);
service_file = popen(connman->command, "r"); service_file = popen(connman->command, "r");
fgets(ln, sizeof(ln), service_file); fgets(ln, sizeof(ln), service_file);
ln_size = strlen(ln) - 1; ln_len = strlen(ln) - 1;
if (ln[ln_size] == '\n') if (ln[ln_len] == '\n')
ln[ln_size] = '\0'; ln[ln_len] = '\0';
pclose(service_file); pclose(service_file);
RARCH_LOG("[CONNMANCTL] Service: \"%s\", status: \"%s\"\n", RARCH_LOG("[CONNMANCTL] Service: \"%s\", status: \"%s\"\n",
temp, ln); tmp, ln);
if (ln[0] == '1') if (ln[0] == '1')
{ {
size_t _len;
pclose(command_file); pclose(command_file);
strlcpy(servicename, temp, buffersize); _len = strlcpy(s, tmp, len);
free(temp); free(tmp);
RARCH_LOG("[CONNMANCTL] Service \"%s\" considered as currently online\n", RARCH_LOG("[CONNMANCTL] Service \"%s\" considered as currently online\n",
servicename); s);
return; return _len;
} }
} }
pclose(command_file); pclose(command_file);
return 0;
} }
static void connmanctl_tether_start_stop(void *data, bool start, char* configfile) static void connmanctl_tether_start_stop(void *data, bool start, char* configfile)
@ -580,14 +594,15 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
if (start) /* we want to start tethering */ if (start) /* we want to start tethering */
{ {
size_t __len;
RARCH_LOG("[CONNMANCTL] Tether start stop: request to start access point\n"); RARCH_LOG("[CONNMANCTL] Tether start stop: request to start access point\n");
if (connmanctl_tether_status(connman)) /* check if already tethering and bail out if so */ if (connmanctl_tether_status(connman)) /* check if already tethering and bail out if so */
{ {
const char *_msg = msg_hash_to_str(MSG_LOCALAP_ALREADY_RUNNING);
RARCH_LOG("[CONNMANCTL] Tether start stop: AP already running\n"); RARCH_LOG("[CONNMANCTL] Tether start stop: AP already running\n");
runloop_msg_queue_push(msg_hash_to_str(MSG_LOCALAP_ALREADY_RUNNING), runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO);
return; return;
} }
@ -599,12 +614,12 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
if (!(command_file = fopen(configfile, "w"))) if (!(command_file = fopen(configfile, "w")))
{ {
const char *_msg = msg_hash_to_str(MSG_LOCALAP_ERROR_CONFIG_CREATE);
RARCH_ERR("[CONNMANCTL] Tether start stop: cannot create config file \"%s\"\n", RARCH_ERR("[CONNMANCTL] Tether start stop: cannot create config file \"%s\"\n",
configfile); configfile);
runloop_msg_queue_push(msg_hash_to_str(MSG_LOCALAP_ERROR_CONFIG_CREATE), runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
MESSAGE_QUEUE_CATEGORY_ERROR);
return; return;
} }
@ -643,13 +658,13 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
while (fgets(ln, sizeof(ln), command_file)) while (fgets(ln, sizeof(ln), command_file))
{ {
size_t ln_size = strlen(ln) - 1; size_t ln_len = strlen(ln) - 1;
i++; i++;
if ((ln_size + 1) > 1) if ((ln_len + 1) > 1)
{ {
if (ln[ln_size] == '\n') if (ln[ln_len] == '\n')
ln[ln_size] = '\0'; ln[ln_len] = '\0';
if (i == 1) if (i == 1)
{ {
@ -682,15 +697,14 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
if (!ap_name || !pass_key) if (!ap_name || !pass_key)
{ {
size_t _len;
RARCH_ERR("[CONNMANCTL] Tether start stop: APNAME or PASSWORD missing\n"); RARCH_ERR("[CONNMANCTL] Tether start stop: APNAME or PASSWORD missing\n");
_len = snprintf(ln, sizeof(ln),
snprintf(ln, sizeof(ln),
msg_hash_to_str(MSG_LOCALAP_ERROR_CONFIG_PARSE), msg_hash_to_str(MSG_LOCALAP_ERROR_CONFIG_PARSE),
configfile); configfile);
runloop_msg_queue_push(ln, runloop_msg_queue_push(ln, _len, 1, 180, true, NULL,
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
MESSAGE_QUEUE_CATEGORY_ERROR);
return; return;
} }
@ -701,10 +715,11 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
if (strlen(ssid) != 0) if (strlen(ssid) != 0)
{ {
connmanctl_get_connected_servicename(connman, service, sizeof(service)); size_t service_len = connmanctl_get_connected_servicename(connman, service, sizeof(service));
if (strlen(service) != 0) if (service_len != 0)
{ {
size_t _len;
/* disconnect from wi-fi network */ /* disconnect from wi-fi network */
RARCH_LOG("[CONNMANCTL] Tether start stop: connected to SSID \"%s\", service \"%s\"\n", RARCH_LOG("[CONNMANCTL] Tether start stop: connected to SSID \"%s\", service \"%s\"\n",
ssid, service); ssid, service);
@ -728,9 +743,9 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
while (fgets(ln, sizeof(ln), command_file)) while (fgets(ln, sizeof(ln), command_file))
{ {
size_t ln_size = strlen(ln) - 1; size_t ln_len = strlen(ln) - 1;
if (ln[ln_size] == '\n') if (ln[ln_len] == '\n')
ln[ln_size] = '\0'; ln[ln_len] = '\0';
RARCH_LOG("[CONNMANCTL] Tether start stop: output: \"%s\"\n", RARCH_LOG("[CONNMANCTL] Tether start stop: output: \"%s\"\n",
ln); ln);
@ -738,9 +753,8 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if (!widgets_active) if (!widgets_active)
#endif #endif
runloop_msg_queue_push(ln, 1, 180, true, runloop_msg_queue_push(ln, ln_len, 1, 180, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO);
} }
pclose(command_file); pclose(command_file);
@ -749,32 +763,32 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
} }
} }
snprintf(connman->command, sizeof(connman->command), __len = snprintf(connman->command, sizeof(connman->command),
msg_hash_to_str(MSG_LOCALAP_STARTING), msg_hash_to_str(MSG_LOCALAP_STARTING),
ap_name, pass_key); ap_name, pass_key);
runloop_msg_queue_push(connman->command, runloop_msg_queue_push(connman->command, __len, 1, 180, true, NULL,
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO);
} }
else /* we want to stop tethering */ else /* we want to stop tethering */
{ {
const char *_msg;
RARCH_LOG("[CONNMANCTL] Tether start stop: request to stop access point\n"); RARCH_LOG("[CONNMANCTL] Tether start stop: request to stop access point\n");
if (!connmanctl_tether_status(connman)) /* check if not tethering and when not, bail out */ if (!connmanctl_tether_status(connman)) /* check if not tethering and when not, bail out */
{ {
const char *__msg = msg_hash_to_str(MSG_LOCALAP_NOT_RUNNING);
RARCH_LOG("[CONNMANCTL] Tether start stop: access point is not running\n"); RARCH_LOG("[CONNMANCTL] Tether start stop: access point is not running\n");
runloop_msg_queue_push(msg_hash_to_str(MSG_LOCALAP_NOT_RUNNING), runloop_msg_queue_push(__msg, strlen(__msg), 1, 180, true, NULL,
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO);
return; return;
} }
runloop_msg_queue_push(msg_hash_to_str(MSG_LOCALAP_SWITCHING_OFF), _msg = msg_hash_to_str(MSG_LOCALAP_SWITCHING_OFF);
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
RARCH_LOG("[CONNMANCTL] Tether start stop: calling tether_toggle()\n"); RARCH_LOG("[CONNMANCTL] Tether start stop: calling tether_toggle()\n");

View File

@ -947,20 +947,20 @@ bool netplay_handshake_init(netplay_t *netplay,
uint32_t header[6]; uint32_t header[6];
uint32_t netplay_magic = 0; uint32_t netplay_magic = 0;
int32_t ping = 0; int32_t ping = 0;
const char *dmsg = NULL; const char *_msg = NULL;
RECV(header, sizeof(header[0])) RECV(header, sizeof(header[0]))
{ {
if (netplay->is_server) if (netplay->is_server)
{ {
dmsg = msg_hash_to_str(MSG_FAILED_TO_CONNECT_TO_CLIENT); _msg = msg_hash_to_str(MSG_FAILED_TO_CONNECT_TO_CLIENT);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
return false; return false;
} }
else else
{ {
dmsg = msg_hash_to_str(MSG_FAILED_TO_CONNECT_TO_HOST); _msg = msg_hash_to_str(MSG_FAILED_TO_CONNECT_TO_HOST);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
goto error; goto error;
} }
} }
@ -991,16 +991,16 @@ bool netplay_handshake_init(netplay_t *netplay,
case NETPLAY_MAGIC: case NETPLAY_MAGIC:
break; break;
case FULL_MAGIC: case FULL_MAGIC:
dmsg = msg_hash_to_str(MSG_NETPLAY_HOST_FULL); _msg = msg_hash_to_str(MSG_NETPLAY_HOST_FULL);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
goto error; goto error;
case BANNED_MAGIC: case BANNED_MAGIC:
dmsg = msg_hash_to_str(MSG_NETPLAY_BANNED); _msg = msg_hash_to_str(MSG_NETPLAY_BANNED);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
goto error; goto error;
default: default:
dmsg = msg_hash_to_str(MSG_NETPLAY_NOT_RETROARCH); _msg = msg_hash_to_str(MSG_NETPLAY_NOT_RETROARCH);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
goto error; goto error;
} }
} }
@ -1009,14 +1009,14 @@ bool netplay_handshake_init(netplay_t *netplay,
{ {
if (netplay->is_server) if (netplay->is_server)
{ {
dmsg = msg_hash_to_str(MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT); _msg = msg_hash_to_str(MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
return false; return false;
} }
else else
{ {
dmsg = msg_hash_to_str(MSG_FAILED_TO_RECEIVE_HEADER_FROM_HOST); _msg = msg_hash_to_str(MSG_FAILED_TO_RECEIVE_HEADER_FROM_HOST);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
goto error; goto error;
} }
} }
@ -1037,8 +1037,8 @@ bool netplay_handshake_init(netplay_t *netplay,
/* Send it so that a proper notification can be shown there. */ /* Send it so that a proper notification can be shown there. */
netplay_handshake_init_send(netplay, connection, 0); netplay_handshake_init_send(netplay, connection, 0);
dmsg = msg_hash_to_str(MSG_NETPLAY_OUT_OF_DATE); _msg = msg_hash_to_str(MSG_NETPLAY_OUT_OF_DATE);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
return false; return false;
} }
@ -1057,8 +1057,8 @@ bool netplay_handshake_init(netplay_t *netplay,
if (connection->netplay_protocol < LOW_NETPLAY_PROTOCOL_VERSION || if (connection->netplay_protocol < LOW_NETPLAY_PROTOCOL_VERSION ||
connection->netplay_protocol > HIGH_NETPLAY_PROTOCOL_VERSION) connection->netplay_protocol > HIGH_NETPLAY_PROTOCOL_VERSION)
{ {
dmsg = msg_hash_to_str(MSG_NETPLAY_OUT_OF_DATE); _msg = msg_hash_to_str(MSG_NETPLAY_OUT_OF_DATE);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
goto error; goto error;
} }
} }
@ -1068,8 +1068,8 @@ bool netplay_handshake_init(netplay_t *netplay,
{ {
if (ntohl(header[1]) != netplay_platform_magic()) if (ntohl(header[1]) != netplay_platform_magic())
{ {
dmsg = msg_hash_to_str(MSG_NETPLAY_PLATFORM_DEPENDENT); _msg = msg_hash_to_str(MSG_NETPLAY_PLATFORM_DEPENDENT);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
if (netplay->is_server) if (netplay->is_server)
return false; return false;
@ -1080,8 +1080,8 @@ bool netplay_handshake_init(netplay_t *netplay,
{ {
if (netplay_endian_mismatch(netplay_platform_magic(), ntohl(header[1]))) if (netplay_endian_mismatch(netplay_platform_magic(), ntohl(header[1])))
{ {
dmsg = msg_hash_to_str(MSG_NETPLAY_ENDIAN_DEPENDENT); _msg = msg_hash_to_str(MSG_NETPLAY_ENDIAN_DEPENDENT);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
if (netplay->is_server) if (netplay->is_server)
return false; return false;
@ -1094,10 +1094,10 @@ bool netplay_handshake_init(netplay_t *netplay,
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
/* We allow the connection but warn that this could cause issues. */ /* We allow the connection but warn that this could cause issues. */
dmsg = msg_hash_to_str(MSG_NETPLAY_DIFFERENT_VERSIONS); _msg = msg_hash_to_str(MSG_NETPLAY_DIFFERENT_VERSIONS);
RARCH_WARN("[Netplay] %s\n", dmsg); RARCH_WARN("[Netplay] %s\n", _msg);
if (!netplay->is_server && settings->bools.notification_show_netplay_extra) if (!netplay->is_server && settings->bools.notification_show_netplay_extra)
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -1135,7 +1135,7 @@ bool netplay_handshake_init(netplay_t *netplay,
return true; return true;
error: error:
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false; return false;
@ -1144,6 +1144,7 @@ error:
static void netplay_handshake_ready(netplay_t *netplay, static void netplay_handshake_ready(netplay_t *netplay,
struct netplay_connection *connection) struct netplay_connection *connection)
{ {
size_t _len;
char msg[512]; char msg[512];
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -1151,7 +1152,7 @@ static void netplay_handshake_ready(netplay_t *netplay,
{ {
unsigned slot = (unsigned)(connection - netplay->connections); unsigned slot = (unsigned)(connection - netplay->connections);
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_GOT_CONNECTION_FROM), _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_GOT_CONNECTION_FROM),
connection->nick); connection->nick);
RARCH_LOG("[Netplay] %s %u\n", msg_hash_to_str(MSG_CONNECTION_SLOT), RARCH_LOG("[Netplay] %s %u\n", msg_hash_to_str(MSG_CONNECTION_SLOT),
@ -1162,9 +1163,9 @@ static void netplay_handshake_ready(netplay_t *netplay,
} }
else else
{ {
size_t _len = strlcpy(msg, msg_hash_to_str(MSG_CONNECTED_TO), _len = strlcpy(msg, msg_hash_to_str(MSG_CONNECTED_TO),
sizeof(msg)); sizeof(msg));
snprintf(msg + _len, sizeof(msg) - _len, ": \"%s\"", _len += snprintf(msg + _len, sizeof(msg) - _len, ": \"%s\"",
connection->nick); connection->nick);
} }
@ -1174,7 +1175,7 @@ static void netplay_handshake_ready(netplay_t *netplay,
but not as useful to the server. but not as useful to the server.
Let it be optional if server. */ Let it be optional if server. */
if (!netplay->is_server || settings->bools.notification_show_netplay_extra) if (!netplay->is_server || settings->bools.notification_show_netplay_extra)
runloop_msg_queue_push(msg, 1, 180, false, NULL, runloop_msg_queue_push(msg, _len, 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -1436,18 +1437,18 @@ static bool netplay_handshake_pre_nick(netplay_t *netplay,
ntohl(nick_buf.cmd[0]) != NETPLAY_CMD_NICK || ntohl(nick_buf.cmd[0]) != NETPLAY_CMD_NICK ||
ntohl(nick_buf.cmd[1]) != sizeof(nick_buf.nick)) ntohl(nick_buf.cmd[1]) != sizeof(nick_buf.nick))
{ {
const char *dmsg = NULL; const char *_msg = NULL;
if (netplay->is_server) if (netplay->is_server)
dmsg = msg_hash_to_str(MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT); _msg = msg_hash_to_str(MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT);
else else
{ {
dmsg = msg_hash_to_str(MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST); _msg = msg_hash_to_str(MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
return false; return false;
} }
@ -1577,10 +1578,10 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
{ {
if (!netplay->is_server) if (!netplay->is_server)
{ {
const char *dmsg = const char *_msg =
msg_hash_to_str(MSG_NETPLAY_INCORRECT_PASSWORD); msg_hash_to_str(MSG_NETPLAY_INCORRECT_PASSWORD);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false; return false;
} }
@ -1631,10 +1632,10 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
info_buf.core_name, system->library_name)) info_buf.core_name, system->library_name))
{ {
/* Wrong core! */ /* Wrong core! */
const char *dmsg = msg_hash_to_str(MSG_NETPLAY_DIFFERENT_CORES); const char *_msg = msg_hash_to_str(MSG_NETPLAY_DIFFERENT_CORES);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
if (!netplay->is_server) if (!netplay->is_server)
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return false; return false;
} }
@ -1652,11 +1653,11 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
if (!string_is_equal_case_insensitive( if (!string_is_equal_case_insensitive(
info_buf.core_version, my_core_version)) info_buf.core_version, my_core_version))
{ {
const char *dmsg = msg_hash_to_str( const char *_msg = msg_hash_to_str(
MSG_NETPLAY_DIFFERENT_CORE_VERSIONS); MSG_NETPLAY_DIFFERENT_CORE_VERSIONS);
RARCH_WARN("[Netplay] %s\n", dmsg); RARCH_WARN("[Netplay] %s\n", _msg);
if (!netplay->is_server && extra_notifications) if (!netplay->is_server && extra_notifications)
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
} }
} }
@ -1667,12 +1668,12 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
if (content_crc && ntohl(info_buf.content_crc) != content_crc) if (content_crc && ntohl(info_buf.content_crc) != content_crc)
{ {
/* Warning of a different severety when using netpacket interface */ /* Warning of a different severety when using netpacket interface */
const char *dmsg = msg_hash_to_str( const char *_msg = msg_hash_to_str(
netplay->modus == NETPLAY_MODUS_CORE_PACKET_INTERFACE ? netplay->modus == NETPLAY_MODUS_CORE_PACKET_INTERFACE ?
MSG_CONTENT_NETPACKET_CRC32S_DIFFER : MSG_CONTENT_CRC32S_DIFFER); MSG_CONTENT_NETPACKET_CRC32S_DIFFER : MSG_CONTENT_CRC32S_DIFFER);
RARCH_WARN("[Netplay] %s\n", dmsg); RARCH_WARN("[Netplay] %s\n", _msg);
if (!netplay->is_server && extra_notifications) if (!netplay->is_server && extra_notifications)
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
} }
@ -1754,9 +1755,9 @@ static bool netplay_handshake_pre_sync(netplay_t *netplay,
RECV(cmd, sizeof(cmd)) RECV(cmd, sizeof(cmd))
{ {
const char *dmsg = msg_hash_to_str(MSG_PING_TOO_HIGH); const char *_msg = msg_hash_to_str(MSG_PING_TOO_HIGH);
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false; return false;
} }
@ -1859,14 +1860,15 @@ static bool netplay_handshake_pre_sync(netplay_t *netplay,
STRING_SAFE(new_nick, sizeof(new_nick)); STRING_SAFE(new_nick, sizeof(new_nick));
if (!string_is_equal(new_nick, netplay->nick)) if (!string_is_equal(new_nick, netplay->nick))
{ {
size_t _len;
char msg[512]; char msg[512];
memcpy(netplay->nick, new_nick, sizeof(netplay->nick)); memcpy(netplay->nick, new_nick, sizeof(netplay->nick));
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_CHANGED_NICK), new_nick); msg_hash_to_str(MSG_NETPLAY_CHANGED_NICK), new_nick);
RARCH_LOG("[Netplay] %s\n", msg); RARCH_LOG("[Netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, false, NULL, runloop_msg_queue_push(msg, _len, 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -4141,7 +4143,7 @@ static void netplay_hangup(netplay_t *netplay,
{ {
size_t i; size_t i;
char msg[512]; char msg[512];
const char *dmsg; const char *_msg;
bool was_playing = false; bool was_playing = false;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -4159,14 +4161,14 @@ static void netplay_hangup(netplay_t *netplay,
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_SERVER_NAMED_HANGUP), msg_hash_to_str(MSG_NETPLAY_SERVER_NAMED_HANGUP),
connection->nick); connection->nick);
dmsg = msg; _msg = msg;
} }
else else
dmsg = msg_hash_to_str(MSG_NETPLAY_SERVER_HANGUP); _msg = msg_hash_to_str(MSG_NETPLAY_SERVER_HANGUP);
} }
else else
{ {
dmsg = msg_hash_to_str(MSG_NETPLAY_CLIENT_HANGUP); _msg = msg_hash_to_str(MSG_NETPLAY_CLIENT_HANGUP);
#ifdef HAVE_PRESENCE #ifdef HAVE_PRESENCE
{ {
presence_userdata_t userdata; presence_userdata_t userdata;
@ -4182,12 +4184,12 @@ static void netplay_hangup(netplay_t *netplay,
networking_driver_st.core_netpacket_interface->disconnected networking_driver_st.core_netpacket_interface->disconnected
((uint16_t)(connection - netplay->connections + 1)); ((uint16_t)(connection - netplay->connections + 1));
RARCH_LOG("[Netplay] %s\n", dmsg); RARCH_LOG("[Netplay] %s\n", _msg);
/* This notification is really only important to the server if the client was playing. /* This notification is really only important to the server if the client was playing.
* Let it be optional if server and the client wasn't playing. */ * Let it be optional if server and the client wasn't playing. */
if (!netplay->is_server || was_playing || if (!netplay->is_server || was_playing ||
settings->bools.notification_show_netplay_extra) settings->bools.notification_show_netplay_extra)
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
socket_close(connection->fd); socket_close(connection->fd);
@ -4571,7 +4573,7 @@ static void netplay_announce_play_spectate(netplay_t *netplay,
{ {
size_t _len; size_t _len;
char msg[512]; char msg[512];
const char *dmsg = NULL; const char *_msg = NULL;
switch (mode) switch (mode)
{ {
@ -4581,10 +4583,10 @@ static void netplay_announce_play_spectate(netplay_t *netplay,
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_PLAYER_S_LEFT), msg_hash_to_str(MSG_NETPLAY_PLAYER_S_LEFT),
NETPLAY_NICK_LEN, nick); NETPLAY_NICK_LEN, nick);
dmsg = msg; _msg = msg;
} }
else else
dmsg = msg_hash_to_str(MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME); _msg = msg_hash_to_str(MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME);
break; break;
case NETPLAY_CONNECTION_PLAYING: case NETPLAY_CONNECTION_PLAYING:
case NETPLAY_CONNECTION_SLAVE: case NETPLAY_CONNECTION_SLAVE:
@ -4659,7 +4661,7 @@ static void netplay_announce_play_spectate(netplay_t *netplay,
strlcpy(msg + _len, ping_str, sizeof(msg) - _len); strlcpy(msg + _len, ping_str, sizeof(msg) - _len);
} }
dmsg = msg; _msg = msg;
break; break;
} }
default: /* wrong usage */ default: /* wrong usage */
@ -4670,8 +4672,8 @@ static void netplay_announce_play_spectate(netplay_t *netplay,
rcheevos_spectating_changed(); rcheevos_spectating_changed();
#endif #endif
RARCH_LOG("[Netplay] %s\n", dmsg); RARCH_LOG("[Netplay] %s\n", _msg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -4795,12 +4797,11 @@ static void netplay_handle_play_spectate(netplay_t *netplay,
} }
else else
{ {
const char *dmsg = msg_hash_to_str( const char *_msg = msg_hash_to_str(
MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE); MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE);
RARCH_LOG("[Netplay] %s\n", dmsg); RARCH_LOG("[Netplay] %s\n", _msg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO);
} }
return; return;
} }
@ -4860,12 +4861,11 @@ static void netplay_handle_play_spectate(netplay_t *netplay,
} }
else else
{ {
const char *dmsg = msg_hash_to_str( const char *_msg = msg_hash_to_str(
MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS); MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS);
RARCH_LOG("[Netplay] %s\n", dmsg); RARCH_LOG("[Netplay] %s\n", _msg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO);
} }
return; return;
} }
@ -5085,7 +5085,7 @@ static void netplay_show_chat(netplay_t *netplay, const char *nick, const char *
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation" #pragma GCC diagnostic ignored "-Wformat-truncation"
#endif #endif
snprintf(formatted_chat, sizeof(formatted_chat), "%s: %s", nick, msg); size_t _len = snprintf(formatted_chat, sizeof(formatted_chat), "%s: %s", nick, msg);
#ifdef GEKKO #ifdef GEKKO
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
@ -5109,7 +5109,7 @@ static void netplay_show_chat(netplay_t *netplay, const char *nick, const char *
} }
else else
#endif #endif
runloop_msg_queue_push(formatted_chat, 1, NETPLAY_CHAT_FRAME_TIME, false, runloop_msg_queue_push(formatted_chat, _len, 1, NETPLAY_CHAT_FRAME_TIME, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -5849,7 +5849,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
case NETPLAY_CMD_MODE_REFUSED: case NETPLAY_CMD_MODE_REFUSED:
{ {
uint32_t reason; uint32_t reason;
const char *dmsg = NULL; const char *_msg = NULL;
if (netplay->is_server) if (netplay->is_server)
{ {
@ -5870,20 +5870,20 @@ static bool netplay_get_cmd(netplay_t *netplay,
switch (reason) switch (reason)
{ {
case NETPLAY_CMD_MODE_REFUSED_REASON_UNPRIVILEGED: case NETPLAY_CMD_MODE_REFUSED_REASON_UNPRIVILEGED:
dmsg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY_UNPRIVILEGED); _msg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY_UNPRIVILEGED);
break; break;
case NETPLAY_CMD_MODE_REFUSED_REASON_NO_SLOTS: case NETPLAY_CMD_MODE_REFUSED_REASON_NO_SLOTS:
dmsg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS); _msg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS);
break; break;
case NETPLAY_CMD_MODE_REFUSED_REASON_NOT_AVAILABLE: case NETPLAY_CMD_MODE_REFUSED_REASON_NOT_AVAILABLE:
dmsg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE); _msg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE);
break; break;
default: default:
dmsg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY); _msg = msg_hash_to_str(MSG_NETPLAY_CANNOT_PLAY);
} }
RARCH_LOG("[Netplay] %s\n", dmsg); RARCH_LOG("[Netplay] %s\n", _msg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
@ -6216,6 +6216,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
case NETPLAY_CMD_PAUSE: case NETPLAY_CMD_PAUSE:
{ {
size_t _len;
char msg[512], nick[NETPLAY_NICK_LEN]; char msg[512], nick[NETPLAY_NICK_LEN];
NETPLAY_ASSERT_MODUS(NETPLAY_MODUS_INPUT_FRAME_SYNC); NETPLAY_ASSERT_MODUS(NETPLAY_MODUS_INPUT_FRAME_SYNC);
@ -6244,7 +6245,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
} }
/* Inform peers */ /* Inform peers */
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_PEER_PAUSED), connection->nick); msg_hash_to_str(MSG_NETPLAY_PEER_PAUSED), connection->nick);
netplay_send_raw_cmd_all(netplay, connection, NETPLAY_CMD_PAUSE, netplay_send_raw_cmd_all(netplay, connection, NETPLAY_CMD_PAUSE,
connection->nick, sizeof(connection->nick)); connection->nick, sizeof(connection->nick));
@ -6256,7 +6257,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
else else
{ {
STRING_SAFE(nick, sizeof(nick)); STRING_SAFE(nick, sizeof(nick));
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_PEER_PAUSED), nick); msg_hash_to_str(MSG_NETPLAY_PEER_PAUSED), nick);
} }
@ -6264,7 +6265,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
netplay->remote_paused = true; netplay->remote_paused = true;
RARCH_LOG("[Netplay] %s\n", msg); RARCH_LOG("[Netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, false, NULL, runloop_msg_queue_push(msg, _len, 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break; break;
} }
@ -6650,17 +6651,17 @@ static void netplay_announce_nat_traversal(netplay_t *netplay,
if (!getnameinfo_retro((struct sockaddr*)addr, sizeof(*addr), if (!getnameinfo_retro((struct sockaddr*)addr, sizeof(*addr),
host, sizeof(host), port, sizeof(port), host, sizeof(host), port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) NI_NUMERICHOST | NI_NUMERICSERV))
snprintf(msg + _len, sizeof(msg) - _len, ": %s:%s", host, port); _len += snprintf(msg + _len, sizeof(msg) - _len, ": %s:%s", host, port);
RARCH_LOG("[Netplay] %s\n", msg); RARCH_LOG("[Netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, false, NULL, runloop_msg_queue_push(msg, _len, 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
else else
{ {
const char *msg = msg_hash_to_str(MSG_PRIVATE_OR_SHARED_ADDRESS); const char *msg = msg_hash_to_str(MSG_PRIVATE_OR_SHARED_ADDRESS);
RARCH_WARN("[Netplay] %s\n", msg); RARCH_WARN("[Netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 600, false, NULL, runloop_msg_queue_push(msg, strlen(msg), 1, 600, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -6668,7 +6669,7 @@ static void netplay_announce_nat_traversal(netplay_t *netplay,
{ {
const char *msg = msg_hash_to_str(MSG_UPNP_FAILED); const char *msg = msg_hash_to_str(MSG_UPNP_FAILED);
RARCH_ERR("[Netplay] %s\n", msg); RARCH_ERR("[Netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, false, NULL, runloop_msg_queue_push(msg, strlen(msg), 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -6697,7 +6698,7 @@ static int init_tcp_connection(netplay_t *netplay, const struct addrinfo *addr,
{ {
char msg[512]; char msg[512];
char host[256], port[6]; char host[256], port[6];
const char *dmsg = NULL; const char *_msg = NULL;
int fd = socket(addr->ai_family, addr->ai_socktype, int fd = socket(addr->ai_family, addr->ai_socktype,
addr->ai_protocol); addr->ai_protocol);
@ -6727,10 +6728,10 @@ static int init_tcp_connection(netplay_t *netplay, const struct addrinfo *addr,
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),
"Failed to connect to host %s on port %s.", "Failed to connect to host %s on port %s.",
host, port); host, port);
dmsg = msg; _msg = msg;
} }
else else
dmsg = "Failed to connect to host."; _msg = "Failed to connect to host.";
} }
else if (is_mitm) else if (is_mitm)
{ {
@ -6770,7 +6771,7 @@ static int init_tcp_connection(netplay_t *netplay, const struct addrinfo *addr,
} }
} }
dmsg = "Failed to create a tunnel session."; _msg = "Failed to create a tunnel session.";
} }
else else
{ {
@ -6781,10 +6782,10 @@ static int init_tcp_connection(netplay_t *netplay, const struct addrinfo *addr,
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),
"Failed to connect to relay server %s on port %s.", "Failed to connect to relay server %s on port %s.",
host, port); host, port);
dmsg = msg; _msg = msg;
} }
else else
dmsg = "Failed to connect to relay server."; _msg = "Failed to connect to relay server.";
} }
} }
else else
@ -6814,17 +6815,17 @@ static int init_tcp_connection(netplay_t *netplay, const struct addrinfo *addr,
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),
"Failed to bind port %s.", "Failed to bind port %s.",
port); port);
dmsg = msg; _msg = msg;
} }
else else
dmsg = "Failed to bind port."; _msg = "Failed to bind port.";
} }
} }
socket_close(fd); socket_close(fd);
if (dmsg) if (_msg)
RARCH_ERR("[Netplay] %s\n", dmsg); RARCH_ERR("[Netplay] %s\n", _msg);
return -1; return -1;
} }
@ -8280,9 +8281,10 @@ static void netplay_announce_cb(retro_task_t *task, void *task_data,
/* Warn only on the first announce. */ /* Warn only on the first announce. */
if (!host_room->connectable && first) if (!host_room->connectable && first)
{ {
const char *_msg = msg_hash_to_str(MSG_ROOM_NOT_CONNECTABLE);
RARCH_WARN("[Netplay] %s\n", msg_hash_to_str(MSG_ROOM_NOT_CONNECTABLE)); RARCH_WARN("[Netplay] %s\n", msg_hash_to_str(MSG_ROOM_NOT_CONNECTABLE));
runloop_msg_queue_push(msg_hash_to_str(MSG_ROOM_NOT_CONNECTABLE), 1, 180, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, false, NULL,
false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
#ifdef HAVE_PRESENCE #ifdef HAVE_PRESENCE
@ -8765,14 +8767,14 @@ bool init_netplay(const char *server, unsigned port, const char *mitm_session)
if (net_st->core_netpacket_interface) if (net_st->core_netpacket_interface)
modus = NETPLAY_MODUS_CORE_PACKET_INTERFACE; modus = NETPLAY_MODUS_CORE_PACKET_INTERFACE;
if ((!core_info_current_supports_netplay() || if ((!core_info_current_supports_netplay()
serialization_quirks & (RETRO_SERIALIZATION_QUIRK_INCOMPLETE | || serialization_quirks & (RETRO_SERIALIZATION_QUIRK_INCOMPLETE
RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION)) | RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION))
&& modus != NETPLAY_MODUS_CORE_PACKET_INTERFACE) && modus != NETPLAY_MODUS_CORE_PACKET_INTERFACE)
{ {
const char *_msg = msg_hash_to_str(MSG_NETPLAY_UNSUPPORTED);
RARCH_ERR("[Netplay] %s\n", msg_hash_to_str(MSG_NETPLAY_UNSUPPORTED)); RARCH_ERR("[Netplay] %s\n", msg_hash_to_str(MSG_NETPLAY_UNSUPPORTED));
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 0, 180, false, NULL,
msg_hash_to_str(MSG_NETPLAY_UNSUPPORTED), 0, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto failure; goto failure;
} }
@ -8847,6 +8849,7 @@ bool init_netplay(const char *server, unsigned port, const char *mitm_session)
if (netplay->is_server) if (netplay->is_server)
{ {
const char *_msg;
if (mitm) if (mitm)
{ {
int flen = 0; int flen = 0;
@ -8869,8 +8872,8 @@ bool init_netplay(const char *server, unsigned port, const char *mitm_session)
netplay->next_announce = netplay->next_announce =
cpu_features_get_time_usec() + NETPLAY_ANNOUNCE_AFTER; cpu_features_get_time_usec() + NETPLAY_ANNOUNCE_AFTER;
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_WAITING_FOR_CLIENT);
msg_hash_to_str(MSG_WAITING_FOR_CLIENT), 0, 180, false, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 0, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
netplay->self_mode = NETPLAY_CONNECTION_SPECTATING; netplay->self_mode = NETPLAY_CONNECTION_SPECTATING;
@ -8902,10 +8905,12 @@ failure:
| NET_DRIVER_ST_FLAG_NETPLAY_CLIENT_DEFERRED); | NET_DRIVER_ST_FLAG_NETPLAY_CLIENT_DEFERRED);
deinit_netplay(); deinit_netplay();
RARCH_ERR("[Netplay] %s\n", msg_hash_to_str(MSG_NETPLAY_FAILED)); {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_NETPLAY_FAILED);
msg_hash_to_str(MSG_NETPLAY_FAILED), 0, 180, false, NULL, RARCH_ERR("[Netplay] %s\n", _msg);
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 0, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
return false; return false;
} }

View File

@ -7,7 +7,7 @@
// //
extension CocoaView { extension CocoaView {
// A native swift wrapper around displaying notifications // A native swift wrapper around displaying notifications
@objc func showRetroArchNotification( @objc func showRetroArchNotification(
title: String? = nil, title: String? = nil,
@ -23,6 +23,6 @@ extension CocoaView {
} }
return nil return nil
}() }()
runloop_msg_queue_push(messageCString, 1, 100, true, titleCString, icon, category) runloop_msg_queue_push(messageCString, strlen(messageCString), 1, 100, true, titleCString, icon, category)
} }
} }

View File

@ -21,7 +21,7 @@ extension CocoaView {
@objc func setupHelperBar() { @objc func setupHelperBar() {
let helperVC = HelperBarViewController() let helperVC = HelperBarViewController()
let viewModel = HelperBarViewModel(delegate: helperVC, actionDelegate: self) let viewModel = HelperBarViewModel(delegate: helperVC, actionDelegate: self)
helperVC.viewModel = viewModel helperVC.viewModel = viewModel
addChild(helperVC) addChild(helperVC)
helperVC.didMove(toParent: self) helperVC.didMove(toParent: self)
helperBarView = helperVC.view helperBarView = helperVC.view
@ -40,17 +40,18 @@ extension CocoaView: HelperBarActionDelegate {
func keyboardButtonTapped() { func keyboardButtonTapped() {
toggleCustomKeyboard() toggleCustomKeyboard()
} }
func mouseButtonTapped() { func mouseButtonTapped() {
mouseHandler.enabled.toggle() mouseHandler.enabled.toggle()
let messageKey = mouseHandler.enabled ? MSG_IOS_TOUCH_MOUSE_ENABLED : MSG_IOS_TOUCH_MOUSE_DISABLED let messageKey = mouseHandler.enabled ? MSG_IOS_TOUCH_MOUSE_ENABLED : MSG_IOS_TOUCH_MOUSE_DISABLED
let message = msg_hash_to_str(messageKey) let message = msg_hash_to_str(messageKey)
runloop_msg_queue_push(message, 1, 100, true, nil, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO) runloop_msg_queue_push(message, strlen(message), 1, 100, true, nil,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO)
} }
func helpButtonTapped() { func helpButtonTapped() {
} }
func orientationLockButtonTapped() { func orientationLockButtonTapped() {
#if os(iOS) #if os(iOS)
shouldLockCurrentInterfaceOrientation.toggle() shouldLockCurrentInterfaceOrientation.toggle()
@ -63,15 +64,15 @@ extension CocoaView: HelperBarActionDelegate {
} }
#endif #endif
} }
var isKeyboardEnabled: Bool { var isKeyboardEnabled: Bool {
!keyboardController.view.isHidden !keyboardController.view.isHidden
} }
var isMouseEnabled: Bool { var isMouseEnabled: Bool {
mouseHandler.enabled mouseHandler.enabled
} }
var isOrientationLocked: Bool { var isOrientationLocked: Bool {
shouldLockCurrentInterfaceOrientation shouldLockCurrentInterfaceOrientation
} }

View File

@ -418,7 +418,10 @@ bool driver_location_start(void)
if (location_allow) if (location_allow)
return location_st->driver->start(location_st->data); return location_st->driver->start(location_st->data);
runloop_msg_queue_push("Location is explicitly disabled.\n", /* TODO/FIXME - localize */
runloop_msg_queue_push(
"Location is explicitly disabled.\n",
STRLEN_CONST("Location is explicitly disabled.\n"),
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -3132,9 +3135,9 @@ bool command_event(enum event_command cmd, void *data)
{ {
if (!core_info_current_supports_runahead()) if (!core_info_current_supports_runahead())
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_RUNAHEAD), const char *_msg = msg_hash_to_str(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_RUNAHEAD);
1, 100, false, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break; break;
} }
@ -3144,15 +3147,16 @@ bool command_event(enum event_command cmd, void *data)
if (settings->bools.run_ahead_enabled) if (settings->bools.run_ahead_enabled)
{ {
char msg[128]; char msg[128];
size_t _len;
if (settings->bools.run_ahead_secondary_instance) if (settings->bools.run_ahead_secondary_instance)
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_RUNAHEAD_ENABLED_WITH_SECOND_INSTANCE), msg_hash_to_str(MSG_RUNAHEAD_ENABLED_WITH_SECOND_INSTANCE),
settings->uints.run_ahead_frames); settings->uints.run_ahead_frames);
else else
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_RUNAHEAD_ENABLED), msg_hash_to_str(MSG_RUNAHEAD_ENABLED),
settings->uints.run_ahead_frames); settings->uints.run_ahead_frames);
runloop_msg_queue_push(msg, 1, 100, false, runloop_msg_queue_push(msg, _len, 1, 100, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
@ -3161,9 +3165,11 @@ bool command_event(enum event_command cmd, void *data)
preempt_deinit(runloop_st); preempt_deinit(runloop_st);
} }
else else
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_DISABLED), {
1, 100, false, const char *_msg = msg_hash_to_str(MSG_RUNAHEAD_DISABLED);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
#ifdef HAVE_MENU #ifdef HAVE_MENU
/* Update menu */ /* Update menu */
@ -3187,17 +3193,18 @@ bool command_event(enum event_command cmd, void *data)
settings->bools.run_ahead_hide_warnings = old_warn; settings->bools.run_ahead_hide_warnings = old_warn;
if (old_inited && !runloop_st->preempt_data) if (old_inited && !runloop_st->preempt_data)
runloop_msg_queue_push(msg_hash_to_str(MSG_PREEMPT_DISABLED), {
1, 100, false, const char *_msg = msg_hash_to_str(MSG_PREEMPT_DISABLED);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else if (runloop_st->preempt_data) else if (runloop_st->preempt_data)
{ {
char msg[128]; char msg[128];
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_PREEMPT_ENABLED), size_t _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_PREEMPT_ENABLED),
settings->uints.run_ahead_frames); settings->uints.run_ahead_frames);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, false, NULL,
msg, 1, 100, false, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
/* Disable runahead */ /* Disable runahead */
settings->bools.run_ahead_enabled = false; settings->bools.run_ahead_enabled = false;
@ -3244,25 +3251,27 @@ bool command_event(enum event_command cmd, void *data)
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc))) if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
{ {
size_t _len;
char msg[128]; char msg[128];
video_driver_set_video_mode(width, height, true); video_driver_set_video_mode(width, height, true);
if (width == 0 || height == 0) if (width == 0 || height == 0)
strlcpy(msg, msg_hash_to_str(MSG_SCREEN_RESOLUTION_DEFAULT), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_SCREEN_RESOLUTION_DEFAULT), sizeof(msg));
else else
{ {
msg[0] = '\0'; msg[0] = '\0';
if (!string_is_empty(desc)) if (!string_is_empty(desc))
snprintf(msg, sizeof(msg), _len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_SCREEN_RESOLUTION_DESC), msg_hash_to_str(MSG_SCREEN_RESOLUTION_DESC),
width, height, desc); width, height, desc);
else else
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_NO_DESC), _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_NO_DESC),
width, height); width, height);
} }
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
#endif #endif
@ -3326,7 +3335,9 @@ bool command_event(enum event_command cmd, void *data)
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
if (rcheevos_hardcore_active()) if (rcheevos_hardcore_active())
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_LOAD_STATE_PREVENTED_BY_HARDCORE_MODE), 0, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING); const char *_msg = msg_hash_to_str(MSG_CHEEVOS_LOAD_STATE_PREVENTED_BY_HARDCORE_MODE);
runloop_msg_queue_push(_msg, strlen(_msg), 0, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return false; return false;
} }
#endif #endif
@ -3374,34 +3385,38 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
break; break;
case CMD_EVENT_RESET: case CMD_EVENT_RESET:
RARCH_LOG("[Core]: %s.\n", msg_hash_to_str(MSG_RESET)); {
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_RESET);
RARCH_LOG("[Core]: %s.\n", _msg);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 120, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
core_reset(); core_reset();
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
rcheevos_reset_game(dispwidget_get_ptr()->active); rcheevos_reset_game(dispwidget_get_ptr()->active);
#else #else
rcheevos_reset_game(false); rcheevos_reset_game(false);
#endif #endif
#endif #endif
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
netplay_driver_ctl(RARCH_NETPLAY_CTL_RESET, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_RESET, NULL);
#endif #endif
/* Recalibrate frame delay target */ /* Recalibrate frame delay target */
if (settings->bools.video_frame_delay_auto) if (settings->bools.video_frame_delay_auto)
video_st->frame_delay_target = 0; video_st->frame_delay_target = 0;
/* Run a few frames to blank core output while paused */ /* Run a few frames to blank core output while paused */
if (runloop_st->flags & RUNLOOP_FLAG_PAUSED) if (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
{ {
runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED; runloop_st->flags &= ~RUNLOOP_FLAG_PAUSED;
runloop_st->run_frames_and_pause = 8; runloop_st->run_frames_and_pause = 8;
} }
#if HAVE_RUNAHEAD #if HAVE_RUNAHEAD
command_event(CMD_EVENT_PREEMPT_RESET_BUFFER, NULL); command_event(CMD_EVENT_PREEMPT_RESET_BUFFER, NULL);
#endif #endif
}
return false; return false;
case CMD_EVENT_PLAY_REPLAY: case CMD_EVENT_PLAY_REPLAY:
{ {
@ -3420,12 +3435,11 @@ bool command_event(enum event_command cmd, void *data)
res = movie_start_playback(input_st, replay_path); res = movie_start_playback(input_st, replay_path);
if (!res) if (!res)
{ {
const char *movie_fail_str = const char *_msg =
msg_hash_to_str(MSG_FAILED_TO_LOAD_MOVIE_FILE); msg_hash_to_str(MSG_FAILED_TO_LOAD_MOVIE_FILE);
runloop_msg_queue_push(movie_fail_str, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1, 180, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); RARCH_ERR("%s.\n", _msg);
RARCH_ERR("%s.\n", movie_fail_str);
} }
return res; return res;
#else #else
@ -3454,12 +3468,10 @@ bool command_event(enum event_command cmd, void *data)
configuration_set_int(settings, settings->ints.replay_slot, replay_slot); configuration_set_int(settings, settings->ints.replay_slot, replay_slot);
if (!res) if (!res)
{ {
const char *movie_rec_fail_str = const char *_msg = msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD);
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD); runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
runloop_msg_queue_push(movie_rec_fail_str, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 180, true, RARCH_ERR("%s.\n", _msg);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_ERR("%s.\n", movie_rec_fail_str);
} }
return res; return res;
#else #else
@ -3857,7 +3869,7 @@ bool command_event(enum event_command cmd, void *data)
audio_st->mute_enable); audio_st->mute_enable);
else else
#endif #endif
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, strlen(msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
break; break;
@ -3918,9 +3930,11 @@ bool command_event(enum event_command cmd, void *data)
else if (!string_is_empty(settings->paths.path_osk_overlay)) else if (!string_is_empty(settings->paths.path_osk_overlay))
input_st->flags |= INP_FLAG_KB_LINEFEED_ENABLE; input_st->flags |= INP_FLAG_KB_LINEFEED_ENABLE;
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_OSK_OVERLAY_NOT_SET), 1, 100, false, const char *_msg = msg_hash_to_str(MSG_OSK_OVERLAY_NOT_SET);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
command_event(CMD_EVENT_OVERLAY_INIT, NULL); command_event(CMD_EVENT_OVERLAY_INIT, NULL);
@ -4290,11 +4304,11 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
case CMD_EVENT_SHUTDOWN: case CMD_EVENT_SHUTDOWN:
#if defined(__linux__) && !defined(ANDROID) #if defined(__linux__) && !defined(ANDROID)
const char *_msg = msg_hash_to_str(MSG_VALUE_SHUTTING_DOWN);
if (settings->bools.config_save_on_exit) if (settings->bools.config_save_on_exit)
{
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
} runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
runloop_msg_queue_push(msg_hash_to_str(MSG_VALUE_SHUTTING_DOWN), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_LAKKA #ifdef HAVE_LAKKA
system("nohup /usr/bin/lakka-shutdown.sh 2>&1 >/dev/null & exit"); system("nohup /usr/bin/lakka-shutdown.sh 2>&1 >/dev/null & exit");
#else #else
@ -4305,11 +4319,11 @@ bool command_event(enum event_command cmd, void *data)
break; break;
case CMD_EVENT_REBOOT: case CMD_EVENT_REBOOT:
#if defined(__linux__) && !defined(ANDROID) #if defined(__linux__) && !defined(ANDROID)
const char *_msg = msg_hash_to_str(MSG_VALUE_REBOOTING);
if (settings->bools.config_save_on_exit) if (settings->bools.config_save_on_exit)
{
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
} runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
runloop_msg_queue_push(msg_hash_to_str(MSG_VALUE_REBOOTING), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_LAKKA #ifdef HAVE_LAKKA
system("nohup /usr/bin/lakka-reboot.sh 2>&1 >/dev/null & exit"); system("nohup /usr/bin/lakka-reboot.sh 2>&1 >/dev/null & exit");
#else #else
@ -4340,11 +4354,11 @@ bool command_event(enum event_command cmd, void *data)
struct string_list *str_list = (struct string_list*)data; struct string_list *str_list = (struct string_list*)data;
/* Check whether favourites playlist is at capacity */ /* Check whether favourites playlist is at capacity */
if (playlist_size(g_defaults.content_favorites) >= if ( playlist_size(g_defaults.content_favorites)
playlist_capacity(g_defaults.content_favorites)) >= playlist_capacity(g_defaults.content_favorites))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_ADD_TO_FAVORITES_FAILED);
msg_hash_to_str(MSG_ADD_TO_FAVORITES_FAILED), 1, 180, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return true; return true;
} }
@ -4366,6 +4380,7 @@ bool command_event(enum event_command cmd, void *data)
/* Write playlist entry */ /* Write playlist entry */
if (playlist_push(g_defaults.content_favorites, &entry)) if (playlist_push(g_defaults.content_favorites, &entry))
{ {
const char *_msg;
enum playlist_sort_mode current_sort_mode = enum playlist_sort_mode current_sort_mode =
playlist_get_sort_mode(g_defaults.content_favorites); playlist_get_sort_mode(g_defaults.content_favorites);
@ -4376,8 +4391,8 @@ bool command_event(enum event_command cmd, void *data)
playlist_qsort(g_defaults.content_favorites); playlist_qsort(g_defaults.content_favorites);
playlist_write_file(g_defaults.content_favorites); playlist_write_file(g_defaults.content_favorites);
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_ADDED_TO_FAVORITES);
msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#if TARGET_OS_TV #if TARGET_OS_TV
update_topshelf(); update_topshelf();
@ -4424,11 +4439,11 @@ bool command_event(enum event_command cmd, void *data)
playlist = playlist_init(&playlist_config); playlist = playlist_init(&playlist_config);
/* Check whether favourites playlist is at capacity */ /* Check whether favourites playlist is at capacity */
if (playlist_size(playlist) >= if ( playlist_size(playlist)
playlist_capacity(playlist)) >= playlist_capacity(playlist))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_ADD_TO_PLAYLIST_FAILED);
msg_hash_to_str(MSG_ADD_TO_PLAYLIST_FAILED), 1, 180, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return true; return true;
} }
@ -4436,6 +4451,7 @@ bool command_event(enum event_command cmd, void *data)
/* Write playlist entry */ /* Write playlist entry */
if (playlist_push(playlist, &entry)) if (playlist_push(playlist, &entry))
{ {
const char *_msg = NULL;
enum playlist_sort_mode current_sort_mode = enum playlist_sort_mode current_sort_mode =
playlist_get_sort_mode(playlist); playlist_get_sort_mode(playlist);
@ -4446,8 +4462,8 @@ bool command_event(enum event_command cmd, void *data)
playlist_qsort(playlist); playlist_qsort(playlist);
playlist_write_file(playlist); playlist_write_file(playlist);
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_ADDED_TO_PLAYLIST);
msg_hash_to_str(MSG_ADDED_TO_PLAYLIST), 1, 180, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
@ -4461,6 +4477,7 @@ bool command_event(enum event_command cmd, void *data)
} }
case CMD_EVENT_RESET_CORE_ASSOCIATION: case CMD_EVENT_RESET_CORE_ASSOCIATION:
{ {
const char *_msg;
const char *core_name = "DETECT"; const char *core_name = "DETECT";
const char *core_path = "DETECT"; const char *core_path = "DETECT";
size_t *playlist_index = (size_t*)data; size_t *playlist_index = (size_t*)data;
@ -4486,8 +4503,8 @@ bool command_event(enum event_command cmd, void *data)
menu_st->userdata, i); menu_st->userdata, i);
#endif #endif
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION);
msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break; break;
} }
@ -4817,17 +4834,15 @@ bool command_event(enum event_command cmd, void *data)
else if (!task_push_netplay_content_reload(NULL)) else if (!task_push_netplay_content_reload(NULL))
{ {
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
const char *_msg = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED);
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 480, true, NULL,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#else #else
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED);
msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED), runloop_msg_queue_push(_msg, strlen(_msg), 1, 480, true, NULL,
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#endif #endif
@ -4974,10 +4989,11 @@ bool command_event(enum event_command cmd, void *data)
return success; return success;
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS), const char *_msg = msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS);
1, 120, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 120, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
break; break;
case CMD_EVENT_DISK_EJECT_TOGGLE: case CMD_EVENT_DISK_EJECT_TOGGLE:
@ -5014,10 +5030,11 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS), const char *_msg = msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS);
1, 120, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 120, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
break; break;
case CMD_EVENT_DISK_NEXT: case CMD_EVENT_DISK_NEXT:
@ -5041,10 +5058,11 @@ bool command_event(enum event_command cmd, void *data)
disk_control_set_index_next(&sys_info->disk_control, verbose); disk_control_set_index_next(&sys_info->disk_control, verbose);
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS), const char *_msg = msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS);
1, 120, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 120, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
break; break;
case CMD_EVENT_DISK_PREV: case CMD_EVENT_DISK_PREV:
@ -5068,10 +5086,11 @@ bool command_event(enum event_command cmd, void *data)
disk_control_set_index_prev(&sys_info->disk_control, verbose); disk_control_set_index_prev(&sys_info->disk_control, verbose);
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS), const char *_msg = msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS);
1, 120, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 120, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
break; break;
case CMD_EVENT_DISK_INDEX: case CMD_EVENT_DISK_INDEX:
@ -5087,10 +5106,11 @@ bool command_event(enum event_command cmd, void *data)
if (disk_control_enabled(&sys_info->disk_control)) if (disk_control_enabled(&sys_info->disk_control))
disk_control_set_index(&sys_info->disk_control, *index, false); disk_control_set_index(&sys_info->disk_control, *index, false);
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS), const char *_msg = msg_hash_to_str(MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS);
1, 120, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 120, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
break; break;
case CMD_EVENT_RUMBLE_STOP: case CMD_EVENT_RUMBLE_STOP:
@ -5249,13 +5269,15 @@ bool command_event(enum event_command cmd, void *data)
| INP_FLAG_KB_MAPPING_BLOCKED); | INP_FLAG_KB_MAPPING_BLOCKED);
if (show_message) if (show_message)
runloop_msg_queue_push( {
const char *_msg =
input_st->game_focus_state.enabled ? input_st->game_focus_state.enabled ?
msg_hash_to_str(MSG_GAME_FOCUS_ON) : msg_hash_to_str(MSG_GAME_FOCUS_ON) :
msg_hash_to_str(MSG_GAME_FOCUS_OFF), msg_hash_to_str(MSG_GAME_FOCUS_OFF);
1, 60, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, runloop_msg_queue_push(_msg, strlen(_msg), 1, 60, true, NULL,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
RARCH_LOG("[Input]: %s => %s\n", RARCH_LOG("[Input]: %s => %s\n",
"Game Focus", "Game Focus",
@ -5392,12 +5414,14 @@ bool command_event(enum event_command cmd, void *data)
} }
break; break;
case CMD_EVENT_VRR_RUNLOOP_TOGGLE: case CMD_EVENT_VRR_RUNLOOP_TOGGLE:
settings->bools.vrr_runloop_enable = !(settings->bools.vrr_runloop_enable); {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(
msg_hash_to_str(
settings->bools.vrr_runloop_enable ? MSG_VRR_RUNLOOP_ENABLED settings->bools.vrr_runloop_enable ? MSG_VRR_RUNLOOP_ENABLED
: MSG_VRR_RUNLOOP_DISABLED), : MSG_VRR_RUNLOOP_DISABLED);
1, 100, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); settings->bools.vrr_runloop_enable = !(settings->bools.vrr_runloop_enable);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
break; break;
case CMD_EVENT_NONE: case CMD_EVENT_NONE:
return false; return false;

View File

@ -1174,11 +1174,12 @@ void runahead_run(void *data,
if (!runahead_create(runloop_st)) if (!runahead_create(runloop_st))
{ {
const char *runahead_failed_str = const char *_msg =
msg_hash_to_str(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES); msg_hash_to_str(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES);
if (!runahead_hide_warnings) if (!runahead_hide_warnings)
runloop_msg_queue_push(runahead_failed_str, 0, 2 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 0, 2 * 60, true, NULL,
RARCH_WARN("[Run-Ahead]: %s\n", runahead_failed_str); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_WARN("[Run-Ahead]: %s\n", _msg);
goto force_input_dirty; goto force_input_dirty;
} }
} }
@ -1226,10 +1227,11 @@ void runahead_run(void *data,
{ {
if (!runahead_save_state(runloop_st)) if (!runahead_save_state(runloop_st))
{ {
const char *runahead_failed_str = const char *_msg =
msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE); msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE);
runloop_msg_queue_push(runahead_failed_str, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, true, NULL,
RARCH_WARN("[Run-Ahead]: %s\n", runahead_failed_str); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_WARN("[Run-Ahead]: %s\n", _msg);
return; return;
} }
} }
@ -1238,10 +1240,10 @@ void runahead_run(void *data,
{ {
if (!runahead_load_state(runloop_st)) if (!runahead_load_state(runloop_st))
{ {
const char *runahead_failed_str = const char *_msg = msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE);
msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE); runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, true, NULL,
runloop_msg_queue_push(runahead_failed_str, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_WARN("[Run-Ahead]: %s\n", runahead_failed_str); RARCH_WARN("[Run-Ahead]: %s\n", _msg);
return; return;
} }
} }
@ -1252,12 +1254,13 @@ void runahead_run(void *data,
#if HAVE_DYNAMIC #if HAVE_DYNAMIC
if (!secondary_core_ensure_exists(runloop_st, config_get_ptr())) if (!secondary_core_ensure_exists(runloop_st, config_get_ptr()))
{ {
const char *runahead_failed_str = const char *_msg =
msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE); msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE);
runahead_secondary_core_destroy(runloop_st); runahead_secondary_core_destroy(runloop_st);
runloop_st->flags &= ~RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE; runloop_st->flags &= ~RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE;
runloop_msg_queue_push(runahead_failed_str, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, true, NULL,
RARCH_WARN("[Run-Ahead]: %s\n", runahead_failed_str); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_WARN("[Run-Ahead]: %s\n", _msg);
goto force_input_dirty; goto force_input_dirty;
} }
@ -1276,19 +1279,19 @@ void runahead_run(void *data,
if (!runahead_save_state(runloop_st)) if (!runahead_save_state(runloop_st))
{ {
const char *runahead_failed_str = const char *_msg = msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE);
msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE); runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, true, NULL,
runloop_msg_queue_push(runahead_failed_str, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_WARN("[Run-Ahead]: %s\n", runahead_failed_str); RARCH_WARN("[Run-Ahead]: %s\n", _msg);
return; return;
} }
if (!runahead_load_state_secondary(runloop_st, settings)) if (!runahead_load_state_secondary(runloop_st, settings))
{ {
const char *runahead_failed_str = const char *_msg = msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE);
msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE); runloop_msg_queue_push(_msg, strlen(_msg), 0, 3 * 60, true, NULL,
runloop_msg_queue_push(runahead_failed_str, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_WARN("[Run-Ahead]: %s\n", runahead_failed_str); RARCH_WARN("[Run-Ahead]: %s\n", _msg);
return; return;
} }
@ -1434,7 +1437,7 @@ bool preempt_init(void *data)
{ {
runloop_state_t *runloop_st = (runloop_state_t*)data; runloop_state_t *runloop_st = (runloop_state_t*)data;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
const char *failed_str = NULL; const char *_msg = NULL;
if ( runloop_st->preempt_data if ( runloop_st->preempt_data
|| !settings->bools.preemptive_frames_enable || !settings->bools.preemptive_frames_enable
@ -1445,7 +1448,7 @@ bool preempt_init(void *data)
/* Check if supported - same requirements as runahead */ /* Check if supported - same requirements as runahead */
if (!core_info_current_supports_runahead()) if (!core_info_current_supports_runahead())
{ {
failed_str = msg_hash_to_str(MSG_PREEMPT_CORE_DOES_NOT_SUPPORT_PREEMPT); _msg = msg_hash_to_str(MSG_PREEMPT_CORE_DOES_NOT_SUPPORT_PREEMPT);
goto error; goto error;
} }
@ -1459,7 +1462,7 @@ bool preempt_init(void *data)
runloop_st->current_core.retro_run(); runloop_st->current_core.retro_run();
/* Allocate - same 'frames' setting as runahead */ /* Allocate - same 'frames' setting as runahead */
if ((failed_str = preempt_allocate(runloop_st, if ((_msg = preempt_allocate(runloop_st,
settings->uints.run_ahead_frames))) settings->uints.run_ahead_frames)))
goto error; goto error;
@ -1474,10 +1477,9 @@ error:
preempt_deinit(runloop_st); preempt_deinit(runloop_st);
if (!settings->bools.run_ahead_hide_warnings) if (!settings->bools.run_ahead_hide_warnings)
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 0, 2 * 60, true, NULL,
failed_str, 0, 2 * 60, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); RARCH_WARN("[Preemptive Frames]: %s\n", _msg);
RARCH_WARN("[Preemptive Frames]: %s\n", failed_str);
return false; return false;
} }
@ -1616,7 +1618,7 @@ void preempt_run(preempt_t *preempt, void *data)
{ {
runloop_state_t *runloop_st = (runloop_state_t*)data; runloop_state_t *runloop_st = (runloop_state_t*)data;
struct retro_core_t *current_core = &runloop_st->current_core; struct retro_core_t *current_core = &runloop_st->current_core;
const char *failed_str = NULL; const char *_msg = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
audio_driver_state_t *audio_st = audio_state_get_ptr(); audio_driver_state_t *audio_st = audio_state_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr(); video_driver_state_t *video_st = video_state_get_ptr();
@ -1636,7 +1638,7 @@ void preempt_run(preempt_t *preempt, void *data)
if (!current_core->retro_unserialize( if (!current_core->retro_unserialize(
preempt->buffer[preempt->start_ptr], preempt->state_size)) preempt->buffer[preempt->start_ptr], preempt->state_size))
{ {
failed_str = msg_hash_to_str(MSG_PREEMPT_FAILED_TO_LOAD_STATE); _msg = msg_hash_to_str(MSG_PREEMPT_FAILED_TO_LOAD_STATE);
goto error; goto error;
} }
@ -1648,7 +1650,7 @@ void preempt_run(preempt_t *preempt, void *data)
if (!current_core->retro_serialize( if (!current_core->retro_serialize(
preempt->buffer[preempt->replay_ptr], preempt->state_size)) preempt->buffer[preempt->replay_ptr], preempt->state_size))
{ {
failed_str = msg_hash_to_str(MSG_PREEMPT_FAILED_TO_SAVE_STATE); _msg = msg_hash_to_str(MSG_PREEMPT_FAILED_TO_SAVE_STATE);
goto error; goto error;
} }
@ -1664,7 +1666,7 @@ void preempt_run(preempt_t *preempt, void *data)
if (!current_core->retro_serialize( if (!current_core->retro_serialize(
preempt->buffer[preempt->start_ptr], preempt->state_size)) preempt->buffer[preempt->start_ptr], preempt->state_size))
{ {
failed_str = msg_hash_to_str(MSG_PREEMPT_FAILED_TO_SAVE_STATE); _msg = msg_hash_to_str(MSG_PREEMPT_FAILED_TO_SAVE_STATE);
goto error; goto error;
} }
preempt->start_ptr = PREEMPT_NEXT_PTR(preempt->start_ptr); preempt->start_ptr = PREEMPT_NEXT_PTR(preempt->start_ptr);
@ -1684,10 +1686,9 @@ error:
preempt_deinit(runloop_st); preempt_deinit(runloop_st);
if (!settings->bools.run_ahead_hide_warnings) if (!settings->bools.run_ahead_hide_warnings)
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 0, 2 * 60, true, NULL,
failed_str, 0, 2 * 60, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); RARCH_ERR("[Preemptive Frames]: %s\n", _msg);
RARCH_ERR("[Preemptive Frames]: %s\n", failed_str);
} }
void runahead_clear_variables(void *data) void runahead_clear_variables(void *data)

135
runloop.c
View File

@ -1351,7 +1351,7 @@ static void runloop_core_msg_queue_push(
/* Note: Do not flush the message queue here - a core /* Note: Do not flush the message queue here - a core
* may need to send multiple notifications simultaneously */ * may need to send multiple notifications simultaneously */
runloop_msg_queue_push(msg->msg, runloop_msg_queue_push(msg->msg, strlen(msg->msg),
msg->priority, duration_frames, msg->priority, duration_frames,
false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
category); category);
@ -1745,7 +1745,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
roundf((float)msg->frames / 60.0f * 1000.0f)); roundf((float)msg->frames / 60.0f * 1000.0f));
else else
#endif #endif
runloop_msg_queue_push(msg->msg, 3, msg->frames, runloop_msg_queue_push(msg->msg, strlen(msg->msg), 3, msg->frames,
true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[Environ]: SET_MESSAGE: %s\n", msg->msg); RARCH_LOG("[Environ]: SET_MESSAGE: %s\n", msg->msg);
@ -2466,10 +2466,9 @@ bool runloop_environment_cb(unsigned cmd, void *data)
if (recording_st->data) if (recording_st->data)
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT);
msg_hash_to_str(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT), runloop_msg_queue_push(_msg, strlen(_msg), 2, 180, false, NULL,
2, 180, false, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (recording_st->streaming_enable) if (recording_st->streaming_enable)
{ {
command_event(CMD_EVENT_STREAMING_TOGGLE, NULL); command_event(CMD_EVENT_STREAMING_TOGGLE, NULL);
@ -2705,10 +2704,9 @@ bool runloop_environment_cb(unsigned cmd, void *data)
* the recording. */ * the recording. */
if (recording_st->data) if (recording_st->data)
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT);
msg_hash_to_str(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT), runloop_msg_queue_push(_msg, strlen(_msg), 2, 180, false, NULL,
2, 180, false, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (recording_st->streaming_enable) if (recording_st->streaming_enable)
{ {
command_event(CMD_EVENT_STREAMING_TOGGLE, NULL); command_event(CMD_EVENT_STREAMING_TOGGLE, NULL);
@ -3692,12 +3690,10 @@ bool runloop_init_libretro_symbols(
path_get_realsize(RARCH_PATH_CORE) path_get_realsize(RARCH_PATH_CORE)
))) )))
{ {
const char *failed_open_str = const char *_msg = msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE);
msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE); RARCH_ERR("%s: \"%s\"\nError(s): %s\n", _msg, path, dylib_error());
RARCH_ERR("%s: \"%s\"\nError(s): %s\n", failed_open_str, runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
path, dylib_error()); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(failed_open_str,
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false; return false;
} }
lib_handle_local = runloop_st->lib_handle; lib_handle_local = runloop_st->lib_handle;
@ -4783,9 +4779,11 @@ void runloop_pause_checks(void)
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
if (!widgets_active) if (!widgets_active)
#endif #endif
runloop_msg_queue_push(msg_hash_to_str(MSG_PAUSED), 1, {
1, true, const char *_msg = msg_hash_to_str(MSG_PAUSED);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 1, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
if (!is_idle) if (!is_idle)
video_driver_cached_frame(); video_driver_cached_frame();
@ -4884,6 +4882,7 @@ bool core_options_create_override(bool game_specific)
{ {
char options_path[PATH_MAX_LENGTH]; char options_path[PATH_MAX_LENGTH];
runloop_state_t *runloop_st = &runloop_state; runloop_state_t *runloop_st = &runloop_state;
const char *_msg = NULL;
config_file_t *conf = NULL; config_file_t *conf = NULL;
options_path[0] = '\0'; options_path[0] = '\0';
@ -4924,10 +4923,9 @@ bool core_options_create_override(bool game_specific)
goto error; goto error;
RARCH_LOG("[Core]: Core options file created successfully: \"%s\".\n", options_path); RARCH_LOG("[Core]: Core options file created successfully: \"%s\".\n", options_path);
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY);
msg_hash_to_str(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
path_set(RARCH_PATH_CORE_OPTIONS, options_path); path_set(RARCH_PATH_CORE_OPTIONS, options_path);
if (game_specific) if (game_specific)
@ -4945,10 +4943,9 @@ bool core_options_create_override(bool game_specific)
return true; return true;
error: error:
runloop_msg_queue_push( _msg = msg_hash_to_str(MSG_ERROR_SAVING_CORE_OPTIONS_FILE);
msg_hash_to_str(MSG_ERROR_SAVING_CORE_OPTIONS_FILE), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (conf) if (conf)
config_file_free(conf); config_file_free(conf);
@ -5099,10 +5096,12 @@ bool core_options_remove_override(bool game_specific)
} }
} }
runloop_msg_queue_push(
msg_hash_to_str(MSG_CORE_OPTIONS_FILE_REMOVED_SUCCESSFULLY), {
1, 100, true, const char *_msg = msg_hash_to_str(MSG_CORE_OPTIONS_FILE_REMOVED_SUCCESSFULLY);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
if (conf) if (conf)
config_file_free(conf); config_file_free(conf);
@ -5110,10 +5109,11 @@ bool core_options_remove_override(bool game_specific)
return true; return true;
error: error:
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_REMOVING_CORE_OPTIONS_FILE), const char *_msg = msg_hash_to_str(MSG_ERROR_REMOVING_CORE_OPTIONS_FILE);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
if (conf) if (conf)
config_file_free(conf); config_file_free(conf);
@ -5141,10 +5141,11 @@ void core_options_reset(void)
rcheevos_validate_config_settings(); rcheevos_validate_config_settings();
#endif #endif
runloop_msg_queue_push( {
msg_hash_to_str(MSG_CORE_OPTIONS_RESET), const char *_msg = msg_hash_to_str(MSG_CORE_OPTIONS_RESET);
1, 100, true, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
void core_options_flush(void) void core_options_flush(void)
@ -5238,15 +5239,16 @@ void core_options_flush(void)
path_core_options ? path_core_options : "UNKNOWN"); path_core_options ? path_core_options : "UNKNOWN");
} }
snprintf(msg + _len, sizeof(msg) - _len, " \"%s\"", _len += snprintf(msg + _len, sizeof(msg) - _len, " \"%s\"",
core_options_file); core_options_file);
runloop_msg_queue_push( runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
msg, 1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
void runloop_msg_queue_push(const char *msg, void runloop_msg_queue_push(
const char *msg,
size_t len,
unsigned prio, unsigned duration, unsigned prio, unsigned duration,
bool flush, bool flush,
char *title, char *title,
@ -5281,6 +5283,7 @@ void runloop_msg_queue_push(const char *msg,
gfx_widgets_msg_queue_push( gfx_widgets_msg_queue_push(
NULL, NULL,
msg, msg,
len,
roundf((float)duration / 60.0f * 1000.0f), roundf((float)duration / 60.0f * 1000.0f),
title, title,
icon, icon,
@ -5677,15 +5680,14 @@ static enum runloop_state_enum runloop_check_state(
if (!trig_quit_key) if (!trig_quit_key)
{ {
float target_hz = 0.0; const char *_msg = msg_hash_to_str(MSG_PRESS_AGAIN_TO_QUIT);
float target_hz = 0.0;
runloop_environment_cb( runloop_environment_cb(
RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE, &target_hz); RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE, &target_hz);
runloop_msg_queue_push(msg_hash_to_str(MSG_PRESS_AGAIN_TO_QUIT), 1, runloop_msg_queue_push(_msg, strlen(_msg), 1, QUIT_DELAY_USEC * target_hz / 1000000,
QUIT_DELAY_USEC * target_hz / 1000000, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }
@ -6156,7 +6158,7 @@ static enum runloop_state_enum runloop_check_state(
#endif #endif
{ {
if (rewinding) if (rewinding)
runloop_msg_queue_push(s, 0, t, true, NULL, runloop_msg_queue_push(s, strlen(s), 0, t, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
@ -6454,8 +6456,11 @@ static enum runloop_state_enum runloop_check_state(
* status via OSD text for 1 frame every frame */ * status via OSD text for 1 frame every frame */
if ( (runloop_st->flags & RUNLOOP_FLAG_FASTMOTION) if ( (runloop_st->flags & RUNLOOP_FLAG_FASTMOTION)
&& settings->bools.notification_show_fast_forward) && settings->bools.notification_show_fast_forward)
runloop_msg_queue_push( {
msg_hash_to_str(MSG_FAST_FORWARD), 1, 1, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(MSG_FAST_FORWARD);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 1, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
} }
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
@ -6519,14 +6524,18 @@ static enum runloop_state_enum runloop_check_state(
*rewind_st = &runloop_st->rewind_st; *rewind_st = &runloop_st->rewind_st;
if (rewind_st->flags if (rewind_st->flags
& STATE_MGR_REWIND_ST_FLAG_FRAME_IS_REVERSED) & STATE_MGR_REWIND_ST_FLAG_FRAME_IS_REVERSED)
runloop_msg_queue_push( {
msg_hash_to_str(MSG_SLOW_MOTION_REWIND), 1, 1, false, NULL, const char *_msg = msg_hash_to_str(MSG_SLOW_MOTION_REWIND);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 1, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else else
#endif #endif
runloop_msg_queue_push( {
msg_hash_to_str(MSG_SLOW_MOTION), 1, 1, false, const char *_msg = msg_hash_to_str(MSG_SLOW_MOTION);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1, 1, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
} }
@ -6579,14 +6588,14 @@ static enum runloop_state_enum runloop_check_state(
": %d", settings->ints.state_slot); ": %d", settings->ints.state_slot);
if (cur_state_slot < 0) if (cur_state_slot < 0)
strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len); _len += strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len);
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if (dispwidget_get_ptr()->active) if (dispwidget_get_ptr()->active)
gfx_widget_set_generic_message(msg, 1000); gfx_widget_set_generic_message(msg, 1000);
else else
#endif #endif
runloop_msg_queue_push(msg, 2, 60, true, NULL, runloop_msg_queue_push(msg, _len, 2, 60, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[State]: %s\n", msg); RARCH_LOG("[State]: %s\n", msg);
@ -6639,14 +6648,14 @@ static enum runloop_state_enum runloop_check_state(
": %d", settings->ints.replay_slot); ": %d", settings->ints.replay_slot);
if (cur_replay_slot < 0) if (cur_replay_slot < 0)
strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len); _len += strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len);
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if (dispwidget_get_ptr()->active) if (dispwidget_get_ptr()->active)
gfx_widget_set_generic_message(msg, 1000); gfx_widget_set_generic_message(msg, 1000);
else else
#endif #endif
runloop_msg_queue_push(msg, 2, 60, true, NULL, runloop_msg_queue_push(msg, _len, 2, 60, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[Replay]: %s\n", msg); RARCH_LOG("[Replay]: %s\n", msg);
@ -7299,6 +7308,7 @@ void runloop_task_msg_queue_push(
gfx_widgets_msg_queue_push( gfx_widgets_msg_queue_push(
task, task,
msg, msg,
strlen(msg),
duration, duration,
NULL, NULL,
(enum message_queue_icon)MESSAGE_QUEUE_CATEGORY_INFO, (enum message_queue_icon)MESSAGE_QUEUE_CATEGORY_INFO,
@ -7315,7 +7325,8 @@ void runloop_task_msg_queue_push(
} }
else else
#endif #endif
runloop_msg_queue_push(msg, prio, duration, flush, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, strlen(msg), prio, duration, flush, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }

View File

@ -321,7 +321,7 @@ void runloop_path_fill_names(void);
**/ **/
bool runloop_environment_cb(unsigned cmd, void *data); bool runloop_environment_cb(unsigned cmd, void *data);
void runloop_msg_queue_push(const char *msg, void runloop_msg_queue_push(const char *msg, size_t len,
unsigned prio, unsigned duration, unsigned prio, unsigned duration,
bool flush, bool flush,
char *title, char *title,

View File

@ -655,7 +655,7 @@ void state_manager_event_deinit(
if (!rewind_st) if (!rewind_st)
return; return;
restore_callbacks = restore_callbacks =
(rewind_st->flags & STATE_MGR_REWIND_ST_FLAG_INIT_ATTEMPTED) (rewind_st->flags & STATE_MGR_REWIND_ST_FLAG_INIT_ATTEMPTED)
&& (rewind_st->state) && (rewind_st->state)
&& (current_core); && (current_core);
@ -717,13 +717,15 @@ bool state_manager_check_rewind(
if (!rewind_st->state) if (!rewind_st->state)
{ {
if ((pressed if ((pressed
&& (!(rewind_st->flags && (!(rewind_st->flags
& STATE_MGR_REWIND_ST_FLAG_HOTKEY_WAS_PRESSED))) & STATE_MGR_REWIND_ST_FLAG_HOTKEY_WAS_PRESSED)))
&& !core_info_current_supports_rewind()) && !core_info_current_supports_rewind())
runloop_msg_queue_push(msg_hash_to_str(MSG_REWIND_UNSUPPORTED), {
1, 100, false, NULL, const char *_msg = msg_hash_to_str(MSG_REWIND_UNSUPPORTED);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
if (pressed) if (pressed)
rewind_st->flags |= STATE_MGR_REWIND_ST_FLAG_HOTKEY_WAS_PRESSED; rewind_st->flags |= STATE_MGR_REWIND_ST_FLAG_HOTKEY_WAS_PRESSED;
@ -817,16 +819,16 @@ bool state_manager_check_rewind(
{ {
if (current_core->retro_set_audio_sample) if (current_core->retro_set_audio_sample)
current_core->retro_set_audio_sample( current_core->retro_set_audio_sample(
(rewind_st->flags (rewind_st->flags
& STATE_MGR_REWIND_ST_FLAG_FRAME_IS_REVERSED) & STATE_MGR_REWIND_ST_FLAG_FRAME_IS_REVERSED)
? audio_driver_sample_rewind ? audio_driver_sample_rewind
: audio_driver_sample); : audio_driver_sample);
if (current_core->retro_set_audio_sample_batch) if (current_core->retro_set_audio_sample_batch)
current_core->retro_set_audio_sample_batch( current_core->retro_set_audio_sample_batch(
( rewind_st->flags ( rewind_st->flags
& STATE_MGR_REWIND_ST_FLAG_FRAME_IS_REVERSED) & STATE_MGR_REWIND_ST_FLAG_FRAME_IS_REVERSED)
? audio_driver_sample_batch_rewind ? audio_driver_sample_batch_rewind
: audio_driver_sample_batch); : audio_driver_sample_batch);
} }

View File

@ -267,6 +267,7 @@ steam_core_dlc_t* steam_get_core_dlc_by_name(
void steam_install_core_dlc(steam_core_dlc_t *core_dlc) void steam_install_core_dlc(steam_core_dlc_t *core_dlc)
{ {
size_t _len;
char msg[128] = { 0 }; char msg[128] = { 0 };
bool downloading = false; bool downloading = false;
bool installed = false; bool installed = false;
@ -284,7 +285,8 @@ void steam_install_core_dlc(steam_core_dlc_t *core_dlc)
if (downloading || installed) if (downloading || installed)
{ {
runloop_msg_queue_push(msg_hash_to_str(MSG_CORE_STEAM_CURRENTLY_DOWNLOADING), 1, 180, true, NULL, const char *_msg = msg_hash_to_str(MSG_CORE_STEAM_CURRENTLY_DOWNLOADING);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return; return;
} }
@ -297,11 +299,11 @@ void steam_install_core_dlc(steam_core_dlc_t *core_dlc)
return; return;
error: error:
snprintf(msg, sizeof(msg), "%s: (%d-%d)", _len = snprintf(msg, sizeof(msg), "%s: (%d-%d)",
msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_ERROR),
MIST_UNPACK_RESULT(result)); MIST_UNPACK_RESULT(result));
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
RARCH_ERR("[Steam]: Error installing DLC %d (%d-%d)\n", core_dlc->app_id, MIST_UNPACK_RESULT(result)); RARCH_ERR("[Steam]: Error installing DLC %d (%d-%d)\n", core_dlc->app_id, MIST_UNPACK_RESULT(result));
@ -309,23 +311,25 @@ error:
void steam_uninstall_core_dlc(steam_core_dlc_t *core_dlc) void steam_uninstall_core_dlc(steam_core_dlc_t *core_dlc)
{ {
char msg[128] = { 0 }; size_t _len;
const char *_msg = NULL;
char msg[128] = { 0 };
MistResult result = mist_steam_apps_uninstall_dlc(core_dlc->app_id); MistResult result = mist_steam_apps_uninstall_dlc(core_dlc->app_id);
if (MIST_IS_ERROR(result)) if (MIST_IS_ERROR(result))
goto error; goto error;
runloop_msg_queue_push(msg_hash_to_str(MSG_CORE_STEAM_UNINSTALLED), 1, 180, true, NULL, _msg = msg_hash_to_str(MSG_CORE_STEAM_UNINSTALLED);
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return; return;
error: error:
snprintf(msg, sizeof(msg), "%s: (%d-%d)", _len = snprintf(msg, sizeof(msg), "%s: (%d-%d)",
msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_ERROR),
MIST_UNPACK_RESULT(result)); MIST_UNPACK_RESULT(result));
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
RARCH_ERR("[Steam]: Error uninstalling DLC %d (%d-%d)\n", core_dlc->app_id, MIST_UNPACK_RESULT(result)); RARCH_ERR("[Steam]: Error uninstalling DLC %d (%d-%d)\n", core_dlc->app_id, MIST_UNPACK_RESULT(result));

View File

@ -258,7 +258,7 @@ static const blissbox_pad_type_t* input_autoconfigure_get_blissbox_pad_type_win3
/* Check for some other error */ /* Check for some other error */
if (!bResult) if (!bResult)
{ {
if ( (ERROR_INSUFFICIENT_BUFFER == GetLastError()) if ( (ERROR_INSUFFICIENT_BUFFER == GetLastError())
&& (required_length > 0)) && (required_length > 0))
{ {
/* we got the size, now allocate buffer */ /* we got the size, now allocate buffer */
@ -354,8 +354,11 @@ found:
if (hDeviceHandle == INVALID_HANDLE_VALUE) if (hDeviceHandle == INVALID_HANDLE_VALUE)
{ {
/* TODO/FIXME - localize */
const char *_msg = "Bliss-Box already in use. Please make sure other programs are not using it.";
RARCH_ERR("[Autoconf]: Can't open device for reading and writing: %d.", GetLastError()); RARCH_ERR("[Autoconf]: Can't open device for reading and writing: %d.", GetLastError());
runloop_msg_queue_push("Bliss-Box already in use. Please make sure other programs are not using it.", 2, 300, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 2, 300, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto done; goto done;
} }
} }

View File

@ -1904,12 +1904,10 @@ static bool firmware_update_status(
(content_ctx->flags & CONTENT_INFO_FLAG_BIOS_IS_MISSING) (content_ctx->flags & CONTENT_INFO_FLAG_BIOS_IS_MISSING)
&& (content_ctx->flags & CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING)) && (content_ctx->flags & CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_FIRMWARE);
msg_hash_to_str(MSG_FIRMWARE), runloop_msg_queue_push(_msg, strlen(_msg), 100, 500, true, NULL,
100, 500, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("[Content]: Load content blocked. Reason: %s\n", RARCH_LOG("[Content]: Load content blocked. Reason: %s\n", _msg);
msg_hash_to_str(MSG_FIRMWARE));
return true; return true;
} }
@ -3149,8 +3147,12 @@ bool content_init(void)
case MSG_ERROR_LIBRETRO_CORE_REQUIRES_VFS: case MSG_ERROR_LIBRETRO_CORE_REQUIRES_VFS:
case MSG_FAILED_TO_LOAD_CONTENT: case MSG_FAILED_TO_LOAD_CONTENT:
case MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT: case MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT:
RARCH_ERR("[Content]: %s\n", msg_hash_to_str(error_enum)); {
runloop_msg_queue_push(msg_hash_to_str(error_enum), 2, ret ? 1 : 180, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); const char *_msg = msg_hash_to_str(error_enum);
RARCH_ERR("[Content]: %s\n", _msg);
runloop_msg_queue_push(_msg, strlen(_msg), 2, ret ? 1 : 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
break; break;
case MSG_UNKNOWN: case MSG_UNKNOWN:
default: default:
@ -3168,7 +3170,8 @@ bool content_init(void)
/* Do not flush the message queue here /* Do not flush the message queue here
* > This allows any core-generated error messages * > This allows any core-generated error messages
* to propagate through to the frontend */ * to propagate through to the frontend */
runloop_msg_queue_push(error_string, 2, ret ? 1 : 180, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(error_string, strlen(error_string), 2, ret ? 1 : 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
free(error_string); free(error_string);
} }

View File

@ -982,13 +982,14 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
msg_hash_to_str(MSG_CORE_RESTORATION_INVALID_CONTENT), msg_hash_to_str(MSG_CORE_RESTORATION_INVALID_CONTENT),
sizeof(msg)); sizeof(msg));
if (backup_filename) if (backup_filename)
strlcpy(msg + _len, _len += strlcpy(msg + _len,
backup_filename, backup_filename,
sizeof(msg) - _len); sizeof(msg) - _len);
/* TODO/FIXME - localize */
RARCH_ERR("[core restore] Invalid core file selected: %s\n", backup_path); RARCH_ERR("[core restore] Invalid core file selected: %s\n", backup_path);
runloop_msg_queue_push(msg, 1, 100, true, runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto error; goto error;
} }
@ -1015,13 +1016,14 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
? msg_hash_to_str(MSG_CORE_RESTORATION_DISABLED) ? msg_hash_to_str(MSG_CORE_RESTORATION_DISABLED)
: msg_hash_to_str(MSG_CORE_INSTALLATION_DISABLED), : msg_hash_to_str(MSG_CORE_INSTALLATION_DISABLED),
sizeof(msg)); sizeof(msg));
strlcpy(msg + _len, _len += strlcpy(msg + _len,
core_name, core_name,
sizeof(msg) - _len); sizeof(msg) - _len);
/* TODO/FIXME - localize */
RARCH_ERR("[core restore] Restoration disabled - core is locked: %s\n", core_path); RARCH_ERR("[core restore] Restoration disabled - core is locked: %s\n", core_path);
runloop_msg_queue_push(msg, 1, 100, true, runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto error; goto error;
} }

View File

@ -1079,10 +1079,9 @@ void *task_push_core_updater_download(
{ {
char msg[128]; char msg[128];
size_t _len = strlcpy(msg, msg_hash_to_str(MSG_CORE_UPDATE_DISABLED), sizeof(msg)); size_t _len = strlcpy(msg, msg_hash_to_str(MSG_CORE_UPDATE_DISABLED), sizeof(msg));
strlcpy(msg + _len, list_entry->display_name, sizeof(msg) - _len); _len += strlcpy(msg + _len, list_entry->display_name, sizeof(msg) - _len);
runloop_msg_queue_push(msg, _len, 1, 100, true, NULL,
runloop_msg_queue_push(msg, 1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
goto error; goto error;

View File

@ -216,10 +216,9 @@ static void task_manual_content_scan_handler(retro_task_t *task)
= manual_content_scan_get_content_list( = manual_content_scan_get_content_list(
manual_scan->task_config))) manual_scan->task_config)))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_INVALID_CONTENT);
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_INVALID_CONTENT), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,\
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto task_finished; goto task_finished;
} }
@ -232,10 +231,9 @@ static void task_manual_content_scan_handler(retro_task_t *task)
logiqx_dat_init( logiqx_dat_init(
manual_scan->task_config->dat_file_path))) manual_scan->task_config->dat_file_path)))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_DAT_FILE_LOAD_ERROR);
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_DAT_FILE_LOAD_ERROR), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto task_finished; goto task_finished;
} }
} }
@ -570,13 +568,12 @@ bool task_push_manual_content_scan(
calloc(1, sizeof(manual_content_scan_task_config_t)))) calloc(1, sizeof(manual_content_scan_task_config_t))))
goto error; goto error;
if ( !manual_content_scan_get_task_config( if (!manual_content_scan_get_task_config(
manual_scan->task_config, playlist_directory)) manual_scan->task_config, playlist_directory))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_INVALID_CONFIG);
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_INVALID_CONFIG), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto error; goto error;
} }

View File

@ -253,29 +253,28 @@ static bool bsv_movie_start_record(input_driver_state_t * input_st, char *path)
{ {
size_t _len; size_t _len;
char msg[128]; char msg[128];
bsv_movie_t *state = NULL; bsv_movie_t *state = NULL;
const char *movie_rec_str = NULL; const char *_msg = NULL;
/* this should trigger a start recording task which on failure or /* this should trigger a start recording task which on failure or
success prints a message and on success sets the success prints a message and on success sets the
input_st->bsv_movie_state_handle. */ input_st->bsv_movie_state_handle. */
if (!(state = bsv_movie_init_internal(path, RARCH_MOVIE_RECORD))) if (!(state = bsv_movie_init_internal(path, RARCH_MOVIE_RECORD)))
{ {
const char *movie_rec_fail_str = const char *_msg = msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD);
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD); runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
runloop_msg_queue_push(movie_rec_fail_str, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1, 180, true, RARCH_ERR("%s.\n", _msg);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_ERR("%s.\n", movie_rec_fail_str);
return false; return false;
} }
bsv_movie_enqueue(input_st, state, BSV_FLAG_MOVIE_RECORDING); bsv_movie_enqueue(input_st, state, BSV_FLAG_MOVIE_RECORDING);
movie_rec_str = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO); _msg = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO);
_len = strlcpy(msg, movie_rec_str, sizeof(msg)); _len = strlcpy(msg, _msg, sizeof(msg));
snprintf(msg + _len, sizeof(msg) - _len, " \"%s\".", path); _len += snprintf(msg + _len, sizeof(msg) - _len, " \"%s\".", path);
runloop_msg_queue_push(msg, 2, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg, _len, 2, 180, true, NULL,
RARCH_LOG("%s \"%s\".\n", movie_rec_str, path); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s \"%s\".\n", _msg, path);
return true; return true;
} }
@ -283,7 +282,7 @@ static bool bsv_movie_start_record(input_driver_state_t * input_st, char *path)
static bool bsv_movie_start_playback(input_driver_state_t *input_st, char *path) static bool bsv_movie_start_playback(input_driver_state_t *input_st, char *path)
{ {
bsv_movie_t *state = NULL; bsv_movie_t *state = NULL;
const char *starting_movie_str = NULL; const char *_msg = NULL;
/* This should trigger a start playback task which on failure or /* This should trigger a start playback task which on failure or
success prints a message and on success sets the success prints a message and on success sets the
input_st->bsv_movie_state_handle. */ input_st->bsv_movie_state_handle. */
@ -296,13 +295,11 @@ static bool bsv_movie_start_playback(input_driver_state_t *input_st, char *path)
} }
bsv_movie_enqueue(input_st, state, BSV_FLAG_MOVIE_PLAYBACK); bsv_movie_enqueue(input_st, state, BSV_FLAG_MOVIE_PLAYBACK);
starting_movie_str = _msg = msg_hash_to_str(MSG_STARTING_MOVIE_PLAYBACK);
msg_hash_to_str(MSG_STARTING_MOVIE_PLAYBACK);
runloop_msg_queue_push(starting_movie_str, runloop_msg_queue_push(_msg, strlen(_msg), 2, 180, false, NULL,
2, 180, false, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); RARCH_LOG("%s.\n", _msg);
RARCH_LOG("%s.\n", starting_movie_str);
return true; return true;
} }
@ -375,15 +372,14 @@ static void moviectl_start_record_cb(retro_task_t *task,
/* In the future this should probably be a deferred task as well */ /* In the future this should probably be a deferred task as well */
bool movie_stop_playback(input_driver_state_t *input_st) bool movie_stop_playback(input_driver_state_t *input_st)
{ {
const char *movie_playback_end_str = NULL; const char *_msg = NULL;
/* Checks if movie is being played back. */ /* Checks if movie is being played back. */
if (!(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK)) if (!(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK))
return false; return false;
movie_playback_end_str = msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED); _msg = msg_hash_to_str(MSG_MOVIE_PLAYBACK_ENDED);
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 2, 180, false, NULL,
movie_playback_end_str, 2, 180, false, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); RARCH_LOG("%s\n", _msg);
RARCH_LOG("%s\n", movie_playback_end_str);
bsv_movie_deinit_full(input_st); bsv_movie_deinit_full(input_st);
@ -395,13 +391,12 @@ bool movie_stop_playback(input_driver_state_t *input_st)
/* in the future this should probably be a deferred task as well */ /* in the future this should probably be a deferred task as well */
bool movie_stop_record(input_driver_state_t *input_st) bool movie_stop_record(input_driver_state_t *input_st)
{ {
const char *movie_rec_stopped_str = msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED); const char *_msg = msg_hash_to_str(MSG_MOVIE_RECORD_STOPPED);
if (!(input_st->bsv_movie_state_handle)) if (!(input_st->bsv_movie_state_handle))
return false; return false;
runloop_msg_queue_push(movie_rec_stopped_str, runloop_msg_queue_push(_msg, strlen(_msg), 2, 180, true, NULL,
2, 180, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); RARCH_LOG("%s\n", _msg);
RARCH_LOG("%s\n", movie_rec_stopped_str);
bsv_movie_deinit_full(input_st); bsv_movie_deinit_full(input_st);
input_st->bsv_movie_state.flags &= ~( input_st->bsv_movie_state.flags &= ~(
BSV_FLAG_MOVIE_END BSV_FLAG_MOVIE_END
@ -454,7 +449,7 @@ bool movie_start_record(input_driver_state_t *input_st, char*path)
{ {
size_t _len; size_t _len;
char msg[128]; char msg[128];
const char *movie_rec_str = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO); const char *_msg = msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO);
retro_task_t *task = task_init(); retro_task_t *task = task_init();
moviectl_task_state_t *state = (moviectl_task_state_t *)calloc(1, sizeof(*state)); moviectl_task_state_t *state = (moviectl_task_state_t *)calloc(1, sizeof(*state));
@ -464,7 +459,7 @@ bool movie_start_record(input_driver_state_t *input_st, char*path)
*state = input_st->bsv_movie_state; *state = input_st->bsv_movie_state;
strlcpy(state->movie_start_path, path, sizeof(state->movie_start_path)); strlcpy(state->movie_start_path, path, sizeof(state->movie_start_path));
_len = strlcpy(msg, movie_rec_str, sizeof(msg)); _len = strlcpy(msg, _msg, sizeof(msg));
snprintf(msg + _len, sizeof(msg) - _len, " \"%s\".", path); snprintf(msg + _len, sizeof(msg) - _len, " \"%s\".", path);
task->type = TASK_TYPE_NONE; task->type = TASK_TYPE_NONE;

View File

@ -686,6 +686,7 @@ static void task_netplay_crc_scan_callback(retro_task_t *task,
if (data->current.core_loaded && (state->state & STATE_RELOAD)) if (data->current.core_loaded && (state->state & STATE_RELOAD))
{ {
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
const char *_msg;
command_event(CMD_EVENT_UNLOAD_CORE, NULL); command_event(CMD_EVENT_UNLOAD_CORE, NULL);
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
@ -710,14 +711,12 @@ static void task_netplay_crc_scan_callback(retro_task_t *task,
content_set_subsystem_by_name(data->current.subsystem); content_set_subsystem_by_name(data->current.subsystem);
} }
runloop_msg_queue_push( _msg = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED);
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED), runloop_msg_queue_push(_msg, strlen(_msg), 1, 480, true, NULL,
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#else #else
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED);
msg_hash_to_str(MSG_NETPLAY_NEED_CONTENT_LOADED), runloop_msg_queue_push(_msg, strlen(_msg), 1, 480, true, NULL,
1, 480, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#endif #endif
} }

View File

@ -271,7 +271,7 @@ static bool task_overlay_load_desc(
goto end; goto end;
} }
if (!config_get_array(conf, overlay_desc_key, overlay, sizeof(overlay))) if (config_get_array(conf, overlay_desc_key, overlay, sizeof(overlay)) == 0)
{ {
RARCH_ERR("[Overlay]: Didn't find key: %s.\n", overlay_desc_key); RARCH_ERR("[Overlay]: Didn't find key: %s.\n", overlay_desc_key);
ret = false; ret = false;
@ -836,7 +836,7 @@ static void task_overlay_deferred_load(retro_task_t *task)
overlay->w = overlay->h = 1.0f; overlay->w = overlay->h = 1.0f;
if (config_get_array(conf, overlay->config.rect.key, if (config_get_array(conf, overlay->config.rect.key,
overlay->config.rect.array, sizeof(overlay->config.rect.array))) overlay->config.rect.array, sizeof(overlay->config.rect.array)) > 0)
{ {
char *tok, *save; char *tok, *save;
char *elem0 = NULL; char *elem0 = NULL;

View File

@ -751,10 +751,10 @@ static bool apply_patch_content(uint8_t **buf,
{ {
char msg[128]; char msg[128];
const char *patch_filename = path_basename_nocompression(patch_path); const char *patch_filename = path_basename_nocompression(patch_path);
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_APPLYING_PATCH), size_t _len = snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_APPLYING_PATCH),
patch_filename ? patch_filename : patch_filename ? patch_filename :
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNKNOWN)); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNKNOWN));
runloop_msg_queue_push(msg, 1, 180, false, NULL, runloop_msg_queue_push(msg, _len, 1, 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }

View File

@ -941,10 +941,9 @@ bool task_push_pl_entry_thumbnail_download(
} }
if (next_flag == PLAYLIST_THUMBNAIL_FLAG_NONE) if (next_flag == PLAYLIST_THUMBNAIL_FLAG_NONE)
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_NO_THUMBNAIL_DOWNLOAD_POSSIBLE);
msg_hash_to_str(MSG_NO_THUMBNAIL_DOWNLOAD_POSSIBLE), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto error; goto error;
} }

View File

@ -190,9 +190,10 @@ static void task_screenshot_handler(retro_task_t *task)
/* Report any errors */ /* Report any errors */
if (!ret) if (!ret)
{ {
char *msg = strdup(msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT)); const char *_msg = msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT);
runloop_msg_queue_push(msg, 1, (state->flags & SS_TASK_FLAG_IS_PAUSED) ? 1 : 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(_msg, strlen(_msg), 1,
free(msg); (state->flags & SS_TASK_FLAG_IS_PAUSED) ? 1 : 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
if (task->title) if (task->title)

View File

@ -81,11 +81,11 @@ task_finished:
char msg[128]; char msg[128];
size_t _len = strlcpy(msg, msg_hash_to_str(MSG_CORE_INSTALLED), size_t _len = strlcpy(msg, msg_hash_to_str(MSG_CORE_INSTALLED),
sizeof(msg)); sizeof(msg));
strlcpy(msg + _len, _len += strlcpy(msg + _len,
state->name, state->name,
sizeof(msg) - _len); sizeof(msg) - _len);
runloop_msg_queue_push(msg, 1, 180, true, NULL, runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR); MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
} }

View File

@ -320,6 +320,7 @@ static void handle_translation_cb(
image_type = IMAGE_TYPE_PNG; image_type = IMAGE_TYPE_PNG;
else else
{ {
/* TODO/FIXME - localize */
RARCH_LOG("Invalid image type returned from server.\n"); RARCH_LOG("Invalid image type returned from server.\n");
goto finish; goto finish;
} }
@ -328,12 +329,11 @@ static void handle_translation_cb(
raw_image_file_data, (unsigned)new_image_size, raw_image_file_data, (unsigned)new_image_size,
image_type)) image_type))
{ {
/* TODO/FIXME - localize */
const char *_msg = "Video driver not supported.";
RARCH_LOG("Video driver not supported for AI Service."); RARCH_LOG("Video driver not supported for AI Service.");
runloop_msg_queue_push( runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
/* msg_hash_to_str(MSG_VIDEO_DRIVER_NOT_SUPPORTED), */ MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
"Video driver not supported.",
1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
else if (gfx_widgets_paused) else if (gfx_widgets_paused)
{ {

View File

@ -2029,19 +2029,17 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign
true); true);
if (ret) if (ret)
runloop_msg_queue_push( {
msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY), const char *_msg = msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY);
1, 100, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_CATEGORY_INFO }
);
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET), const char *_msg = msg_hash_to_str(MSG_ERROR_SAVING_SHADER_PRESET);
1, 100, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
MESSAGE_QUEUE_CATEGORY_ERROR }
);
} }
else else
{ {
@ -2050,24 +2048,20 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign
path_dir_video_shader, path_dir_video_shader,
path_dir_menu_config)) path_dir_menu_config))
{ {
runloop_msg_queue_push( const char *_msg = msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY);
msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY), runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
MESSAGE_QUEUE_ICON_DEFAULT,
MESSAGE_QUEUE_CATEGORY_INFO
);
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_state_get_ptr()->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; menu_state_get_ptr()->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
#endif #endif
} }
else else
runloop_msg_queue_push( {
msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET), const char *_msg = msg_hash_to_str(MSG_ERROR_REMOVING_SHADER_PRESET);
1, 100, true, NULL, runloop_msg_queue_push(_msg, strlen(_msg), 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
MESSAGE_QUEUE_CATEGORY_ERROR }
);
} }
} }

View File

@ -745,8 +745,11 @@ void App::OnPackageInstalling(PackageCatalog^ sender,
if (args->IsComplete) if (args->IsComplete)
{ {
char msg[512]; char msg[512];
snprintf(msg, sizeof(msg), "Package \"%ls\" installed, a restart may be necessary", args->Package->DisplayName->Data()); size_t _len = snprintf(msg, sizeof(msg),
runloop_msg_queue_push(msg, 1, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); "Package \"%ls\" installed, a restart may be necessary",
args->Package->DisplayName->Data());
runloop_msg_queue_push(msg, _len, 1, 5 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
} }
} }