Skip to content

Add Discord SDK crash fallback#2756

Open
mindless2831 wants to merge 1 commit into
SubnauticaNitrox:masterfrom
mindless2831:fix-discord-sdk-crash-fallback
Open

Add Discord SDK crash fallback#2756
mindless2831 wants to merge 1 commit into
SubnauticaNitrox:masterfrom
mindless2831:fix-discord-sdk-crash-fallback

Conversation

@mindless2831
Copy link
Copy Markdown
Contributor

Summary

Adds a Discord SDK crash fallback for game launch.

Fixes #2708.

What changed

This PR adds two protections for users affected by native Discord SDK crashes during Nitrox startup:

  • Adds a launcher option to enable/disable Discord integration.
  • Adds a launch flag that lets the client skip Nitrox Discord integration entirely.
  • Skips creating DiscordClient when Discord integration is disabled.
  • Guards Rich Presence calls so they are not invoked when Discord integration is disabled.
  • Monitors the launched Subnautica process briefly after startup.
  • If Subnautica exits during the observation window and Player.log contains the known Discord SDK crash signatures, the launcher relaunches Subnautica once with Discord integration disabled.
  • Shows a launcher warning explaining that Discord integration was disabled for the retry.

Why

The crash in #2708 occurs inside the native Discord SDK path around Rich Presence initialization/update:

  • discord_game_sdk
  • DiscordClient.InitializeRPMenu
  • DiscordClient.UpdateActivity
  • DiscordGameSDKWrapper.ActivityManager.UpdateActivity

Because this is a native crash, managed try/catch inside the client is not reliable. The safer fallback is to relaunch without initializing Discord integration.

Testing

Tested manual Discord integration toggle:

  • With Discord integration enabled, Discord shows Nitrox Rich Presence / main menu activity.
  • With Discord integration disabled, Discord only shows normal Subnautica activity and Nitrox does not start its Discord client.
  • Game log confirms disabled launches with:
    [Discord] Discord integration disabled by launch argument

Tested fallback behavior using a local test-only forced detection path:

  • Initial launch starts with Discord integration enabled.
  • Simulated Discord crash detection triggers after game exit during the observation window.
  • Launcher relaunches Subnautica with Discord integration disabled.
  • Relaunched game logs:
    [Discord] Discord integration disabled by launch argument

The forced test hook was removed before this PR.

Also tested normal early game exit without a current Discord crash signature; the launcher does not relaunch.

@mindless2831 mindless2831 force-pushed the fix-discord-sdk-crash-fallback branch from 83217a8 to b98bd95 Compare May 21, 2026 11:46
@github-actions
Copy link
Copy Markdown

Test Results

255 tests  ±0   252 ✅ ±0   18s ⏱️ -5s
  1 suites ±0     3 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit b98bd95. ± Comparison against base commit a89227d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retry game launch without Discord if Discord SDK integration caused crash

1 participant