summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem (follow)
Commit message (Collapse)AuthorAgeFilesLines
* hle/service: Default constructors and destructors in the cpp file where applicableLioncash2018-09-118-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-042-0/+10
| | | | Aggregates multiple caches into one interface
* Merge pull request #1213 from DarkLordZach/octopath-fsbunnei2018-09-022-2/+30
|\ | | | | filesystem/maxwell_3d: Various changes to boot Project Octopath Traveller
| * filesystem: Implement OpenReadOnlySaveDataFilesystemZach Hilman2018-09-012-1/+7
| |
| * filesystem: Add OpenFileSystemWithPatchZach Hilman2018-09-012-1/+23
| |
* | 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.
* core/core: Replace includes with forward declarations where applicableLioncash2018-08-311-0/+1
| | | | | | | | | | | The follow-up to e2457418dae19b889b2ad85255bb95d4cd0e4bff, which replaces most of the includes in the core header with forward declarations. This makes it so that if any of the headers the core header was previously including change, then no one will need to rebuild the bulk of the core, due to core.h being quite a prevalent inclusion. This should make turnaround for changes much faster for developers.
* 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-232-8/+11
| | | | | | | | 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-213-2/+3
| | | | | Avoids the need to rebuild these source files if the mode header changes.
* service/filesystem: Use forward declarations where applicableLioncash2018-08-213-5/+19
| | | | | | | | 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-194-16/+50
|
* filesystem: Add Open and Register functions for BISFactoryZach Hilman2018-08-122-4/+23
|
* Merge pull request #990 from lioncash/entrybunnei2018-08-101-6/+3
|\ | | | | fsp_srv: Emplace entries first when building index instead of emplacing last
| * fsp_srv: Use std::string_view's copy() function instead of strncpy()Lioncash2018-08-091-5/+1
| | | | | | | | | | | | Given elements inserted into a vector are zeroed out, we can just copy MAX_LEN - 1 elements and the data will already be properly null terminated.
| * fsp_srv: Emplace entries first when building index instead of emplacing lastLioncash2018-08-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way were doing it would require copying a 768 character buffer (part of the Entry struct) to the new element in the vector. Given it's a plain array, std::move won't eliminate that. Instead, we can emplace an instance directly into the destination buffer and then fill it out, avoiding the need to perform any unnecessary copies. Given this is done in a loop, we can request the destination to allocate all of the necessary memory ahead of time, avoiding the need to potentially keep reallocating over and over on every few insertions into the vector.
* | core: Port core to VfsFilesystem for file accessZach Hilman2018-08-092-8/+8
| |
* | filesystem: Remove unnecessary if conditionsZach Hilman2018-08-091-1/+1
|/
* service: Remove redundant #pragma once directivesLioncash2018-08-042-4/+0
| | | | | These don't do anything within .cpp files (we don't include cpp files, so...)
* service/filesystem: Add fsp:ldr and fsp:pr servicesLioncash2018-08-015-0/+85
| | | | | 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.
* | Merge pull request #712 from lioncash/fspbunnei2018-07-191-17/+22
|\ \ | | | | | | fsp_srv: Misc individual changes
| * | fsp_srv: Remove unnecessary vector construction in IFile's Write() functionLioncash2018-07-191-2/+3
| | | | | | | | | | | | | | | | | | | | | We can avoid constructing a std::vector here by simply passing a pointer to the original data and the size of the copy we wish to perform to the backend's Write() function instead, avoiding copying the data where it's otherwise not needed.
| * | fsp_srv: Remove unnecessary std::vector construction in IDirectory's Read() functionLioncash2018-07-191-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using a second std::vector as a buffer to convert another std::vector's data into a byte sequence, however we can just use pointers to the original data and use them directly with WriteBuffer, which avoids copying the data at all into a separate std::vector. We simply cast the pointers to u8* (which is allowed by the standard, given std::uint8_t is an alias for unsigned char on platforms that we support).
| * | fsp_srv: Make IStorage constructor explicitLioncash2018-07-191-1/+1
| | | | | | | | | | | | Prevents implicit conversions.
| * | fsp_srv: Add missing includesLioncash2018-07-191-0/+5
| | | | | | | | | | | | Gets rid of relying on indirect inclusions.
| * | fsp_srv: Resolve sign-mismatch warnings in assertion comparisonsLioncash2018-07-191-3/+3
| | |
| * | fsp_srv: Respect write length in Write()Lioncash2018-07-191-4/+5
| |/ | | | | | | | | | | | | | | | | | | | | Previously we were just copying the data whole-sale, even if the length was less than the total data size. This effectively makes the actual_data vector useless, which is likely not intended. Instead, amend this to only copy the given length amount of data. At the same time, we can avoid zeroing out the data before using it by passing iterators to the constructor instead of a size.
* | 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-194-115/+383
| | | | | | | | | | * Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
* General Filesystem and Save Data Fixes (#670)Zach Hilman2018-07-174-87/+125
|
* Merge pull request #559 from Subv/mount_savedatabunnei2018-07-121-2/+11
|\ | | | | Services/FS: Return the correct error code when trying to mount a nonexistent savedata.
| * Services/FS: Return the correct error code when trying to mount a nonexistent savedata.Subv2018-06-191-2/+11
| |
* | Revert "Virtual Filesystem (#597)"bunnei2018-07-084-404/+70
| | | | | | | | This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
* | Virtual Filesystem (#597)Zach Hilman2018-07-064-70/+404
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-032-28/+28
|/
* Common/string_util: add StringFromBuffer functionmailwl2018-06-071-22/+9
| | | | convert input buffer (std::vector<u8>) to string, stripping zero chars
* general: Make formatting of logged hex values more straightforwardLioncash2018-05-022-6/+6
| | | | | | 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-242-30/+29
|
* Service/FS: implement IFileSystem::RenameFilemailwl2018-04-241-1/+21
|
* service: Use nested namespace specifiers where applicableLioncash2018-04-203-12/+6
| | | | Tidies up namespace declarations
* fsp_srv: Implement DeleteFile.bunnei2018-04-151-1/+15
| | | | - Used by Binding of Isaac.
* fsp_srv: Implement IFile::Flush.bunnei2018-04-151-1/+9
|
* Various fixes and clangHexagon122018-04-111-12/+5
|
* Updated fsp-srv with more service names.Hexagon122018-04-101-4/+102
|
* Fix spelling of InitializeJames Rowe2018-04-072-3/+3
|
* hle_ipc, fsp_srv: Cleanup logging.bunnei2018-04-011-2/+2
|
* fsp_srv: Implement GetSize and SetSize.bunnei2018-03-311-2/+21
|
* Merge pull request #255 from Subv/sd_cardbunnei2018-03-243-2/+106
|\ | | | | FS: Implemented access to the SD card
| * FS: Implemented IFileSystem::CreateDirectory.Subv2018-03-211-0/+15
| |
| * FS: Implemented IFileSystem's OpenDirectory function.Subv2018-03-201-0/+28
| | | | | | | | Note that the filter parameter is not yet implemented.
| * FS: Added the IDirectory IPC interface and implemented its two functions.Subv2018-03-201-0/+51
| |
| * FS: Implement MountSdCard.Subv2018-03-201-2/+6
| |
| * FS: Added an SDMC archive factory and registered it to the SDMC archive on startup.Subv2018-03-202-0/+6
| |
* | oopsN00byKing2018-03-191-3/+3
| |
* | Clean Warnings (?)N00byKing2018-03-191-3/+3
|/
* FS: Stubbed CreateSaveData. It currently does nothing.Subv2018-03-042-0/+15
|
* FS: Make EnsureSaveData create the savedata folder when called for the first time.Subv2018-03-042-0/+20
|
* FS: Implement MountSaveData and some of the IFile interface.Subv2018-03-022-0/+189
|
* Filesystem: Added a SaveData Factory and associated Disk_FileSystem.Subv2018-03-022-2/+10
|
* service: Remove remaining uses of BufferDescriptor*.bunnei2018-02-141-3/+1
|
* fsp_srv: Stub MountSdCard.bunnei2018-02-102-0/+9
|
* Service: stub some functions in am, audio, time, vi servicesmailwl2018-02-071-0/+1
|
* hle: Rename RequestBuilder to ResponseBuilder.bunnei2018-01-251-9/+9
|
* service: Fix all incorrect IPC response headers.bunnei2018-01-251-2/+2
|
* fsp_srv: Various improvements to IStorage:Read implementation.bunnei2018-01-213-48/+72
|
* filesystem: Implement basic IStorage functionality.David Marcec2018-01-214-0/+252