summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem/filesystem.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* savedata_factory: Expose accessors for SaveDataSpaceZach Hilman2018-10-291-0/+10
|
* file_sys/registered_cache: Use unique_ptr and regular pointers instead of shared_ptrs where applicableLioncash2018-10-161-7/+6
| | | | | | | | | | | | | | | The data retrieved in these cases are ultimately chiefly owned by either the RegisteredCache instance itself, or the filesystem factories. Both these should live throughout the use of their contained data. If they don't, it should be considered an interface/design issue, and using shared_ptr instances here would mask that, as the data would always be prolonged after the main owner's lifetime ended. This makes the lifetime of the data explicit and makes it harder to accidentally create cyclic references. It also makes the interface slightly more flexible than the previous API, as a shared_ptr can be created from a unique_ptr, but not the other way around, so this allows for that use-case if it ever becomes necessary in some form.
* filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem instance by referenceLioncash2018-10-131-8/+8
| | | | | | | Neither of these functions alter the ownership of the provided pointer, so we can simply make the parameters a reference rather than a direct shared pointer alias. This way we also disallow passing incorrect memory values like nullptr.
* romfs_factory: Extract packed update setter to new functionZach Hilman2018-10-051-0/+9
|
* filesystem: Add LayeredFS VFS directory getterZach Hilman2018-09-221-1/+12
|
* Fixed GetAccountId stub, Added error code for OpenDirectory and added ActivateNpadWithRevisionDavid Marcec2018-09-191-1/+1
| | | | With these, `Nintendo Entertainment System - Nintendo Switch Online` loads
* hle/service: Default constructors and destructors in the cpp file where applicableLioncash2018-09-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a destructor isn't defaulted into a cpp file, it can cause the use of forward declarations to seemingly fail to compile for non-obvious reasons. It also allows inlining of the construction/destruction logic all over the place where a constructor or destructor is invoked, which can lead to code bloat. This isn't so much a worry here, given the services won't be created and destroyed frequently. The cause of the above mentioned non-obvious errors can be demonstrated as follows: ------- Demonstrative example, if you know how the described error happens, skip forwards ------- Assume we have the following in the header, which we'll call "thing.h": \#include <memory> // Forward declaration. For example purposes, assume the definition // of Object is in some header named "object.h" class Object; class Thing { public: // assume no constructors or destructors are specified here, // or the constructors/destructors are defined as: // // Thing() = default; // ~Thing() = default; // // ... Some interface member functions would be defined here private: std::shared_ptr<Object> obj; }; If this header is included in a cpp file, (which we'll call "main.cpp"), this will result in a compilation error, because even though no destructor is specified, the destructor will still need to be generated by the compiler because std::shared_ptr's destructor is *not* trivial (in other words, it does something other than nothing), as std::shared_ptr's destructor needs to do two things: 1. Decrement the shared reference count of the object being pointed to, and if the reference count decrements to zero, 2. Free the Object instance's memory (aka deallocate the memory it's pointing to). And so the compiler generates the code for the destructor doing this inside main.cpp. Now, keep in mind, the Object forward declaration is not a complete type. All it does is tell the compiler "a type named Object exists" and allows us to use the name in certain situations to avoid a header dependency. So the compiler needs to generate destruction code for Object, but the compiler doesn't know *how* to destruct it. A forward declaration doesn't tell the compiler anything about Object's constructor or destructor. So, the compiler will issue an error in this case because it's undefined behavior to try and deallocate (or construct) an incomplete type and std::shared_ptr and std::unique_ptr make sure this isn't the case internally. Now, if we had defaulted the destructor in "thing.cpp", where we also include "object.h", this would never be an issue, as the destructor would only have its code generated in one place, and it would be in a place where the full class definition of Object would be visible to the compiler. ---------------------- End example ---------------------------- Given these service classes are more than certainly going to change in the future, this defaults the constructors and destructors into the relevant cpp files to make the construction and destruction of all of the services consistent and unlikely to run into cases where forward declarations are indirectly causing compilation errors. It also has the plus of avoiding the need to rebuild several services if destruction logic changes, since it would only be necessary to recompile the single cpp file.
* bktr: Fix bucket overlap errorZach Hilman2018-09-041-1/+1
|
* registration: Add RegisteredCacheUnionZach Hilman2018-09-041-0/+7
| | | | Aggregates multiple caches into one interface
* filesystem: Move dir retrieval after path checking in DeleteFile()Lioncash2018-09-021-2/+5
| | | | | We don't need to do the lookup if the path is considered empty currently.
* Merge pull request #1166 from lioncash/typoSebastian Valle2018-08-251-1/+1
|\ | | | | filesystem: Fix typo in log message
| * filesystem: Fix typo in log messageLioncash2018-08-241-1/+1
| |
* | filesystem: Add CreateFactories methods to fsZach Hilman2018-08-231-7/+6
| | | | | | | | Allows frontend to create registration caches for use before a game has booted.
* | filesystem: Add logging to registration gettersZach Hilman2018-08-231-4/+25
|/
* vfs: Replace mode.h include with forward declarations where applicableLioncash2018-08-211-1/+1
| | | | | Avoids the need to rebuild these source files if the mode header changes.
* service/filesystem: Use forward declarations where applicableLioncash2018-08-211-0/+2
| | | | | | | | Avoids the need to rebuild multiple source files if the filesystem code headers change. This also gets rid of a few instances of indirect inclusions being relied upon
* filesystem: Add support for loading of system archivesZach Hilman2018-08-191-3/+16
|
* filesystem: Add Open and Register functions for BISFactoryZach Hilman2018-08-121-0/+19
|
* core: Port core to VfsFilesystem for file accessZach Hilman2018-08-091-7/+7
|
* filesystem: Remove unnecessary if conditionsZach Hilman2018-08-091-1/+1
|
* service/filesystem: Add fsp:ldr and fsp:pr servicesLioncash2018-08-011-0/+4
| | | | | Adds the basic skeleton for the remaining fsp services based off information provided by Switch Brew.
* VFS Regression and Accuracy Fixes (#776)Zach Hilman2018-07-241-16/+29
| | | | | | | | | | | | | | | | * Regression and Mode Fixes * Review Fixes * string_view correction * Add operator& for FileSys::Mode * Return std::string from SanitizePath * Farming Simulator Fix * Use != With mode operator&
* file_util, vfs: Use std::string_view where applicableLioncash2018-07-221-1/+1
| | | | | Avoids unnecessary construction of std::string instances where applicable.
* file_util: Use an enum class for GetUserPath()Lioncash2018-07-211-2/+2
| | | | | | | | | | | | | Instead of using an unsigned int as a parameter and expecting a user to always pass in the correct values, we can just convert the enum into an enum class and use that type as the parameter type instead, which makes the interface more type safe. We also get rid of the bookkeeping "NUM_" element in the enum by just using an unordered map. This function is generally low-frequency in terms of calls (and I'd hope so, considering otherwise would mean we're slamming the disk with IO all the time) so I'd consider this acceptable in this case.
* Merge pull request #720 from Subv/getentrytype_rootSebastian Valle2018-07-191-0/+4
|\ | | | | Filesystem: Return EntryType::Directory for the root directory.
| * Filesystem: Return EntryType::Directory for the root directory.Subv2018-07-191-0/+4
| | | | | | | | It is unknown if this is correct behavior, but it makes sense and fixes a regression with Stardew Valley.
* | filesystem: std::move VirtualDir instance in VfsDirectoryServiceWrapper's constructorLioncash2018-07-191-1/+3
| | | | | | | | Avoids unnecessary atomic reference count incrementing and decrementing
* | filesystem: Use std::string's empty() function instead of comparing against a literalLioncash2018-07-191-1/+1
| | | | | | | | | | This is simply a basic value check as opposed to potentially doing string based operations (unlikely, but still, avoiding it is free).
* | filesystem: Remove pragma disabling global optimizationsLioncash2018-07-191-2/+0
|/ | | | This was just an artifact missed during PR review.
* Virtual Filesystem 2: Electric Boogaloo (#676)Zach Hilman2018-07-191-10/+199
| | | | | | | | | | * Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
* General Filesystem and Save Data Fixes (#670)Zach Hilman2018-07-171-28/+49
|
* Revert "Virtual Filesystem (#597)"bunnei2018-07-081-208/+17
| | | | This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
* Virtual Filesystem (#597)Zach Hilman2018-07-061-17/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add VfsFile and VfsDirectory classes * Finish abstract Vfs classes * Implement RealVfsFile (computer fs backend) * Finish RealVfsFile and RealVfsDirectory * Finished OffsetVfsFile * More changes * Fix import paths * Major refactor * Remove double const * Use experimental/filesystem or filesystem depending on compiler * Port partition_filesystem * More changes * More Overhaul * FSP_SRV fixes * Fixes and testing * Try to get filesystem to compile * Filesystem on linux * Remove std::filesystem and document/test * Compile fixes * Missing include * Bug fixes * Fixes * Rename v_file and v_dir * clang-format fix * Rename NGLOG_* to LOG_* * Most review changes * Fix TODO * Guess 'main' to be Directory by filename
* Update clang formatJames Rowe2018-07-031-2/+2
|
* Rename logging macro back to LOG_*James Rowe2018-07-031-3/+3
|
* general: Make formatting of logged hex values more straightforwardLioncash2018-05-021-1/+1
| | | | | | This makes the formatting expectations more obvious (e.g. any zero padding specified is padding that's entirely dedicated to the value being printed, not any pretty-printing that also gets tacked on).
* filesystem: Move logging macros over to new fmt-compatible onesLioncash2018-04-241-4/+4
|
* service: Use nested namespace specifiers where applicableLioncash2018-04-201-4/+2
| | | | Tidies up namespace declarations
* FS: Added an SDMC archive factory and registered it to the SDMC archive on startup.Subv2018-03-201-0/+5
|
* FS: Make EnsureSaveData create the savedata folder when called for the first time.Subv2018-03-041-0/+13
|
* Filesystem: Added a SaveData Factory and associated Disk_FileSystem.Subv2018-03-021-2/+9
|
* filesystem: Implement basic IStorage functionality.David Marcec2018-01-211-0/+54