Make Discord RPC configurable

This commit is contained in:
Starlet 2018-07-13 10:30:34 -04:00
parent e1ef8f3286
commit c32082961a
3 changed files with 40 additions and 27 deletions

View file

@ -19,6 +19,8 @@ namespace Ryujinx
public static int GamePadIndex { get; private set; }
public static float GamePadTriggerThreshold { get; private set; }
public static bool DiscordRPCEnable { get; private set; }
public static void Read(Logger Log)
{
string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
@ -40,6 +42,8 @@ namespace Ryujinx
GamePadDeadzone = (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture);
GamePadTriggerThreshold = (float)Convert.ToDouble (Parser.Value("GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture);
DiscordRPCEnable = Convert.ToBoolean(Parser.Value("DiscordRPC_Enable"));
string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);
//When the classes are specified on the list, we only

View file

@ -31,6 +31,9 @@ GamePad_Trigger_Threshold = 0.5
#Whether or not to enable Controller support
GamePad_Enable = true
#Whether or not to enable Discord Rich Presence (requires discord-rpc.dll 64-bit in same path as Ryujinx)
DiscordRPC_Enable = false
#https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs
Controls_Left_JoyConKeyboard_Stick_Up = 105
Controls_Left_JoyConKeyboard_Stick_Down = 101

View file

@ -19,14 +19,6 @@ namespace Ryujinx
{
Console.Title = "Ryujinx Console";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Handlers = new DiscordRpc.EventHandlers();
Presence = new DiscordRpc.RichPresence();
DiscordRpc.Initialize("467315377412767744", ref Handlers, true, null);
}
IGalRenderer Renderer = new OGLRenderer();
IAalOutput AudioOut = new OpenALAudioOut();
@ -35,6 +27,17 @@ namespace Ryujinx
Config.Read(Ns.Log);
if (Config.DiscordRPCEnable)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Handlers = new DiscordRpc.EventHandlers();
Presence = new DiscordRpc.RichPresence();
DiscordRpc.Initialize("467315377412767744", ref Handlers, true, null);
}
}
Ns.Log.Updated += ConsoleLog.PrintLog;
if (args.Length == 1)
@ -61,6 +64,8 @@ namespace Ryujinx
Ns.LoadCart(args[0]);
}
if (Config.DiscordRPCEnable)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
if (Ns.Os.SystemState.GetNpdmTitleName() != "Application")
@ -87,6 +92,7 @@ namespace Ryujinx
DiscordRpc.UpdatePresence(Presence);
}
}
}
else if (File.Exists(args[0]))
{
Console.WriteLine("Loading as homebrew.");