Commit Graph

920 Commits

Author SHA1 Message Date
Léo Lam 31b04149b3 DiscIO: Fix TMD extraction
The offset that we read from the header is relative to the partition.
2017-08-25 17:31:50 +02:00
JosJuice fb2016838e Merge pull request #5864 from JosJuice/directoryblob-disccontentcontainer
DirectoryBlob: Improve ReadInternal
2017-08-23 18:48:24 +02:00
JosJuice 6e6864fcbf Revert "DirectoryBlob: Use NonCopyable"
This reverts commit a7a8e467b6.
2017-08-22 16:35:37 +02:00
Leo Lam 3748384008 Merge pull request #5746 from leoetlino/disc-updates
Add support for installing disc updates from the game list
2017-08-16 19:02:42 +08:00
Michael M 1ade08c607 Fix two small lint errors 2017-08-13 19:06:10 -07:00
Leo Lam 54778303ee Merge pull request #5871 from JosJuice/read-swapped-and-shifted
DiscIO: Add a Volume::ReadSwappedAndShifted function
2017-08-11 15:58:42 +08:00
Léo Lam eb1ba4b0e9 DiscIO: Add a blob reader for Volume files 2017-08-10 23:47:18 +08:00
Léo Lam ca0438e26d WiiWad: Allow using WiiWad with more than just files
This adds a WiiWad constructor that takes a BlobReader, so that the
class can be used with more than just files from the host filesystem.

Required for using WiiWad with WADs from update partitions.
2017-08-10 23:47:18 +08: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 5e3c98af1d DiscIO: Add a Volume::ReadSwappedAndShifted function
This is a fairly common operation, so let's make a utility
function for it to cut down on code duplication.
2017-08-02 22:00:51 +02:00
JosJuice 2bcccd893a DirectoryBlob: Remove unused DiscContent member 2017-08-01 22:01:34 +02:00
JosJuice f7032f8deb FileSystemGCWii: Don't add 0-size files to m_offset_file_info_cache
This is done in order to reduce the risk of files not being added
due to them having the same end offset as another file.
2017-08-01 21:58:25 +02:00
JosJuice b155c46aca DirectoryBlob: Fix reading beyond the end of the disc
There were two problems with this:

1. If the starting offset was beyond the end of the disc,
   we would dereference an invalid iterator.
2. The data beyond the end of the disc was non-deterministic.
2017-08-01 21:58:18 +02:00
JosJuice 74ada98e84 DirectoryBlob: Remove redundant assert
DiscContent::Read contains an equivalent assertion.
2017-08-01 21:58:12 +02:00
JosJuice 6b0a60d2ee DirectoryBlob: Don't add DiscContents with size 0
Having DiscContents with size 0 would mean that some DiscContents
might not get added to the std::set because of them comparing
identically to another DiscContent.

This replaces an older piece of code in WriteDirectory that ensures
that no two files have the same starting offset. (We now care about
the ending offset, not the starting offset. The new solution both
ensures that no two files have the same ending offset and that no
two files have the same starting offset.)
2017-08-01 21:58:04 +02:00
JosJuice 78fa98f559 DirectoryBlob: Change the return type of Add/CheckSizeAndAdd
Only return the information that isn't already known to the caller.
2017-08-01 21:57:54 +02:00
JosJuice 1b1a75ee3a DirectoryBlob: Lookup DiscContents by offset + size instead of offset
This simplifies DiscContentContainer::Read.
2017-08-01 21:57:48 +02:00
JosJuice d6260e02ce DirectoryBlob: Replace std::set<DiscContent> with a new class 2017-08-01 21:57:24 +02:00
JosJuice a7a8e467b6 DirectoryBlob: Use NonCopyable 2017-08-01 21:52:30 +02:00
JosJuice b6c6a04f95 DirectoryBlob: Standardize the spelling of disc
DirectoryBlob was using disk in some places and disc in other places.
2017-08-01 11:36:40 +02:00
JosJuice d0c322f6e6 DirectoryBlob: Don't silently set GC region to NTSC-J if bi2.bin is missing
We were already handling the Wii region in region.bin in this way.
2017-08-01 11:36:40 +02:00
JosJuice 3fd0d39a85 DirectoryBlob: Write partition headers properly 2017-08-01 11:36:40 +02:00
JosJuice 5fe3745750 Don't show "extra" files from DirectoryBlobs in game list
For instance, we don't want to show TGC files that might be
inside the /files/ directory of a GameCube DirectoryBlob,
and we don't want to show the /sys/main.dol files for extra
partitions of Wii DirectoryBlobs.
2017-08-01 11:36:40 +02:00
JosJuice 1ea44f425d DirectoryBlob: Change ConvertUTF8NamesToSHIFTJIS's parameter to pointer 2017-08-01 11:36:40 +02:00
JosJuice 34fd08e7eb DirectoryBlob: Support multiple partitions 2017-08-01 11:36:40 +02:00
JosJuice 955ab72b1d DirectoryBlob: Remove m_root_directory from DirectoryBlob 2017-08-01 11:36:40 +02:00
JosJuice e15b957d53 DirectoryBlob: Implement GetDataSize() 2017-08-01 11:36:40 +02:00
JosJuice d84bee3ff4 DirectoryBlob: Prepare more for supporting multiple partitions 2017-08-01 11:36:40 +02:00
JosJuice a3ee61e1a9 DirectoryBlob: Let DirectoryBlob force GC/Wii for partition 2017-08-01 11:36:40 +02:00
JosJuice fb09874f79 DirectoryBlob: Reorder functions in .cpp file
They're now grouped by which class they belong to.
2017-08-01 11:36:40 +02:00
JosJuice ba0ee3f54b DirectoryBlob: Prepare for supporting multiple partitions 2017-08-01 11:36:40 +02:00
JosJuice 953ca9cee1 DirectoryBlob: Make PadToAddress and Write32 static 2017-08-01 11:36:40 +02:00
JosJuice ab4762c4c2 DirectoryBlob: Split out setting BI2 to new function 2017-08-01 11:36:40 +02:00
JosJuice 2ea0a1a086 DirectoryBlob: Make some constants local 2017-08-01 11:36:40 +02:00
JosJuice 0d4ad0e39e DirectoryBlob: Remove m_fst_name_offset 2017-08-01 11:36:40 +02:00
JosJuice ef39b4da46 DirectoryBlob: Improve SetApploader
The code gets simpler by using IOFile instead of ReadFileToString.
Also, we now write -1 in all cases where loading fails.
2017-08-01 11:36:40 +02:00
JosJuice 31d8322c5a DirectoryBlob: Don't use member variables for addresses
Now it's clearer that SetDOL depends on SetApploader
and BuildFST depends on SetDOL.

As a side note, we now load the DOL even if there's
no apploader. (I don't think it matters whether we
do it, but it was easier to implement this way.)
2017-08-01 11:36:40 +02:00
JosJuice b28ec0b7ee DirectoryBlob: Split out setting partition table to new function 2017-08-01 11:36:40 +02:00
JosJuice c4879aa48d DirectoryBlob: Split out setting TMD and ticket to new function 2017-08-01 11:36:40 +02:00
JosJuice 5a00bda490 DirectoryBlob: Move content emplacement out of the constructor 2017-08-01 11:36:40 +02:00
JosJuice 1258d18f21 DirectoryBlob: Restructure SetApploader 2017-08-01 11:36:40 +02:00
JosJuice 8747b1b6ab DirectoryBlob: Support region.bin 2017-08-01 11:36:40 +02:00
JosJuice c73f6b6c26 DirectoryBlob: Add ReadFileToVector function 2017-08-01 11:36:40 +02:00
JosJuice 8afa230787 DirectoryBlob: Rename DISKHEADERINFO_ADDRESS to BI2_ADDRESS
Because DISKHEADERINFO is too easy confuse with DISKHEADER.

Also adding BI2_SIZE and DISKHEADER_SIZE contants.
2017-08-01 11:36:40 +02:00
JosJuice 975b2b40fa DirectoryBlob: Support bi2.bin 2017-08-01 11:36:40 +02:00
JosJuice 251828ccc0 Don't check validity twice when creating DirectoryBlob 2017-08-01 11:36:40 +02:00
JosJuice a6bbf7e21b DirectoryBlob: Don't keep DOL in memory 2017-08-01 11:36:40 +02:00
JosJuice 4cc8d3091c DirectoryBlob: Require header file (boot.bin) 2017-08-01 11:36:40 +02:00
JosJuice 71578b468d DirectoryBlob: Support tickets and TMDs 2017-08-01 11:36:40 +02:00
JosJuice 02610d4b28 DirectoryBlob: Use DISCIO instead of DVDINTERFACE for logging 2017-08-01 11:36:40 +02:00