Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS/FS: Reimplement many functions in a more accurate way #8539

Merged
merged 19 commits into from
Jan 25, 2020

Commits on Jan 25, 2020

  1. IOS/FS: Move path validity check functions

    They will be used in more places than just HostBackend/FS.cpp.
    
    Also fix the check and make it accurate while we're at it.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    d185bc6 View commit details
    Browse the repository at this point in the history
  2. IOS/FS: Add base FST functions

    Some official titles rely on implementation details of Nintendo's
    FS sysmodule and will not work properly if those are changed.
    Notably, some games and older versions of the System Menu appear
    to be relying on the order of files returned by FS::ReadDirectory
    and will either fail to find their save data (for Bolt) or
    outright crash (for the System Menu).
    
    Some titles also actually expect filesystem metadata to be correct.
    One title that has been confirmed to do this is DQX, which generates
    paths based on the GID of files within its own title directory.
    
    While it is easy to make workarounds for these issues -- and in fact
    we already do have some for the sysmenu and DQX, having hacks
    is obviously nonideal and adding yet another hack would be required
    to fix Bolt -- one that would be even uglier.
    
    Furthermore, while it is currently unknown whether any official
    title cares about permissions, the lack of FS metadata means that
    we are unable to implement them if that turns out to be desirable
    or necessary.
    
    By adding a FST, we can implement things correctly and solve all
    those problems without hacks.
    
    Apart from DQX, the sysmenu and Bolt, this changeset also fixes
    the Photo Channel complaining about corrupted system files
    on the initial launch.
    
    This first commit adds the basic structures and functions that
    are necessary to load, save, query and update our version of the FST.
    
    For simplicity, a binary format that is inspired from Nintendo's FST
    structure was chosen for serialization. It is not expected to ever
    receive an update.
    
    PS: an update on the NAND image backend:
    
    A long time ago I had planned to add another FS backend which would
    be using a NAND image/blob as the storage. While I have already
    written an implementation that has been tested, solves all the
    aforementioned issues and more, produces images that are fully
    compatible with IOS's FS driver, I feel like NAND images raise too
    many issues: savestate sizes, code complexity and maintenance cost.
    
    Since many fixes and additions that are part of that implementation
    (e.g. FS timings, utility structures, FST) have already been merged
    or will be submitted as part of this changeset, I will likely not
    submit the branch.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    f743f10 View commit details
    Browse the repository at this point in the history
  3. IOS/FS: Move /tmp clearing back to the IPC interface

    Prevents /tmp from being cleared unnecessarily; clearing /tmp is
    normally only done once every time IOS is reloaded.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    0543598 View commit details
    Browse the repository at this point in the history
  4. IOS/FS: Make sure FS root directory exists

    Previously, the FS root directory would get created as a side
    effect of calling CreateDirectory during boot (since the
    implementation was sloppy and used File::CreateFullDir).
    
    Since CreateDirectory no longer does that, it is necessary to ensure
    that the FS root directory does exist by creating it explicitly.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    a83d9e5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    36676d2 View commit details
    Browse the repository at this point in the history
  6. Core: Fix a few misuses of FS::CreateDirectory

    CreateDirectory does not create missing parent directories. If that
    behaviour is desired, CreateFullPath should be used instead.
    
    (These small misuses went unnoticed since the previous implementation
    of CreateDirectory automatically created parent directories.)
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    8f74d02 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8517528 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    53ceb6c View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a40f297 View commit details
    Browse the repository at this point in the history
  10. IOS/FS: Implement ReadDirectory properly and remove sorting hack

    With the CreateFile/CreateDirectory fix and this commit, we can
    finally return correct results in ReadDirectory and the sorting
    hack -- whose purpose was to prevent certain versions of the
    System Menu from crashing -- can be removed too.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    396429d View commit details
    Browse the repository at this point in the history
  11. IOS/FS: Implement GetMetadata properly and remove GID hack

    Now that all FS functions that create new inodes are properly
    implemented, we can make GetMetadata actually return correct file
    metadata rather than giving fixed information. The hack for the DQX
    installer can also be removed now since our ES and FS keep track of
    caller UID/GIDs now.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    e4dd582 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    142b7e0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    484cfb9 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    d4ba0ac View commit details
    Browse the repository at this point in the history
  15. UnitTests/FS: Fix file rename tests

    Files cannot be given a different file name, only moved across
    directories.
    
    Add a test for that behaviour and fix the existing
    RenameWithExistingTargetFile test.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    8789a6d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    af416c6 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    150c832 View commit details
    Browse the repository at this point in the history
  18. UnitTests/FS: Improve deletion test

    * Test recursive directory deletion
    * Test "in use" check for both files and directories
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    031c63e View commit details
    Browse the repository at this point in the history
  19. IOS/ES: Remove now unnecessary title sorting hack

    ES now uses FS to access the filesystem and FS's ReadDirectory now
    returns file lists that are correctly ordered.
    leoetlino committed Jan 25, 2020
    Configuration menu
    Copy the full SHA
    c02e7de View commit details
    Browse the repository at this point in the history