summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem/filesystem.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-01-25fs/errors: Unify naming of result codesFearlessTobi1-19/+19
2024-01-25fs: Replace Mode enum by OpenMode enumFearlessTobi1-15/+15
2024-01-25vfs: Move vfs files to their own directoryFearlessTobi1-2/+2
2024-01-25fs: Move fsp_srv subclasses to separate filesFearlessTobi1-3/+3
fs: Move additional files to the fsp directory
2024-01-11fsp-srv: use program registry for SetCurrentProcessLiam1-177/+50
2023-12-06Improve path splitting speedBreadFish641-5/+1
2023-08-24filesystem: Return correct error for RenameFile when dest_path already existsFearlessTobi1-1/+10
Allows Grid Autosport to boot. Fixes https://github.com/yuzu-emu/yuzu/issues/8287.
2023-08-15vfs: expand support for NCA readingLiam1-0/+5
2023-08-08fs: return result on null outputsLiam1-4/+24
2023-08-08general: fix incorrect conversionsLiam1-1/+1
2023-08-08core: remove ResultVal typeLiam1-52/+74
2023-02-21service: refactor server architectureLiam1-4/+8
Converts services to have their own processes
2023-02-14general: rename CurrentProcess to ApplicationProcessLiam1-2/+2
2022-06-27core: Replace all instances of ResultCode with Resultgerman771-15/+14
2022-04-23general: Convert source file copyright comments over to SPDXMorph1-3/+2
This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
2022-04-02fix: typosAndrea Pappacoda1-1/+1
2021-11-04general: Get the current process program id directly from the systemMorph1-3/+2
This allows us to avoid including KProcess' header file in files that only need to get the current process' program id.
2021-11-04general: Rename GetTitleID to GetProgramIDMorph1-2/+2
2021-11-04core: Remove unused includesameerj1-1/+0
2021-11-02general: Remove MakeResult helpersMorph1-11/+10
This is made obsolete by the presence of implicit constructors.
2021-09-14vfs: Partially implement GetFileTimeStampRawMorph1-0/+12
Gets rid of homebrew warnings using this func
2021-09-12FS: Mark recursive CreateDirectory as inaccurate and temporaryMorph1-0/+5
2021-09-08Addressed issuesChloe1-1/+1
Co-authored-by: Mai M. <mathew1800@gmail.com>
2021-09-06FS: Recursively create directories for CreateDirectoryChloe Marcec1-8/+13
Originally we only created the parent directory, this caused issues for creating directories which also contained subdirectories, eg `/Folder1/Folder2` This allows the ultimate mod manager homebrew to at least boot
2021-06-28filesystem: Open a read-only directory for SDMC modsMorph1-5/+9
This prevents mod files from being locked due to the read-only share flag in Windows.
2021-06-28core: Simplify SDMC mod loadinglat9nq1-1/+2
If someone else wants to support other mod formats in the SDMC directory, that can be added later. For now, just allow RomFS modding here and force people to do other types of mods the old way. Addresses review comments. Co-authored-by: LC <mathew1800@gmail.com>
2021-06-28core: Support LayeredFS mod from SDMC directorylat9nq1-0/+9
Enables loading a mod directly from `[yuzu data directory]/sdmc/atmosphere/contents/[title_id]`. For use with some homebrew mod managers.
2021-06-03fspsrv: Implement DisableAutoSaveDataCreation (#6355)Chloe1-0/+4
- Used by Mii Edit
2021-06-02general: Replace RESULT_UNKNOWN with ResultUnknownMorph1-15/+15
Transition to PascalCase for result names.
2021-06-02general: Replace RESULT_SUCCESS with ResultSuccessMorph1-16/+16
Transition to PascalCase for result names.
2021-05-26common: fs: Rework the Common Filesystem interface to make use of std::filesystem (#6270)Morph1-9/+12
* common: fs: fs_types: Create filesystem types Contains various filesystem types used by the Common::FS library * common: fs: fs_util: Add std::string to std::u8string conversion utility * common: fs: path_util: Add utlity functions for paths Contains various utility functions for getting or manipulating filesystem paths used by the Common::FS library * common: fs: file: Rewrite the IOFile implementation * common: fs: Reimplement Common::FS library using std::filesystem * common: fs: fs_paths: Add fs_paths to replace common_paths * common: fs: path_util: Add the rest of the path functions * common: Remove the previous Common::FS implementation * general: Remove unused fs includes * string_util: Remove unused function and include * nvidia_flags: Migrate to the new Common::FS library * settings: Migrate to the new Common::FS library * logging: backend: Migrate to the new Common::FS library * core: Migrate to the new Common::FS library * perf_stats: Migrate to the new Common::FS library * reporter: Migrate to the new Common::FS library * telemetry_session: Migrate to the new Common::FS library * key_manager: Migrate to the new Common::FS library * bis_factory: Migrate to the new Common::FS library * registered_cache: Migrate to the new Common::FS library * xts_archive: Migrate to the new Common::FS library * service: acc: Migrate to the new Common::FS library * applets/profile: Migrate to the new Common::FS library * applets/web: Migrate to the new Common::FS library * service: filesystem: Migrate to the new Common::FS library * loader: Migrate to the new Common::FS library * gl_shader_disk_cache: Migrate to the new Common::FS library * nsight_aftermath_tracker: Migrate to the new Common::FS library * vulkan_library: Migrate to the new Common::FS library * configure_debug: Migrate to the new Common::FS library * game_list_worker: Migrate to the new Common::FS library * config: Migrate to the new Common::FS library * configure_filesystem: Migrate to the new Common::FS library * configure_per_game_addons: Migrate to the new Common::FS library * configure_profile_manager: Migrate to the new Common::FS library * configure_ui: Migrate to the new Common::FS library * input_profiles: Migrate to the new Common::FS library * yuzu_cmd: config: Migrate to the new Common::FS library * yuzu_cmd: Migrate to the new Common::FS library * vfs_real: Migrate to the new Common::FS library * vfs: Migrate to the new Common::FS library * vfs_libzip: Migrate to the new Common::FS library * service: bcat: Migrate to the new Common::FS library * yuzu: main: Migrate to the new Common::FS library * vfs_real: Delete the contents of an existing file in CreateFile Current usages of CreateFile expect to delete the contents of an existing file, retain this behavior for now. * input_profiles: Don't iterate the input profile dir if it does not exist Silences an error produced in the log if the directory does not exist. * game_list_worker: Skip parsing file if the returned VfsFile is nullptr Prevents crashes in GetLoader when the virtual file is nullptr * common: fs: Validate paths for path length * service: filesystem: Open the mod load directory as read only
2021-05-06hle: kernel: Rename Process to KProcess.bunnei1-1/+1
2021-05-01service: filesystem: Return proper error codes for CreateFileMorph1-2/+7
This improves the accuracy of CreateFile by returning the correct error codes on certain conditions (parent directory does not exist, path already exists). This fixes saving and the loading of existing saves in New Pokemon Snap
2021-04-15common: Move settings to common from core.bunnei1-1/+1
- Removes a dependency on core and input_common from common.
2020-12-08fsp_srv: Implement OpenDataStorageWithProgramIndexMorph1-0/+25
- Used by RollerCoaster Tycoon 3: Complete Edition
2020-12-08core: Remove unnecessary enum casts in log callsLioncash1-8/+8
Follows the video core PR. fmt doesn't require casts for enum classes anymore, so we can remove quite a few casts.
2020-11-27savedata_factory: Eliminate usage of the global system instanceLioncash1-1/+2
Now there's only two meaningful instances left in core.
2020-11-27service: Eliminate usages of the global system instanceLioncash1-5/+3
Completely removes all usages of the global system instance within the services code by passing in the using system instance to the services.
2020-11-18patch_manager: Remove usages of the global system instanceLioncash1-2/+5
With this, only 19 usages of the global system instance remain within the core library. We're almost there.
2020-10-13filesystem: Fix CreateDirectory and DeleteFileMorph1-2/+3
Add a check if dir is nullptr (does not exist) Fixes save game creation in Hades
2020-09-17file_sys/bis_factory: Eliminate usage of the global system accessorLioncash1-1/+1
2020-08-16common/fileutil: Convert namespace to Common::FSLioncash1-40/+40
Migrates a remaining common file over to the Common namespace, making it consistent with the rest of common files. This also allows for high-traffic FS related code to alias the filesystem function namespace as namespace FS = Common::FS; for more concise typing.
2020-07-30fs: Rename SaveDataDescriptor to SaveDataAttributeMorph1-4/+4
2020-07-16Add comment to clarify the nullptr checkMorph1-0/+1
2020-07-16filesystem: Create subdirectories prior to creating a fileMorph1-0/+3
If subdirectories exist in the given path parameter and don't exist in the real filesystem create them prior to creating the files within. This fixes the softlocks upon save creation in The Legend of Zelda: Breath of the Wild
2020-04-16CMakeLists: Specify -Wextra on linux buildsLioncash1-1/+2
Allows reporting more cases where logic errors may exist, such as implicit fallthrough cases, etc. We currently ignore unused parameters, since we currently have many cases where this is intentional (virtual interfaces). While we're at it, we can also tidy up any existing code that causes warnings. This also uncovered a few bugs as well.
2019-11-12service: Resolve sign conversion errorsLioncash1-13/+13
These are fairly trivial to resolve and most of the changes entail using RESULT_UNKNOWN over ResultCode(-1).
2019-10-06hle/service: Replace global system instance calls with instance-based onesLioncash1-10/+10
Migrates the HLE service code off the use of directly accessing the global system instance where trivially able to do so. This removes all usages of Core::CurrentProcess from the service code, only 8 occurrences of this function exist elsewhere. There's still quite a bit of "System::GetInstance()" being used, however this was able to replace a few instances.
2019-10-01bcat: Add FSC accessors for BCAT dataZach Hilman1-1/+1
Ports BCAT to use FSC interface
2019-09-30filesystem: Add getter for BCAT temporary directoryZach Hilman1-0/+9
2019-09-22configure_debug: Move reporting option to loggingZach Hilman1-3/+2
2019-09-21filesystem: Add const qualification to various accessorsZach Hilman1-32/+36
2019-09-21yuzu: Port old usages of Filesystem namespace to FilesystemControllerZach Hilman1-0/+1
2019-09-21filesystem: Pass Size Getter functions to IFileSystem for sizesZach Hilman1-12/+0
2019-09-21filesystem: Add FileSystemController to deglobalize FS servicesZach Hilman1-32/+277
2019-06-29fsp-srv: Implement OutputAccessLogToSdCardZach Hilman1-5/+5
Allows games to log data to the SD.
2019-04-05service/fsp_srv: Don't pass SaveDataDescriptor instances by value.Lioncash1-3/+3
Passing around a 64 byte data struct by value is kind of wasteful, instead pass a reference to the struct.
2019-04-05filesystem: Use a std::string_view in OpenFile()Lioncash1-5/+8
Rather than make a full copy of the path, we can just use a string view and truncate the viewed portion of the string instead of creating a totally new truncated string.
2019-03-27core: Port current uses of RegisteredCache to ContentProviderZach Hilman1-5/+6
2018-12-27filesystem: Populate save data sizes from control dataZach Hilman1-0/+47
2018-12-02filesystem: De-globalize registered_cache_unionLioncash1-15/+3
We can just return a new instance of this when it's requested. This only ever holds pointers to the existing registed caches, so it's not a large object. Plus, this also gets rid of the need to keep around a separate member function just to properly clear out the union. Gets rid of one of five globals in the filesystem code.
2018-12-01service/fsp_srv: Implement CleanDirectoryRecursivelyLioncash1-0/+12
This is the same behavior-wise as DeleteDirectoryRecursively, with the only difference being that it doesn't delete the top level directory in the hierarchy, so given: root_dir/ - some_dir/ - File.txt - OtherFile.txt The end result is just: root_dir/
2018-11-19filesystem: Clear registered union paths on factory creationZach Hilman1-0/+5
2018-11-16file_sys/errors: Extract FS-related error codes to file_sys/errors.hLioncash1-3/+3
Keeps filesystem-related error codes in one spot.
2018-11-02filesystem: Cache RegisteredCacheUnion instead of constructing on demandZach Hilman1-3/+10
Prevents unnecessary re-reads of the metadata and unnecessary temporary objects.
2018-10-29bis_factory: Add getter for mod dump root for a title IDZach Hilman1-4/+21
Equates to yuzu_dir/dump/<title id>/
2018-10-29savedata_factory: Expose accessors for SaveDataSpaceZach Hilman1-0/+10
2018-10-16file_sys/registered_cache: Use unique_ptr and regular pointers instead of shared_ptrs where applicableLioncash1-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.
2018-10-13filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem instance by referenceLioncash1-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.
2018-10-05romfs_factory: Extract packed update setter to new functionZach Hilman1-0/+9
2018-09-22filesystem: Add LayeredFS VFS directory getterZach Hilman1-1/+12
2018-09-19Fixed GetAccountId stub, Added error code for OpenDirectory and added ActivateNpadWithRevisionDavid Marcec1-1/+1
With these, `Nintendo Entertainment System - Nintendo Switch Online` loads
2018-09-11hle/service: Default constructors and destructors in the cpp file where applicableLioncash1-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.
2018-09-04bktr: Fix bucket overlap errorZach Hilman1-1/+1
2018-09-04registration: Add RegisteredCacheUnionZach Hilman1-0/+7
Aggregates multiple caches into one interface
2018-09-02filesystem: Move dir retrieval after path checking in DeleteFile()Lioncash1-2/+5
We don't need to do the lookup if the path is considered empty currently.
2018-08-24filesystem: Fix typo in log messageLioncash1-1/+1
2018-08-23filesystem: Add CreateFactories methods to fsZach Hilman1-7/+6
Allows frontend to create registration caches for use before a game has booted.
2018-08-23filesystem: Add logging to registration gettersZach Hilman1-4/+25
2018-08-21vfs: Replace mode.h include with forward declarations where applicableLioncash1-1/+1
Avoids the need to rebuild these source files if the mode header changes.
2018-08-21service/filesystem: Use forward declarations where applicableLioncash1-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
2018-08-19filesystem: Add support for loading of system archivesZach Hilman1-3/+16
2018-08-12filesystem: Add Open and Register functions for BISFactoryZach Hilman1-0/+19
2018-08-09core: Port core to VfsFilesystem for file accessZach Hilman1-7/+7
2018-08-09filesystem: Remove unnecessary if conditionsZach Hilman1-1/+1
2018-08-01service/filesystem: Add fsp:ldr and fsp:pr servicesLioncash1-0/+4
Adds the basic skeleton for the remaining fsp services based off information provided by Switch Brew.
2018-07-24VFS Regression and Accuracy Fixes (#776)Zach Hilman1-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&
2018-07-22file_util, vfs: Use std::string_view where applicableLioncash1-1/+1
Avoids unnecessary construction of std::string instances where applicable.
2018-07-21file_util: Use an enum class for GetUserPath()Lioncash1-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.
2018-07-19Filesystem: Return EntryType::Directory for the root directory.Subv1-0/+4
It is unknown if this is correct behavior, but it makes sense and fixes a regression with Stardew Valley.
2018-07-19filesystem: std::move VirtualDir instance in VfsDirectoryServiceWrapper's constructorLioncash1-1/+3
Avoids unnecessary atomic reference count incrementing and decrementing
2018-07-19filesystem: Use std::string's empty() function instead of comparing against a literalLioncash1-1/+1
This is simply a basic value check as opposed to potentially doing string based operations (unlikely, but still, avoiding it is free).
2018-07-19filesystem: Remove pragma disabling global optimizationsLioncash1-2/+0
This was just an artifact missed during PR review.
2018-07-19Virtual Filesystem 2: Electric Boogaloo (#676)Zach Hilman1-10/+199
* Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
2018-07-18hle/filesystem: Amend trace log in OpenSaveData() to compile in debug modeLioncash1-1/+1
Previously this wouldn't compile, since no such function named SaveStructDebugInfo() exists.
2018-07-17General Filesystem and Save Data Fixes (#670)Zach Hilman1-28/+49
2018-07-08Revert "Virtual Filesystem (#597)"bunnei1-208/+17
This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
2018-07-06Virtual Filesystem (#597)Zach Hilman1-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
2018-07-03Update clang formatJames Rowe1-2/+2
2018-07-03Rename logging macro back to LOG_*James Rowe1-3/+3
2018-05-02general: Make formatting of logged hex values more straightforwardLioncash1-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).
2018-04-24filesystem: Move logging macros over to new fmt-compatible onesLioncash1-4/+4
2018-04-20service: Use nested namespace specifiers where applicableLioncash1-4/+2
Tidies up namespace declarations
2018-03-20FS: Added an SDMC archive factory and registered it to the SDMC archive on startup.Subv1-0/+5
2018-03-04FS: Make EnsureSaveData create the savedata folder when called for the first time.Subv1-0/+13
2018-03-02Filesystem: Added a SaveData Factory and associated Disk_FileSystem.Subv1-2/+9
2018-01-21filesystem: Implement basic IStorage functionality.David Marcec1-0/+54