Al
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # VFS Read-Write Spec In this document is outlined the desired behavior of a Virtual File System with Read and Write capabilities. ## Base Assumptions: The main goal of the VFS is that of adding files and folders from multiple different directories to a single specific directory. This scenario is very common for the installation of mods for video games, where files from multiple mod folders need to be added to the game directory. The assumption is that there are a few mod folder, the game folder and an override folder. The override folder would serve as a known clean location where to place new files with the intent of preserving the game folder from unwanted clutter and unnecessary modifications. In case the same file is present in multiple locations linked with the VFS, a priority system is used to decide which version of the file is shown the application. In general the order is: game < mod 1 < mod 2 < mod n < Override So files in the game folder always get overridden by all other locations. Mods can override other mods with lower priority and the Override folder always overrides all other locations. ## File Operations: ### Open File - Result: File with the highest priority is opened ### Enumerate Folder (file search) - Result: Should compile a list of all the files matching the filter present in all the version of the folder (g,m,o), selecting the version of the file with higher priority in case of duplicates from different locations. - It should be made possible to exclude files from the search (for example if a specific file was deleted in this session, the lower priority versions of the same file should not show up in this search) - The list of results should be returned in the same order that would be returned where all the files located in the same physical folder (this order is often not documented, but there are known cases of applications relying on it) ### Create File - Completely new file: - Result: Create new file in Override (also create supporting folder structure if needed and expected to exist due to its presence in mods) - File that was deleted or renamed in current session: - Result: Create the file at the location of the recently removed file, to appear is if it was edited in place. ### Create Folder - Result: Don't actually do anything, just keep track of the created structure. This is to avoid cluttering the Override folder uselessly with empty folders. - Only create the folder structure in the override folder if needed for an actual file. ### Edit File - Open file in writing: - Result: Edit the file with the highest priority. - Delete file and create new: - Result: Keep track of removed files and create the replacement file at the location of the recently removed one. - Rename original copy original, edit copy, rename copy, remove original: - Result: Keep track of removed files and place the copy file at the location of the recetnly removed one. ### Delete File - Result: Delete file with the highest priority and hide existence of any alternative underneath, both from other mods and from the game itself. - Keep track of the deleted file and the original location for the duration of the session and place any new files withe the same name in that location. - Attention! In the case where multiple versions of the same file exist, with this approach the application will get the desired result of removing the file only for the duration of the program execution. After the program is closed any further program launched from the VFS would now see the other version of the file that was previously hidden behind the now deleted version. ### Delete Folder (recursive) - Result: Delete all the winning files contained in the folder from the mods/game/override. - If, and only if the resulting folder is left empty in the mod or in the game directory, then delete the folder as well, otherwise leave the remaining files in place but make sure they will not turn up inside the program. - If the folder is also present in override delete the folder directly. - Attention! With this approach the application will get the desired effect of removing the folder only for the duration of the application execution. After that a new execution through the VFS would show the folder still existing, with it containing any files that were previously hidden by a higher priority mod. ### Move File - Attention! Moving files has different semantics depending on whether src and dst are located on the same drive or on different ones. - Care must be given to properly handle all the cases and simulate the presence of all the virtual files being on the same drive as the game managed folder. - Basically if (IsOnSameDrive(actualSrc, actualDst) != IsOnSameDrive(originalSrc, originalDst)) => need to fix stuff. - src Inside Managed Folder (IMF) - g - dst IMF - dst replace deleted file: - g - Result: perform normal renaming between redirected location. - m - same drive: - Result: perform normal renaming between redirected location. - diff drive: - Result: !!! need to doctor the operation to make sure it can succeed even across the drive. - o - same drive: - Result: perform normal renaming between redirected locations. - diff drive: - Result: !!! need to doctor the operation to make sure it can succeed even across the drive. - dst OMF - Result: perform normal renaming (no need to doctor anything since origin is game already) - m - dst IMF - dst replace deleted file: - g - same drive: - Result: Perform normal renaming between redirected locations. - diff drive: - Result: !!! need to doctor the operation to make it appear as if the source was already on the game drive. - m - Result: Perform normal renaming between redirected locations. - o - same drive: - Result: Perform normal renaming between redirected locations. - diff drive: - Result: !!! need to doctor operation to make dst look like it was on same drive as src. - dst OMF - same drive as game - same drive as src: - Result: Perform normal renaming between redirected locations. - diff drive as src - Result: !!! Need to doctor the operation to make it succeed even across drive - diff drive than game - same drive as src: - Result: !!! Need to fake the dst being on a different drive, since that is what the app would expect. - diff drive as src: - Result: can perform normal renaming between redirected locations. - o - dst IMF - dst replace deleted file: - g - same drive - Result: perform normal renaming between redirected locations. - diff drive - Result: !!! Need to doctor the operation to make appear is if src was on g drive. - m - same drive - Result: perform normal renaming between redirected locations. - diff drive - Result: !!! need to doctor operation to make it appear as if they are both on the same drive. - o - Result: perform normal renaming between redirected locations. - dst OMF - same drive as game - same drive as src: - Result: Perform normal renaming between redirected locations. - diff drive as src - Result: !!! Need to doctor the operation to make it succeed even across drive - diff drive than game - same drive as src: - Result: !!! Need to fake the dst being on a different drive, since that is what the app would expect. - diff drive as src: - Result: can perform normal renaming between redirected locations. - src Outside Managed Folder (OMF) - dst OMF - Result: not a managed operations - dst IMF - src on same drive as game - dst replace deleted file: - g - Result: Perform normal renaming between redirected locations. - m - same drive: - Result: Perform normal renaming between redirected locations. - diff drive: - Result: !!! Need to doctor operation to make it work across drives. - o - same drive: - Result: Perform normal renaming between redirected locations. - diff drive: - Result: !!! Need to doctor operation to make it work across drives. - src on diff drive as game - dst replace deleted file: - g - Result: Perform normal renaming between redirected locations. - m - same drive as src - Result: !!! Need to fake the dst being on a diff drive since the app would expect it - diff drive as src - Result: Perform normal renaming between redirected locations. - o - same drive as src - Result: !!! Need to fake the dst being on a diff drive since the app would expect it - diff drive as src - Result: Perform normal renaming between redirected locations. ### Move Folder ### Start Child Process - Result: The child process should inherit the VFS and see exactly the same resulting folder structure as the parent process. - Any change made from one process (e.g. file deletion) should be propagated to all other processes currently being hooked. ## External manipulations of the physical folders: ### Create File ### Create Folder ### Edit File ### Delete File ### Delete Folder ### Move File ### Move Folder ### New Hooked process is started ## Scenarios Considering a single mod scenario and a single file with the same name, there are 8 possible scenarios of presence of said file in those folders. Considering the locations in the following order (game, mod, override), and a 0 to indicate the absence of the file and a 1 to indicate its presence, the following are the 8 possible combinations: - : (g,m,o): - 0: (0,0,0) - 1: (1,0,0) g - 2: (0,1,0) m - 3: (0,0,1) o - 4: (1,1,0) gm - 5: (0,1,1) mo - 6: (1,0,1) go - 7: (1,1,1) gmo Each of these file sources could be located on different drives (Like game on SSD, mods and override on HDD). Using "()" to indicate a single drive, the possible location scenarios are 5: - 0: (gmo) - 1: (g), (mo) - 2: (gm), (o) - 3: (go), (m) - 4: (g), (m), (o)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully