mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Linux: Make Discord Rich Presence work (#998)
* Linux: Make Discord Rich Presence work * Fix file already exists * Fix chmod file name
This commit is contained in:
@@ -27,9 +27,24 @@ namespace VRCX
|
||||
var isGameRunning = false;
|
||||
var isSteamVRRunning = false;
|
||||
|
||||
if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
|
||||
if (Wine.GetIfWine())
|
||||
{
|
||||
isGameRunning = true;
|
||||
var wineTmpPath = Path.Combine(Program.AppDataDirectory, "wine.tmp");
|
||||
if (File.Exists(wineTmpPath))
|
||||
{
|
||||
var wineTmp = File.ReadAllText(wineTmpPath);
|
||||
if (wineTmp.Contains("isGameRunning=true"))
|
||||
{
|
||||
isGameRunning = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
|
||||
{
|
||||
isGameRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ProcessMonitor.Instance.IsProcessRunning("vrserver"))
|
||||
|
||||
+17
-17
@@ -1,23 +1,23 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace VRCX;
|
||||
|
||||
public static class Wine
|
||||
namespace VRCX
|
||||
{
|
||||
[DllImport("ntdll.dll")]
|
||||
private static extern IntPtr wine_get_version();
|
||||
|
||||
public static bool GetIfWine()
|
||||
public static class Wine
|
||||
{
|
||||
// wine_get_version should be guaranteed to exist exclusively in Wine envs,
|
||||
// unlike some other suggestions like checking Wine registry keys
|
||||
try
|
||||
{
|
||||
wine_get_version();
|
||||
return true;
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
}
|
||||
[DllImport("ntdll.dll")]
|
||||
private static extern IntPtr wine_get_version();
|
||||
|
||||
public static bool GetIfWine()
|
||||
{
|
||||
// wine_get_version should be guaranteed to exist exclusively in Wine envs,
|
||||
// unlike some other suggestions like checking Wine registry keys
|
||||
try
|
||||
{
|
||||
wine_get_version();
|
||||
return true;
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user