Fix CPU display in Discord Rich Presence
This commit is contained in:
@@ -68,7 +68,8 @@ void
|
|||||||
discord_update_activity(int paused)
|
discord_update_activity(int paused)
|
||||||
{
|
{
|
||||||
struct DiscordActivity activity;
|
struct DiscordActivity activity;
|
||||||
char config_name[1024];
|
char config_name[1024], cpufamily[1024];
|
||||||
|
char *paren;
|
||||||
|
|
||||||
if(discord_activities == NULL)
|
if(discord_activities == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -78,15 +79,21 @@ discord_update_activity(int paused)
|
|||||||
memset(&activity, 0x00, sizeof(activity));
|
memset(&activity, 0x00, sizeof(activity));
|
||||||
|
|
||||||
plat_get_dirname(config_name, usr_path);
|
plat_get_dirname(config_name, usr_path);
|
||||||
|
|
||||||
|
strncpy(cpufamily, cpu_f->name, sizeof(cpufamily) - 1);
|
||||||
|
paren = strchr(cpufamily, '(');
|
||||||
|
if (paren)
|
||||||
|
*(paren - 1) = '\0';
|
||||||
|
|
||||||
if (strlen(plat_get_filename(config_name)) < 100)
|
if (strlen(plat_get_filename(config_name)) < 100)
|
||||||
{
|
{
|
||||||
sprintf_s(activity.details, sizeof(activity.details), "Running \"%s\"", plat_get_filename(config_name));
|
sprintf_s(activity.details, sizeof(activity.details), "Running \"%s\"", plat_get_filename(config_name));
|
||||||
sprintf_s(activity.state, sizeof(activity.state), "%s (%s)", strchr(machine_getname(), ']') + 2, cpu_s->name);
|
sprintf_s(activity.state, sizeof(activity.state), "%s (%s/%s)", strchr(machine_getname(), ']') + 2, cpufamily, cpu_s->name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(activity.details, strchr(machine_getname(), ']') + 2, sizeof(activity.details) - 1);
|
strncpy(activity.details, strchr(machine_getname(), ']') + 2, sizeof(activity.details) - 1);
|
||||||
strncpy(activity.state, cpu_s->name, sizeof(activity.state) - 1);
|
sprintf_s(activity.state, sizeof(activity.state), "%s/%s", cpufamily, cpu_s->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.timestamps.start = time(NULL);
|
activity.timestamps.start = time(NULL);
|
||||||
|
Reference in New Issue
Block a user