mirror of
https://github.com/RPCS3/rpcs3
synced 2024-11-02 11:45:30 +00:00
Add Rich Presence option
This commit is contained in:
parent
98b715d8c8
commit
f27f7d50c9
6 changed files with 42 additions and 14 deletions
|
@ -54,6 +54,7 @@
|
|||
"configs": "Only useful to developers.\nIf unsure, don't use this option.",
|
||||
"stylesheets": "Changes the overall look of RPCS3.\nChoose a stylesheet and click Apply to change between styles.",
|
||||
"show_welcome": "Shows the initial welcome screen upon starting RPCS3.",
|
||||
"useRichPresence": "Enables use of Discord Rich Presence to show what game you are playing on Discord.\nRequires a restart of RPCS3 to apply.",
|
||||
"custom_colors": "Prioritize custom user interface colors over properties set in stylesheet."
|
||||
},
|
||||
"misc": {
|
||||
|
|
|
@ -94,8 +94,12 @@ void rpcs3_app::Init()
|
|||
welcome->exec();
|
||||
}
|
||||
#ifdef WITH_DISCORD_RPC
|
||||
// Discord Rich Presence Integration
|
||||
if (guiSettings->GetValue(gui::m_richPresence).toBool())
|
||||
{
|
||||
DiscordEventHandlers handlers = {};
|
||||
Discord_Initialize("424004941485572097", &handlers, 1, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ namespace gui
|
|||
const gui_save m_saveNotes = gui_save(meta, "saveNotes", QVariantMap());
|
||||
const gui_save m_showDebugTab = gui_save(meta, "showDebugTab", false);
|
||||
const gui_save m_enableUIColors = gui_save(meta, "enableUIColors", false);
|
||||
const gui_save m_richPresence = gui_save(meta, "useRichPresence", true);
|
||||
|
||||
const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false);
|
||||
const gui_save gs_resize = gui_save(gs_frame, "resize", false);
|
||||
|
|
|
@ -248,6 +248,8 @@ void main_window::Boot(const std::string& path, bool direct, bool add_only)
|
|||
AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
|
||||
#ifdef WITH_DISCORD_RPC
|
||||
// Discord Rich Presence Integration
|
||||
if (guiSettings->GetValue(gui::m_richPresence).toBool())
|
||||
{
|
||||
DiscordRichPresence discordPresence = {};
|
||||
discordPresence.state = Emu.GetTitleID().c_str();
|
||||
discordPresence.details = Emu.GetTitle().c_str();
|
||||
|
@ -256,6 +258,7 @@ void main_window::Boot(const std::string& path, bool direct, bool add_only)
|
|||
discordPresence.startTimestamp = time(0);
|
||||
discordPresence.instance = 0;
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -775,10 +778,13 @@ void main_window::OnEmuStop()
|
|||
}
|
||||
#ifdef WITH_DISCORD_RPC
|
||||
// Discord Rich Presence Integration
|
||||
if (guiSettings->GetValue(gui::m_richPresence).toBool())
|
||||
{
|
||||
DiscordRichPresence discordPresence = {};
|
||||
discordPresence.largeImageKey = "rpcs3_logo";
|
||||
discordPresence.largeImageText = "RPCS3 is the world's first PlayStation 3 emulator.";
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -706,6 +706,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
|
||||
SubscribeTooltip(ui->cb_custom_colors, json_emu_gui["custom_colors"].toString());
|
||||
|
||||
SubscribeTooltip(ui->useRichPresence, json_emu_gui["useRichPresence"].toString());
|
||||
|
||||
xemu_settings->EnhanceCheckBox(ui->exitOnStop, emu_settings::ExitRPCS3OnFinish);
|
||||
SubscribeTooltip(ui->exitOnStop, json_emu_misc["exitOnStop"].toString());
|
||||
|
||||
|
@ -907,6 +909,13 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
xgui_settings->SetValue(gui::gs_height, ui->gs_height->value());
|
||||
});
|
||||
|
||||
ui->useRichPresence->setChecked(xgui_settings->GetValue(gui::m_richPresence).toBool());
|
||||
|
||||
connect(ui->useRichPresence, &QCheckBox::clicked, [=](bool val)
|
||||
{
|
||||
xgui_settings->SetValue(gui::m_richPresence, val);
|
||||
});
|
||||
|
||||
AddConfigs();
|
||||
AddStylesheets();
|
||||
}
|
||||
|
|
|
@ -1287,6 +1287,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useRichPresence">
|
||||
<property name="text">
|
||||
<string>Use Discord Rich Presence</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_13">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in a new issue