Skip to content

Commit

Permalink
Merge pull request #401 from endorpersand/discord-rpc-mac-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0ade authored Nov 22, 2021
2 parents 933bdc4 + 8d239f4 commit bf71639
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Celeste.Mod.mm/Mod/Everest/Everest.Discord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,31 @@ private static void WorkerLoop() {
string lib = null;
if (!string.IsNullOrEmpty(CoreModule.Settings.DiscordLib))
lib = CoreModule.Settings.DiscordLib;
else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
else if (PlatformHelper.Is(MonoMod.Utils.Platform.Windows))
lib = "discord-rpc.dll";
else if (Environment.OSVersion.Platform == PlatformID.MacOSX) {
else if (PlatformHelper.Is(MonoMod.Utils.Platform.MacOS))
lib = "libdiscord-rpc.dylib";
// FIXME: macOS doesn't see libdiscord-rpc.dylib wherever Celeste.exe is.
} else if (Environment.OSVersion.Platform == PlatformID.Unix)
else if (PlatformHelper.Is(MonoMod.Utils.Platform.Unix))
lib = "libdiscord-rpc.so";

if (!string.IsNullOrEmpty(lib))
DynDll.Mappings["discord-rpc"] = new List<DynDllMapping>() { lib };

string discordID = "430794114037055489";
if (!string.IsNullOrEmpty(CoreModule.Settings.DiscordID))
discordID = CoreModule.Settings.DiscordID;

try {
typeof(DiscordRpc).ResolveDynDllImports();
} catch {

}

if (DiscordRpc.Initialize == null) {
Logger.Log(LogLevel.Info, "discord", "Discord_Initialize not found - skipping Discord Rich Presence.");
return;
}

string discordID = "430794114037055489";
if (!string.IsNullOrEmpty(CoreModule.Settings.DiscordID))
discordID = CoreModule.Settings.DiscordID;

Logger.Log(LogLevel.Verbose, "discord", $"Discord_Initialize found - initializing Discord Rich Presence, app ID {discordID}");

DiscordHandlers.readyCallback += OnDiscordReady;
Expand Down

0 comments on commit bf71639

Please sign in to comment.