Commit Graph

41 Commits

Author SHA1 Message Date
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
JosJuice b43f7c85cc DiscIO: Fix recursive directory extraction
https://bugs.dolphin-emu.org/issues/12331
2020-12-03 21:13:53 +01:00
JosJuice f25367a7a2 DiscIO: Avoid copies when comparing FileSystemGCWii file names 2019-05-29 14:53:39 +02:00
JosJuice d4b069f458 DiscIO: Use std::string_view in FileSystem::FindFileInfo
...and in the functions that call it.
2019-05-29 08:29:56 +02:00
spycrab f6865117e4 Qt/FilesystemWidget: Add size column 2018-06-02 18:59:56 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
JosJuice ca36c977d9 DiscIO: Remove m_partition and m_volume from FileSystem
The last commit made m_partition unnecessary, and m_volume
has been unnecessary ever since the PR that added DiscExtractor.
2017-09-15 18:57:05 +02:00
JosJuice 38304da947 DiscIO: Use Common::Lazy for loading filesystems
This simplifies FileMonitor a lot and also lets us
clean up FilesystemPanel.
2017-09-15 18:57:05 +02:00
Lioncash 01c262fe47 Filesystem: Declare FileInfo iterator's move constructor and assignment operator noexcept
Prevents potential extra copies being created in the context of
std::move_if_noexcept.
2017-08-05 12:29:02 -04:00
JosJuice d06b532150 DiscIO: Move parts of Filesystem to the new file DiscExtractor 2017-06-28 22:21:23 +02:00
JosJuice 583406d900 Filesystem: Make destructors = default 2017-06-14 15:26:04 +02:00
JosJuice 0b7d2e7c68 Filesystem: Modernize variable names 2017-06-14 15:25:09 +02:00
JosJuice 87916fe099 Filesystem: Replace GetFileList()
Instead of expecting callers to know how the size of directory file infos
relates to which files are in which directories, filesystems now offer a
GetRoot() method, and file infos offer a way to get their children. As
a bonus, m_FileInfoVector no longer has to be created and kept around
in RAM. Only the file info objects that actually are used are created.
2017-06-14 15:23:48 +02:00
JosJuice afe2bc60f6 Filesystem: Initialize everything in constructor
Not initializing until the filesystem is used is good when
a filesystem is constructed and then never used, but nobody does that.
This simplifies the code a little and lets all methods be const.
2017-06-13 22:44:07 +02:00
JosJuice d6ee7ec32c Filesystem: Read the entire FST in one go
Instead of using lots of small scattered reads to read the FST,
only one big read is used, which is more efficient.

This also means that the FST only allocates memory once and stores all
strings close to each other - good for the CPU cache. The file info
objects use pointers to this FST memory of containing data themselves.
Keeping around the big m_FileInfoVector containing objects with only
pointers is a bit unnecessary, but that will be fixed soon.
2017-06-13 22:43:41 +02:00
JosJuice 7c45afecb2 Filesystem: Use file info in arguments instead of path
Some callers already have the file info, making the relatively slow
FindFileInfo calls unnecessary. Callers that didn't have the file info
will now need to call FindFileInfo on their own.
2017-06-13 22:40:57 +02:00
JosJuice 3d5ef948d0 Filesystem: Make FindFileInfo public 2017-06-13 22:40:53 +02:00
JosJuice 07d3a39aeb Filesystem: Replace file info's full path with name
Some callers (i.e. ISOProperties) don't want the full path, so giving them
it is unnecessary. Those that do want it can use GetPathFromFSTOffset.
Not storing full paths everywhere also saves a small bit of RAM and is
necessary for a later commit. The code isn't especially pretty right now
(callers need to use FST offsets...) but it'll become better later.
2017-06-13 22:38:31 +02:00
JosJuice 5021b4a567 Filesystem: Replace FileInfo struct with interface
GC/Wii filesystem internals shouldn't be exposed to other classes.
This change isn't especially useful by itself, but it opens up the
way for some neat stuff in the following commits.
2017-06-13 22:37:43 +02:00
JosJuice b2af07a7b7 DiscIO: Remove C/I/S prefixes from class names
These prefixes were inconsistent with the rest of Dolphin.

I'm also renaming VolumeWiiCrypted to VolumeWii because of 1113b13.
2017-06-06 12:31:59 +02:00
JosJuice c3fa0d6edf DiscIO: Use std::optional in Volume and Blob 2017-06-05 13:26:51 +02:00
JosJuice 19b8f1c10a VolumeWiiCrypted: Replace ChangePartition with a partition parameter
By removing mutable state in VolumeWiiCrypted, this change makes
partition-related code simpler. It also gets rid of other ugly things,
like ISOProperties's "over 9000" loop that creates a list of
partitions by trying possible combinations, and DiscScrubber's
volume swapping that recreates the entire volume when it needs to
change partition.
2017-05-16 22:58:15 +02:00
Lioncash 144c23dead Filesystem: Return strings from GetFileName without the const qualifier
This is mostly pointless and can inhibit move construction
2016-09-18 12:56:25 -04:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
JosJuice c7e747d775 DiscIO: Improve IVolume::Read32 error handling
Callers can now check whether reads fail, either by checking the return
value or by setting the buffer to a known bad value and seeing if it stays
untouched. I've added error checks to FileSystemGCWii and Boot_BS2Emu,
but not to Boot since it doesn't check any of its other reads either.
2015-12-14 09:38:21 +01:00
Lioncash edbbf493f8 DiscIO: Make factory methods return unique_ptrs
Rather than rely on the developer to do the right thing,
just make the default behavior safely deallocate resources.

If shared semantics are ever needed in the future, the
constructor that takes a unique_ptr for shared_ptr can
be used.
2015-12-07 05:57:37 -05:00
Tillmann Karras df79398445 DiscIO: drop unused stuff 2015-11-10 17:03:08 +01:00
JosJuice 618ccf6109 Remove DiscScrubber::GetDOLSize in favor of IFileSystem::GetBootDOLSize
IFileSystem::GetBootDOLSize acts the same. The only difference is that it
reads the DOL offset on its own, but this change makes that optional.
2015-10-17 20:52:26 +02:00
comex 2ae6fb9240 Merge pull request #2338 from JosJuice/getfilelist-return
Filesystem: Return file list reference instead of modifying argument
2015-06-02 20:28:25 -04:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
JosJuice 272f9d3cbc FileSystemGCWii: Allow reading files partially 2015-05-03 15:44:24 +02:00
JosJuice d43a920924 Filesystem: Return file list reference instead of modifying argument 2015-04-28 12:48:05 +02:00
Tres Walsh e3e290123b Fix compiler error for win64 (SFileInfo doesn't get used much so a copy won't kill us) 2015-01-11 15:59:50 -08:00
Tres Walsh 9e541f6d2d Reduce number of allocations in CFileSystemGCWii::BuildFilenames
Modify SFileInfo to use a default move constructor, and no copy constructor.
Modify SFileInfo to use member initializers.
2015-01-11 13:42:50 -08:00
Lioncash bd1ce18f90 Simplify file tree building for the filesystem view.
Technically this also simplifies on disc filename building in general.
2014-03-16 16:54:00 -04:00
Lioncash a82675b7d5 Kill off some usages of c_str.
Also changes some function params, but this is ok.
Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
2014-03-14 13:51:23 -04:00
Pierre Bourdon c698c07755 Make DiscIO/ mostly IWYU clean (and fix errors in rest of the project detected by this change). 2014-02-22 23:37:29 +01:00
Lioncash 2afe215271 Convert all includes to relative paths. 2014-02-18 02:19:10 -05:00
lioncash d2038049f5 Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Jasper St. Pierre 34692ab826 Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00