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

Game finders overhaul #2121

Merged
merged 16 commits into from
Feb 29, 2024

Conversation

dartasen
Copy link
Member

This is a spin-off of #2053, I splitted up this into several ones, so it will be easier to review. I applied the suggestions from the previous PR onto this one.

Nitrox has always defined an order in the way it searches the Subnautica installation files. This works in most cases, since users generally have only one installation of the game. However, this approach raises questions when a user has the game on both Steam & Epic.

The aim of this PR is to do away with this automatic way of doing things, by providing an API that lets you search for one or more installations of a given game (GameInfo) via flags (GameLibraries).

i.e:

IEnumerable<GameInstallation> installations = GameInstallerFinder.FindGame(GameInfo.SubnauticaZero, GameLibraries.EPIC | GameLibraries.STEAM);

var wantedInstallation = installations.Where(install => install.Origin == GameLibraries.Steam)

That will allow the launcher to display all the path, and let the user choose between them. Rather than imposing it.

What's changed

  • Changed namespace to be file-scoped by default (Others are just automatic additions for available lines that were not in our .editorconfig)
  • Reimplemented finders to use our GameInfo structure
  • Added Microsoft finder (real game install is locked up behind OS secured folder, so for now we'll check for default path)
  • Improved Steam finder to support Linux & OSX game path
  • Removed CurrentDirectory finder

@dartasen dartasen changed the title Installation finders v2 Game finders overhaul Feb 25, 2024
@dartasen dartasen added the Area: setup Related to installing or configuring Nitrox label Feb 25, 2024
dartasen and others added 4 commits February 28, 2024 13:21
Instead of finders appending to an error list they now return an error result.
NotFound should be returned when the game libraries were found but the requested game appears to not be installed.
Copy link
Collaborator

@Measurity Measurity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved again (I messed up a unit test)

Nitrox.Test/Model/ExtensionsTests.cs Show resolved Hide resolved
.editorconfig Show resolved Hide resolved
NitroxModel/Discovery/GameInstallationFinder.cs Outdated Show resolved Hide resolved
NitroxModel/Discovery/InstallationFinders/SteamFinder.cs Outdated Show resolved Hide resolved
NitroxModel/Discovery/InstallationFinders/SteamFinder.cs Outdated Show resolved Hide resolved
NitroxModel/Helper/NitroxUser.cs Show resolved Hide resolved
NitroxModel/Helper/NitroxUser.cs Outdated Show resolved Hide resolved
GameInstallationHelper.HasValidGameFolder was previously only checked when Steam game was installed on a different drive than Steam itself.
Copy link
Member

@Jannify Jannify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM CW

@dartasen dartasen merged commit 26179d0 into SubnauticaNitrox:master Feb 29, 2024
@dartasen dartasen deleted the installation-finders-v2 branch February 29, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: setup Related to installing or configuring Nitrox
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants