mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-18 00:31:35 -06:00
discord rpc: Change how info is displayed
This commit is contained in:
parent
4dbe0fd497
commit
727377c012
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user