Create virtual file system for mod manager #6

Open
opened 2023-01-30 16:20:24 +01:00 by lucas · 3 comments
Owner

On Linux, this should be fairly simple with OverlayFS, but will require setting up a directory where all the mod bundles and modified game bundles are stored in a way that they can overlay the game bundle folder. But given that Linux also has easy access to hard links, that shouldn't be a problem.

For Windows, there are two approaches:

  • hooking whatever Win32 API functions the game uses to access the file system, and re-route them to the manager's files. Mod Organizer 2 does this for Bethesda games, and can be used as reference
  • Windows Projected File System (ProjFS): A new Win32 API that allows to create a virtual file system, where any kind of access is handled by callback functions. Requires enabling an optional feature, though.

ProjFS would be the more sane solution, and examples and documentation look quite nice at first glance.

Either way, once the virtual folder is set up, the game needs to be started with that as the working directory.
Although, since the game has a CLI flag to specify a bundle directory, it might be possible to make just that bundle directory the virtual folder.

On Linux, this should be fairly simple with OverlayFS, but will require setting up a directory where all the mod bundles and modified game bundles are stored in a way that they can overlay the game bundle folder. But given that Linux also has easy access to hard links, that shouldn't be a problem. For Windows, there are two approaches: - hooking whatever Win32 API functions the game uses to access the file system, and re-route them to the manager's files. Mod Organizer 2 does this for Bethesda games, and can be used as reference - [Windows Projected File System (ProjFS)](https://learn.microsoft.com/en-us/windows/win32/projfs/projected-file-system): A new Win32 API that allows to create a virtual file system, where any kind of access is handled by callback functions. Requires enabling an optional feature, though. ProjFS would be the more sane solution, and examples and documentation look quite nice at first glance. Either way, once the virtual folder is set up, the game needs to be started with that as the working directory. Although, since the game has a CLI flag to specify a bundle directory, it might be possible to make just that bundle directory the virtual folder.
lucas added the
kind
feature
crate/dtmm
labels 2023-01-30 16:20:24 +01:00
lucas added this to the Mod Manager project 2023-01-30 16:20:25 +01:00
Author
Owner

The general architecture would be

  • the game directory as fallback for all reads
  • an index table of all mod files mapping the virtual path within the game dir (e.g. bundle/<mod_bundle>) to the actual path on disk (wherever the manager stores its imported mods)

so the hook for reads would be something like

if index.has(path):
  return filesystem.read(index.get(path))
else:
  return filesystem.read(game_dir + "/" + path)
The general architecture would be - the game directory as fallback for all reads - an index table of all mod files mapping the virtual path within the game dir (e.g. `bundle/<mod_bundle>`) to the actual path on disk (wherever the manager stores its imported mods) so the hook for reads would be something like ``` if index.has(path): return filesystem.read(index.get(path)) else: return filesystem.read(game_dir + "/" + path) ```
lucas added the
status/good first issue
label 2023-02-21 00:15:13 +01:00
lucas added the
stage
design
label 2023-02-21 22:51:38 +01:00
lucas added a new dependency 2023-02-23 11:56:57 +01:00
Author
Owner

Another potential example of VFS on Windows: https://www.nexusmods.com/skyrim/mods/90868

Another potential example of VFS on Windows: https://www.nexusmods.com/skyrim/mods/90868
lucas added this to the DTMM v1.0 + DTMT milestone 2023-02-28 16:00:37 +01:00
lucas added a new dependency 2023-02-28 16:01:28 +01:00
Author
Owner

The recent hotfix didn't produce any errors for the bundle patcher, simply re-patching was enough. This suggests that a VFS might not be strictly necessary.

A bigger patch may result in actual breakage, but this can be delayed until something like that happens.

The recent hotfix didn't produce any errors for the bundle patcher, simply re-patching was enough. This suggests that a VFS might not be strictly necessary. A bigger patch may result in actual breakage, but this can be delayed until something like that happens.
lucas removed a dependency 2023-03-01 22:32:35 +01:00
lucas removed this from the DTMM v1.0 + DTMT milestone 2023-03-08 21:28:57 +01:00
lucas added
kind
enhancement
and removed
kind
feature
labels 2023-11-24 14:21:02 +01:00
lucas added
kind
feature
and removed
kind
enhancement
labels 2023-12-04 13:32:20 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: bitsquid_dt/dtmt#6
No description provided.