This commit is contained in:
Nayla Hanegan 2023-04-24 09:41:01 -04:00
commit f161453af9
No known key found for this signature in database
GPG key ID: BAFE9001DA16CFA2
2 changed files with 34 additions and 13 deletions

View file

@ -15,22 +15,42 @@ bool mpn_update_discord()
if (CurrentState.Scenes != NULL && CurrentState.Scene != NULL)
RichPresence.state = CurrentState.Scene->Name.c_str();
DiscordRichPresence discord_presence = {};
if (CurrentState.Addresses != NULL)
{
char Details[128] = "";
if (CurrentState.Boards && CurrentState.Board)
{
DiscordRichPresence discord_presence = {};
snprintf(Details, sizeof(Details), "Players: %d/4 Turn: %d/%d",
discord_presence.partySize,
if (discord_presence.partySize > 0)
{
snprintf(Details, sizeof(Details), "Players: %d/4 Turn: %d/%d", discord_presence.partySize,
mpn_read_value(CurrentState.Addresses->CurrentTurn, 1),
mpn_read_value(CurrentState.Addresses->TotalTurns, 1));
RichPresence.smallImageKey = CurrentState.Board->Icon.c_str();
RichPresence.smallImageText = CurrentState.Board->Name.c_str();
}
else if (discord_presence.partySize = 0)
{
snprintf(Details, sizeof(Details), "Players: 1/4 Turn: %d/%d",
mpn_read_value(CurrentState.Addresses->CurrentTurn, 1),
mpn_read_value(CurrentState.Addresses->TotalTurns, 1));
RichPresence.smallImageKey = CurrentState.Board->Icon.c_str();
RichPresence.smallImageText = CurrentState.Board->Name.c_str();
}
}
else
{
if (discord_presence.partySize > 0)
{
snprintf(Details, sizeof(Details), "Players: %d/4", discord_presence.partySize);
RichPresence.smallImageKey = "";
RichPresence.smallImageText = "";
}
else if (discord_presence.partySize = 0)
{
snprintf(Details, sizeof(Details), "Players: 1/4");
RichPresence.smallImageKey = "";
@ -38,6 +58,7 @@ bool mpn_update_discord()
}
RichPresence.details = Details;
}
}
RichPresence.startTimestamp = std::time(nullptr);
Discord_UpdatePresence(&RichPresence);

View file

@ -1005,10 +1005,10 @@ bool MainWindow::RequestStopNetplay()
auto confirm = ModalMessageBox::question(
confirm_parent, tr("Quitter!"),
m_stop_requested ? tr("A user closed down their game from the netplay lobby. "
"This could the Netplay session has ended due to someone ragequitting! "
"This means the Netplay session has ended! "
"Do you want to stop the current emulation?") :
tr("A user closed down their game from the netplay lobby. "
"This could the Netplay session has ended due to someone ragequitting"
"This means the Netplay session has ended! "
"Do you want to stop the current emulation?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::ApplicationModal);