Northstar icon indicating copy to clipboard operation
Northstar copied to clipboard

Make `-northstar` work on Linux

Open GeckoEidechse opened this issue 2 years ago • 12 comments

The argument -northstar can be added to the launch arguments to the base game on Steam, which then launches Northstar if it's installed. This works by Northstar providing its own wsock32.dll which overwrites the one shipped with Titanfall2 and specifically checks for the -northstar command line argument.

This does however not work on Linux as Wine/Proton uses its own version of wsock32.dll which obviously does not support listening for the -northstar argument.

Therefore to make -northstar work on Linux we need to figure out how to prevent Wine/Proton from overwriting that specific DLL at runtime.

GeckoEidechse avatar Jun 14 '22 11:06 GeckoEidechse

Probably changing the DLL overrides settings in registry for the wineprefix... I wonder if there's some wine hack to make it cleaner

p0358 avatar Jun 15 '22 08:06 p0358

The trick in Windows would be AppInit_DLLs

  • http://web.archive.org/web/20071229055255/http://support.microsoft.com/kb/197571
  • http://web.archive.org/web/20100124145108/http://blogs.msdn.com/nickkramer/archive/2006/04/18/577962.aspx
  • https://docs.microsoft.com/en-us/windows/win32/win7appqual/appinit-dlls-in-windows-7-and-windows-server-2008-r2

But after a glance on WINE source code, it doesn't seem like it implements this, so idk

p0358 avatar Jun 15 '22 08:06 p0358

Going to add my experience here since there was some talk about it in the discord yesterday.

Adding WINEDLLOVERRRIDES="wsock32=n,b" either via WINECFG or launch args does not produce working functionality of -northstar

======================
Proton: 1657298792 TKG-proton-7.12.r1.g0acaed0a
SteamGameId: 1237970
Command: ['link2ea://launchgame/1237970?platform=steam&theme=tf2', '-northstar']
Options: {'nowinedbg', 'dxvkasync', 'useglosmesa', 'logcommandtoprefix', 'nonvapi'}
Kernel: Linux 5.18.9-263-tkg-pds #1 TKG SMP PREEMPT_DYNAMIC Tue, 05 Jul 2022 07:47:16 +0000 x86_64
System WINEDLLOVERRIDES: wsock32=n,b
======================
...
12192.963:07e8:07ec:trace:loaddll:build_module Loaded L"Z:\\home\\tony\\.local\\share\\Steam\\steamapps\\common\\Titanfall2\\bin\\x64_retail\\WSOCK32.dll" at 00007FFFFFA40000: native

Proton loads the native wsock32.dll just fine, but the functionality is not present.

cyrv6737 avatar Jul 09 '22 13:07 cyrv6737

Yet another update. Adding the DLL override along with creating a file called run_northstar.txt in the root directory of Titanfall 2 causes Northstar to be run regardless of having -northstar or -vanilla or simply nothing.

Steps to reproduce:

  • Have Northstar set up with a working proton or wine version.
  • add WINEDLLOVERRIDES="wsock32=n,b"
  • Make sure NorthstarLauncher.exe and Titanfall2.exe are separate and non symlinked executables.
  • Add run_northstar.txt to the root directory of TF|2
  • Run the game (Once with -northstar and once without)

This was done with the Steam version of Titanfall 2

cyrv6737 avatar Jul 11 '22 10:07 cyrv6737

@cyrv6737 was that with Steam version of Titanfall2? ^^

GeckoEidechse avatar Jul 11 '22 16:07 GeckoEidechse

@GeckoEidechse Yes it was, I will clarify that

cyrv6737 avatar Jul 11 '22 18:07 cyrv6737

Yet another update. Adding the DLL override along with creating a file called run_northstar.txt in the root directory of Titanfall 2 causes Northstar to be run regardless of having -northstar or -vanilla or simply nothing.

Steps to reproduce:

* Have Northstar set up with a working proton or wine version.

* add `WINEDLLOVERRIDES="wsock32=n,b"`

* Make sure `NorthstarLauncher.exe` and `Titanfall2.exe` are separate and non symlinked executables.

* Add `run_northstar.txt` to the root directory of TF|2

* Run the game (Once with `-northstar` and once without)

This was done with the Steam version of Titanfall 2

Was run_northstar.txt empty or did it have single value of 1 in it?

Also did you do WINEDLLOVERRIDES="wsock32=n,b" in Titanfall2 launch args on Steam or somewhere else?

Finally, when you used WINEDLLOVERRIDES="wsock32=n,b" and -northstar, in what order where the args?

Trying to reproduce but I seem to be unable to. I keep getting vanilla :/

GeckoEidechse avatar Jul 15 '22 20:07 GeckoEidechse

@GeckoEidechse

Was run_northstar.txt empty or did it have single value of 1 in it?

This is the behavior I observed with this file:

  • The presence of run_northstar.txt without anything inside the file launches Northstar, this is how I had it set up when I made my original post.
  • A 0 launches vanilla
  • A 1 launches Northstar

I am assuming this is intended behavior.

Also did you do WINEDLLOVERRIDES="wsock32=n,b" in Titanfall2 launch args on Steam or somewhere else?

Launch args.

Finally, when you used WINEDLLOVERRIDES="wsock32=n,b" and -northstar, in what order where the args?

WINEDLLOVERRIDES="wsock32=n,b" %command% -northstar

cyrv6737 avatar Jul 15 '22 20:07 cyrv6737

WINEDLLOVERRIDES="wsock32=n,b" %command% -northstar

This worked for me (together with run_northstar.txt) :D

GeckoEidechse avatar Jul 16 '22 22:07 GeckoEidechse

WINEDLLOVERRIDES="wsock32=n,b" %command% even works on SteamDeck :D

GeckoEidechse avatar Jul 16 '22 23:07 GeckoEidechse

Given that the run_northstar.txt method works with WINEDLLOVERRIDES but -northstar does not, it's fair to assume that the only reason the latter does not work is due to the command never being passed to the game. If we can figure out the reason for this, then we should be able to get -northstar to work :D

GeckoEidechse avatar Jul 17 '22 11:07 GeckoEidechse

The Linux guide on the has been overhauled to mention a new custom version of Proton for Northstar and run_northstar.txt, simplifying the Linux experience overall ^^

https://r2northstar.gitbook.io/r2northstar-wiki/using-northstar/playing-on-linux

GeckoEidechse avatar Jul 25 '22 13:07 GeckoEidechse

@GeckoEidechse Maybe this issue can be closed now?

Jan figured out the root cause in this PR to upstream Proton, and we now have this patch integrated into NorthstarProton (until it gets upstreamed of course). The only thing that might still be an issue is using -northstar outside of Steam with regular Wine, like in Lutris and such.

cyrv6737 avatar Feb 27 '23 14:02 cyrv6737

Good catch, thanks <3

GeckoEidechse avatar Feb 27 '23 14:02 GeckoEidechse

For NorthstarProton, the issue of -northstar has been solved with https://github.com/cyrv6737/NorthstarProton/pull/10.

As this is the recommended way of running Northstar on Linux, this issue is now considered solved. Linux users on Steam are encouraged to use the newest version of NorthstarProton.

When running without NorthstarProton, e.g. just Proton then wait for https://github.com/ValveSoftware/Proton/pull/6555 to be merged and released or otherwise keep using run_northstar.txt.

GeckoEidechse avatar Feb 27 '23 14:02 GeckoEidechse

ive added a protonfix workaround in proton-ge that allows this to work without patching steam_helper:

https://github.com/GloriousEggroll/protonfixes/commit/aac5e6267dcc76cf7c5252b6b7b9e32112502588

the current proposed steamhelper patch https://github.com/ValveSoftware/Proton/pull/6555 breaks other games that run batch scripts

GloriousEggroll avatar Aug 19 '23 23:08 GloriousEggroll

updated the steamhelper patch to fix any issues that were brought up. NorthstarProton is also affected, but its not intended to be used for anything but Northstar so it does not matter.

I've already told this to GE on Discord, but its also worth mentioning here that the protonfix workaround only works if -northstar is the last argument e.g. -novid -northstar.

We should also look into moving away from NorthstarProton, since we've had problems with the current tkg based setup.

Its also worth noting that Northstar appears to run flawlessly on the proton_8.0 branch, NorthstarProton may not be needed in the future.

Jan200101 avatar Aug 20 '23 02:08 Jan200101