theNizo / linux_rocksmith

Guides to get Rocksmith 2014 running on Linux
https://thenizo.github.io/linux_rocksmith/
GNU General Public License v3.0
110 stars 10 forks source link

NixOS Guide (Pipewire) #45

Closed TimP4w closed 4 months ago

TimP4w commented 5 months ago

First of all, I want to thank you @theNizo for this Repo. Rocksmith was something I was never able to play on Linux and this is a huge step for finally being able to only use a single system on my PC.

This issue is not to ask for help: thanks to this repo I was able to make this work on my NixOS machine. I tried to make it a bit general so I could share it: https://github.com/TimP4w/nixos/tree/main/patches/rocksmith2014 It's still WIP but it's working pretty consistently for me.

If there is a need or general interest, I could also make a PR here.

The only issue is the latency which is quite high unfortunately. But I'll try to work on that

Cheers

theNizo commented 5 months ago

Thanks for writing this.

Pull request would be the easiest for me. Please read this comment first though.

I have never worked with Nix, so I'll probably don't understand the OS-specific configuration.

I'm going to point out some parts that I don't understand with the intention of giving you points to improve on.


latency which is quite high

This might be subjective. Compared to an amp, absolutely. Wearing Headphones, only hearing the game's sound, it doesn't bother me.

From the README:

users.users.<username>.extraGroups = [ "audio" "rtkit" ];

Is it possible to use $USER?

Copy the CDLC patch *.dll inside the cdlc directory

It's an installer .exe nowadays that you have to run. The only way a user already has this file is if they already set up Rocksmith in the past.

Which directory do you mean by "cdlc directory"?

Also, please specify in the script in line 32.

Add Launch Options

Only the LD_PRELOAD way is described. Proton Experimental should currently be based on Wine 9 or later, so I can see why you did that.

VBASIOTest32.exe doesn't work, because the 32-bit library of JACK is not linked to pipewire.

I don't understand anything this sentence says.

Needs musnix but I'm not exactly sure why. Need to test.

About section of musnix's git page reads "Real-time audio in NixOS ".

If your question was why you need realtime, I'm not sure.

We need to copy the content of the pfx dir into ~/.wine because we can't use prefixes with steam-run

When I read this, I thought "You didn't specify when I have to do this." A short note that this step is done in the script would avoid confusion.

Line 42

Typo

When should one do this step? Are files copied back to the original prefix?

Backup directories before making changes.

Which ones?

Looking at patch.sh:

This turned out to be more of a code review.


I would be interested in what steam-run is and why you chose to do regsvr like that. I'm not judging, just want to know.

TimP4w commented 5 months ago

Thanks for the review! Yeah, many things are just assumed since I mostly wrote this for me and just made some basic explanation since my repo is public and someone may stumble upon it. If I make a PR here I'll clarify more what's needed and why. Also the script is for me to have a single do-it-all that I can launch for my setup. I most likely need to change some of the stuff there to put it here. Hence also the question if there is a need / interest since this would take some additional effort.

About your comments:

Is it possible to use $USER?

This should be explicitly set by the user, it's not an environment variable. May be confusing to use $USER.

It's an installer .exe nowadays that you have to run. The only way a user already has this file is if they already set up Rocksmith in the past.

Which directory do you mean by "cdlc directory"?

Also, please specify in the script in line 32. So the script is run by the user. As far as I can tell, you didn't specify a working directory and you never told the user to create folders called "cdlc" and "config" in this working directory.

add_configs() and patch_cdlc(): the files go into the same directory, why use different folders for them?

This works only for my setup (the dirs are in the repo with a .gitkeep file inside). Will remove the cldc and config part here, since it's not relevant.

I don't understand anything this sentence says. [about VBASIOTest32.exe not working]

The "issue" with NixOS is that dynamic linking doesn't really work. For Rocksmith we pass explicitly the libjack.so path with the LD_PRELOAD variable, but for VBASIOTest32.exe we don't do that. Tbh I'm kinda still in the learning phase, this is probably why it's poorly worded as I don't completely understand it. There is probably a way to make it work easily but I don't know how (maybe wine needs it, maybe pipewire, no idea really). I actually made it work by modifying the upstream .nix file that installs pipewire, but it's not a nice solution since one would then need to disable the official package.

About section of musnix's git page reads "Real-time audio in NixOS ".

If your question was why you need realtime, I'm not sure.

Not so sure either. It didn't work without some of the configs that musnix adds but I need to do some more testing in figuring out what (or if still applies).

When should one do this step? Are files copied back to the original prefix?

I don't actually think it's needed anymore. The script should be indempotent.

Line 10: I'd change it to "We can't specify a prefix [...] so we're using the default one." ~/.wine is a prefix, the current statement is incorrect.

Yeah it's poorly worded. What we can't do with my approach is to define a WINEPREFIX env variable such that wine can use it, because we have to run it through steam-run. Therefore my workaround is to copy everything back and forth and use the default prefix from wine.

I would be interested in what steam-run is and why you chose to do regsvr like that. I'm not judging, just want to know.

NixOS doesn't use the FHS convention, but steam kinda needs it, so the packaged version of steam in nixpkgs has its own fake FHS environment. In NixOS you also can't run unpackaged binaries because of missing dependencies. steam-run solves this problem by executing commands (and binaries) inside the FHS environment in which steam is installed. I'm using this approach because the packaged versions of wine from nixpkgs somehow didn't work for me and I always got an error when trying to register the dlls. I need to do more tests in this regard, since that would solve the WINEPREFIX issue and we can use rocksmith's pfx directly.

Line 23-24: If you use a release version of Proton (one from Valve with a number at the end), it would be dist instead of files.

Thanks for the info! I'll adapt the script to account for that.

prepare(): This is a recommendation from me to reduce the user's frustration. Nobody wants to hear "Oh, but you missed this thing too, which I could have already told you, but didn't." - Create a boolean value at the beginning. If something's missing, this value is set to true. At the end of this function, check if it's true and only at this point quit the script. This way, the user sees everything that's missing at once and doesn't have to repeatedly run it.

Great advice, thanks!

safe_copy(): cp overrides anyway, which achieves the same thing.

Due to permission (file have 555 permission) override doesn't work.

theNizo commented 5 months ago

Let me know what you think about the different structure of your guide. (Good, or rather not?)

Also, in the troubleshooting, I didn't include this one section called "WineASIO", because I'm not sure regarding the path.

theNizo commented 4 months ago

No further interaction. Guide exists, I'm closing

TimP4w commented 4 months ago

@theNizo Sorry, I was a bit busy lately and forgot to reply. I'll have a look tomorrow or during the weekend

theNizo commented 4 months ago

Okay ^^