mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-11-27 15:34:17 +01:00
Exported Discord_Register and Discord_RegisterSteam (#109)
* Update CMakeLists.txt * Update and rename src/discord_register.h to include/discord_register.h * Update CMakeLists.txt * Update discord_register_win.cpp * Update discord_register_linux.cpp
This commit is contained in:
parent
94ee4e64d9
commit
eee5085e9b
26
include/discord_register.h
Normal file
26
include/discord_register.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(DISCORD_DYNAMIC_LIB)
|
||||
# if defined(_WIN32)
|
||||
# if defined(DISCORD_BUILDING_SDK)
|
||||
# define DISCORD_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define DISCORD_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DISCORD_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
#else
|
||||
# define DISCORD_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
|
||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD 14)
|
||||
set(BASE_RPC_SRC
|
||||
${PROJECT_SOURCE_DIR}/include/discord-rpc.h
|
||||
discord-rpc.cpp
|
||||
discord_register.h
|
||||
${PROJECT_SOURCE_DIR}/include/discord_register.h
|
||||
rpc_connection.h
|
||||
rpc_connection.cpp
|
||||
serialization.h
|
||||
@ -130,5 +130,6 @@ install(
|
||||
install(
|
||||
FILES
|
||||
"../include/discord-rpc.h"
|
||||
"../include/discord_register.h"
|
||||
DESTINATION "include"
|
||||
)
|
||||
|
@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void Discord_Register(const char* applicationId, const char* command);
|
||||
void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -21,7 +21,7 @@ bool Mkdir(const char* path)
|
||||
}
|
||||
|
||||
// we want to register games so we can run them from Discord client as discord-<appid>://
|
||||
extern "C" void Discord_Register(const char* applicationId, const char* command)
|
||||
extern "C" DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command)
|
||||
{
|
||||
// Add a desktop file and update some mime handlers so that xdg-open does the right thing.
|
||||
|
||||
@ -90,7 +90,7 @@ extern "C" void Discord_Register(const char* applicationId, const char* command)
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
|
||||
extern "C" DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
|
||||
{
|
||||
char command[256];
|
||||
sprintf(command, "xdg-open steam://rungameid/%s", steamId);
|
||||
|
@ -115,7 +115,7 @@ void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* command)
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
extern "C" void Discord_Register(const char* applicationId, const char* command)
|
||||
extern "C" DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command)
|
||||
{
|
||||
wchar_t appId[32];
|
||||
MultiByteToWideChar(CP_UTF8, 0, applicationId, -1, appId, 32);
|
||||
@ -131,7 +131,7 @@ extern "C" void Discord_Register(const char* applicationId, const char* command)
|
||||
Discord_RegisterW(appId, wcommand);
|
||||
}
|
||||
|
||||
extern "C" void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
|
||||
extern "C" DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId)
|
||||
{
|
||||
wchar_t appId[32];
|
||||
MultiByteToWideChar(CP_UTF8, 0, applicationId, -1, appId, 32);
|
||||
|
Loading…
Reference in New Issue
Block a user