Commit graph

60 commits

Author SHA1 Message Date
JosJuice
d1946aded6 Avoid using panic alerts in DiscIO
Panic alerts in DiscIO can potentially be very annoying since
large amounts of them can pop up when loading the game list
if you have some particularly weird files in your game list.

This was a much bigger problem back in 5.0 with its
"Tried to decrypt data from a non-Wii volume" panic alert, but
I figured I would take it all the way and remove the remaining
panic alerts that can show up when loading the game list.

I have exempted uses of ASSERT/ASSERT_MSG since they indicate
a bug in Dolphin rather than a malformed file.
2021-03-20 12:58:54 +01:00
Shawn Hoffman
84128d9532 rename Common/File to Common/IOFile 2021-01-27 14:29:48 -08:00
JosJuice
9a01c3fb9f Use positional arguments in all translatable fmt strings
We want to use positional arguments in translatable strings
that have more than one argument so that translators can change
the order of them, but the question is: Should we also use
positional arguments in translatable strings with only one
argument? I think it makes most sense that way, partially
so that translators don't even have to be aware of the
non-positional syntax and partially because "translatable
strings use positional arguments" is an easier rule for us
to remember than "transitional strings which have more than
one argument use positional arguments". But let me know if
you have a different opinion.
2020-11-16 13:28:11 +01: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
1084cfec1a Add helper function for fmt::format(GetStringT(... 2020-10-19 14:36:08 +02:00
JosJuice
d100c1dc37 DiscIO: Make use of fmt where applicable
Once nice benefit of fmt is that we can use positional arguments
in localizable strings. This a feature which has been
requested for the Korean translation of strings like
"Errors were found in %zu blocks in the %s partition."
and which will no doubt be useful for other languages too.
2020-10-19 14:30:47 +02:00
JosJuice
ca46028cde DiscIO: Use std::function for compression callback 2020-09-16 18:36:50 +02:00
JosJuice
b93bbbf2e5 DiscIO: Implement multithreaded compression 2020-05-06 14:18:51 +02:00
JosJuice
6ffcbcee70 DiscIO: Move scrubbing code out of ConvertToGCZ
This way, scrubbing can also be performed when converting
to other formats.
2020-04-24 15:11:20 +02:00
JosJuice
42f6913bcc Move DiscIO::ConvertToPlain to FileBlob.cpp
There is no longer anything GCZ specific about it.
2020-04-24 15:10:35 +02:00
JosJuice
8a9597e32e DiscIO: Allow converting from formats other than ISO and GCZ
The constant DESIRED_BUFFER_SIZE was determined by multiplying the
old hardcoded value 32 with the default GCZ block size 16 KiB.
Not sure if it actually is the best value, but it seems fine.
2020-04-24 15:10:35 +02:00
JosJuice
19e9a9c945 DiscIO: Clean up decompression size calculation
We can use subtraction and std::min instead of
modulo and explicit if statements.

This commit does not change the behavior.
2020-04-15 22:15:40 +02:00
JosJuice
3aa463cdae DiscIO: Fix decompressing writing too much sometimes
This issue cannot happen with good dumps due to their size,
but it can happen with trimmed dumps.
2020-04-12 21:47:10 +02:00
JosJuice
26b21e3186 DiscIO: Fix decompressing writing too little sometimes
This issue cannot happen with good dumps due to their size,
but it can happen with trimmed dumps.
2020-04-12 21:45:55 +02:00
JosJuice
0f5a4b37ee DiscIO: Add functions CreateDisc and CreateWAD
...in addition to the existing function CreateVolume
(renamed from CreateVolumeFromFilename).

Lets code easily add constraints such as not letting the user
select a WAD file when using the disc changing functionality.
2019-07-18 22:29:04 +02:00
Lioncash
4f1f55093f Common/MsgHandler: Namespace code within the Common namespace
Closes another gap in the Common library where code isn't being
namespaced under it.
2019-06-19 16:03:55 -04:00
Techjar
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
JosJuice
a469fb3150 VolumeVerifier: Check whether invalid blocks are unused 2019-04-09 14:18:46 +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
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
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
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
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
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
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
EmptyChaos
97d570f0c9 DriveReader: Fix View > Show Drives
DriveReader::m_size was never initialized which was indirectly
causing CGameListCtrl to crash Dolphin when it tried to insert a
character at a negative index in a string.

Reading one sector at a time is very inefficient and appears to
be causing timing issues during boot so SectorReader has been
enhanced to support batching.

SectorReader has been given a working cache system.
2016-04-26 21:24:08 +10:00
Markus Wick
e4b83d17bf Merge pull request #3270 from JosJuice/more-translations
Mark more strings for translation
2015-12-15 18:13:26 +01:00
Lioncash
6295297ab3 DiscIO: Get rid of a few explicit deletes 2015-12-08 04:35:56 -05:00
Lioncash
edbbf493f8 DiscIO: Make factory methods return unique_ptrs
Rather than rely on the developer to do the right thing,
just make the default behavior safely deallocate resources.

If shared semantics are ever needed in the future, the
constructor that takes a unique_ptr for shared_ptr can
be used.
2015-12-07 05:57:37 -05:00
JosJuice
74ea765427 Mark more strings for translation 2015-11-20 11:33:47 +01:00
flacs
34c020352f Merge pull request #3092 from JosJuice/compressed-blobs
Display all compressed formats in blue in GUI
2015-09-27 12:57:19 +02:00
Lioncash
cc036ca86c Common: Remove other Common prefixed headers from Common.h 2015-09-26 18:51:58 -04:00
JosJuice
94ee720a07 Rename IsCompressedBlob to IsGCZBlob for clarity
GCZ is just one of the several compressed formats that Dolphin supports.
2015-09-26 14:46:53 +02:00
Lioncash
19459e827f Partially revert "General: Toss out PRI macro usage" 2015-09-11 09:49:00 -04:00
Lioncash
8fdb013d54 General: Toss out PRI macro usage
Now that VS supports more printf specifiers, these aren't necessary
2015-09-05 16:02:35 -04:00
JosJuice
95a2abc1ce Use PanicAlertT instead of PanicAlert when appropriate
I tried to change messages that contained instructions for users,
while avoiding messages that are so technical that most users
wouldn't understand them even if they were in the right language.
2015-06-04 13:25:06 +02:00
Tillmann Karras
30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras
cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Michael Ehrenreich
9387603fcf Improve error handling in DiscIO::CompressFileToBlob and DecompressBlobToFile 2015-03-17 09:01:26 +01:00
Unknown W. Brackets
df5857b5af DiscIO: On decompress to file, write last blocks. 2015-02-12 20:30:11 -08:00
Lioncash
f14f0caea6 DiscIO: Remove some explicit deletes 2014-12-04 11:39:20 -05:00
Unknown W. Brackets
815b7bec96 DiscIO: Change a memset() to zero initialization. 2014-11-27 11:12:17 -08:00
Unknown W. Brackets
f54bf81520 DiscIO: Avoid zeroing buffer when compressing gcz.
This saves 6% time.
2014-11-27 08:58:09 -08:00
Unknown W. Brackets
2635e7d9ea DiscIO: Decompress to file using a larger buffer.
This improves performance by around 20% for me, and the memory use impact
is negligible considering Dolphin is otherwise unusable.
2014-11-27 08:34:44 -08:00
Unknown W. Brackets
f2f83a0c60 DolphinWX: Allow cancelling gcz compression. 2014-11-27 07:53:28 -08:00
Rohit Nirmal
fbc64984ca Include CommonTypes.h instead of Common.h. 2014-09-08 15:39:58 -04:00