summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWiiCrypted.cpp
AgeCommit message (Collapse)Author
2017-06-06DiscIO: Remove C/I/S prefixes from class namesJosJuice
These prefixes were inconsistent with the rest of Dolphin. I'm also renaming VolumeWiiCrypted to VolumeWii because of 1113b13.
2017-06-05Reimplement support for unencrypted Wii discsJosJuice
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-05DiscIO: Use std::optional in Volume and BlobJosJuice
2017-06-04Don't show FST size in game propertiesJosJuice
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-04Merge pull request #5522 from leoetlino/simpler-gettitleidJosJuice
DiscIO: Use std::optional for GetTitleID instead of pointer
2017-06-03DiscIO: Use std::optional for GetTitleID instead of pointerLéo Lam
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-03Replace {{}} with {}JosJuice
IIRC we were only using {{}} because {} used to cause errors on the FreeBSD buildbot.
2017-05-26Check TMD sizes using the actual constantLéo Lam
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-20VolumeWiiCrypted: Get title keys from TicketReaderJosJuice
2017-05-20VolumeWiiCrypted: Get title IDs from TicketReaderJosJuice
2017-05-20VolumeWiiCrypted: Cache TMDs and ticketsJosJuice
2017-05-19Replace some usages of IVolume::ReadSwapped with IBlobReader::ReadSwappedJosJuice
Skips needing to specify PARTITION_NONE.
2017-05-19Remove CBlobBigEndianReaderJosJuice
We can simply put ReadSwapped directly in IBlobReader.
2017-05-19DiscIO: Remove VolumeCreatorJosJuice
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-16Check file system validity before reading opening.bnrJosJuice
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-16VolumeWiiCrypted: Replace ChangePartition with a partition parameterJosJuice
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-16VolumeWiiCrypted: Turn m_dataOffset into a constantJosJuice
2017-05-14VolumeWiiCrypted: Use std::minJosJuice
2017-05-14VolumeWiiCrypted: Store last decrypted offset instead of block numberJosJuice
This makes it unnecessary to reset m_last_decrypted_offset when changing partition.
2017-03-25DiscIO: make sure to initialize out args to ReadSwappedMichael Maltese
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-20Merge pull request #4901 from JosJuice/filemonitor-redesignAnthony
FileMonitor redesign
2017-03-18Return a more meaningful type from GetSysMenuRegionJosJuice
2017-03-13FileMonitor redesignJosJuice
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-13Remove Blob nullptr checks from Volume codeJosJuice
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-09Volume: Use ReadSwapped moreJosJuice
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-09Get the right game ID for SSBB's Masterpiece partitionsJosJuice
2017-03-03Common: Move byte swapping utilities into their own headerLioncash
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-02IOS/ES: Keep track of the active title properlyLéo Lam
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-02-26Use ESFormats for TMDsLéo Lam
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-12DVDInterface: Translate Wii partition offsets for timing purposesJosJuice
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-11VolumeWiiCrypted: Use constant naming style for constantsJosJuice
2017-01-02DiscIO: Add GetRegion function and Region enumJosJuice
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.
2016-10-29DiscIO/SConfig: Rename GetUniqueID to GetGameIDJosJuice
We call this "game ID" everywhere else, and it's not actually completely unique.
2016-10-01Reorganise a ton of logs levelaldelaro5
Most of this commits changes performance decreasing logs from info to debug and also cleans up innacurate levels.
2016-07-13Move DiscIO enums to a new fileJosJuice
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-06-26GCVolume: supports reading all opening.bnr informationRukai
DQT2: Game properties dialog contains info tab giving information about the selected iso.
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2016-01-15DiscIO: Use specified Wii region for discsbooto
2015-12-19Volume: Make GetTMD return a vectorLioncash
2015-12-15Merge pull request #3309 from JosJuice/reload-banner-without-volumeMarkus Wick
Don't read from volume when reloading Wii banners
2015-12-08DiscIO: Get rid of a few explicit deletesLioncash
2015-12-03Don't read from volume when reloading Wii bannersJosJuice
Should make loading cached Wii games that lack banners slightly faster.
2015-10-03Merge pull request #3091 from Tilka/mbedtlsshuffle2
Update mbed TLS (PolarSSL)
2015-09-27DiscIO: Add a way to get blob typeJosJuice
2015-09-26Display all compressed formats in blue in GUIJosJuice
In the past, only GCZ was shown as compressed, not CISO and WBFS.
2015-09-25mbedTLS: run rename.pl script and fix errorsTillmann Karras
2015-09-22DiscIO: Do swapping in GetTitleID implementationsLioncash
Gets rid of external swaps at every usage.
2015-09-12Merge pull request #2829 from JosJuice/fix-wii-fst-size-2Lioncash
Fix reading Wii FST size (for real this time)
2015-08-31VolumeCreator: Fix a typo in VolumeKeyForPartition's nameLioncash
2015-08-31VolumeCreator: Use a unique_ptr in CreateVolumeFromFilenameLioncash