From 78abc9f16f410d9019deec67ac0741f1546414a0 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Mon, 21 Apr 2025 18:30:32 +0200 Subject: [PATCH] fix: add bacxk the launch command regeistering to the social discord sdk usage this was falsly removed when migrating from the game sdk to the social sdk --- src/discord/core.cpp | 7 +++++++ src/discord/core.hpp | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/discord/core.cpp b/src/discord/core.cpp index 2427367b..c0b86a23 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -94,6 +94,13 @@ void DiscordInstance::after_ready() { spdlog::error("Current Connected User Error: {}", result.ToString()); } ); + + auto result = m_client.RegisterLaunchCommand( + constants::discord::application_id, constants::discord::platform_dependent_launch_arguments + ); + if (not result) { + spdlog::warn("Discord: Failed to Register Launch Command"); + }; } diff --git a/src/discord/core.hpp b/src/discord/core.hpp index c440a4bd..016d22c2 100644 --- a/src/discord/core.hpp +++ b/src/discord/core.hpp @@ -24,6 +24,25 @@ namespace constants::discord { constexpr u64 application_id = 1220147916371394650ULL; + +//TODO(Totto): this isn't correct for all platforms and needs to be tested +#if defined(__ANDROID__) +#error "Not supported" +#elif defined(__CONSOLE__) +#error "Not supported" +#elif defined(FLATPAK_BUILD) + constexpr const char* platform_dependent_launch_arguments = + "flatpak run io.github.openbrickprotocolfoundation.oopetris --discord"; +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + constexpr const char* platform_dependent_launch_arguments = "oopetris.exe --discord"; +#elif defined(__APPLE__) + constexpr const char* platform_dependent_launch_arguments = "TODO"; +#elif defined(__linux__) + constexpr const char* platform_dependent_launch_arguments = "oopetris --discord"; +#else +#error "Unsupported platform" +#endif + #if defined(__ANDROID__) constexpr const discordpp::ActivityGamePlatforms supported_platforms = discordpp::ActivityGamePlatforms::Android; #elif defined(__CONSOLE__)