mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
Add Discord RPC (#161)
* Add discord-rpc submodule * Add Discord RPC * Fix up Discord status * Fix CMake because MacOS sucks * Slightly less hacky fix
This commit is contained in:
parent
32ad43cb8e
commit
1c11e2df40
9 changed files with 145 additions and 8 deletions
|
@ -6,6 +6,7 @@
|
|||
// Remember to initialize every field here to its default value otherwise bad things will happen
|
||||
struct EmulatorConfig {
|
||||
bool shaderJitEnabled = false;
|
||||
bool discordRpcEnabled = false;
|
||||
RendererType rendererType = RendererType::OpenGL;
|
||||
|
||||
EmulatorConfig(const std::filesystem::path& path);
|
||||
|
|
23
include/discord_rpc.hpp
Normal file
23
include/discord_rpc.hpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
|
||||
#include <discord_rpc.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace Discord {
|
||||
enum class RPCStatus { Idling, Playing };
|
||||
|
||||
class RPC {
|
||||
std::uint64_t startTimestamp;
|
||||
bool enabled = false;
|
||||
|
||||
public:
|
||||
void init();
|
||||
void update(RPCStatus status, const std::string& title);
|
||||
void stop();
|
||||
};
|
||||
} // namespace Discord
|
||||
|
||||
#endif
|
|
@ -11,6 +11,7 @@
|
|||
#include "config.hpp"
|
||||
#include "cpu.hpp"
|
||||
#include "crypto/aes_engine.hpp"
|
||||
#include "discord_rpc.hpp"
|
||||
#include "io_file.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
|
@ -64,6 +65,11 @@ class Emulator {
|
|||
friend struct HttpServer;
|
||||
#endif
|
||||
|
||||
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
|
||||
Discord::RPC discordRpc;
|
||||
#endif
|
||||
void updateDiscord();
|
||||
|
||||
// Keep the handle for the ROM here to reload when necessary and to prevent deleting it
|
||||
// This is currently only used for ELFs, NCSDs use the IOFile API instead
|
||||
std::ifstream loadedELF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue