diff --git a/CMakeLists.txt b/CMakeLists.txt index 025152e551..479e3c09f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,6 +132,7 @@ option(SIMULATOR "Set to ON when targeting an x86 simulator of an ARM platform" option(LIBRETRO "Set to ON to generate the libretro target" OFF) # :: Options option(USE_FFMPEG "Build with FFMPEG support" ${USE_FFMPEG}) +option(USE_DISCORD "Build with Discord support" ON) option(USE_SYSTEM_SNAPPY "Dynamically link against system snappy" ${USE_SYSTEM_SNAPPY}) option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG}) option(USE_SYSTEM_LIBZIP "Dynamically link against system libzip" ${USE_SYSTEM_LIBZIP}) @@ -1802,7 +1803,8 @@ if(FFmpeg_FOUND) endif() # Discord integration -if(NOT IOS) +if(USE_DISCORD AND NOT IOS) + add_definitions(-DUSE_DISCORD=1) target_link_libraries(${CoreLibName} discord-rpc) endif() diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 11863bd210..a81bc8c60b 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -388,7 +388,8 @@ void SystemInfoScreen::CreateViews() { DrawContext *draw = screenManager()->getDrawContext(); - const char *apiName = gr->T(screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME)); + const std::string apiNameKey = draw->GetInfoString(InfoField::APINAME); + const char *apiName = gr->T(apiNameKey); deviceSpecs->Add(new InfoItem(si->T("3D API"), apiName)); deviceSpecs->Add(new InfoItem(si->T("Vendor"), draw->GetInfoString(InfoField::VENDORSTRING))); std::string vendor = draw->GetInfoString(InfoField::VENDOR); diff --git a/UI/DiscordIntegration.cpp b/UI/DiscordIntegration.cpp index 54ee337e3f..34fc4d00b5 100644 --- a/UI/DiscordIntegration.cpp +++ b/UI/DiscordIntegration.cpp @@ -9,7 +9,11 @@ #if (PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(LINUX)) && !PPSSPP_PLATFORM(ANDROID) +#ifdef _MSC_VER #define ENABLE_DISCORD +#elif USE_DISCORD +#define ENABLE_DISCORD +#endif #else @@ -130,3 +134,12 @@ void Discord::SetPresenceMenu() { Discord_UpdatePresence(&discordPresence); #endif } + +void Discord::ClearPresence() { + if (!IsEnabled() || !initialized_) + return; + +#ifdef ENABLE_DISCORD + Discord_ClearPresence(); +#endif +} diff --git a/UI/DiscordIntegration.h b/UI/DiscordIntegration.h index cd700d59ea..a2911d6877 100644 --- a/UI/DiscordIntegration.h +++ b/UI/DiscordIntegration.h @@ -17,6 +17,7 @@ public: void SetPresenceGame(const char *gameTitle); void SetPresenceMenu(); + void ClearPresence(); private: void Init(); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index b638661074..fe82bf2373 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -346,7 +346,11 @@ EmuScreen::~EmuScreen() { startDumping = false; } #endif - g_Discord.SetPresenceMenu(); + + if (GetUIState() == UISTATE_EXIT) + g_Discord.ClearPresence(); + else + g_Discord.SetPresenceMenu(); } void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index ade6594e8f..b259a6f059 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -2,7 +2,7 @@ set(ARMIPS_REGEXP OFF CACHE BOOL "" FORCE) add_subdirectory(armips) if(NOT USING_GLES2) - add_subdirectory(glew) + add_subdirectory(glew) endif() set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "let's not build binaries we don't need" FORCE) @@ -12,6 +12,6 @@ add_subdirectory(glslang) add_subdirectory(snappy) add_subdirectory(udis86) add_subdirectory(SPIRV-Cross-build) -if(NOT IOS) -add_subdirectory(discord-rpc-build) +if(USE_DISCORD AND NOT IOS) + add_subdirectory(discord-rpc-build) endif()