Skip to content

Restore Nautilus GameInput compatibility#2740

Open
mindless2831 wants to merge 4 commits into
SubnauticaNitrox:masterfrom
mindless2831:nautilus-gameinput-compat
Open

Restore Nautilus GameInput compatibility#2740
mindless2831 wants to merge 4 commits into
SubnauticaNitrox:masterfrom
mindless2831:nautilus-gameinput-compat

Conversation

@mindless2831
Copy link
Copy Markdown
Contributor

@mindless2831 mindless2831 commented May 17, 2026

Summary

Restores compatibility between Nitrox and newer Nautilus builds that use Nautilus's Subnautica GameInput integration.

Nautilus 1.0.0-pre.45+ introduced a new GameInput/custom button system. With Nitrox, this caused the game to reach the title/menu scene but fail to populate the expected menu/UI state, making Nitrox effectively incompatible with newer Nautilus builds.

This PR applies the focused GameInput/keybind compatibility work from JackNytely's PR #2663, excluding the unrelated launcher/server changes from that PR.

Full credit for the Nautilus GameInput compatibility work goes to JackNytely and PR #2663. This PR separates the input compatibility pieces into a smaller, focused change set.

What changed

  • Makes Nitrox's GameInput button registration compatible with Nautilus's custom GameInput button handling.
  • Ensures Nitrox buttons are safely added without assuming Nitrox is the only system extending GameInput.Button / GameInput.AllActions.
  • Adds duplicate-safe handling around GameInput action registration.
  • Preserves support for Nautilus's new input labels, keyboard shortcuts, and assignment UI.
  • Fixes a server-side spawning exception caused by UwePrefab being declared as a readonly record struct while spawning code expects to mutate Probability.

UwePrefab fix

During multiplayer world sync, the server repeatedly threw:

System.MissingMethodException: Method not found:

'Void Nitrox.Model.Subnautica.DataStructures.GameLogic.Entities.UwePrefab.set_Probability(Single)'.

Mindless2831 added 3 commits May 17, 2026 00:49
Applies the focused Nautilus GameInput/keybind compatibility work from JackNytely's PR SubnauticaNitrox#2663. This restores compatibility with newer Nautilus builds that extend Subnautica's GameInput system, while excluding unrelated launcher/server changes from the original PR. Credit: based on JackNytely's work in SubnauticaNitrox#2663.
Removes readonly from UwePrefab so spawning code can mutate Probability without throwing a MissingMethodException for UwePrefab.set_Probability. This fixes repeated server-side sync exceptions during multiplayer world/entity spawning.
Comment thread Nitrox.Launcher/Program.cs
@Measurity Measurity added this to the 1.9 milestone May 17, 2026
Comment thread Nitrox.Model.Subnautica/DataStructures/GameLogic/Entities/UwePrefab.cs Outdated
try
{
return Assembly.LoadFile(dllPath);
return Assembly.LoadFrom(dllPath);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think we want to keep this LoadFile so that we get a chance to resolve dependencies ourselves. Otherwise it might load dependencies that cause (hidden) incompatibilities by loading slightly different assembly versions.

See MSDN docs for more info.

Use the LoadFile method to load and examine assemblies that have the same identity, but are located in different paths. LoadFile does not load files into the load-from context, and does not resolve dependencies using the load path, as the LoadFrom method does. LoadFile is useful in this limited scenario because LoadFrom cannot be used to load assemblies that have the same identities but different paths; it will load only the first such assembly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That concern makes sense, and I agree we do not want the launcher accidentally resolving incompatible dependency versions.

The reason I changed this is that the LoadFile behavior appears to be the source of the runtime mismatch we were seeing in Release builds. In practice, it can load an assembly outside the normal load context, which means another assembly with the same identity can still be loaded elsewhere. That was causing type/API-surface mismatches, including the UwePrefab/Nitrox.Model.Subnautica MissingMethodException during world sync.

So the issue was not that we needed less control over dependency loading; it was that LoadFile gave us too much isolation and allowed duplicate/mismatched assemblies with the same identity to exist at runtime.

LoadFrom still loads from the explicit path selected by this resolver, so we are still preferring the intended lib/launcher-local assembly path. The important difference is that it participates in the load-from context, so subsequent binds to the same assembly identity resolve consistently instead of creating a hidden duplicate assembly situation.

That said, I understand the concern about broadening dependency resolution. If preferred, I can adjust this to be more targeted, but the purpose of the change is specifically to prevent the Release build from loading mismatched Nitrox assemblies and producing runtime MissingMethodExceptions.

@mindless2831
Copy link
Copy Markdown
Contributor Author

I split the Release launcher dependency-loading fix into its own PR: #2749.

This PR currently builds on top of that work, so some shared Release/lib-loading changes may appear here until #2749 is merged. Once #2749 lands, I can rebase/update this branch so this PR only shows the Nautilus/GameInput compatibility changes.

The dependency is intentional because the Release/lib-loading fix is needed for clean Release-build testing: without it, existing servers may not show and new server creation can fail/crash due to mismatched dependency loading from lib.

@mindless2831
Copy link
Copy Markdown
Contributor Author

I also created a temporary draft integration/testing PR that combines the current related fixes for anyone who wants to test them together before they land individually:

mindless2831:integration/all-current-fixes

This is not intended to replace the focused PRs. It is only a convenience branch for combined Release/modded testing.

@dartasen dartasen added the Status: Waiting for reviews Pull Request is waiting for code review label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Waiting for reviews Pull Request is waiting for code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants