Merge pull request #11550 from unknownbrackets/discord

Discord: Add cmake option to disable
This commit is contained in:
Henrik Rydgård 2018-11-11 00:09:06 +01:00 committed by GitHub
commit b88b07ea00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 6 deletions

View file

@ -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()

View file

@ -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);

View file

@ -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
}

View file

@ -17,6 +17,7 @@ public:
void SetPresenceGame(const char *gameTitle);
void SetPresenceMenu();
void ClearPresence();
private:
void Init();

View file

@ -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) {

View file

@ -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()