qsniyg / ksp_stuff

GNU General Public License v3.0
9 stars 4 forks source link

Add support for winevfs #19

Closed qsniyg closed 5 years ago

qsniyg commented 5 years ago

This adds support for the VFS I've been working on. The VFS isn't yet complete (although it's usable to some degree), but this code should serve as a decent foundation for the time being. It also fixes general variables not being overridden by game-specific ones, and fixes the wineprefix variable.

ajventer commented 5 years ago

I'm not ready to merge the code to the main branch if you consider it not ready for general use. But I'm happy to have it live in a branch in the meantime

qsniyg commented 5 years ago

I believe it's ready now. Skyrim, FO4, FNV, FNIS, and BodySlide are all working.

ajspandigital commented 5 years ago

Can you give me a quick run-through of it ? Compatibility ? Does it require you to run the game with the same winebottle/execution environment that MO is run in ? Can you use it with proton ?

Before I fully merge it - I would really like to ensure those things are addressed. If it's not possible we may want to copy the file and then merge - so that users can choose either the symlink or VFS version depending on their needs.

It's also worth considering submitting your version as an MO plugin to the MO2 devs. They didn't want to use the original because of the symlink model but since yours doesn't have that they may be willing to reconsider, MO already supports python plugins so it shouldn't be too hard to modify for that.

qsniyg commented 5 years ago

Just finished writing a README in the winevfs repo.

First, you will need to download and compile winevfs. At the moment, I haven't implemented proper detection for how LD_PRELOAD detects lib32 and lib64 (I'm not sure if there's a cross-platform way of doing this, it may need to be packaged separately for Arch/Ubuntu). You may need to rename them after building (as stated in the README, check /usr to see how it's setup in your system).

To run Skyrim:

python movfs4l.py --game Skyrim --winevfs /path/to/winevfs-repo/bin/winevfs --run wine skse_loader.exe

You might want to specify winevfs in your config.ini instead to avoid having to type that option. This will automatically set the CWD to be game_path in your chosen game (in this case, Skyrim).

If you want to use another tool, you will likely have to specify the CWD yourself:

python movfs4l.py --game Skyrim --winevfs /path/to/winevfs-repo/bin/winevfs --cwd /path/to/skyrim/Data/tools/generatefnis_for_users --run wine GenerateFNISForUsers.exe

It isn't very elegant at the moment, but it works. Later I plan to add support for custom executables (similar to how it is handled in MO), so you could specify the CWD and the executable in config.ini, then simply run something like:

python movfs4l.py --game Skyrim --run BodySlide

One step at a time though :)

Does it require you to run the game with the same winebottle/execution environment that MO is run in ?

Although I haven't tested that, I can't see why using a different winebottle would fail.

Can you use it with proton ?

Yes (tested), --run runs any program you tell it to, even a linux program.

so that users can choose either the symlink or VFS version depending on their needs.

This doesn't remove support for the symlink option, it only adds an optional new way to run it. If you don't use the --run option, it should default to the old behavior (symlinking).

It's also worth considering submitting your version as an MO plugin to the MO2 devs

Unfortunately this is more or less impossible. It needs to hook into wineserver for it to run. In fact, running ModOrganizer with the hooked wineserver running will unfortunately more or less destroy your entire profile (which is why I added the warning/killing code in https://github.com/ajventer/ksp_stuff/pull/19/commits/387669477c0b4d5c6bfc0ca9e6754d292bbbe72c). I learned that one the hard way...

While it might be possible to hook into wineserver by attaching via ptrace and manually modifying the memory (and subsequently reverting the changes after the process is finished), it would be extremely risky to do this with ModOrganizer open.

This is why I opened #22, to make it easier for users to use this. We could also add the option to quickly change the load order for plugins/mods through it (and enabling/disabling them), as a small convenience feature, to avoid users needing to constantly restart ModOrganizer (possibly endangering their profiles if they don't heed the warnings).

ajspandigital commented 5 years ago

I've merged it, though I'm not sure how it would be run with Proton. Since proton assumes you would be running the program through steam. Do you change the launch command inside steam ? Do you run steam itself through movfs4l ?

qsniyg commented 5 years ago

@ajspandigital I'm not actually sure, I copied it from my windows installation, I haven't tried running it under steamplay yet.

The way I ran proton was just manually via command line. I ran it as:

... --run ~/.steam/steam/steamapps/common/Proton\ 4.2/dist/bin/wine skse_loader.exe