Make Discord RPC configurable
This commit is contained in:
parent
e1ef8f3286
commit
c32082961a
3 changed files with 40 additions and 27 deletions
|
@ -19,6 +19,8 @@ namespace Ryujinx
|
||||||
public static int GamePadIndex { get; private set; }
|
public static int GamePadIndex { get; private set; }
|
||||||
public static float GamePadTriggerThreshold { get; private set; }
|
public static float GamePadTriggerThreshold { get; private set; }
|
||||||
|
|
||||||
|
public static bool DiscordRPCEnable { get; private set; }
|
||||||
|
|
||||||
public static void Read(Logger Log)
|
public static void Read(Logger Log)
|
||||||
{
|
{
|
||||||
string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
@ -40,6 +42,8 @@ namespace Ryujinx
|
||||||
GamePadDeadzone = (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture);
|
GamePadDeadzone = (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture);
|
||||||
GamePadTriggerThreshold = (float)Convert.ToDouble (Parser.Value("GamePad_Trigger_Threshold"), 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);
|
string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
//When the classes are specified on the list, we only
|
//When the classes are specified on the list, we only
|
||||||
|
|
|
@ -31,6 +31,9 @@ GamePad_Trigger_Threshold = 0.5
|
||||||
#Whether or not to enable Controller support
|
#Whether or not to enable Controller support
|
||||||
GamePad_Enable = true
|
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
|
#https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs
|
||||||
Controls_Left_JoyConKeyboard_Stick_Up = 105
|
Controls_Left_JoyConKeyboard_Stick_Up = 105
|
||||||
Controls_Left_JoyConKeyboard_Stick_Down = 101
|
Controls_Left_JoyConKeyboard_Stick_Down = 101
|
||||||
|
|
|
@ -19,14 +19,6 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
Console.Title = "Ryujinx Console";
|
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();
|
IGalRenderer Renderer = new OGLRenderer();
|
||||||
|
|
||||||
IAalOutput AudioOut = new OpenALAudioOut();
|
IAalOutput AudioOut = new OpenALAudioOut();
|
||||||
|
@ -35,6 +27,17 @@ namespace Ryujinx
|
||||||
|
|
||||||
Config.Read(Ns.Log);
|
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;
|
Ns.Log.Updated += ConsoleLog.PrintLog;
|
||||||
|
|
||||||
if (args.Length == 1)
|
if (args.Length == 1)
|
||||||
|
@ -61,30 +64,33 @@ namespace Ryujinx
|
||||||
Ns.LoadCart(args[0]);
|
Ns.LoadCart(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (Config.DiscordRPCEnable)
|
||||||
{
|
{
|
||||||
if (Ns.Os.SystemState.GetNpdmTitleName() != "Application")
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
Presence.details = $"{Ns.Os.SystemState.GetNpdmTitleName()} ({Ns.Os.SystemState.GetNpdmTitleId()})";
|
if (Ns.Os.SystemState.GetNpdmTitleName() != "Application")
|
||||||
}
|
{
|
||||||
else
|
Presence.details = $"{Ns.Os.SystemState.GetNpdmTitleName()} ({Ns.Os.SystemState.GetNpdmTitleId()})";
|
||||||
{
|
}
|
||||||
Presence.details = Ns.Os.SystemState.GetNpdmTitleId();
|
else
|
||||||
}
|
{
|
||||||
|
Presence.details = Ns.Os.SystemState.GetNpdmTitleId();
|
||||||
|
}
|
||||||
|
|
||||||
if (Ns.Os.SystemState.GetNpdmIs64Bit())
|
if (Ns.Os.SystemState.GetNpdmIs64Bit())
|
||||||
{
|
{
|
||||||
Presence.state = "Playing a 64-bit game!";
|
Presence.state = "Playing a 64-bit game!";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Presence.state = "Playing a 32-bit game!";
|
Presence.state = "Playing a 32-bit game!";
|
||||||
}
|
}
|
||||||
|
|
||||||
Presence.largeImageKey = "icon";
|
Presence.largeImageKey = "icon";
|
||||||
Presence.largeImageText = "Ryujinx";
|
Presence.largeImageText = "Ryujinx";
|
||||||
|
|
||||||
DiscordRpc.UpdatePresence(Presence);
|
DiscordRpc.UpdatePresence(Presence);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (File.Exists(args[0]))
|
else if (File.Exists(args[0]))
|
||||||
|
|
Loading…
Reference in a new issue