discord rpc: Change how info is displayed

This commit is contained in:
PabloMK7 2026-04-13 13:41:37 +02:00
parent 4dbe0fd497
commit 727377c012

View File

@ -34,9 +34,17 @@ void DiscordImpl::Update(bool is_powered_on) {
s64 start_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
auto truncate = [](const std::string& str, std::size_t maxLen = 128) -> std::string {
if (str.length() <= maxLen) {
return str;
}
return str.substr(0, maxLen - 3) + "...";
};
std::string title;
if (is_powered_on) {
system.GetAppLoader().ReadTitle(title);
title = truncate("Playing: " + title);
}
DiscordRichPresence presence{};
@ -44,9 +52,6 @@ void DiscordImpl::Update(bool is_powered_on) {
presence.largeImageText = "An open source emulator for the Nintendo 3DS";
if (is_powered_on) {
presence.state = title.c_str();
presence.details = "Currently in game";
} else {
presence.details = "Not in game";
}
presence.startTimestamp = start_time;
Discord_UpdatePresence(&presence);