[PR #780] [CLOSED] [09/04/2024] Added Discord Presence Integration. #1767

Closed
opened 2026-02-27 21:13:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/780
Author: @morkev
Created: 9/4/2024
Status: Closed

Base: mainHead: main


📝 Commits (1)

  • 0920b12 [09/04/2024] Added Discord Presence Integration. Discord displays "In ShadPS4" along with elapsed time when a user is executing shadps4.exe in their computer.

📊 Changes

3 files changed (+331 additions, -0 deletions)

View changed files

presence/discord.cpp (+151 -0)
presence/discord.h (+64 -0)
presence/discord_rpc.h (+116 -0)

📄 Description

Discord displays "In ShadPS4" along with elapsed time when a user is executing shadps4.exe in their computer.

The presence displays the current status of the emulator (e.g., whether shadps4.exe is running) and updates it in real-time within the Discord client. All necessary files have been moved to a presence directory to keep it organized.

Changes:

  • Added presence/discord.h, presence/discord.cpp, and presence/discord_rpc.h for handling Discord RPC integration.
  • In testing, I modified main.cpp to initialize and run Discord Presence alongside the emulator as shown below:
#include <fmt/core.h>
#include "emulator.h"
#include "presence/discord.h"

int main(int argc, char* argv[]) {
    if (argc == 1) {
        fmt::print("Usage: {} <elf or eboot.bin path>\n", argv[0]);
        return -1;
    }

    Discord discord("XXXXXXXXXXXXXXXXXXX");
    discord.Initialize();

    Core::Emulator emulator;
    emulator.Run(argv[1]);

    discord.Run();
    discord.Shutdown();

    return 0;
}

Let's talk the 19 digit Discord API key "XXXXXXXXXXXXXXXXXXX": I used my custom key and it worked, so the owner of the repository or someone with higher privileges needs to go to the Discord Developer Portal and get a key, I could otherwise configure this. That being said, all the functionality is there, and we are 1-key away. As for main.cpp I didn't want to mess with that directly in this merge request, therefore I am just showing what I did.

All files conform to the project's style guide:

  • Functions and classes follow PascalCase.
  • Variables follow lower_case_underscored naming.
  • Line width limited to 100 characters.
  • Used C++-style casts where needed (e.g., static_cast).
  • Proper namespace usage.
  • 4-space indentation with no tabs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/780 **Author:** [@morkev](https://github.com/morkev) **Created:** 9/4/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`0920b12`](https://github.com/shadps4-emu/shadPS4/commit/0920b12d6c0e70ce9a4476fb2fd2868d73492ad4) [09/04/2024] Added Discord Presence Integration. Discord displays "In ShadPS4" along with elapsed time when a user is executing shadps4.exe in their computer. ### 📊 Changes **3 files changed** (+331 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `presence/discord.cpp` (+151 -0) ➕ `presence/discord.h` (+64 -0) ➕ `presence/discord_rpc.h` (+116 -0) </details> ### 📄 Description **Discord displays "In ShadPS4" along with elapsed time when a user is executing shadps4.exe in their computer.** The presence displays the current status of the emulator (e.g., whether shadps4.exe is running) and updates it in real-time within the Discord client. All necessary files have been moved to a presence directory to keep it organized. Changes: - Added presence/discord.h, presence/discord.cpp, and presence/discord_rpc.h for handling Discord RPC integration. - In testing, I modified ```main.cpp``` to initialize and run Discord Presence alongside the emulator as shown below: ```cpp #include <fmt/core.h> #include "emulator.h" #include "presence/discord.h" int main(int argc, char* argv[]) { if (argc == 1) { fmt::print("Usage: {} <elf or eboot.bin path>\n", argv[0]); return -1; } Discord discord("XXXXXXXXXXXXXXXXXXX"); discord.Initialize(); Core::Emulator emulator; emulator.Run(argv[1]); discord.Run(); discord.Shutdown(); return 0; } ``` Let's talk the 19 digit Discord API key "XXXXXXXXXXXXXXXXXXX": I used my custom key and it worked, so the owner of the repository or someone with higher privileges needs to go to the Discord Developer Portal and get a key, I could otherwise configure this. That being said, all the functionality is there, and we are 1-key away. As for ```main.cpp``` I didn't want to mess with that directly in this merge request, therefore I am just showing what I did. All files conform to the project's style guide: - Functions and classes follow PascalCase. - Variables follow lower_case_underscored naming. - Line width limited to 100 characters. - Used C++-style casts where needed (e.g., static_cast). - Proper namespace usage. - 4-space indentation with no tabs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:13:52 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1767
No description provided.