VirtualFileSystem class provides a unified interface for mounting devices and resolving paths in the ReXGlue runtime. It abstracts Xbox 360 file system paths like game:/ and d:/ to host operating system directories.
Class Definition
<rex/filesystem/vfs.h>
Overview
VirtualFileSystem manages device registration and path resolution for the runtime. It supports:- Device mounting - Register filesystem devices at specific mount points
- Symbolic links - Map Xbox 360 paths (e.g.,
game:/,d:/) to device paths - Path resolution - Resolve virtual paths to filesystem entries
- File operations - Open, create, and delete files through mounted devices
Constructor & Destructor
VirtualFileSystem()
~VirtualFileSystem()
Device Management
RegisterDevice
device- Unique pointer to the device to register (ownership transferred)
true if registration succeeded, false otherwise.
Example:
UnregisterDevice
path- Mount path of the device to unregister
true if unregistration succeeded, false if device not found.
Symbolic Link Management
RegisterSymbolicLink
path- Virtual path (e.g.,"game:","d:")target- Target device path (e.g.,"\\Device\\Harddisk0\\Partition1")
true if registration succeeded, false otherwise.
Example:
UnregisterSymbolicLink
path- Virtual path to unregister
true if unregistration succeeded, false if link not found.
FindSymbolicLink
path- Virtual path to look uptarget- Output parameter receiving the target path
true if link found, false otherwise.
Path Resolution
ResolvePath
- Resolves any symbolic links in the path
- Finds the appropriate mounted device
- Returns the entry from the device
path- Virtual path to resolve (e.g.,"game:/default.xex")
Entry, or nullptr if not found.
Example:
File Operations
CreatePath
path- Virtual path where to create the entryattributes- File attributes (e.g., directory flag)
Entry, or nullptr on failure.
DeletePath
path- Virtual path to delete
true if deletion succeeded, false otherwise.
OpenFile
root_entry- Root entry for relative path resolution (ornullptrfor absolute)path- Path to the filecreation_disposition- How to handle existing files (open, create, etc.)desired_access- Access flags (read, write, etc.)is_directory- Must be a directoryis_non_directory- Must not be a directoryout_file- Output parameter receiving the openedFilepointerout_action- Output parameter receiving the action taken (opened, created, etc.)
X_STATUS result code.
Runtime Integration
The VFS is set up during runtime initialization inRuntime::SetupVfs():
runtime.cpp:224-287
Thread Safety
VirtualFileSystem uses internal locking (global_critical_region_) to ensure thread-safe access to device and symbolic link registries.