summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/discord_impl.cpp9
-rw-r--r--src/yuzu/discord_impl.h8
-rw-r--r--src/yuzu/main.cpp2
3 files changed, 13 insertions, 6 deletions
diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp
index a93733b26..66f928af6 100644
--- a/src/yuzu/discord_impl.cpp
+++ b/src/yuzu/discord_impl.cpp
@@ -13,7 +13,7 @@
13 13
14namespace DiscordRPC { 14namespace DiscordRPC {
15 15
16DiscordImpl::DiscordImpl() { 16DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} {
17 DiscordEventHandlers handlers{}; 17 DiscordEventHandlers handlers{};
18 18
19 // The number is the client ID for yuzu, it's used for images and the 19 // The number is the client ID for yuzu, it's used for images and the
@@ -35,12 +35,13 @@ void DiscordImpl::Update() {
35 std::chrono::system_clock::now().time_since_epoch()) 35 std::chrono::system_clock::now().time_since_epoch())
36 .count(); 36 .count();
37 std::string title; 37 std::string title;
38 if (Core::System::GetInstance().IsPoweredOn()) 38 if (system.IsPoweredOn()) {
39 Core::System::GetInstance().GetAppLoader().ReadTitle(title); 39 system.GetAppLoader().ReadTitle(title);
40 }
40 DiscordRichPresence presence{}; 41 DiscordRichPresence presence{};
41 presence.largeImageKey = "yuzu_logo"; 42 presence.largeImageKey = "yuzu_logo";
42 presence.largeImageText = "yuzu is an emulator for the Nintendo Switch"; 43 presence.largeImageText = "yuzu is an emulator for the Nintendo Switch";
43 if (Core::System::GetInstance().IsPoweredOn()) { 44 if (system.IsPoweredOn()) {
44 presence.state = title.c_str(); 45 presence.state = title.c_str();
45 presence.details = "Currently in game"; 46 presence.details = "Currently in game";
46 } else { 47 } else {
diff --git a/src/yuzu/discord_impl.h b/src/yuzu/discord_impl.h
index 4bfda8cdf..03ad42681 100644
--- a/src/yuzu/discord_impl.h
+++ b/src/yuzu/discord_impl.h
@@ -6,15 +6,21 @@
6 6
7#include "yuzu/discord.h" 7#include "yuzu/discord.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace DiscordRPC { 13namespace DiscordRPC {
10 14
11class DiscordImpl : public DiscordInterface { 15class DiscordImpl : public DiscordInterface {
12public: 16public:
13 DiscordImpl(); 17 DiscordImpl(Core::System& system_);
14 ~DiscordImpl() override; 18 ~DiscordImpl() override;
15 19
16 void Pause() override; 20 void Pause() override;
17 void Update() override; 21 void Update() override;
22
23 Core::System& system;
18}; 24};
19 25
20} // namespace DiscordRPC 26} // namespace DiscordRPC
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 1d9e0f79d..8140e659b 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3431,7 +3431,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
3431void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { 3431void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
3432#ifdef USE_DISCORD_PRESENCE 3432#ifdef USE_DISCORD_PRESENCE
3433 if (state) { 3433 if (state) {
3434 discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(); 3434 discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(system);
3435 } else { 3435 } else {
3436 discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); 3436 discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
3437 } 3437 }