BepIn Virtual File System (VFS)
This is a proof-of-concept virtual file system for BepInEx
Setting up
- Remove all BepInEx files/folders from the game folder
- Download the latest version of UnityDoorstop and place
winhttp.dll
in the game root - Clone an build everything
- Download the latest BepInEx (v. 4.0)
- Set up the following folder structure:
<Root> | |-- BepInEx | | | |-- bin | | | | | |-- BepInEx.dll | | |-- Mono.Cecil.dll | | |-- 0Harmony.dll | | |-- VirtualFS.dll | | |-- BepInPreloader.dll | | | |-- patchers | | | | | |-- <empty> | | | |-- config.ini | |-- mods | | | |-- <mod name> | | | |-- <files/folders to place in game root> | |-- BepInLauncher.exe
- Run
BepInLauncher.exe
and select the game EXE - The game should run with BepInEx
Project structure
BepInLauncher
The main launcher. The only point is to showcase how to generate a VFS tree used by the VirtualFS.
For convenience, the launcher also -- as the name implies -- launches the game with custom Doorstop attributes.
The VFS tree is a JSON file with the following semantics:
- Every key represents an item in the file system
- An object represents a folder
- A string represents a file. The string points to the real file location.
- The root (unnamed) object is considered game's root folder
BepInPreloader
The DLL loaded by Doorstop.
Showcases how to start up VFS. Namely, the DLL only does two things:
- Loads VirtualFS.dll and initializes the VFS through it
- Resets the working directory and invokes BepInEx as usual
In addition, a basic test function is provided
VirtualFS
The main part of the VFS written in C++.
VirtualFS reads the VFS tree generated by the launcher and installs hooks to some common WinAPI calls for IO.
When the hooks fire, VirtualFS checks the files being requested and simulates the folder structure using the VFS tree.
Currently WIP. See issues for a TODO list.