Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve linux support (new launcher) #1848

Open
wants to merge 519 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
519 commits
Select commit Hold shift + click to select a range
380eb52
Fixed tooltip pointerover underlining text
NinjaPedroX Jun 9, 2024
fb38b60
Fixed focus and dialogs not resetting
Measurity Jun 9, 2024
dbc95fb
Restore Windows OS default window animations
NinjaPedroX Jun 11, 2024
537f64d
Added null checks for getting window handle in MainWindow.axaml.cs
Measurity Jun 11, 2024
8b4d00a
Server logging Fixes (WIP)
NinjaPedroX Jun 12, 2024
b90dd3d
More Server logging WIP
NinjaPedroX Jun 12, 2024
634ca60
Fixed file logging to correct file name
Measurity Jun 13, 2024
1fc59a8
Fixed logging not working on launcher
Measurity Jun 13, 2024
0bfd322
Fix LaunchGameView and OptionsView game platform icon
NinjaPedroX Jun 14, 2024
f2e49f3
Fixed game path change not working
Measurity Jun 14, 2024
f773e9e
Fix game platform icons not updating
NinjaPedroX Jun 14, 2024
53dfa3a
Initialize Servers in ServersView at startup
NinjaPedroX Jun 14, 2024
93226b8
Add TrimAttribute & Save version validation
NinjaPedroX Jun 14, 2024
0b4478c
Add missing language localizations and clean up output folder (WIP)
NinjaPedroX Jun 14, 2024
7e9dad1
Renamed TrimAttribute to NotEndsWithAttribute.cs
Measurity Jun 14, 2024
48e2b29
Finish cleanup of output folder
NinjaPedroX Jun 15, 2024
9010898
Fix multiplayer Subnautica not launching
NinjaPedroX Jun 15, 2024
33a6507
Combine dialog modals into DialogBoxModal (WIP)
NinjaPedroX Jun 16, 2024
be2aa24
Fix converter filename typo
NinjaPedroX Jun 16, 2024
763a4da
Finished DialogBoxModal
NinjaPedroX Jun 16, 2024
c810bee
Removed CommandParameter for dialog closing
NinjaPedroX Jun 16, 2024
2290815
i missed one
NinjaPedroX Jun 16, 2024
152fe5f
Changed ButtonOptions in Flags enum
Measurity Jun 16, 2024
0037799
Merge pull request #9 from NinjaPedroX/linux
Measurity Jun 16, 2024
3e4ad29
Added "Update to Legacy" popup for Start Multiplayer button
NinjaPedroX Jun 16, 2024
30d3b8b
Improved legacy version check
NinjaPedroX Jun 16, 2024
ceb0d37
Added Legacy version check to server start
NinjaPedroX Jun 16, 2024
0ee6784
Improved StartPlatformAsync for Steam
Measurity Jun 16, 2024
9b3c2a1
Added timeout for steam ready
Measurity Jun 16, 2024
606cf29
Removed NitroxLauncher in favor of Nitrox.Launcher
Measurity Jun 16, 2024
b5a60ab
Fixed empty "Using game files from:" server message and started Yes/N…
NinjaPedroX Jun 17, 2024
c47c555
Changed Nitrox Server "Press L to open log file" to open Nitrox Logs …
NinjaPedroX Jun 17, 2024
374244e
Fixed DialogBox usage in ServersView
NinjaPedroX Jun 18, 2024
9e184b0
Adding Main Scrollviewer offset per VM logic (WIP)
NinjaPedroX Jun 18, 2024
78597cb
Used RoutableViewModelBase to store main scroll offset
Measurity Jun 18, 2024
c71f719
Wrapped all views into individual Scrollviewers (WIP)
NinjaPedroX Jun 18, 2024
87c9332
Fixed DLL resolve issue for non local DLLs
Measurity Jun 18, 2024
f8999df
Finished indiviual scrollviewers
NinjaPedroX Jun 18, 2024
b2eb17e
Fixed file not found causing problems in assembly resolve
Measurity Jun 18, 2024
754d3b2
Added basic RichTextBox and improved UpdatesView
NinjaPedroX Jun 19, 2024
83f5d65
Moved Nitrox assets on build into "Resources"
Measurity Jun 19, 2024
9bacaea
Fixed and Improved RichTextBox
NinjaPedroX Jun 19, 2024
17ad0cf
Refactored RichTextBlock to use Regex for tag parsing
Measurity Jun 19, 2024
69320aa
Added hyperlink support to RichTextBlock
Measurity Jun 19, 2024
e38a48d
Change changelog expand to happen anywhere on grid
Measurity Jun 19, 2024
5a8a2b9
Added more error handling
Measurity Jun 19, 2024
5bc4829
Improved ScrollViewer in ManageServerView
NinjaPedroX Jun 19, 2024
ef038fe
Removed PolyFill dependency since it broke Nitrox.Test
Measurity Jun 19, 2024
2968faa
Fixed some code warnings on build
Measurity Jun 19, 2024
6d50c50
Reduce build size by removing fonts and runtimes folder
Measurity Jun 19, 2024
a1e93db
Fixed launcher crashing
NinjaPedroX Jun 20, 2024
171552c
Improve ScrollViewer style and revert UpdateView changes
NinjaPedroX Jun 20, 2024
c4746e9
Fixed previewer not working
Measurity Jun 21, 2024
e546795
Removed embedded/console server options
Measurity Jun 21, 2024
63c0742
(WIP) Added Advanced Options dialog
Measurity Jun 21, 2024
bdf7094
Fixed a typo
NinjaPedroX Jun 22, 2024
1b872b0
Upgrade vulnerable version of ImageSharp
dartasen Jun 22, 2024
4d72f95
Merge pull request #11 from dartasen/fix/upgrade-imagesharp
Measurity Jun 22, 2024
7276551
Build improvement and enabled Advanced Settings button
NinjaPedroX Jun 22, 2024
c91b91c
Fixed field accept filter in advanced settings
Measurity Jun 22, 2024
ee647a5
Made Nitrox.Launcher build sequential
Measurity Jun 22, 2024
ac3771c
Fixed "0/100 playing" styling in ManageServerView.axaml
Measurity Jun 23, 2024
d8fb02a
Moved duplicated game version check into shared API
Measurity Jun 23, 2024
3a22fb7
Moved game running check into GameInspect API
Measurity Jun 23, 2024
9442090
IsGameRunning parameter changed to GameInfo instead of string
Measurity Jun 23, 2024
442b154
Fix issue for launching on Linux
Measurity Jun 23, 2024
1b5d2fa
Changed launch game to be async
Measurity Jun 23, 2024
a5e5c92
Removed unused "gameProcess" variable from LaunchGameViewModel.cs
Measurity Jun 23, 2024
f98c0d2
Merge branch 'master' into linux
Measurity Jun 23, 2024
f57c8e2
Continued work on Advanced Options Dialog
NinjaPedroX Jun 23, 2024
fd8a3ec
Used cancellation tokens in server init code
Measurity Jun 23, 2024
82e5b72
Added server window close event handling
Measurity Jun 23, 2024
4dfb78a
More work on Advanced Options Dialog
NinjaPedroX Jun 24, 2024
0676af8
Fix "CreateFullEntityCache" not showing up on Adv. Opt. Dialog
NinjaPedroX Jun 24, 2024
ba82b38
Reset ManageServerView scrollviewers when loaded
NinjaPedroX Jun 24, 2024
90354a1
Style improvements to ComboBox and Dialog window
NinjaPedroX Jun 24, 2024
0e56915
Improved Window styles
NinjaPedroX Jun 24, 2024
fc3d361
Allowed .ico file selection for server icons
NinjaPedroX Jun 24, 2024
dd088bc
Fixed WindowTitle not being set to Title or Description
Measurity Jun 25, 2024
dcc696d
Fix saving Advanced settings (WIP)
NinjaPedroX Jun 25, 2024
7cdf21a
Fixed advanced options not saving all fields
Measurity Jun 25, 2024
345b8c5
Fixed assembly resolve fail when using dotnet CLI to run launcher
Measurity Jun 29, 2024
e33bd7a
Fixed NitroxConfig serialization issues with different cultures
Measurity Jul 4, 2024
42a4f83
Added version file path to outdated game check message
Measurity Jul 6, 2024
6bdb981
Removed Linux check for ConfigFileKeyValueStore as it should work on …
Measurity Jul 7, 2024
ebbf3c3
Attempt fix steam finder for macOS to point inside .app/Contents
Measurity Jul 7, 2024
0f9a97a
Attempt fix steam finder for macos
Measurity Jul 7, 2024
644c0a5
Attempt fix SteamFinder for macos
Measurity Jul 7, 2024
f22b8ad
Attempt fix game paths for OSX
Measurity Jul 7, 2024
8e7d364
Attempt fix CurrentExecutablePath for OSX
Measurity Jul 7, 2024
ec209ae
Fixed more paths for OSX
Measurity Jul 7, 2024
e27911d
More path fixes for MacOS
Measurity Jul 7, 2024
b51b795
Fixed steam_api.bundle path for OSX
Measurity Jul 7, 2024
978d6b0
Fixed paths to resource data for server on OSX
Measurity Jul 7, 2024
e1d0cd1
Fixed asset bundle parsing on OSX
Measurity Jul 7, 2024
7e80e63
Added more logs for platform checks
Measurity Jul 7, 2024
24339bc
Fixed pipe is broken error when connection to launcher is not made
Measurity Jul 7, 2024
6b18074
Fixed steam platform check on OSX
Measurity Jul 7, 2024
e3b215e
Attempt fix to start Steam on OSX
Measurity Jul 7, 2024
7020727
Attempt fix StartSubnauticaAsync on OSX
Measurity Jul 7, 2024
d9737df
Attempt fix launch game through Steam on OSX
Measurity Jul 7, 2024
abd7855
Added create directory when serializing nitrox configs
Measurity Jul 7, 2024
13d908c
Attempt fix steam id env variable for process start on OSX
Measurity Jul 7, 2024
f6e26c1
Implemented Backup System and restore dialog + logic
NinjaPedroX Jul 11, 2024
7bfaf3a
Backup code cleanup and minor fixes
Measurity Jul 12, 2024
83bf80d
Fixed "Restore Backup" in ManageServerViewModel not changing UI
Measurity Jul 12, 2024
ba18e15
Fixed null value for TypedValidationAttribute to set expected validat…
Measurity Jul 12, 2024
5cd096a
Cleaned up converter types
Measurity Jul 12, 2024
fcc9b43
Various fixes and improvements
NinjaPedroX Jul 13, 2024
94c3758
Fixed log spam
NinjaPedroX Jul 13, 2024
b0646b8
Added property missing cache to not warn for the same value
Measurity Jul 13, 2024
950ca2d
Removed OldWorldManager.cs and improved Backup logic
NinjaPedroX Jul 13, 2024
0bf889d
Refactored Extensions.GetSavesFolderDir to be for KeyValueStore
Measurity Jul 13, 2024
8056f69
Moved clipboard code from DialogBoxModal.axaml.cs to its ViewModel
Measurity Jul 13, 2024
0ee6a56
Disabled OS styling for windows if CanReize is false
Measurity Jul 13, 2024
9fb9a22
Fixed cancel action on modals being interpreted as confirmation
Measurity Jul 13, 2024
0d8ba2f
Cleaned up get parent Window from Visual
Measurity Jul 13, 2024
0fc4b68
Fix typo
Measurity Jul 14, 2024
bbe50b0
Delayed init of game path out of OptionsViewModel ctor
Measurity Jul 14, 2024
99321b9
Fixed previewer not displaying views
Measurity Jul 14, 2024
235faa5
Fixed ManageServerView.axaml not working in previewer
Measurity Jul 14, 2024
ca2cb22
Minor readability improvements for RichTextBlock.cs
Measurity Jul 14, 2024
eb983d5
Fixed directory not found error when making backups on old saves
Measurity Jul 14, 2024
d74a753
Fixed bugs with backup logic
Measurity Jul 14, 2024
3c474fd
Fixed NRE when opening OptionsView.axaml
Measurity Jul 16, 2024
be702e8
Centralized OffScreenMargin padding and fixed window styling without …
NinjaPedroX Jul 20, 2024
132177b
Fixed OptionsView SavesFolderDir and LaunchGameView icon not updating
NinjaPedroX Jul 20, 2024
50e954d
Fixed OptionsView having no values in previewer
Measurity Jul 20, 2024
44de5a7
Minor improvements to EnableDefaultWindowAnimations
Measurity Jul 20, 2024
f0f35d6
Refactored scroll login from MangeServerView to NitroxAttached proper…
Measurity Jul 21, 2024
b982a02
RichTextBlock logic now uses ReadOnlySpan where possible
Measurity Jul 26, 2024
2f56dcb
More performance improvements to RichTextBlock
Measurity Jul 26, 2024
ff28d0c
Removed redundant null checking in RichTextBlock.cs
Measurity Jul 28, 2024
a9be096
Removed GameInstallation type in favor of GameFinderResult
Measurity Jul 29, 2024
76aa6d1
Fix registry check for Steam ready not using proper cancellation token
Measurity Jul 31, 2024
9aab019
Fixed date in BlogView being wrong in some cultures
Measurity Aug 12, 2024
89f79c9
Remove race condition at compile time
dartasen Aug 11, 2024
00eb859
Fix StackOverflow happening with .ressources
dartasen Aug 12, 2024
d63039c
Fixed editorconfig for space before closing tag in xml files
Measurity Aug 12, 2024
7f91b80
Fixed vines.png causing huge memory usage when opening BlogView
Measurity Aug 12, 2024
6cc8f44
Use Copy instead of Move in Debug mode for lib folder
dartasen Aug 12, 2024
2754ae8
Fix optional test
dartasen Aug 12, 2024
f0b663a
Optimize images
dartasen Aug 12, 2024
0dde824
Add ConfigureCulture in launcher
dartasen Aug 12, 2024
38fba08
Few fixes on blog UI performance
dartasen Aug 12, 2024
04c89e3
Add pointer cursor when hovering action buttons
dartasen Aug 12, 2024
0d8e43a
Tweak some code inside update view
dartasen Aug 12, 2024
04adf23
Few UI tweaks for colors and cursors
dartasen Aug 12, 2024
6bb468c
Add popup when launching game
dartasen Aug 12, 2024
7aaf264
Review changes
dartasen Aug 12, 2024
34ba1f1
Fixed JIT issue when starting Nitrox.Launcher
Measurity Aug 12, 2024
f3ef133
Prevented extra Nitrox Launcher from opening when one is running
NinjaPedroX Aug 12, 2024
36e3b54
Improved duplicate process code
NinjaPedroX Aug 13, 2024
15f718c
Update avalonia packages
dartasen Aug 12, 2024
cd6933f
Upgrade to 11.1.3
dartasen Aug 13, 2024
00462c8
Temporary fix for toggled switch style
dartasen Aug 13, 2024
a40b318
Added missing icons
dartasen Aug 13, 2024
96d096d
Few tweaks on notifications
dartasen Aug 13, 2024
4e36662
Fixed window animations again that works with Avalonia 11
Measurity Aug 13, 2024
50d1c81
Modified font for modal header
dartasen Aug 13, 2024
243591e
Fixed Nitrox Launcher window not going to front on Windows when a new…
Measurity Aug 13, 2024
8022f5f
Used MainWindowHandle from ProcessEx instead of title for use with Br…
Measurity Aug 13, 2024
91db692
Changed social icons to be vector paths
Measurity Aug 13, 2024
bdcfbf0
Added Nitrox Bluesky account to CommunityView.axaml
Measurity Aug 13, 2024
c62997f
Removed nitroxLogo.png to use Barlow font for "Nitrox" text
Measurity Aug 13, 2024
e9b0811
Fixed FittingWrapPanel oscillating when going past max width
Measurity Aug 13, 2024
28a3266
Used $parent instead of RelativeSource bindings
Measurity Aug 13, 2024
e25b863
Merged Server and Launcher DLLs together which saves ~3MB on release …
Measurity Aug 14, 2024
5ca0fa0
Merge branch 'master' into linux
Measurity Aug 14, 2024
23c5f51
Reverted a change in GenerateLibFolder.props that was used for debugg…
Measurity Aug 14, 2024
eea2f75
Implemented Tornac's "Instant Launch" profile
NinjaPedroX Aug 15, 2024
77b877a
Fixed native dependencies failing to load in release mode
Measurity Aug 15, 2024
47840de
Minor improvements to instant launch
Measurity Aug 15, 2024
7c181ea
Changed -nitrox argument to be --nitrox
Measurity Aug 15, 2024
a78e6e9
Added player name parameter to instantlaunch
Measurity Aug 15, 2024
71e78af
Changed instantlaunch to let server create the empty save when needed
Measurity Aug 15, 2024
bf39895
Removed unused references
NinjaPedroX Aug 15, 2024
0192db8
Fixed server save name not being used when using instantlaunch
Measurity Aug 15, 2024
477ec9f
Fixed color from player name conversion when using --instantlaunch
Measurity Aug 15, 2024
d960d0b
Cleanup images
dartasen Aug 13, 2024
d36348c
Merge remote-tracking branch 'upstream/master' into linux
Measurity Aug 23, 2024
55a0190
Removed extra \ path character from hintpaths in Directory.Build.targets
Measurity Aug 23, 2024
a307567
Remove unused DI and fixed Scrollviewer Style regression
NinjaPedroX Aug 23, 2024
0f3a313
Fixed "DoubleWrites" error in MSBuild for some launcher DLLs
Measurity Aug 24, 2024
987f9d0
Moved Assembly-Csharp dependencies to the top of Directory.Build.targets
Measurity Aug 24, 2024
ee2ffcd
Upgraded Nitrox.Discovery.MSBuild from 0.0.3 to 0.0.4
Measurity Aug 25, 2024
0ed9052
Fix VS deadlocking on DiscoverGame task
Measurity Aug 26, 2024
6c4e321
Merge remote-tracking branch 'upstream/master' into linux
Measurity Aug 26, 2024
9306ec1
fix locating game path
jumpers775 Sep 5, 2024
a938012
remove debug print, whoops
jumpers775 Sep 5, 2024
2421b96
Added "Open world folder" to ServersView.axaml
Measurity Sep 6, 2024
54a0f3b
fix linux URI handling
jumpers775 Sep 6, 2024
5b5ec09
allow game to launch with wine
jumpers775 Sep 6, 2024
ba5d90e
Merge branch 'Measurity:linux' into linux
jumpers775 Sep 6, 2024
7850864
fix game launching on linux
jumpers775 Sep 7, 2024
d6a8e23
remove dxvk cache file
jumpers775 Sep 7, 2024
8827e5e
disable proton logging
jumpers775 Sep 7, 2024
aa3ae7c
switch to using native titlebar on linux
jumpers775 Sep 8, 2024
501cf91
update ProcessEx to support linux and macOS
jumpers775 Sep 8, 2024
dbcc9cf
Updated Nitrox.Discovery.MSBuild to 0.0.10
Measurity Sep 8, 2024
01bcdfb
Fixed GetFullPath throwing NRE on linux
Measurity Sep 8, 2024
33669e9
revert unneeded path changes
jumpers775 Sep 8, 2024
3a7e855
move OS structures
jumpers775 Sep 8, 2024
1824870
revert changes to Nitrox.axaml
jumpers775 Sep 8, 2024
f14e736
use steam proton instead of umu-launcher
jumpers775 Sep 8, 2024
6843863
use proton version selected in steam
jumpers775 Sep 8, 2024
d35a718
fix not launching when no proton version is specified
jumpers775 Sep 8, 2024
62aa7ca
Fixed Nitrox.Launcher sub-project build paths sometimes not working
Measurity Sep 10, 2024
2e92a44
fix ProcessEx
jumpers775 Sep 11, 2024
85690e9
error handling for no proton
jumpers775 Sep 16, 2024
99ac3d3
Improved config.vdf parsing to extract proton version
Measurity Sep 17, 2024
72b63d0
Merge branch 'linux' into HEAD
Measurity Sep 17, 2024
21ebaf7
Added back ProcessEx.ProcessExists
Measurity Oct 16, 2024
d0f7c43
Merge pull request #19 from jumpers775/linux
Measurity Oct 16, 2024
8d42ed7
Cleaned up titlebar hiding logic for linux systems
Measurity Oct 20, 2024
8909f5b
Improved comments of RichTextBlock.cs
Measurity Oct 23, 2024
742522c
Fixed Subnautica not able to be started multiple times
Measurity Oct 28, 2024
d5a9423
Fix native window animations for Windows
NinjaPedroX Oct 29, 2024
d47a8d7
Fixed OSX build failing on wrong game version check
Measurity Nov 1, 2024
a9eaf7b
Updated Nitrox.Discovery.MSBuild dependency to v0.1.0
Measurity Nov 1, 2024
f113746
Fix process finding on macos
Measurity Nov 1, 2024
c153ebe
Used GetProcessesByName instead of GetProcesses in ProcessEx.cs
Measurity Nov 1, 2024
796d723
Merge remote-tracking branch 'upstream/master' into linux
Measurity Nov 1, 2024
3e6161a
Added BringToFront support for Linux systems with X11 window manager
Measurity Nov 3, 2024
25704bd
Fixed blur not being rounded in LaunchGameView.axaml
Measurity Nov 10, 2024
4c615c5
Only show error on inputs that user interacted with
Measurity Nov 10, 2024
c120824
Handle IpcHost case where stream ended while trying to read it
Measurity Nov 10, 2024
49b3d70
Change modal dialogs to use dark theme instead of white
Measurity Nov 12, 2024
6ec224d
Merge remote-tracking branch 'upstream/master' into linux
Measurity Nov 12, 2024
b3e59fb
Fixed asset path not working during tests on Linux
Measurity Nov 12, 2024
9a59c82
Macos bundling task
dartasen Nov 3, 2024
e92faa6
Improve Nitrox Build
dartasen Nov 8, 2024
b2d38d0
Add thing to app.manifest
dartasen Nov 9, 2024
732bd4c
Split up IsElevated to specific processEx
dartasen Nov 9, 2024
1f3ba30
Improve mac experience
dartasen Nov 11, 2024
854c97f
Remove processex code that cause crash with permissions
dartasen Nov 11, 2024
4fbc220
Change log directory
dartasen Nov 11, 2024
c8d7133
Add OS specific test
dartasen Nov 11, 2024
4bb8dfc
Fix NetHelper not working for macos
dartasen Nov 11, 2024
618c977
Cleanup
dartasen Nov 11, 2024
3b44c6d
Try to get modding working
dartasen Nov 12, 2024
4afc0dd
Fix server not being built in IDE
dartasen Nov 12, 2024
c8f51e3
Fixed dialog box styling (text invisible and too bold)
Measurity Nov 12, 2024
a04812c
Added progress indicator to buttons with async command
Measurity Nov 12, 2024
0c95a07
Added dispose impl. to AsyncCommandButtonTagger
Measurity Nov 12, 2024
bde913b
Updated to .net 9.0 and C# lang v13
Measurity Nov 13, 2024
7b3e3b8
Changed error tooltip foreground to black
Measurity Nov 13, 2024
99cc96c
Used source gen regex as partial property in RichTextBlock.cs
Measurity Nov 13, 2024
db6acac
Code comment improvements
Measurity Nov 13, 2024
8cad065
Optimized servers view rendering for many server entries
Measurity Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 83 additions & 4 deletions NitroxModel/Platforms/OS/Shared/ProcessEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,51 @@ public void Dispose()
public static ProcessEx GetFirstProcess(string procName, Func<ProcessEx, bool> predicate = null, StringComparer comparer = null)
{
comparer ??= StringComparer.OrdinalIgnoreCase;

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return GetFirstProcessWindows(procName, predicate, comparer);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return GetFirstProcessLinux(procName, predicate, comparer);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return GetFirstProcessMacOS(procName, predicate, comparer);
}
else
{
throw new PlatformNotSupportedException("Unsupported operating system.");
}
}

private static ProcessEx GetFirstProcessWindows(string procName, Func<ProcessEx, bool> predicate, StringComparer comparer)
{
foreach (Process process in Process.GetProcesses())
{
try
{
if (comparer.Compare(procName, process.ProcessName) == 0)
{
ProcessEx processEx = new ProcessEx(process.Id);
if (predicate == null || predicate(processEx))
{
return processEx;
}
}
}
catch (Exception)
{
// Process doesn't exist anymore or we don't have access, skip it
continue;
}
}
return null;
}

private static ProcessEx GetFirstProcessLinux(string procName, Func<ProcessEx, bool> predicate, StringComparer comparer)
{
foreach (string dir in Directory.GetDirectories("/proc"))
{
if (int.TryParse(Path.GetFileName(dir), out int pid))
Expand All @@ -102,21 +147,55 @@ public static ProcessEx GetFirstProcess(string procName, Func<ProcessEx, bool> p
}
}
}
catch (ArgumentException)
catch (Exception)
{
// Process doesn't exist anymore, skip it
// Process doesn't exist anymore or we don't have access, skip it
continue;
}
catch (UnauthorizedAccessException)
}
}
return null;
}

private static ProcessEx GetFirstProcessMacOS(string procName, Func<ProcessEx, bool> predicate, StringComparer comparer)
{
// Use process_listpids to get all PIDs
int[] pids = new int[1024];
int bytesNeeded = 0;
if (process_listpids(PROC_ALL_PIDS, 0, pids, pids.Length * sizeof(int), ref bytesNeeded) > 0)
{
int numProcesses = bytesNeeded / sizeof(int);
for (int i = 0; i < numProcesses; i++)
{
int pid = pids[i];
if (pid == 0) continue;

try
{
ProcessEx processEx = new ProcessEx(pid);
if (comparer.Compare(procName, processEx.Name) == 0)
{
if (predicate == null || predicate(processEx))
{
return processEx;
}
}
}
catch (Exception)
Measurity marked this conversation as resolved.
Show resolved Hide resolved
{
// We don't have permission to access this process, skip it
// Process doesn't exist anymore or we don't have access, skip it
continue;
}
}
}
return null;
}

[DllImport("libproc.dylib")]
private static extern int process_listpids(int type, uint typeinfo, int[] buffer, int buffersize, ref int retbufsize);

private const int PROC_ALL_PIDS = 1;

public static ProcessEx Start(string fileName = null, IEnumerable<(string, string)> environmentVariables = null, string workingDirectory = null, string commandLine = null, bool createWindow = true)
{
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
Expand Down
5 changes: 0 additions & 5 deletions NitroxModel/Platforms/Store/Steam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,6 @@ static string GetProtonVersion(string filePath, string appId)
["WINEPREFIX"] = compatdatapath,
["STEAM_COMPAT_CLIENT_INSTALL_PATH"] = SteamPath,
["STEAM_COMPAT_DATA_PATH"] = compatdatapath,





}
};
return new ProcessEx(Process.Start(startInfo));
Expand Down