Commit graph

1301 commits

Author SHA1 Message Date
Lioncash
a1f77fd14b DiscIO/VolumeVerifier: Make use of unused variable in CheckMisc()
This variable wasn't being utilized when comments indicate that it
probably should be.
2019-05-27 10:09:55 -04:00
Techjar
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
JosJuice
bb1ed46753 Use [[fallthrough]] in DiscExtractor
This was missed in PR 6273 because the fallthrough was added to
DiscExtractor after that PR was created.
2019-05-05 10:35:45 +02:00
JosJuice
8709b21ac3 VolumeVerifier: Verify WAD contents 2019-04-09 14:18:46 +02:00
JosJuice
a469fb3150 VolumeVerifier: Check whether invalid blocks are unused 2019-04-09 14:18:46 +02:00
JosJuice
eced9d7c7e VolumeVerifier: Calculate CRC32/MD5/SHA-1 2019-04-09 14:18:46 +02:00
JosJuice
4fd2d8e8c4 VolumeVerifier: Check hashes in Wii partitions 2019-04-09 14:18:45 +02:00
JosJuice
84cbd5150f Add a Verify tab to game properties 2019-04-09 14:18:41 +02:00
JosJuice
c885fed9da DiscIO: Make Korean GC checks in Enums.cpp less fragile 2019-03-30 12:45:28 +01:00
JosJuice
c028a84531 Volume: Add a GetCertificateChain function 2019-03-30 12:45:28 +01:00
JosJuice
abb3c5bccd VolumeWad: Implement GetTicket 2019-03-30 12:45:17 +01:00
JosJuice
cf9ab6ddcc DiscExtractor: Make P prefix for partition names optional
Also added constants for common partition types.
2019-03-30 12:45:17 +01:00
JosJuice
3014dadfa8 DiscIO: Add way of checking whether blob data size is accurate 2019-03-30 12:45:17 +01:00
JosJuice
c558803cbd DiscExtractor: Fix extracting certificate chain and H3 hashes
Dolphin is currently not using this data, but still,
the way it was being extracted was not at all correct.
2019-03-21 23:07:24 +01:00
JosJuice
8842a0f402 Keep track of GameTDB ID separately from game ID
The difference between Dolphin's game IDs and GameTDB's game IDs
is that GameTDB uses four characters for non-disc titles, whereas
Dolphin uses six characters for all titles.

This fixes:

- TitleDatabase considering Datel discs to be NHL Hitz 2002
- Gecko code downloading not working for discs with IDs starting with P
- Cover downloading mixing up discs with channels (e.g. Mario Kart Wii
  and Mario Kart Channel) and making extra HTTP requests. (Android was
  actually doing a better job at this than DolphinQt!)
2019-02-25 19:54:25 +01:00
Filip Gawin
49fe9f5db1 Use empty instead of size 2019-02-13 00:03:49 +01:00
JosJuice
8baafcc523 Accurate region detection for NAND titles 2018-10-28 11:27:08 +01:00
Tillmann Karras
97cc9894e4 Update to Visual Studio's default Windows SDK 2018-10-20 00:53:08 +01:00
JosJuice
338f3467e5 DiscIO: Restore the Korean case in CountryCodeToCountry
I must've goofed or something last time I changed this.
2018-10-19 18:45:59 +02:00
JosJuice
34c05e17dc Show 1.0U instead of 1.0 for Wii Menu 1.0
As suggested by https://github.com/dolphin-emu/dolphin/pull/7487#issuecomment-429528407
2018-10-14 09:47:47 +02:00
JosJuice
7643d6d2f9 Treat Wii Menu 1.0 as NTSC-U
See the comments of https://github.com/dolphin-emu/dolphin/pull/7440.
2018-10-12 17:13:40 +02:00
JosJuice
f834ef1dfe DiscIO: Rename RegionSwitch/CountrySwitch
Callers don't need to know that these functions are implemented
with a switch statement.
2018-10-12 12:32:22 +02:00
JosJuice
7fd1784b9a DiscIO: Add more RegionSwitch/CountrySwitch comments 2018-10-12 12:32:22 +02:00
JosJuice
7607dc3573 DiscIO: Fix CountrySwitch's 'M' comment (and clarify other VC comments) 2018-10-12 12:31:52 +02:00
JosJuice
cab5e52d15 DiscIO: Fix the 'W', 'X', 'Y' and 'Z' country codes
These country codes have the unfortunate property that they are used
by Wii disc games in two different regions. We already correct for this
in VolumeGC::GetCountry and VolumeWii::GetCountry, so this commit
shouldn't really have any effect on how the game list behaves,
but it will be useful if we in the future would want to call
CountrySwitch directly without having extra code in the caller for
handling region weirdness.
2018-10-08 13:57:31 +02:00
JosJuice
504024ab46 DiscIO: Add the missing 'V' country code 2018-10-08 13:57:31 +02:00
JosJuice
57d05293fd DiscIO: Move the Korean GC mess out of VolumeGC 2018-10-08 13:56:13 +02:00
JosJuice
08d0b98988 DiscIO: Merge RegionSwitchGC and RegionSwitchWii 2018-10-05 17:54:29 +02:00
JosJuice
0bcb9923f8 Fix reading title IDs of Wii discs
Partial revert of a1db82a.
Should fix https://bugs.dolphin-emu.org/issues/11404.
2018-09-30 17:46:20 +02:00
Mat M
a1db82a72e
Merge pull request #7411 from JosJuice/wii-metadata-unencrypted
Read Wii disc metadata from the unencrypted header
2018-09-28 00:44:25 -04:00
JosJuice
facaeb615e Fix scrubbing unencrypted Wii disc images
Untested with unencrypted Wii disc images, because I don't have any.
I tested that normal Wii disc images still work, though.
2018-09-20 23:23:10 +02:00
JosJuice
ce3e0fc091 Refactor DiscScrubber::MarkAsUsedE 2018-09-20 23:23:06 +02:00
JosJuice
cec601f1fb Read Wii disc metadata from the unencrypted header
The header of a Wii disc can be read from two places: The
unencrypted area at the beginning of the disc, or the beginning of
the game partition. The two copies are usually identical (except
for 0x60 and 0x61), but there are exceptions. For most of Dolphin's
history, we have been reading from the header inside the game
partition when getting metadata. This was however not the case
starting with 4.0-4901 and ending with 5.0-3762. This commit once
again makes Dolphin read metadata from the unencrypted header,
because of the following reasons that I recently was informed about:

- The "pink fish" disc has the game ID 410E01 in the unencrypted
  header but the placeholder game ID RELSAB in the partition header.
- The revisions of some games differ between the two headers,
  with the unencrypted one making more sense.
  (See https://bugs.dolphin-emu.org/issues/11387)

For better or worse, this also means that sloppily hacked games where
only the game ID in the unencrypted header has been changed now will
use that modified game ID. And unlike with the partition header,
there is no signing or hashing that can tell us whether the
unencrypted header has been modified by someone other than Nintendo.
2018-09-12 13:41:30 +02:00
booto
800c1570ea ExportDOL: ActionReplay has a 0'd dol offset. Don't try to extract. 2018-08-02 05:32:05 -04:00
Lioncash
c825eecbc9 ChunkFile: Remove unnecessary includes
ChunkFile doesn't use any of the file utilities, so we can drop these
headers to avoid pulling in unnecessary dependencies. This also
uncovered a few indirect inclusions.
2018-06-09 16:49:59 -04:00
spycrab
f6865117e4 Qt/FilesystemWidget: Add size column 2018-06-02 18:59:56 +02:00
Lioncash
f845818cfe VolumeWii: Shorten padding checking code within CheckIntegrity()
We can just use std::any_of here to collapse the checking code down to a
single assignment as opposed to a loop. This also slightly improves on
the existing code, as this won't continue to iterate through the cluster
metadata if an entry that's non-zero is encountered.
2018-05-30 08:42:32 -04:00
Lioncash
efabfc0b54 VolumeWii: Use ReadSwapped for retrieving the partition data size in CheckIntegrity()
Also make this a little more robust by handling the failure case for
the read as well.
2018-05-30 04:34:57 -04:00
Lioncash
7bef470136 VolumeGC/VolumeWii: Dehardcode sizes where applicable
We can just use the relevant array to derive these sizes instead of hardcoding
them directly.
2018-05-30 04:14:42 -04:00
Lioncash
66122f037e Volume/VolumeGC/VolumeWii: Amend variable naming
Drops prefixed underscores and normalizes names to follow our coding
style.
2018-05-30 03:33:12 -04:00
Lioncash
a745666a60 ColorUtil: Amend function name casing
Makes the function names conform to our coding style.
2018-05-27 21:04:48 -04:00
Lioncash
ac474ff1da ColorUtil: Namespace code under the Common namespace
Given this is within Common, it should be in the Common namespace
itself.
2018-05-27 21:00:54 -04:00
Lioncash
470b09fe9d CDUtils: Amend function names
Amends the function names to follow our coding style.
2018-05-27 18:48:09 -04:00
Lioncash
1f75fa0aff CDUtils: Namespace code under the Common namespace 2018-05-27 18:30:58 -04: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
JosJuice
cc42b4354d Reimplement custom PNG banners in game list
Fixes https://bugs.dolphin-emu.org/issues/10938
and makes PNG banners available in DolphinQt2 for the first time.
2018-05-20 15:34:03 +02:00
Lioncash
011ee110bc Common/Hash: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-16 15:39:23 -04:00
Léo Lam
8317a66ea5 NandPaths: Return paths that are relative to Wii NAND
Since all FS access will go through the new FS interface (PR #6421)
in order to keep track of metadata properly, there is no need to return
absolute paths anymore.

In fact, returning host paths is a roadblock to using the FS interface.

This starts the migration work by adding a way to get paths that are
relative to the Wii NAND instead of always getting absolute paths
on the host FS.

To prepare for future changes, this commit also makes returned paths
canonical by removing the trailing slash when it's unneeded.

Eventually, once everything has been migrated to the new interface,
we can remove the "from" parameter.
2018-05-04 19:52:17 +02:00
Lioncash
b256f873ca
CMakeLists: Link in zlib privately where applicable
Also, use the target name introduced via find_package(ZLIB) instead
of hardcoding the 'z' name in the link libraries.
2018-04-13 08:29:46 -04:00
spycrab
40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
JosJuice
4387432436 DiscIO: Don't use all uppercase for enum values
Also removing some prefixes that we don't need now that we're
using enum classes instead of plain enums.
2018-03-31 14:11:32 +02:00
Lioncash
fc531993a9 DiscExtractor: Pass partition by reference rather than by value in ExtractDirectory() 2018-03-27 21:49:42 -04:00
Lioncash
680ceb7f43
DiscIO/CMakeLists: Migrate off add_dolphin_library
Continues the migration work started in 3a4c3bbe01
2018-03-24 13:54:06 -04: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
1f1dae367d Unify ISOFile (wx) with GameFile (Qt) and put it in UICommon
The original reason I wanted to do this was so that we can replace
the Android-specific code with this in the future, but of course,
just deduplicating between DolphinWX and DolphinQt2 is nice too.

Fixes:

- DolphinQt2 showing the wrong size for split WBFS disc images.

- DolphinQt2 being case sensitive when checking if a file is a DOL/ELF.

- DolphinQt2 not detecting when a Wii banner has become available
after the game list cache was created.

Removes:

- DolphinWX's ability to load PNGs as custom banners. But it was
already rather broken (see https://bugs.dolphin-emu.org/issues/10365
and https://bugs.dolphin-emu.org/issues/10366). The reason I removed
this was because PNG decoding relied on wx code and we don't have any
good non-wx/Qt code for loading PNG files right now (let's not use
SOIL), but we should be able to use libpng directly to implement PNG
loading in the future.

- DolphinQt2's ability to ignore a cached game if the last modified
time differs. We currently don't have a non-wx/Qt way to get the time.
2018-03-09 13:08:38 +01:00
Lioncash
666af4605e WiiSaveBanner: Resolve a -Wreorder warning 2017-12-03 18:34:49 -05:00
Lioncash
16a0a58b91 VolumeGC: Correct printf specifier in LoadBannerFile()
Gets rid of a warning when compiling on macOS.
2017-11-19 00:54:47 -05:00
JosJuice
b28e5fa347 Avoid forbidden characters when extracting disc partitions
We shouldn't try to create folder names that contain characters
such as : or / since they are forbidden or have special meanings.
(No officially released disc uses such characters, though.)
2017-11-08 12:04:59 +01:00
Anthony
835eff15a1
Merge pull request #6162 from JosJuice/nand-check-save-game-name
When NAND is damaged, show title names from save files
2017-11-06 23:11:34 -08:00
JosJuice
5e70af1ce5
Merge pull request #6109 from t27duck/missing_wiiware_makers_2
Update maker information to match the wiki
2017-11-06 08:05:19 +01:00
JosJuice
1dc2a85ccc Avoid UB when reading Wii volume names 2017-11-03 23:17:40 +01:00
JosJuice
5a6d90900e Add WiiSaveBanner class
This class is similar to the BannerLoaderWii class that was
removed in ee694e32.
2017-11-03 23:00:43 +01:00
Leo Lam
91dac03c45
Merge pull request #6148 from leoetlino/null-bug
NANDImporter: Construct strings correctly
2017-10-29 10:30:03 +01:00
Léo Lam
7aa083388b NANDImporter: Construct strings correctly
Use std::string(cstring, strnlen(cstring, max_length)) instead of
trying to remove extra null characters manually, which is a bit
ugly and error prone.

And indeed, the original code contained a bug which would cause
extra NULLs to not be removed at all if the string did not
end with a NULL -- causing issues down the road when constructing
paths for sub-entries.
2017-10-28 22:40:05 +02:00
Léo Lam
96d7c39891 NANDImporter: Add support for dumps that don't include keys
This adds support for NAND images that only include the NAND
(i.e. without the OTP/SEEPROM dump appended at the end of the file).
2017-10-28 21:27:18 +02:00
Léo Lam
8e0869aff6 DiscIO: Remove comments that state obvious facts 2017-10-24 11:41:54 +02:00
Léo Lam
346ca009f9 Remove NANDContentManager 2017-10-24 11:41:54 +02:00
Léo Lam
9000a042e4 Drop the direct WAD launch hack
This removes the hack that enables directly booting from WADs
without installing them first for the following reasons:

1. It makes the NAND content handling much more complicated than what
   it should be and makes future changes like permissions or booting
   NAND titles without a WAD more annoying to implement.

   Because of this hack, we needed an extra level of abstraction
   (NANDContent*) which has to read tons of things from the NAND, even
   most of the time it's useless. This in turn forces us to have
   caching, which is known to break titles and requires manual cache
   invalidations. Annoying and error prone.

2. It prevents the WAD boot code from being easily accurate. With this
   change, we can simply reuse the existing launch code, and ask IOS
   to launch the title from the NAND.

3. The hack did not work that well since it did not cover a lot of ES
   commands. And it works even less since the ES accuracy fixes.
   This results in Dolphin returning inconsistent results: a
   lot of the ES "DI" commands will just fail because the active title
   is not installed on the NAND. uid.sys is not changed, etc.

   And I'm not even talking about FS stuff -- where this would still
   totally fail, unless we add even more unnecessary hacks.

   This is not just theoretical -- the system menu and the Wii Shop are
   known to behave strangely because the hack damages the NAND
   structure, and we've already had several users report issues.

This commit makes it so WADs are always installed prior to launching.
A future commit will remove any code that was there only for the hack.
2017-10-24 11:41:54 +02:00
Anthony
5fdb19f3db Merge pull request #6108 from JosJuice/tgc-negative-file-area-shift
Fix TGC support for Zelda OoT Master Quest
2017-10-23 18:57:54 -07:00
Tony Drake
b66a72eb8f Update maker information to match the wiki
This updates the maker data to (mostly) mirror that of the Wiki:
https://wiki.dolphin-emu.org/index.php?title=GameIDs

Only maker ids from that page are now included in Dolphin. This
means no homebrew/unofficial makers.

Also, separate multiple maker names with a slash
2017-10-22 11:39:16 -04:00
FoxP
999c23b182 Add some missing WiiWare makers
Some of my WiiWare games does not have a maker :
- Blue's Journey : EAFPJ8
- Magician Lord : EACPJ8
- The King of Fighters '94 : EAGPJ8
- The Last Ninja : C9XPGX
- World Games : C9ZPGX
2017-10-08 13:04:23 +02:00
JosJuice
e743ac80d2 TGCBlob: Fix brace style 2017-10-08 12:38:12 +02:00
JosJuice
0023d5b5cb TGCBlob: Make m_file_area_shift signed
Part two of fixing TGC files where file_area_virtual_offset is
smaller than file_area_real_offset, such as Zelda OoT Master Quest.
2017-10-08 12:30:53 +02:00
JosJuice
18c7608516 TGCBlob: Use file_area_real_offset as split point
Part one of fixing TGC files where file_area_virtual_offset is
smaller than file_area_real_offset, such as Zelda OoT Master Quest.
2017-10-08 12:16:10 +02:00
JosJuice
ec7ed7b47a TGCBlob: Improve variable names 2017-10-08 12:08:13 +02:00
Tony Drake
b73a4ff5d6 Add some missing WiiWare makers
I noticed the Strong Bad games, FAST - Racing League, and Tetris Party
were lacking info in the game lists' maker column.

This adds the information based on the games' MakerID.
2017-10-01 14:53:01 -04:00
Léo Lam
6f1b156020 VolumeGC: Add a default constructor for ConvertedGCBanner
Without this, it fails to build with the following error in g++ 7.2.0:

> constructor required before non-static data member has been parsed
2017-09-15 20:47:49 +02:00
JosJuice
f294599e73 DiscIO: Use Common::Lazy for loading GC banners 2017-09-15 19:21:50 +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
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
JosJuice
3f9eec9ae4 DirectoryBlob: Use DiscContent for ReadNonPartition too
ReadPartition and ReadNonPartition are now unified into
ReadInternal, with a parameter controlling whether
the read is in a partition or not.
2017-08-01 11:36:40 +02:00
JosJuice
a0fa350ca6 DirectoryBlob: Use DiscContent for everything in ReadPartition 2017-08-01 11:36:40 +02:00
JosJuice
936ef5b9dd DirectoryBlob: Let DiscContent be backed by memory instead of file 2017-08-01 11:36:40 +02:00
JosJuice
e1321b131d DirectoryBlob: Create a DiscContent class for use in m_virtual_disc 2017-08-01 11:36:40 +02:00
JosJuice
b56214789e DirectoryBlob: Make some functions private 2017-08-01 11:36:40 +02:00
JosJuice
b8d8c7370f DirectoryBlob: Move constants to .cpp file 2017-08-01 11:36:40 +02:00
JosJuice
37c09343d8 Turn VolumeDirectory into DirectoryBlob
This lets VolumeDirectory/DirectoryBlob skip implementing
various volume functions like GetGameID, GetBanner, etc.
It also lets us view extracted discs in the game list.

This ends up breaking the boot process for Wii
DirectoryBlobs due to workarounds being removed from the
boot process, but that will be fixed later by adding
proper DirectoryBlob support for things like TMDs.

We now expect the directories to be laid out in a certain
format (based on the format that WIT uses) instead of requiring
the user to set the DVD root and apploader path settings.
2017-08-01 11:36:40 +02:00
JosJuice
5f8935932d Blob: Add interface for reading decrypted Wii data directly
This is useful for blob types that store Wii data unencrypted
(such as WIA and discs extracted to directories) so that
we don't have to waste CPU time encrypting in the blob code
just to decrypt right afterwards in the volume code.
2017-08-01 11:36:40 +02:00
Leo Lam
764c93f932 Merge pull request #5683 from JosJuice/volume-wii-defer
VolumeWii: Defer loading tickets, TMDs and keys until when needed
2017-08-01 17:11:30 +08:00
Leo Lam
c207a1072d Merge pull request #5795 from JosJuice/gc-region-detection
Improve GameCube region detection
2017-07-20 14:13:11 +08:00
JosJuice
be8e93f472 Ensure that Volume::GetRegion doesn't return invalid enum values 2017-07-16 14:52:17 +02:00
JosJuice
db1c534b3e Add warning comments to RegionSwitch and code that uses it 2017-07-16 14:49:28 +02:00
JosJuice
c8b4645039 Detect Korean GC releases as Korean when possible
According to http://scanlines16.com/en/blog-3/retro-gaming/game-cube/gamecube-korean-master-list/,
Korean GC releases use the following country codes:
- E or W for games in English
- K for games in Korean
- Unknown value for games in Japanese (my guess is that they might
  have made the discs bit-for-bit identical to Japanese releases
  because the regions of these games are already set to NTSC-J)

As far as I know, the GC has no Taiwanese releases, which is what
the W country code is used for on the Wii. But I could be wrong.

A small note: The country_byte == 'K' check in the code isn't
actually necessary as long as RegionSwitchGC returns NTSC_J
for 'K', but I thought it would be better to not rely on that.
2017-07-16 14:30:41 +02:00
JosJuice
ebf0f64a01 Detect GC region based on the actual region value
The county code isn't 100% reliable for detecting the region.
For instance, some games released in Korea have the country
code E even though they're region-locked to NTSC-J consoles.

This commit makes the GC disc region detection match the Wii
disc region detection (apart from the region value being in
a different place on the disc).
2017-07-16 14:29:43 +02:00
JosJuice
fe10e8aa6c Fix RegionSwitchGC for the value 'K'
Korean GameCube releases have their region set to NTSC-J.
2017-07-16 13:52:53 +02:00
JosJuice
c64d668c3c Use find_first_not_of in FileSystemGCWii::FindFileInfo 2017-07-16 13:19:18 +02:00
Leo Lam
b6c3479bb4 Merge pull request #5720 from JosJuice/file-metadata
FileUtil: Redesign Exists/IsDirectory/GetSize
2017-07-11 00:28:34 +02:00
JosJuice
edc7a4c895 Fix reading FSTs for multi-disc games
It's a wonder that this managed to work for any discs at all...
2017-07-08 15:17:05 +02:00
JosJuice
78217532e5 VolumeWii: Defer loading tickets, TMDs and keys until when needed
This should make building the game list cache a tiny bit
faster, since we won't have to read anything from
partitions other than the game partition.
2017-07-04 21:31:24 +02:00
JosJuice
93e9740683 Drop unnecessary check from FileSystemGCWii::FindFileInfo
If the current file_info is a file, the ranged for loop will
run 0 times, and we'll reach the last line of the function.
2017-07-04 20:40:32 +02:00
JosJuice
6a31d2598e Support leading slashes in FileSystemGCWii::FindFileInfo 2017-07-04 20:40:08 +02:00
JosJuice
333b6d99d2 VolumeWii: Change the format of partition maps
Having a separate map for each type of data is a bit unnecessary.
2017-07-04 16:20:13 +02:00
JosJuice
5ca3aee00a FileUtil: Add a class for Exists/IsDirectory/GetSize
Some code was calling more than one of these functions in a row
(in particular, FileUtil.cpp itself did it a lot...), which is
a waste since it's possible to call stat a single time and then
read all three values from the stat struct. This commit adds a
File::FileInfo class that calls stat once on construction and
then lets Exists/IsDirectory/GetSize be executed very quickly.

The performance improvement mostly matters for functions that
can be handling a lot of files, such as File::ScanDirectoryTree.

I've also done some cleanup in code that uses these functions.
For instance, some code had checks like !Exists() || !IsDirectory(),
which is functionally equivalent to !IsDirectory(), and some
code was using File::GetSize even though there was an IOFile
object that the code could call GetSize on.
2017-06-29 19:07:29 +02:00
JosJuice
a59edfe8cf FilesystemPanel: Put partitions in separate folders when extracting all partitions 2017-06-28 22:25:27 +02:00
JosJuice
478c4fd1f3 FileSystemGCWii: Use DiscExtractor's FST offset/size functions 2017-06-28 22:25:09 +02:00
JosJuice
1b6506f4e8 DiscExtractor: Add support for more things to extract 2017-06-28 22:24:33 +02:00
JosJuice
0b068d84d5 FilesystemPanel: Overhaul the right-click menu 2017-06-28 22:23:01 +02:00
JosJuice
39ff203c1e DiscExtractor: Don't create extra folders when extracting a folder
Before, if you extracted a directory like /map/Final/Release/,
Dolphin would create the nested folders map, Final and Release
in the output directory and put the files in Release instead of
just putting the files directly in the output directory.
2017-06-28 22:22:41 +02:00
JosJuice
6d51992648 Move ExtractDir from FilesystemPanel to DiscExtractor 2017-06-28 22:22:31 +02:00
JosJuice
baf3a3b188 DiscExtractor: Don't hardcode names in ExportApploader and ExportDOL 2017-06-28 22:22:13 +02:00
JosJuice
89c901780e DiscScrubber: Deduplicate code for writing to file 2017-06-28 22:22:04 +02:00
JosJuice
1f31390b54 DiscExtractor: Improve error handling 2017-06-28 22:21:55 +02:00
JosJuice
a17272c146 DiscExtractor: Minor cleanup 2017-06-28 22:21:48 +02:00
JosJuice
d06b532150 DiscIO: Move parts of Filesystem to the new file DiscExtractor 2017-06-28 22:21:23 +02:00
JosJuice
23bb029250 DiscIO: Add convenience methods IsDisc and IsWii for Platform enum 2017-06-28 21:46:43 +02:00
JosJuice
7992c786b9 Fix references to CACHE_REVISION in DiscIO comments
The ISOFile.cpp one has been moved, and the GameFile.cpp one isn't
used for anything because DolphinQt2 doesn't support caching yet.
2017-06-27 21:32:14 +02:00
Léo Lam
6d821de2b9 IOS: Use a std::array for the title key instead of vector
The title key is always 16 bytes, so it doesn't make sense to make it
a std::vector.
2017-06-27 00:01:20 +02:00
JosJuice
b440dbd998 FileSystemGCWii: Use case insensitive comparison in FindFileInfo
This was a regression in f49b64c. Some games seem to name the
banner file OPENING.BNR instead of opening.bnr.

Should fix https://bugs.dolphin-emu.org/issues/10354
2017-06-24 14:06:31 +02:00
Starsam80
5399311a13
NANDImporter: Improve certificate extraction 2017-06-19 01:23:58 -06:00
Leo Lam
8f460a1cda Merge pull request #5611 from JosJuice/reorganize-file-namespace
Reorganize File namespace
2017-06-15 23:28:36 +02:00
JosJuice
f09ceaa735 Move IOFile to a separate file
Reduces the number of files that need to be recompiled
when making changes to FileUtil.h.
2017-06-15 21:33:50 +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
e3a2cd827a Filesystem: Do more validity checking in the constructor
This makes it possible to catch errors earlier so that file systems
simply fail to load instead of behaving oddly. It also makes it possible
to check for errors that weren't checkable before, like the end of a
directory being after the end of the parent directory.
2017-06-14 15:25:05 +02:00
JosJuice
ee27be06d7 Filesystem: Add a cache for finding file info by disc offset
FileMonitor calls this every time a read happens, and there's no code that
only calls this a small number of times, so having a cache is worthwhile.
2017-06-14 15:25:02 +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
ee2b88ebb6 Filesystem: Store pointer to beginning of FST in file infos
Needed for the next commit.
2017-06-13 22:44:15 +02:00
JosJuice
1262f08ac1 Filesystem: Better validity checking
Now that the FST in read in the constructor, m_Valid
can be set to false when there are errors in the FST.
2017-06-13 22:44:11 +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
f49b64caff Filesystem: Rewrite finding file info by path for performance
Instead of calling GetPathFromFSTOffset for every file info, FindFileInfo
now only looks at names in directories that are included in the path.
For the common case of searching for "opening.bnr", this means that
only root-level files and directories have to be searched through.
2017-06-13 22:41:02 +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
95bc57cff3 DiscScrubber: Use FileInfo::IsDirectory instead of bit magic 2017-06-13 17:01:39 +02:00
JosJuice
2578a3553b VolumeDirectory: That's not what "4 byte" means 2017-06-09 20:00:36 +02:00
JosJuice
240cb0ca11 VolumeDirectory: Use correct endianness when writing apploader -1 2017-06-09 20:00:17 +02:00
JosJuice
d2b69f963a VolumeWii: Don't set m_game_partition until we know partition is valid
Without this, we can end up in an inconsistent state where
m_game_partition is set to a partition that isn't in the
partition maps.
2017-06-09 18:39:30 +02:00
Shawn Hoffman
e1a3e41bf3 fix various instances of -1 being assigned to unsigned types 2017-06-07 19:52:07 -07:00
Léo Lam
0ddb6f9328 DiscIO: Use the correct offset shift for DOL exports 2017-06-07 22:41:00 +02:00
Léo Lam
0b71b60ef0 DiscIO: Fix formatting 2017-06-07 22:40:51 +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
69f01bac39 Reimplement support for unencrypted Wii discs
You may want to read the PR #2047 comments before reading this.

Dolphin attempts to support an unencrypted type of Wii discs
that apparently is identified by a 4-byte integer at 0x60
being non-zero. I don't know what discs (if any) would be
using that format, so I haven't been able to test Dolphin's
support for it, but it has probably been broken for a while.

The old implementation is very short but also strange.
In CreateVolumeFromFilename, we read a 4-byte integer from
0x60, and if it's non-zero, we create a CVolumeGC object
instead of a CVolumeWiiCrypted object. This might seem like
it makes no sense, but it presumably worked in the past
because IsVolumeWiiDisc used to check the volume type by
reading the magic word for Wii straight from the disc,
meaning that CVolumeGC objects representing unencrypted Wii
discs would be treated as Wii discs by pretty much all of
Dolphin's code except for the volume implementation code.
(It wasn't possible to simply use CVolumeWiiCrypted, because
that class only handled encrypted discs, like the name says.)

However, that stopped working as intended because of ace0607.
And furthermore, bb93336 made it even more broken by making
parts of Dolphin expect that data read from Wii discs needed
to be decrypted (rather than the volume implementation
implicitly deciding whether to decrypt when Read was called).
Disclaimer: Like I said before, I haven't been able to test
any of this because I don't have any discs that use this
unencrypted Wii disc format, so this is all theoretical.

Later, PR #2047 tried to remove Dolphin's support for
the unencrypted Wii disc format because seemingly no
discs used it, but the PR got closed without being merged.
At the end of that PR, I said that I would make a new PR
with a better implementation for the format after PR #2353
was merged. Now that PR #2353 is merged (two years later...)
and PR #5521 is merged, the new implementation was easy to
make, and here it is!

Untested.
2017-06-05 14:54:37 +02:00
JosJuice
c3fa0d6edf DiscIO: Use std::optional in Volume and Blob 2017-06-05 13:26:51 +02:00
Léo Lam
d9fd056803 Fix minor formatting issues
These were not caught by the lint script while it was broken.
2017-06-05 02:32:19 +02:00
JosJuice
2ce9281f77 Don't show FST size in game properties
Normal users don't care about it. In fact, people care so
little about it that the Wii implementation of it was broken
starting from when it was implemented (eb65601) to 7 years
later (e0a47c1), apparently without anyone reporting it.
2017-06-04 14:20:20 +02:00
JosJuice
703858e217 Merge pull request #5522 from leoetlino/simpler-gettitleid
DiscIO: Use std::optional for GetTitleID instead of pointer
2017-06-04 08:57:36 +02:00
Shawn Hoffman
397720a9fe might as well update yet some more pointless version numbers.. 2017-06-03 18:20:40 -07:00
Léo Lam
1a17c02d6f DiscIO: Use std::optional for GetTitleID instead of pointer
This makes the interface slightly cleaner and a bit more consistent
with the other getters. Still not fully the same, since the others
don't really handle failures with std::optional; but at least the
value is returned by value now, as opposed to having the function
take a pointer to a u64.
2017-06-03 21:56:33 +02:00
Leo Lam
fbad958f03 Merge pull request #5518 from JosJuice/replace-weird-brace-thingy
Replace {{}} with {}
2017-06-03 21:16:36 +02:00
JosJuice
1c926dcae2 Replace {{}} with {}
IIRC we were only using {{}} because {} used to cause errors
on the FreeBSD buildbot.
2017-06-03 18:14:22 +02:00
Léo Lam
9d52ab5144 IOS/ES: Move ImportTicket write function
This commit moves the write function to where it should be (IOS),
especially when ES::ImportTicket() is the only place to use it.

Prevents misusing the ticket import function, and removes one unsafe
direct write to the NAND that does not go through IOS.

This also fixes the destination path: the session root is the one which
should be used for determining the ticket path, not the configured one.
2017-06-03 17:43:16 +02:00
Léo Lam
62d08e2d17 DiscIO: Fix the wrong NAND root being used
The whole NANDContentLoader stuff is truly awful and will be removed
as soon as possible.

For now, this fixes a bug that was exposed by std::optional::operator*.
2017-06-03 12:36:24 +02:00
Léo Lam
545006f666 Use std::optional for ESFormats/SharedContentMap 2017-06-03 12:36:24 +02:00
BhaaL
072c161445 upgrade to Windows SDK 10.0.15063.0
this is required for /permissive- to work, because some headers in the
Windows SDK use Microsoft extensions that are not allowed in standards mode
2017-05-28 13:37:31 +02:00
Léo Lam
b5a2f34a37 Check TMD sizes using the actual constant
0x49e4 is the actual maximum TMD size (which is checked against in ES).
IsValidTMDSize is added to ESFormats to avoid duplicating the constant.
2017-05-26 11:27:43 +02:00
Pierre Bourdon
d592bdd4d4 Migrate to Visual Studio 2017.
Auto-generated by the IDE, I'll trust it knows what it's doing.
2017-05-25 15:58:59 -07:00
Léo Lam
cf0c4455cd Fix indirect includes 2017-05-22 10:39:36 +02:00
Silvan Jegen
d8db6a7139 NANDImporter: fix printf warning
gcc complains that the printf %x formatting instruction expects an
'unsigned int' but we pass a 'size_t'.  We add the 'z' length formatting
specifier used for 'size_t'
2017-05-21 13:06:40 +02:00
JosJuice
1575020c3a VolumeWiiCrypted: Get title keys from TicketReader 2017-05-20 20:44:12 +02:00
JosJuice
26f5b53ecb VolumeWiiCrypted: Get title IDs from TicketReader 2017-05-20 20:43:31 +02:00
JosJuice
5c68a03ae4 VolumeWiiCrypted: Cache TMDs and tickets 2017-05-20 20:42:44 +02:00
Starsam80
3229cde292
NANDImporter: Add logging 2017-05-19 16:36:06 -06:00
Starsam80
618eb9f743
NANDImporter: Use a indeterminate progress meter 2017-05-19 16:31:47 -06:00
JosJuice
78effbabc6 Replace some usages of IVolume::ReadSwapped with IBlobReader::ReadSwapped
Skips needing to specify PARTITION_NONE.
2017-05-19 21:31:47 +02:00
JosJuice
fcb2c5bd29 Remove CBlobBigEndianReader
We can simply put ReadSwapped directly in IBlobReader.
2017-05-19 21:23:00 +02:00
JosJuice
ac5c82b36b DiscIO: Remove VolumeCreator
This file is pretty small now that it doesn't handle Wii
partitions anymore, so let's move its contents to Volume.cpp.
This is also more consistent with how blob creation works.
2017-05-19 18:33:21 +02:00
JosJuice
56b218a750 DiscIO: Simplify volume creation
Basically inlining GetDiscType into CreateVolumeFromFilename.
2017-05-19 18:18:43 +02:00
JosJuice
fa06d10f4a Merge pull request #2353 from JosJuice/wii-partition-cleanup
VolumeWiiCrypted: Replace ChangePartition with a partition parameter
2017-05-16 23:06:32 +02:00
JosJuice
2bcad57225 Check file system validity before reading opening.bnr
This happened to work without any problems because the only way for a
file system to be invalid was to not have the right GC/Wii magic word
in the unencrypted area, and a volume could not be created without
having the right GC/Wii magic word there. Now that file systems read
the magic word from a partition instead, a fix is needed.
2017-05-16 22:59:01 +02:00
JosJuice
639ce6c484 FileSystemGCWii: Replace m_Wii with m_offset_shift
I replaced m_OffsetShift with m_Wii in bb93336 to support
the decrypt parameter for read functions. Doing that is no
longer necessary, so m_offset_shift is now used like before.
2017-05-16 22:58:57 +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
JosJuice
74d84c5af2 VolumeWiiCrypted: Turn m_dataOffset into a constant 2017-05-16 22:56:53 +02:00
JosJuice
405643b902 VolumeWiiCrypted: Use std::min 2017-05-14 22:52:21 +02:00
JosJuice
5c46810a36 VolumeWiiCrypted: Store last decrypted offset instead of block number
This makes it unnecessary to reset m_last_decrypted_offset
when changing partition.
2017-05-14 22:52:21 +02:00
Léo Lam
c8bffb0153 Reuse the IOS code for WAD installation
* Less code and logic duplication.

* Fixes a bug with the data dir not being created, steps being done in
  the wrong order.
2017-05-14 15:30:42 +02:00
Léo Lam
afcda22da9 DiscIO: Add GetContent() for reading content from WADs
Direct access to the WAD bytes is required to read contents with proper
padding data (since they can sometimes end up being outside of the
data app section). Allowing the whole buffer to be accessed directly
would be error prone, so this commit adds GetContent() to WiiWAD
for getting raw content data by index.
2017-05-14 15:30:42 +02:00
Léo Lam
bacf52384f IOS/ES: Implement DeleteTitleContent properly
Just like DeleteTitle, Using CNANDContentManager is overkill,
inefficient and useless. And it results in a few failures in
situations where a delete should just always work.

But here it gets bonus points, because it manages to actually use
the TMD for deleting contents, when IOS does none of that and just
deletes files ending with .app in the title content directory. :)
2017-05-13 00:34:58 +02:00
JosJuice
36b9e3dd35 Don't duplicate code for getting paths based on title IDs
I've seen the expression (u32)(title_id >> 32), (u32)title_id
a few more times in my life than I would've liked to...
2017-05-06 17:45:08 +02:00
Michael Maltese
f04747e910 NANDImporter: fix printf warning
Fixes warning:

```
Source/Core/DiscIO/NANDImporter.cpp:55:17: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
                file.GetSize(), NAND_BIN_SIZE);
                ^~~~~~~~~~~~~~
1 warning generated.

```
2017-05-02 15:13:46 -07:00
spycrab
e66ad018f4 Convert VolumeDirectory names back to SHIFT-JIS (issue #9988) 2017-05-01 14:08:47 +02:00
Léo Lam
f56a9b660d Merge pull request #5077 from ds84182/volume_directory_off_by_uno
Fix VolumeDirectory for Wii games
2017-04-29 23:57:32 +02:00
Léo Lam
f8ab521e6d Merge pull request #5335 from JosJuice/clinclude-tgcblob
Fix TGCBlob.h's listing in DiscIO.vcxproj.filters
2017-04-29 13:35:26 +02:00
JosJuice
d1b54f7697 Fix TGCBlob.h's listing in DiscIO.vcxproj.filters 2017-04-28 18:16:08 +02:00
Léo Lam
dae950ff90 IOS: Implement UID/GID changes for the PPC
This will be required for permission checks in the future.

Note that this is only for the PPC as we do not have actual processes.
Keeping track of other modules' UIDs/GIDs is virtually useless anyway.

UID/GID changes are implemented in the following functions:

* ES_Launch
* ES_DIVerify

ES_SetUid is not implemented yet because it'd need further changes.
2017-04-23 23:09:44 +02:00
Dwayne Slater
1b9268485c VolumeDirectory: Pass address shift to WriteEntryData as argument 2017-04-15 14:04:17 -04:00
Dwayne Slater
108d59b131 VolumeDirectory: Correctly check name_offset alignment in assert 2017-04-15 14:04:10 -04:00
Dwayne Slater
138b0cb14e VolumeDirectory: Align the name table size up properly
If the name table isn't rounded up, a Wii game can read an incorrect
number of bytes when fetching the FST.
2017-04-15 14:03:31 -04:00
Dwayne Slater
9d633307e3 VolumeDirectory: Shift parent_entry_index by m_address_shift
Parent entrys were written correctly for GameCube (since the address
shift is 0), but not for Wii (since the address shift is 2).
2017-04-15 13:53:59 -04:00
Dwayne Slater
d3e9569cf0 VolumeDirectory: Compare case-insensitive file names as uppercase, not lowercase
Fixes file ordering in games that use ASCII characters between lowercase
'z' and uppercase 'A' (underscores).

MySims Kingdom has the files "terrainLightMapTinted.shader",
"terrainLightMapTintedGrid.shader", and
"terrainLightMapTinted_no_shadow.shader". In lowercase,
"terrainLightMapTinted_no_shadow.shader" comes before
"terrainLightMapTinted.shader" and "terrainLightMapTintedGrid.shader",
which is invalid.
2017-04-15 13:53:53 -04:00
Dwayne Slater
7908302782 VolumeDirectory: Fix off-by-one in entry count calculation
The size field in FSTEntry contains the total amount of children, not
including the parent, but the parent needs to be included.

VolumeDirectory: Fix off-by-one in entry count calculation

The size field in FSTEntry contains the total amount of children, not
including the parent, but the parent needs to be included.
2017-04-15 13:52:46 -04:00
Starsam80
6bccc13f3b
Add BootMii NAND import functionality 2017-04-09 13:14:05 -06:00
Mat M
80a812322e Merge pull request #5152 from ligfx/disciomaybeuninitialized
DiscIO: initialize out args to ReadSwapped (fixes warning)
2017-03-31 00:11:53 -04:00
Léo Lam
7b17163a7a IOS/ES: Move shared content map, uid.sys code
These are all specific to ES and belong there.

The SharedContentMap and UIDSys classes were also modernised.
2017-03-26 12:16:28 +02:00
Michael Maltese
4cd9a2ef1e DiscIO: make sure to initialize out args to ReadSwapped
Fixes warnings:

```
../Source/Core/DiscIO/VolumeGC.cpp: In member function 'virtual u8 DiscIO::CVolumeGC::GetDiscNumber() const':
../Source/Core/DiscIO/VolumeGC.cpp:178:10: error: 'disc_number' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   return disc_number;
          ^
../Source/Core/DiscIO/VolumeWiiCrypted.cpp: In member function 'virtual u8 DiscIO::CVolumeWiiCrypted::GetDiscNumber() const':
../Source/Core/DiscIO/VolumeWiiCrypted.cpp:258:10: error: 'disc_number' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   return disc_number;
          ^
../Source/Core/DiscIO/VolumeWiiCrypted.cpp: In member function 'virtual IOS::ES::TMDReader DiscIO::CVolumeWiiCrypted::GetTMD() const':
../Source/Core/DiscIO/VolumeWiiCrypted.cpp:123:20: error: 'tmd_address' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   tmd_address <<= 2;
                    ^
```
2017-03-25 13:50:23 -07:00
JosJuice
a31bb7a27c Clarify the log message for unknown Wii Menu regions
Saying just "title" made it seem like we are showing the title
ID, but what we actually are showing is the title version.
2017-03-24 16:44:38 +01:00
Michael Maltese
0767c3d94d DiscIO: add empty UNKNOWN_REGION case (fixes warning)
Fixes warning:

```
dolphin/Source/Core/DiscIO/Enums.cpp:171:11: warning: enumeration value 'UNKNOWN_REGION' not handled in switch [-Wswitch]
  switch (GetSysMenuRegion(title_version))
          ^
```
2017-03-23 20:14:11 -07:00
Anthony
26bb26fe54 Merge pull request #4901 from JosJuice/filemonitor-redesign
FileMonitor redesign
2017-03-20 12:46:19 -07:00
Matthew Parlane
8eb26d298e Merge pull request #5099 from JosJuice/wii-menu-strings
Display nicer version strings for the Wii Menu
2017-03-20 14:03:04 +13:00
Matthew Parlane
9da35edd15 Merge pull request #5093 from JosJuice/six-char-game-ids
Use 6-char game IDs for NAND tiles (if they are printable)
2017-03-20 13:38:35 +13:00
Léo Lam
194b0ae36d IOS: Add NandUtils
This keeps the ES specific NAND code in a single place and makes it
reusable. Eventually, other ES specific code will be moved to it.
2017-03-19 11:10:45 +01:00
Anthony
9604a06921 Merge pull request #5102 from leoetlino/channel-title-type
Check whether WAD is a channel before reading names
2017-03-18 23:30:27 -07:00
Léo Lam
c987f58319 Check whether WAD is a channel before reading names
Dolphin assumes that content 0 is opening.bnr, without checking
whether content 0 exists or if it is even supposed to be there (it's
only there for channels). This results in sometimes reading garbage.

This adds a check to only try to read names from content 0's header
if the title is a channel (channel, system channel or game channel).
2017-03-18 19:07:11 +01:00
JosJuice
9d54e4a9de Return a more meaningful type from GetSysMenuRegion 2017-03-18 10:13:36 +01:00
JosJuice
04c49aa395 Fix GetSysMenuRegion's handling of Wii Menu 1.0
This was a regression in 58bd129.
2017-03-18 10:13:31 +01:00
JosJuice
19d6092847 Display nicer version strings for the Wii Menu
The Tools > Load System Menu option displays the version of the
installed Wii Menu. This commit changes the way we display that
version, like so: "Load System Menu 514P" -> "Load System Menu 4.3E"

The numbers are from http://wiibrew.org/wiki/System_Menu
2017-03-18 10:08:13 +01:00
JosJuice
ff7425214a Use 6-char game IDs for NAND tiles (if they are printable)
5.0-2712 made ES's code for setting the game ID use the
title ID converted to hex (except for disc titles) instead
of using a 6-char game ID like before. Then, 5.0-2830 made
us use that code even when loading game INIs. This breaks the
expectations of both users and the game INIs we ship with.

This commit makes Dolphin use 6-char game IDs for all
titles (unless the 6-char ID would contain unprintable
characters, which is the case with e.g. the Wii Menu).

I'm also putting unprintability checks in VolumeWad
for consistency.
2017-03-16 11:21:31 +01:00
JosJuice
58bd129987 Simplify GetSysMenuRegion 2017-03-16 10:45:57 +01:00
JosJuice
b470fa5454 FileMonitor redesign
Advantages:

* Simpler code in general
* No extra volume objects created
* Now actually notices if the disc or partition gets
  changed while the core is running
* No longer picks up on disc access done by the GUI
  (it used to do so as long as the core was running)
* Gets rid of a Core dependency in DiscIO

There are two performance disadvantages:

* FileMonitor is now a bit slower when used with VolumeDirectory
  because FileMonitor now always uses the FileSystemGCWii code
  for finding filenames instead of VolumeDirectory finding the
  filename on its own and directly hooking into FileMonitor.
  But this isn't such a big deal, because it's happening on the
  DVD thread, and my currently unmerged file system PR will make
  FileSystemGCWii's file finding code about as fast as
  VolumeDirectory's.
* FileMonitor's creation of the file system object is now
  done on the CPU thread instead of the DVD thread, and
  it will be done even if FileMonitor logging is disabled.
  This will be fixed in the next commit.
2017-03-13 17:13:20 +01:00
JosJuice
acec02ffc6 Remove Blob nullptr checks from Volume code
There's no point in creating a volume without a blob,
since essentially all the functionality of a volume
requires a blob to be used.

Also, VolumeCreator doesn't support creating volumes
without blobs (it can't even figure out the volume type
unless it gets a blob), so it's currently impossible
for a volume to be created without a blob.
2017-03-13 14:13:55 +01:00
JosJuice
135733e285 Volume: Use ReadSwapped more
Most of the Volume code was written before this
convenience function was added. Let's use it more.

Also deleting m_pReader nullptr checks that are
unnecessary because of Read (which ReadSwapped calls)
already having a nullptr check.
2017-03-09 21:03:28 +01:00
JosJuice
ab616145c2 Get the right game ID for SSBB's Masterpiece partitions 2017-03-09 18:47:40 +01:00
Mat M
7fa14169e9 Merge pull request #5007 from lioncash/swap
Common: Move byte swapping utilities into their own header
2017-03-05 09:45:29 -05:00
Léo Lam
b1ffbef5ce IOS/ES: Implement ES_GetOwnedTitles 2017-03-04 20:33:35 +01:00
Lioncash
552c0d8404 Common: Move byte swapping utilities into their own header
This moves all the byte swapping utilities into a header named Swap.h.

A dedicated header is much more preferable here due to the size of the
code itself. In general usage throughout the codebase, CommonFuncs.h was
generally only included for these functions anyway. These being in their
own header avoids dumping the lesser used utilities into scope. As well
as providing a localized area for more utilities related to byte
swapping in the future (should they be needed). This also makes it nicer
to identify which files depend on the byte swapping utilities in
particular.

Since this is a completely new header, moving the code uncovered a few
indirect includes, as well as making some other inclusions unnecessary.
2017-03-03 17:18:18 -05:00
Léo Lam
4d776ffa8f IOS/ES: Keep track of the active title properly
This changes ES to keep track of the active title properly,
just like IOS:

* It is NOT changed on resource manager open/close.
* It is reset on IOS reload.
* It is changed by ES_DIVerify and ES_Launch.

IOS stores the active title in a structure like this:

    struct ESTitleContext
    {
      Ticket* ticket;
      TMD* tmd;
      u32 active;
    };

With this commit, we also do keep the Ticket and TMD around. This
makes some of the DI ioctlvs (which return data about the current
active title) trivial to implement in the future.

This fixes the System Menu not being able to see update partitions
and also allows us to change Dolphin's active game info in the future.
2017-03-02 20:28:01 +01:00
Mat M
78e7f4aae3 Merge pull request #4984 from leoetlino/content-fixes
IOS/ES: Title import fixes + hack removals (fix for System Menu disc updates)
2017-03-02 14:17:29 -05:00
Lioncash
ee61bd6f2e CMakeLists: Normalize whitespace
Normalizes tabs to spaces to follow our codebase's indentation style.
2017-03-01 14:53:23 -05:00
Léo Lam
ac27aff9c8 Add ES::Content::IsShared to avoid hardcoding 0x8000 2017-03-01 17:36:07 +01:00
Léo Lam
6327a29847 IOS/ES: Implement ES_Export* ioctlvs
This should allow channels to be copied to the SD properly.
2017-02-27 21:26:28 +01:00
Léo Lam
44a3db21e4 ES: Make sure the TMD and ticket are valid before use 2017-02-26 19:46:30 +01:00
Léo Lam
5104caf6a6 Move AES code to Common/Crypto 2017-02-26 19:46:30 +01:00
Léo Lam
c1a139e8ac Use ESFormats for TMDs
We already have a TMDReader, so let's actually use it.

And move ESFormats to IOS::ES, since it's definitely part of IOS.
This adds a DiscIO dependency on Core which will be fixed in a
follow-up PR.
2017-02-26 19:46:29 +01:00
Léo Lam
bf1f70db0a Move the ticket code to ESFormats
This moves some parsing code for tickets and ticket views to ESFormats
instead of duplicating it over DiscIO and Core.
2017-02-26 19:46:28 +01:00
JosJuice
298e81881f Forward declare IBlobReader in Volume headers
We have to do this (or include Blob.h) since the
constructors take unique_ptr<IBlobReader> parameters.
2017-02-19 08:40:30 +01:00
JosJuice
f80f7b6f9c Merge pull request #4883 from JosJuice/dvd-timing-address-translation-2
DVDInterface: Translate Wii partition offsets for timing purposes
2017-02-15 21:12:42 +01:00
JosJuice
49ec22bc42 DVDInterface: Translate Wii partition offsets for timing purposes
Until now, Dolphin has been using the wrong values
for calculating DVD timing for decrypted Wii reads
(which Wii games essentially always use).
2017-02-12 09:37:39 +01:00
JosJuice
c96bcace2f VolumeWiiCrypted: Use constant naming style for constants 2017-02-11 12:56:48 +01:00
Léo Lam
850802ea88 Get rid of a singleton for NAND shared contents
This also allows shared contents to be installed to the configured root
when installing a WAD.
2017-02-10 22:46:38 +01:00
Léo Lam
7a1f676ef4 Always use configured root when installing WAD
This prevents Dolphin from writing to /sys/uid.sys (on the host; root
partition) when installing a WAD before starting emulation, because
the session root is not initialized at that moment.

Incidentally, this also gets rid of a singleton.
2017-02-10 19:12:08 +01:00
Lioncash
e07383a783 Core: Convert State enum into an enum class 2017-02-05 08:32:23 -05:00
Matthew Parlane
017e8050b6 Merge pull request #4746 from JosJuice/volumedirectory-sort-case-insensitive
VolumeDirectory: Use case-insensitive comparison when sorting
2017-01-27 18:23:14 +13:00
JosJuice
104faa9fb3 VolumeDirectory: Use case-insensitive comparison when sorting
This fixes a regression from 5.0-1556, but I don't know why
the regression occurred or why this fixes it. (Many games
failed to fully boot - I tried Metroid Prime and Twilight
Princess (both GC), and they never got to the title screen.)
2017-01-25 15:07:07 +01:00
Léo Lam
3d21280ab4 DiscIO: Fix out-of-bounds access in NANDContentDataBuffer
Accessing buffer[start + size] triggers an error (and a crash) in debug
builds. Using std::copy_n fixes this.
2017-01-23 21:49:26 +01:00
Léo Lam
b892d78872 VolumeWad: Implement GetTMD()
This allows getting useful info like the required IOS version for WADs
(for showing it in the UI, for example).
2017-01-23 20:59:02 +01:00
Léo Lam
f89aaee91a VolumeWad: Remove useless else after return 2017-01-23 18:17:34 +01:00
Léo Lam
2cd287baf7 VolumeWad: Add missing forward declaration 2017-01-23 18:17:34 +01:00
Léo Lam
6128679396 VolumeWad: Clean up variable naming 2017-01-23 18:07:23 +01:00
Léo Lam
6d909b3e30 VolumeWad: In-class initialise member variables 2017-01-23 18:07:21 +01:00
Markus Wick
90ee85f4e8 Merge pull request #4714 from JosJuice/wbfs-file-entry
Fix -Wshadow warning for file_entry
2017-01-22 17:56:51 +01:00
JosJuice
79f3b5c5ff Fix -Wshadow warning for file_entry
This struct didn't follow our naming convention,
so let's rename the struct itself instead of
the variable that triggered the warning.
2017-01-22 17:27:37 +01:00
BhaaL
07d1f18f53 CompressFileToBlob: add an explicit seek to make sure we're at the start 2017-01-21 21:42:58 +01:00
BhaaL
30e0f3d9ca DecompressFileToBlob: don't assume success if decompression failed 2017-01-21 21:42:58 +01:00
BhaaL
24be8c0814 IsGCZBlob: try to leave the file position where it was before
callers that don't seek afterwards might be missing a few bytes that way.
2017-01-21 21:42:57 +01:00
Pierre Bourdon
334ddf754e DiscIO: Export GetKeyFromTicket
This function has more uses than just in DiscIO (e.g. WFS).
2017-01-14 17:06:40 +01:00
Pierre Bourdon
650a1fdb1f DiscIO: Implement functions to lookup tickets
These two functions load either a signed ticket or a raw ticket from the
emulated NAND.

The ticket signature skip is refactored out of the ticket writing in
order to be usable by the raw ticket reading function.
2017-01-14 17:06:40 +01:00
Pierre Bourdon
2ed352698f IOS/ES: Implement ES_AddTicket.
Refactor the existing DiscIO::AddTicket to not require the caller to
pass the requested title ID. We do not have the title ID in the ES case,
and it needs to be extracted from the ticket. Since this is always a
safe operation to do (title ID is always in the ticket), the
implementation is made default.
2017-01-14 15:23:16 +01:00
Matthew Parlane
9838afea41 Merge pull request #4479 from GerbilSoft/feature/RVT-R.dev-key
Support for RVT-R disc images
2017-01-13 09:56:50 +13:00
Matthew Parlane
d346d4ced1 Merge pull request #4544 from JosJuice/region-enum
DiscIO: Add GetRegion function and Region enum
2017-01-13 09:19:27 +13:00
JosJuice
b1873264d7 WbfsBlob: Don't wrap file_entry in std::unique_ptr
There doesn't seem to be any reason for doing it.
2017-01-11 13:39:46 +01:00
JosJuice
0363be4320 WbfsBlob: Remove m_total_files
std::vector already keeps track of this for us.
2017-01-11 13:39:38 +01:00
JosJuice
5c02795af0 WbfsBlob: Only open each file once
The first file used to be opened once by
CreateBlobReader and once inside WbfsFileReader.
2017-01-11 13:33:27 +01:00
JosJuice
8d54bbc528 Don't create new IOFiles when creating a blob
...except for WBFS, which is special because
it has the ability to open multiple files.
2017-01-11 13:23:23 +01:00
JosJuice
d1ea00ed88 Only open file once when detecting blob type 2017-01-11 13:23:19 +01:00
Lioncash
a93861ab49 DiscScrubber: Don't take SFileInfo instances by value
Avoids unnecessary copies.
2017-01-04 20:12:49 -05:00
Lioncash
c52d1e735a DiscScrubber: Use an unsigned loop index in ParseDisc
Prevents an implicit signed to unsigned conversion when assigning a
partition's group number.
2017-01-04 20:03:12 -05:00
Lioncash
6ff21c48cb DiscScrubber: Correct printf specifiers 2017-01-04 19:56:39 -05:00
Lioncash
b1a2dec78a DiscScrubber: Convert a #define into a typed constant 2017-01-04 19:53:31 -05:00
Lioncash
5b1aae0cbf DiscScrubber: Make struct and variable names conformant to the coding style 2017-01-04 17:04:41 -05:00
Lioncash
4a9bc2340b DiscScrubber: Convert into a class
Allows potential multiple scrubbers to run at once. Also gets rid of the
need to explicitly clean up resources.
2017-01-04 16:06:21 -05:00
JosJuice
f85266df20 SConfig: Replace bNTSC with m_region
This lets us get rid of VideoInterface::SetRegionReg,
a huge hack in CEXIMemoryCard, and some minor things.
2017-01-02 20:57:48 +01:00
JosJuice
66ea9f5cc1 DiscIO: Add GetRegion function and Region enum
Instead of needing different switch cases for
converting countries to regions in multiple places,
we now only need a single country-to-region switch case
(in DiscIO/Enums.cpp), and we get a nice Region type.
2017-01-02 20:57:11 +01:00
JosJuice
8e4a781974 VolumeDirectory: Modernize variable names 2016-12-26 11:45:22 +01:00
JosJuice
00aa2d37e9 VolumeDirectory: Don't use references inappropriately
Integers should be passed as pointers when a function
modifies them (to make it clear that they get modified).
2016-12-26 09:52:18 +01:00
Mat M
9c8e27e3bb Merge pull request #4558 from JosJuice/volumedirectory-fst-sort
VolumeDirectory: Sort the FST
2016-12-25 17:38:58 -05:00
JosJuice
3196f697bb VolumeDirectory: Use a range-based for loop in ComputeNameSize 2016-12-25 23:01:42 +01:00
JosJuice
f3987d13ea VolumeDirectory: Make m_totalNameSize a local variable
After BuildFST finishes executing, it's never needed again.
2016-12-25 22:57:14 +01:00
JosJuice
a502f069e8 VolumeDirectory: Sort the FST
We can't rely on the OS returning files and directories
in a deterministic order, so we should sort them on our own
if we want VolumeDirectory to work for movies and netplay.
2016-12-25 22:35:38 +01:00
JosJuice
9bd514ed1c Add TGC disc image compatibility 2016-12-18 18:57:36 +01:00
Léo Lam
31ccfffd38 Common: Add alignment header
Gets rid of duplicated alignment code.
2016-12-06 20:33:53 +01:00
David Korth
25fe999a79 Added support for Wii RVT-R disc images.
These disc images are encrypted and signed using a different set of keys.
We only care about the master key, so we check the signature issuer. If
it matches the debug issuer, then we'll use the RVT-R key. Otherwise,
the previous set of common and Korean keys are used.
2016-12-01 07:51:29 -05:00
Markus Wick
d5ca153c26 Merge pull request #4401 from JosJuice/rename-getuniqueid
DiscIO/SConfig: Rename GetUniqueID to GetGameID
2016-10-31 12:39:27 +01:00
JosJuice
1081497cad DiscIO/SConfig: Rename GetUniqueID to GetGameID
We call this "game ID" everywhere else, and it's not
actually completely unique.
2016-10-29 15:24:02 +02:00
JosJuice
d6731d34ef Remove VolumeCreator logs
These logs are very rarely useful and cause the issue
https://bugs.dolphin-emu.org/issues/9767
2016-10-29 13:08:24 +02:00
Lioncash
d9eb7c4e80 NANDContentLoader: Add IOFile forward declaration
This would previously fail to compile when included in files that do not
include FileUtil.h due to lack of a type declaration.

This moves the constructor and destructor into the cpp file in order to
satisfy the requirements of unique_ptr construction and deletion. That is,
unique_ptr requires a concrete type at the point of construction and
destruction. If the constructor or destructor is left in the header, then
at the point of construction or destruction, IOFile will still be
considered an incomplete type, as unique_ptr's deleter will still only be
able to see the forward declaration, which it can't use.
2016-10-14 20:27:22 -04:00
shuffle2
cc66f0336f Merge pull request #3963 from JosJuice/banner-loaded-failure
VolumeGC: Set m_banner_loaded when banner loading fails
2016-10-03 06:33:52 -07:00
Mat M
ccfc081697 Merge pull request #4245 from aldelaro5/logs-levels-changes
Lots of Logs levels changes (also enable INFO level in every build)
2016-10-02 16:51:44 -04:00
aldelaro5
f0aa9b3751 Reorganise a ton of logs level
Most of this commits changes performance decreasing logs from info to debug and also cleans up innacurate levels.
2016-10-01 15:50:28 -04:00
Lioncash
61b977c914 WiiWad: Make WiiWAD constructor explicit 2016-09-25 18:04:11 -04:00
Lioncash
7de0d51345 WiiWad: Move static implementation details to cpp file
These functions don't actually depend on any state from the class
instance, so they don't really belong in the header, and are just
an implementation detail.
2016-09-25 18:04:04 -04: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
Lioncash
5aeedcd27c NANDContentLoader: Remove unnecessary trailing semicolons 2016-09-14 20:12:25 -04:00
Lioncash
b43a26b90c NANDContentLoader: Remove virtual specifier from CNANDContentLoader destructor
This class is marked final, so there's no need to declare it as virtual.
2016-09-14 19:45:52 -04:00
Lioncash
3196bf5392 NANDContentLoader: Specify constructors as explicit where applicable
Prevents implicit conversion.
2016-09-14 19:44:44 -04:00
Lioncash
89c65be703 NANDContentLoader: Delay vector construction until needed in Get()
No need to construct the vector right off the bat.
2016-09-14 19:41:41 -04:00
Lioncash
b1ffa74043 NANDContentLoader: Make CNANDContentData's Get function return by non-const value
const specifiers like this are practically pointless and can inhibit move construction.
2016-09-14 19:15:31 -04:00
EmptyChaos
eccec3c6d3 DiscIO: Fix NAND Memory Leak
CNANDContentData is a base class with a non-virtual destructor so
derived classes don't get destroyed causing them to leak resources.
2016-09-14 15:54:05 +10:00
Léo Lam
c1184957a5 Run clang-format on missed files
`clang-format`s files that lint missed because of the bug. Fortunately,
not much.
2016-08-11 21:14:39 +02:00
JosJuice
0a15aaaa12 Move DiscIO enums to a new file
At first there weren't many enums in Volume.h, but the number has been
growing, and I'm planning to add one more for regions. To not make
Volume.h too large, and to avoid needing to include Volume.h in code
that doesn't use volume objects, I'm moving the enums to a new file.
I'm also turning them into enum classes while I'm at it.
2016-07-13 17:29:27 +02:00
Pierre Bourdon
f4d2626d2b Merge pull request #4005 from EmptyChaos/blockcache-bug
SectorReader: Minor cache bias bug
2016-07-13 12:11:19 +02:00
JosJuice
53e7eed28d DiscScrubber: Fix issue 9356 2016-07-11 11:46:15 +02:00
EmptyChaos
9036b9d8e8 SectorReader: Fix cache line bias
Minor bug where SectorReader::GetEmptyCacheLine was biased towards
the first hit.
2016-07-09 02:27:35 +10:00
JosJuice
31226b8503 DiscScrubber: Replace unused blocks with 0x00 instead of 0xFF 2016-07-07 11:51:58 +02:00
JosJuice
202c9d58cd VolumeGC: Set m_banner_loaded when banner loading fails
If banner loading fails once, it will very likely fail again.
Setting m_banner_loaded to true when banner loading fails
prevents LoadBannerFile from wasting time if it's called again.
Banner loading requires loading the file system, which takes a
noticeable amount of time, so this matters.
2016-06-28 18:05:44 +02:00
JosJuice
1878605d77 Undo some comment formatting changes from b5104a7 2016-06-25 18:07:10 +02:00
Rukai
b5104a79f1 GCVolume: supports reading all opening.bnr information
DQT2: Game properties dialog contains info tab giving information about the selected iso.
2016-06-26 00:03:59 +10:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Pierre Bourdon
c4240692b6 SectorReader: Fix reading the last block of the disc.
Regression from PR #3795.
2016-05-29 18:26:04 +02:00