discord: general discord-rpc improvements

Now, if the content was loaded from a playlist, the content name will be the playlist entry's title instead of the filename of the content.

Also, `state` was modified to show the display name of the core, not the
library name. The difference is that the display name shows the platform
as well, not just the core name (i.e. "NEC - PC Engine SuperGrafx (Beetle SGX)" instead of "Mednafen SuperGrafx").
This commit is contained in:
Jesse Bryan 2018-08-14 23:12:47 -05:00
parent 4a9ef99759
commit bf9a8ac4a0
2 changed files with 22 additions and 8 deletions

View File

@ -1336,8 +1336,8 @@ static void command_event_restore_default_shader_preset(void)
static void command_event_restore_remaps(void)
{
if (rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL) ||
rarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL) ||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL) ||
rarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL) ||
rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
input_remapping_set_defaults(true);
}
@ -2254,7 +2254,7 @@ TODO: Add a setting for these tweaks */
break;
case CMD_EVENT_CORE_INFO_DEINIT:
core_info_deinit_list();
core_info_free_current_core();
//core_info_free_current_core();
break;
case CMD_EVENT_CORE_INFO_INIT:
{

View File

@ -21,6 +21,7 @@
#include "../core.h"
#include "../core_info.h"
#include "../paths.h"
#include "../playlist.h"
#include "../msg_hash.h"
@ -80,7 +81,7 @@ void discord_update(enum discord_presence presence)
return;
if (
(discord_status != DISCORD_PRESENCE_MENU) &&
(discord_status != DISCORD_PRESENCE_MENU) &&
(discord_status == presence))
return;
@ -104,16 +105,29 @@ void discord_update(enum discord_presence presence)
const char *system_name = string_replace_substring(
string_to_lower(core_info->core_name), " ", "_");
char *label = NULL;
playlist_t *current_playlist = playlist_get_cached();
if (current_playlist)
{
playlist_get_index_by_path(
current_playlist, path_get(RARCH_PATH_CONTENT), NULL, &label, NULL, NULL, NULL, NULL);
}
if (!label)
{
label = (char *)path_basename(path_get(RARCH_PATH_BASENAME));
}
start_time = time(0);
discord_presence.state = system ? system->info.library_name : "---";
discord_presence.details = path_basename(path_get(RARCH_PATH_BASENAME));
discord_presence.state = core_info->display_name;
discord_presence.details = label;
#if 1
RARCH_LOG("[Discord] system name: %s\n", system_name);
RARCH_LOG("[Discord] current content: %s\n", label);
#endif
discord_presence.largeImageKey = system_name;
discord_presence.smallImageKey = "base";
discord_presence.instance = 0;
discord_presence.startTimestamp = start_time;