Skip to content

Fix command line not being restored after NeoForge early window init#3803

Open
FlashyReese wants to merge 1 commit into
CaffeineMC:devfrom
FlashyReese:fix/neoforge-early-window-workaround-restoration
Open

Fix command line not being restored after NeoForge early window init#3803
FlashyReese wants to merge 1 commit into
CaffeineMC:devfrom
FlashyReese:fix/neoforge-early-window-workaround-restoration

Conversation

@FlashyReese

Copy link
Copy Markdown
Contributor

Fixes #3733

On newer NeoForge, Sodium applies the Nvidia/AMD command line workaround from the early window bootstrap path, but the normal Window#createGlfwWindow restore path is not hit for that early GL context.

This leaves the spoofed command line in the PEB after startup.

This waits for NeoForge's early renderer to initialize, then restores the command line using the existing undo path. The workaround still stays active long enough for the driver to initialize, but it should no longer remain visible for the rest of the process.

image

Newer NeoForge creates the early GL context through the early window bootstrap path, so Sodium's normal Window#createGlfwWindow restore path does not run for that context.

Wait for the early window renderer to initialize, then restore the Nvidia/AMD command line workaround using the existing undo methods.
@douira

douira commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for looking into this. You're using a polling approach, which makes me wonder whether there's maybe instead some place that we could hook into that would give us this event explicitly. Is that possible?

@FlashyReese

Copy link
Copy Markdown
Contributor Author

afaict neoforge doesn't expose a hook for this exact point.

the point we want is after LoadingScreenRenderer finishes init / rendererFuture completes, but that is internal earlydisplay state. sodium's normal mixins also load too late for this path.

takeOverGlfwWindow() exists, but that is later when minecraft takes over the window, not when the early renderer is ready.

so unless we add a neoforge hook or use an early transformer/mixin into neoforge internals, polling seems like the only sodium-side option.

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.

Sodium fails to restore modifications to PEB in newer NeoForge versions

2 participants