/BepInVFS

A basic virtual file system for BepInEx

Primary LanguageC#

BepIn Virtual File System (VFS)

This is a proof-of-concept virtual file system for BepInEx

Setting up

  1. Remove all BepInEx files/folders from the game folder
  2. Download the latest version of UnityDoorstop and place winhttp.dll in the game root
  3. Clone an build everything
  4. Download the latest BepInEx (v. 4.0)
  5. 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
    
  6. Run BepInLauncher.exe and select the game EXE
  7. 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.