qsniyg / ksp_stuff

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

Documentation #12

Closed qsniyg closed 5 years ago

qsniyg commented 5 years ago

Since the usage is now completely changed, it'd be helpful to write some documentation on how to use it. Possibly both in README.md and --help?

Claw256 commented 5 years ago

I for one would greatly appreciate some documentation to go along with the README.md, as I currently have some difficulty getting movfs4l.py to detect my MO directory and my Game directory.

qsniyg commented 5 years ago

@Spudnik1 For the time being (as I'm not sure when I will be able to get to the documentation), here's a small checklist:

Is MO and the game somewhere other than ~/.wine? If so, set WINEPREFIX before running movfs4l.py, for example:

WINEPREFIX=~/.wine-skyrim python movfs4l.py

Is MO installed to somewhere other than C:\Modding\MO2? If so, set mo_installroot. For example (if it's installed at C:\Program Files\MO2):

python movfs4l.py --mo_installroot ~/.wine-skyrim/drive_c/Program\ Files/MO2

Do you have more than one user in your wineprefix (other than Public)? If so, set wineuser (python movfs4l.py --wineuser some_username)

Is the Mod Organizer profile root (not installation root) somewhere other than C:\users\your_username\Local Settings\Application Data\ModOrganizer? If so... for now that's a problem, I'll make it configurable in the next update (slipped my mind when I was writing it).

Let me know if that doesn't work, I have only tested it with my setup so far, it definitely needs to be improved.

Claw256 commented 5 years ago

Hi, The script seemed to recognise my MO install dir with the WINEPREFIX env variable, and with the argument --mo_installroot, but failed to recognise my Game directory, it outputted the message, "Unable to detect game". Do you know the command line argument that lets me set the Game install directory? And to answer your question,

Is the Mod Organizer profile root (not installation root) somewhere other than C:\users\your_username\Local Settings\Application Data\ModOrganizer?

Yes, it is located in my portable installation directory, in $WINEPREFIX/drive_c/Modding/Games/Skyrim-SE/Managers/Skyrim-SE-MO2/profiles, so I would say you would have to make it configurable.

qsniyg commented 5 years ago

@Spudnik1

Yes, it is located in my portable installation directory

Oh good, then it should work, assuming mo_installroot is $WINEPREFIX/drive_c/Modding/Games/Skyrim-SE/Managers/Skyrim-SE-MO2 (it can detect portable installations).

it outputted the message, "Unable to detect game".

Can you check if there's a file called config.ini beside movfs4l.py? It should only show that message if it has generated a configuration file.

Check to see what games it shows listed (such as [game/SkyrimSE]), and then simply:

python movfs4l.py --game SkyrimSE

If that doesn't work, make sure game_path in config.ini is correct.

Claw256 commented 5 years ago

I checked the config.ini file beside movfs4l.py and the directory was correct for the game_path and for the mo_gameroot variables. Here is my config.ini, https://pastebin.com/jiX9cqcy. When I type the following command, WINEPREFIX=/mnt/linux-games/WineBottles/SkyrimSE/prefix/ ./movfs4l.py --mo_installroot "/mnt/linux-games/WineBottles/SkyrimSE/prefix/drive_c/Modding/Games/Skyrim-SE/Managers/Skyrim-SE-MO2" --game SkyrimSE I get the following error: Traceback (most recent call last): File "./movfs4l.py", line 814, in <module> game = games[game] KeyError: 'SkyrimSE' I am not sure how to fix this error.

qsniyg commented 5 years ago

@Spudnik1 Huh, it shouldn't show [game/]. Change that to [game/SkyrimSE] (or whatever you want) and then just run:

./movfs4l.py --game SkyrimSE

Could you send /mnt/linux-games/WineBottles/SkyrimSE/prefix/drive_c/Modding/Games/Skyrim-SE/Managers/Skyrim-SE-MO2/ModOrganizer.ini? I'm not sure why it's unable to detect the game's name.

By the way, you don't have to write all of the WINEPREFIX and --mo_installroot stuff once config.ini is generated, it's only used to generate that file.

Claw256 commented 5 years ago

I got it working, I changed [game/] to [game/SkyrimSE], as you suggested, and it worked:

Removing VFS layer
Parsing MO mods configuration
Creating VFS index
Linking mods                                                                                                       
Linking plugins list                                                                                               
Linking load order
Writing log

VFS layer created. Run "./movfs4l.py --game SkyrimSE --profile Default --unvfs" to shut it down (run this before running Mod Organizer again)

Thanks for your help.

Claw256 commented 5 years ago

Hi, I have run into another problem. I am trying to setup Oblivion to work with movfs4l.py. I edited the movfs4l.py to add Oblivion to the game_infos section of the script (Line 149). Here is my movfs4l.py, https://pastebin.com/ThzgCWHc. If you go to line 228, you can see that I added an entry to game_infos as Oblivion. I also edited my config.ini to add the game Oblivion to it. Here is also my new config.ini, https://pastebin.com/qgKFC9AG. Then when I enter the command, ./movfs4l.py --game "Oblivion", I get the following error, https://pastebin.com/KuQ83jMV. I am not sure what to do.

qsniyg commented 5 years ago

@Spudnik1 It's because a comma is missing after } in line 227 :) (Yeah, those error messages are confusing haha)

Claw256 commented 5 years ago

Thank you, it's working now :)

qsniyg commented 5 years ago

@ajventer Sorry to ping you again, but this one as well is not implemented yet.

I personally think for the time being, it's better if this one remains open, as since there is no documentation at the moment, the contents of this thread might prove useful to people who don't know how to use it.

Right now I'm focusing my efforts on a real VFS solution (nearly complete), but this is next in line, unless you want to handle this (either way is fine by me).

ajventer commented 5 years ago

Fair point.

That said, I am curious about your approach to a real VFS solution. I looked at several possible approaches using existing FUSE filesystems but I never managed to get a workable one. Would be a great option if you can get that working.

qsniyg commented 5 years ago

@ajventer It's basically the linux equivalent to USVFS, it uses LD_PRELOAD to replace libc functions.

It's not very portable since it can't replace the syscalls themselves; ptrace not only kills performance by bottlenecking the entire process to be single-threaded every syscall, it also prevents SKSE from working due to only one ptrace process being allowed to attach to another process at any given time. Seccomp does not currently support returning file descriptors yet.

However, it will work fine if you want to play the Bethesda games under a standard Linux installation (GCC + GNU libc) using a normal build of WINE/Proton.

A number of optimization opportunities are also enabled with this, such as cached case insensitivity, and possibly a few Bethesda-specific optimizations down the line (could either be implemented in the script, or in the VFS). For instance, creating fake .inis for .es{mp}s, as the game will try to access them thousands of times for each ES{MP} (my log file recorded ~2300 per ES{MP}), before the game even starts. Due to WINE's implementation of case insensitivity, this significantly slows down the initial load time.

Right now what's remaining is a proper implementation for file descriptor passing via SCM_RIGHTS. Although basic WINE applications work fine, my current implementation for it seems to break winevulkan, so a bit more work is needed before I can release it in good conscience :) Without that implementation though, the games run mostly fine (with the exception of directory listings, which make use of file descriptor passing).

ajventer commented 5 years ago

That sounds really cool. Ld_preload is probably the exact right approach. Indeed mo2s VFS uses essentially Windows' version of ld_preload already.