Commit Graph

84 Commits

Author SHA1 Message Date
JosJuice 07605bf67c
Merge pull request #13090 from mitaclaw/ranges-modernization-1-trivial
Ranges Algorithms Modernization - Trivial
2024-10-15 17:08:55 +02:00
mitaclaw ebf7cebc32 Modernize `std::sort` with ranges 2024-10-10 00:53:48 -07:00
mitaclaw 7c96762f5f Simplify `std::copy` with `std::copy_n`
+ a surprise `std::memcpy` in VolumeVerifier.cpp.
2024-10-07 15:34:56 -07:00
JosJuice 9c53c110f8 DiscIO: Remove unintentional use of comma operator 2023-11-05 09:24:49 +01:00
LillyJadeKatrin 335cf4f2db Added CopyReader to BlobReader and all subclasses
A deep-copy method CopyReader has been added to BlobReader (virtual) and all of its subclasses (override). This should create a second BlobReader to open the same set of data but with an independent read pointer so that it doesn't interfere with any reads done on the original Reader.

As part of this, IOFile has added code to create a deep copy IOFile pointer onto the same file, with code based on the platform in question to find the file ID from the file pointer and open a new one. There has also been a small piece added to FileInfo to enable a deep copy, but its only subclass at this time already had a copy constructor so this was relatively minor.
2023-10-01 09:04:06 -04:00
Admiral H. Curtiss 7ac042d00b
DirectoryBlob: Fix partition size mixup for encrypted Wii discs. 2022-08-10 20:43:52 +02:00
JosJuice bb27d4cc95 DiscIO/VolumeWii: Decouple "is encrypted" from "is hashed"
Needed for the next commit. NFS disc images are hashed but not encrypted.

While we're at it, also get rid of SupportsIntegrityCheck.
It does the same thing as old IsEncryptedAndHashed and new HasWiiHashes.
2022-08-04 20:29:22 +02:00
Admiral H. Curtiss ec3cfc01c1
DiscIO/DirectoryBlob: Add callback to modify sys files before they're added to the disc. 2022-07-19 00:55:04 +02:00
Admiral H. Curtiss f5c132580c
DiscIO/DirectoryBlob: Add ContentSource that stores data locally in std::vector. 2022-07-19 00:55:03 +02:00
Admiral H. Curtiss 36cfcb530f
IOFile: Make origin parameter to Seek() an enum class. 2022-01-29 06:49:21 +01:00
JosJuice ff5b323a56 DiscIO: Delete an unused function declaration 2022-01-23 22:15:56 +01:00
Pokechu22 6e5f4125e3 Use Common::ToLower and Common::ToUpper 2022-01-16 17:00:12 -08:00
Admiral H. Curtiss e3f1de023f
DiscIO/DirectoryBlob: Add a callback that allows patching the main.dol and FST of the game partition during blob construction. 2021-10-24 00:09:05 +02:00
Admiral H. Curtiss 00ef9f2b4f
DiscIO/DirectoryBlob: Allow constructing a DirectoryBlobReader from a VolumeDisc. 2021-10-24 00:09:05 +02:00
Admiral H. Curtiss 3a72a39efd
DiscIO/DirectoryBlob: Allow constructing a DirectoryBlobPartition from a VolumeDisc. 2021-10-24 00:09:00 +02:00
Admiral H. Curtiss b1802f6daa
DiscIO/DirectoryBlob: Add a content source representing a run of padding bytes. 2021-10-23 23:51:23 +02:00
Admiral H. Curtiss f8611f7139
DiscIO/DirectoryBlob: Add a content source that reads data from a DiscIO::Volume. 2021-10-23 16:51:45 +02:00
Admiral H. Curtiss b7a9cc37b1
DiscIO/DirectoryBlob: Add ability to have an offset for a partition ContentSource. 2021-10-23 16:51:45 +02:00
Admiral H. Curtiss a14436fe3f
DiscIO/DirectoryBlob: Add ability to have a start-of-file offset for a file ContentSource. 2021-10-23 16:51:45 +02:00
Admiral H. Curtiss b988ab4441
DiscIO/DirectoryBlob: Consolidate functions that take data for ContentSource to just take a ContentSource. 2021-10-23 16:51:44 +02:00
Admiral H. Curtiss 7f57c24172
DiscIO/DirectoryBlob: Rename the vector-reference variant of DiscContentContainer::Add() to AddReference() to make it clearer at call sites that the given vector must remain in memory. 2021-10-23 16:51:44 +02:00
Admiral H. Curtiss ad410009bb
Core/DiscIO: Extract disc and partition constants to DiscUtils.h. 2021-09-19 22:43:52 +02:00
Admiral H. Curtiss 06d41c53ce DiscIO/DirectoryBlob: Handle reads between files. 2021-09-14 07:09:55 +02:00
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
Léo Lam 8d2b0fff8a
Merge pull request #9545 from leoetlino/es-launch-timings
IOS: Improve timing accuracy for title launches (both ARM and PPC)
2021-03-27 01:47:28 +01:00
JosJuice 7d570f1edb DiscIO: Move magic constants for discs to DiscUtils 2021-03-10 00:16:37 +01:00
Léo Lam aef0760efe
IOS/ES: Emulate /sys/launch.sys for more accurate timings
Also gets rid of one static variable
2021-03-04 18:41:13 +01:00
Shawn Hoffman 84128d9532 rename Common/File to Common/IOFile 2021-01-27 14:29:48 -08:00
Lioncash 689eec5304 DiscIO: Make use of fmt-capable panic alerts
Migrates the DiscIO code over to fmt.
2020-11-11 01:09:42 -05:00
Lioncash e93fbb7c5e DiscIO: Migrate logging over to fmt
Eliminates quite a bit of the PRI* macros used for handling 64-bit
values.
2020-10-22 15:41:42 -04:00
JosJuice 047bb80337 DiscIO: Add parameters to BlobReader::SupportsReadWiiDecrypted
It's possible (but rare) for a WIA or RVZ file to support
this for some partitions but not all, and for the game and
the blob code to disagree on how large a partition is.
2020-08-29 15:18:52 +02:00
JosJuice 319c508978 DiscIO: Implement re-encryption of Wii partition data 2020-04-24 14:24:12 +02:00
JosJuice a4c7100bcc DiscIO: Use partition data offset for ReadWiiDecrypted parameter
Instead of the partition offset (which is usually 0x20000 less).
2020-04-24 14:16:55 +02:00
JosJuice 9a348ae654 DiscIO: Check for DirectoryBlob seek failure
Someone reported a problem with DirectoryBlob at
https://forums.dolphin-emu.org/Thread-feature-request-thread?pid=502820#pid502820.
I'm not sure if the change in this commit actually fixes that problem,
but it's something I found that should be changed regardless.
2020-02-09 11:21:10 +01:00
JosJuice 297b790e4f DiscIO: Add out of bounds checks for blob reading 2020-01-14 18:59:31 +01:00
Léo Lam ad75215bb0 Fix several warnings
A small, nonexhaustive set of warning fixes. The DiscIO Volume change
is a workaround for a GCC bug [1] that causes returning an unengaged
std::optional to emit annoying -Wmaybe-uninitialized warnings.
This last change alone fixes pages upon pages of warnings since
Volume.h is included from several files.

-Wstringop-truncation is another irrelevant warning for us, but
unfortunately there seems to be no way to disable it without
adding ugly pragmas wherever the warning appears.
2020-01-04 12:11:39 +01:00
Techjar ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
JosJuice 58743416bb Make the support for unencrypted Wii disc images less broken
These disc images are only used on dev units and not retail units.
There are two important differences compared to normal Wii disc images:

- The data starts 0x8000 bytes into each partition instead of 0x20000
- The data of a partition is stored unencrypted and contains no hashes

Our old implementation was just guesswork and doesn't work at all.
According to testing by GerbilSoft, this commit's implementation
is able to read and extract files in the filesystem correctly,
but the tested game still isn't able to boot. (It's thanks to their
info about unencrypted disc images that I was able to make this commit.)
2018-05-23 08:40:37 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Lioncash 75f5fcdfee Assert: Remove unused parameter from DEBUG_ASSERT
This brings the macro in line with the regular ASSERT macro, which only has one
macro parameter.
2018-03-16 13:01:11 -04:00
Lioncash 50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04: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 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