diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2019-06-20 13:37:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-20 13:37:24 +0200 |
| commit | 4885130799a357eee8e279ed68dac60d6bcd78ca (patch) | |
| tree | 01260bc72811143b0153b747d0d8b860638325eb /Source/Core/DiscIO | |
| parent | baf02194c1bf4a55620e3aee7d9c0a1658a61168 (diff) | |
| parent | 4f1f55093fcf98aa1592b6b8b1ad0d33c4461b50 (diff) | |
Merge pull request #8194 from lioncash/common-msg
Common/MsgHandler: Tidy up interface and namespace code
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/CompressedBlob.cpp | 11 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Enums.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeVerifier.cpp | 185 |
3 files changed, 110 insertions, 90 deletions
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 20584cf845..76b7506cb2 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -200,7 +200,7 @@ bool CompressFileToBlob(const std::string& infile_path, const std::string& outfi if (deflateInit(&z, 9) != Z_OK) return false; - callback(GetStringT("Files opened, ready to compress."), 0, arg); + callback(Common::GetStringT("Files opened, ready to compress."), 0, arg); CompressedBlobHeader header; header.magic_cookie = GCZ_MAGIC; @@ -239,8 +239,8 @@ bool CompressFileToBlob(const std::string& infile_path, const std::string& outfi if (inpos != 0) ratio = (int)(100 * position / inpos); - std::string temp = - StringFromFormat(GetStringT("%i of %i blocks. Compression ratio %i%%").c_str(), i, + const std::string temp = + StringFromFormat(Common::GetStringT("%i of %i blocks. Compression ratio %i%%").c_str(), i, header.num_blocks, ratio); bool was_cancelled = !callback(temp, (float)i / (float)header.num_blocks, arg); if (was_cancelled) @@ -332,7 +332,7 @@ bool CompressFileToBlob(const std::string& infile_path, const std::string& outfi if (success) { - callback(GetStringT("Done compressing disc image."), 1.0f, arg); + callback(Common::GetStringT("Done compressing disc image."), 1.0f, arg); } return success; } @@ -381,7 +381,8 @@ bool DecompressBlobToFile(const std::string& infile_path, const std::string& out { if (i % progress_monitor == 0) { - bool was_cancelled = !callback(GetStringT("Unpacking"), (float)i / (float)num_buffers, arg); + const bool was_cancelled = + !callback(Common::GetStringT("Unpacking"), (float)i / (float)num_buffers, arg); if (was_cancelled) { success = false; diff --git a/Source/Core/DiscIO/Enums.cpp b/Source/Core/DiscIO/Enums.cpp index 507616e32c..0939ae9174 100644 --- a/Source/Core/DiscIO/Enums.cpp +++ b/Source/Core/DiscIO/Enums.cpp @@ -64,7 +64,7 @@ std::string GetName(Country country, bool translate) break; } - return translate ? GetStringT(name.c_str()) : name; + return translate ? Common::GetStringT(name.c_str()) : name; } std::string GetName(Language language, bool translate) @@ -108,7 +108,7 @@ std::string GetName(Language language, bool translate) break; } - return translate ? GetStringT(name.c_str()) : name; + return translate ? Common::GetStringT(name.c_str()) : name; } bool IsDisc(Platform volume_type) diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index c86d9c498f..5e20803651 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -70,7 +70,7 @@ void VolumeVerifier::Start() CheckPartitions(); if (m_volume.GetVolumeType() == Platform::WiiWAD) - CheckCorrectlySigned(PARTITION_NONE, GetStringT("This title is not correctly signed.")); + CheckCorrectlySigned(PARTITION_NONE, Common::GetStringT("This title is not correctly signed.")); CheckDiscSize(); CheckMisc(); @@ -85,7 +85,8 @@ void VolumeVerifier::CheckPartitions() if (m_volume.GetVolumeType() != Platform::WiiWAD && !m_volume.GetFileSystem(m_volume.GetGamePartition())) { - AddProblem(Severity::High, GetStringT("The filesystem is invalid or could not be read.")); + AddProblem(Severity::High, + Common::GetStringT("The filesystem is invalid or could not be read.")); } return; } @@ -98,7 +99,7 @@ void VolumeVerifier::CheckPartitions() // The only game that has that many partitions in total is Super Smash Bros. Brawl, // and that game places all partitions other than UPDATE and DATA in the second table. AddProblem(Severity::Low, - GetStringT("There are too many partitions in the first partition table.")); + Common::GetStringT("There are too many partitions in the first partition table.")); } std::vector<u32> types; @@ -110,20 +111,20 @@ void VolumeVerifier::CheckPartitions() } if (std::find(types.cbegin(), types.cend(), PARTITION_UPDATE) == types.cend()) - AddProblem(Severity::Low, GetStringT("The update partition is missing.")); + AddProblem(Severity::Low, Common::GetStringT("The update partition is missing.")); if (std::find(types.cbegin(), types.cend(), PARTITION_DATA) == types.cend()) - AddProblem(Severity::High, GetStringT("The data partition is missing.")); + AddProblem(Severity::High, Common::GetStringT("The data partition is missing.")); const bool has_channel_partition = std::find(types.cbegin(), types.cend(), PARTITION_CHANNEL) != types.cend(); if (ShouldHaveChannelPartition() && !has_channel_partition) - AddProblem(Severity::Medium, GetStringT("The channel partition is missing.")); + AddProblem(Severity::Medium, Common::GetStringT("The channel partition is missing.")); const bool has_install_partition = std::find(types.cbegin(), types.cend(), PARTITION_INSTALL) != types.cend(); if (ShouldHaveInstallPartition() && !has_install_partition) - AddProblem(Severity::High, GetStringT("The install partition is missing.")); + AddProblem(Severity::High, Common::GetStringT("The install partition is missing.")); if (ShouldHaveMasterpiecePartitions() && types.cend() == @@ -135,23 +136,24 @@ void VolumeVerifier::CheckPartitions() // (French), Clásicos (Spanish), Capolavori (Italian), 클래식 게임 체험판 (Korean). // If your language is not one of the languages above, consider leaving the string untranslated // so that people will recognize it as the name of the game mode. - AddProblem(Severity::Medium, GetStringT("The Masterpiece partitions are missing.")); + AddProblem(Severity::Medium, Common::GetStringT("The Masterpiece partitions are missing.")); } for (const Partition& partition : partitions) { if (m_volume.GetPartitionType(partition) == PARTITION_UPDATE && partition.offset != 0x50000) { - AddProblem(Severity::Low, GetStringT("The update partition is not at its normal position.")); + AddProblem(Severity::Low, + Common::GetStringT("The update partition is not at its normal position.")); } const u64 normal_data_offset = m_volume.IsEncryptedAndHashed() ? 0xF800000 : 0x838000; if (m_volume.GetPartitionType(partition) == PARTITION_DATA && partition.offset != normal_data_offset && !has_channel_partition && !has_install_partition) { - AddProblem( - Severity::Low, - GetStringT("The data partition is not at its normal position. This will affect the " + AddProblem(Severity::Low, + Common::GetStringT( + "The data partition is not at its normal position. This will affect the " "emulated loading times. When using NetPlay or sending input recordings to " "other people, you will experience desyncs if anyone is using a good dump.")); } @@ -167,7 +169,7 @@ bool VolumeVerifier::CheckPartition(const Partition& partition) if (!type) { // Not sure if this can happen in practice - AddProblem(Severity::Medium, GetStringT("The type of a partition could not be read.")); + AddProblem(Severity::Medium, Common::GetStringT("The type of a partition could not be read.")); return false; } @@ -182,19 +184,22 @@ bool VolumeVerifier::CheckPartition(const Partition& partition) if (partition.offset % VolumeWii::BLOCK_TOTAL_SIZE != 0 || m_volume.PartitionOffsetToRawOffset(0, partition) % VolumeWii::BLOCK_TOTAL_SIZE != 0) { - AddProblem(Severity::Medium, - StringFromFormat(GetStringT("The %s partition is not properly aligned.").c_str(), - name.c_str())); + AddProblem( + Severity::Medium, + StringFromFormat(Common::GetStringT("The %s partition is not properly aligned.").c_str(), + name.c_str())); } CheckCorrectlySigned( - partition, StringFromFormat(GetStringT("The %s partition is not correctly signed.").c_str(), - name.c_str())); + partition, + StringFromFormat(Common::GetStringT("The %s partition is not correctly signed.").c_str(), + name.c_str())); if (m_volume.SupportsIntegrityCheck() && !m_volume.CheckH3TableIntegrity(partition)) { std::string text = StringFromFormat( - GetStringT("The H3 hash table for the %s partition is not correct.").c_str(), name.c_str()); + Common::GetStringT("The H3 hash table for the %s partition is not correct.").c_str(), + name.c_str()); AddProblem(Severity::Low, std::move(text)); } @@ -227,7 +232,8 @@ bool VolumeVerifier::CheckPartition(const Partition& partition) // the Masterpiece partitions in Super Smash Bros. Brawl without removing them from // the partition table. https://bugs.dolphin-emu.org/issues/8733 std::string text = StringFromFormat( - GetStringT("The %s partition does not seem to contain valid data.").c_str(), name.c_str()); + Common::GetStringT("The %s partition does not seem to contain valid data.").c_str(), + name.c_str()); AddProblem(severity, std::move(text)); return false; } @@ -236,7 +242,8 @@ bool VolumeVerifier::CheckPartition(const Partition& partition) if (!filesystem) { std::string text = StringFromFormat( - GetStringT("The %s partition does not have a valid file system.").c_str(), name.c_str()); + Common::GetStringT("The %s partition does not have a valid file system.").c_str(), + name.c_str()); AddProblem(severity, std::move(text)); return false; } @@ -266,8 +273,9 @@ bool VolumeVerifier::CheckPartition(const Partition& partition) { // This is reached for hacked dumps where the update partition has been replaced with // a very old update partition so that no updates will be installed. - AddProblem(Severity::Low, - GetStringT("The update partition does not contain the IOS used by this title.")); + AddProblem( + Severity::Low, + Common::GetStringT("The update partition does not contain the IOS used by this title.")); } } @@ -303,7 +311,7 @@ std::string VolumeVerifier::GetPartitionName(std::optional<u32> type) const // (French), Clásicos (Spanish), Capolavori (Italian), 클래식 게임 체험판 (Korean). // If your language is not one of the languages above, consider leaving the string untranslated // so that people will recognize it as the name of the game mode. - name = StringFromFormat(GetStringT("%s (Masterpiece)").c_str(), name.c_str()); + name = StringFromFormat(Common::GetStringT("%s (Masterpiece)").c_str(), name.c_str()); } return name; } @@ -381,10 +389,10 @@ void VolumeVerifier::CheckDiscSize() biggest_offset > SL_DVD_SIZE && m_volume.GetSize() >= SL_DVD_SIZE; std::string text = second_layer_missing ? - GetStringT( + Common::GetStringT( "This disc image is too small and lacks some data. The problem is most likely that " "this is a dual-layer disc that has been dumped as a single-layer disc.") : - GetStringT( + Common::GetStringT( "This disc image is too small and lacks some data. If your dumping program saved " "the disc image as several parts, you need to merge them into one file."); AddProblem(Severity::High, std::move(text)); @@ -393,17 +401,18 @@ void VolumeVerifier::CheckDiscSize() if (ShouldBeDualLayer() && biggest_offset <= SL_DVD_R_SIZE) { - AddProblem( - Severity::Medium, - GetStringT("This game has been hacked to fit on a single-layer DVD. Some content such as " + AddProblem(Severity::Medium, + Common::GetStringT( + "This game has been hacked to fit on a single-layer DVD. Some content such as " "pre-rendered videos, extra languages or entire game modes will be broken. " "This problem generally only exists in illegal copies of games.")); } if (!m_volume.IsSizeAccurate()) { - AddProblem(Severity::Low, GetStringT("The format that the disc image is saved in does not " - "store the size of the disc image.")); + AddProblem(Severity::Low, + Common::GetStringT("The format that the disc image is saved in does not " + "store the size of the disc image.")); } else if (!m_is_tgc) { @@ -420,8 +429,9 @@ void VolumeVerifier::CheckDiscSize() { if (debug && valid_retail_wii) { - AddProblem(Severity::Low, - GetStringT("This debug disc image has the size of a retail disc image.")); + AddProblem( + Severity::Low, + Common::GetStringT("This debug disc image has the size of a retail disc image.")); } else { @@ -431,15 +441,16 @@ void VolumeVerifier::CheckDiscSize() if (small) { - AddProblem(Severity::Low, - GetStringT("This disc image has an unusual size. This will likely make the " - "emulated loading times longer. When using NetPlay or sending " - "input recordings to other people, you will likely experience " - "desyncs if anyone is using a good dump.")); + AddProblem( + Severity::Low, + Common::GetStringT("This disc image has an unusual size. This will likely make the " + "emulated loading times longer. When using NetPlay or sending " + "input recordings to other people, you will likely experience " + "desyncs if anyone is using a good dump.")); } else { - AddProblem(Severity::Low, GetStringT("This disc image has an unusual size.")); + AddProblem(Severity::Low, Common::GetStringT("This disc image has an unusual size.")); } } } @@ -528,16 +539,17 @@ void VolumeVerifier::CheckMisc() // Hacked version of the Wii Backup Disc (aka "pinkfish" disc). std::string proper_game_id = game_id_unencrypted; proper_game_id[0] = '4'; - AddProblem(Severity::Low, - StringFromFormat(GetStringT("The game ID is %s but should be %s.").c_str(), - game_id_unencrypted.c_str(), proper_game_id.c_str())); + AddProblem( + Severity::Low, + StringFromFormat(Common::GetStringT("The game ID is %s but should be %s.").c_str(), + game_id_unencrypted.c_str(), proper_game_id.c_str())); inconsistent_game_id = false; } } if (inconsistent_game_id) { - AddProblem(Severity::Low, GetStringT("The game ID is inconsistent.")); + AddProblem(Severity::Low, Common::GetStringT("The game ID is inconsistent.")); } } @@ -546,16 +558,16 @@ void VolumeVerifier::CheckMisc() if (game_id_encrypted.size() < 4) { - AddProblem(Severity::Low, GetStringT("The game ID is unusually short.")); + AddProblem(Severity::Low, Common::GetStringT("The game ID is unusually short.")); } else { const char country_code = game_id_encrypted[3]; if (CountryCodeToRegion(country_code, platform, region) != region) { - AddProblem( - Severity::Medium, - GetStringT("The region code does not match the game ID. If this is because the " + AddProblem(Severity::Medium, + Common::GetStringT( + "The region code does not match the game ID. If this is because the " "region code has been modified, the game might run at the wrong speed, " "graphical elements might be offset, or the game might not run at all.")); } @@ -576,18 +588,19 @@ void VolumeVerifier::CheckMisc() // This is intended to catch pirated Korean games that have had the IOS slot set to 36 // as a side effect of having to fakesign after changing the common key slot to 0. // (IOS36 was the last IOS to have the Trucha bug.) https://bugs.dolphin-emu.org/issues/10319 - AddProblem(Severity::High, - // i18n: You may want to leave the term "ERROR #002" untranslated, - // since the emulated software always displays it in English. - GetStringT("This Korean title is set to use an IOS that typically isn't used on " - "Korean consoles. This is likely to lead to ERROR #002.")); + AddProblem( + Severity::High, + // i18n: You may want to leave the term "ERROR #002" untranslated, + // since the emulated software always displays it in English. + Common::GetStringT("This Korean title is set to use an IOS that typically isn't used on " + "Korean consoles. This is likely to lead to ERROR #002.")); } if (ios_id >= 0x80) { // This is also intended to catch fakesigned pirated Korean games, // but this time with the IOS slot set to cIOS instead of IOS36. - AddProblem(Severity::High, GetStringT("This title is set to use an invalid IOS.")); + AddProblem(Severity::High, Common::GetStringT("This title is set to use an invalid IOS.")); } } @@ -603,7 +616,7 @@ void VolumeVerifier::CheckMisc() const Severity severity = m_volume.GetVolumeType() == Platform::WiiWAD ? Severity::Low : Severity::High; // i18n: This is "common" as in "shared", not the opposite of "uncommon" - AddProblem(severity, GetStringT("This title is set to use an invalid common key.")); + AddProblem(severity, Common::GetStringT("This title is set to use an invalid common key.")); } if (common_key == 1 && region != Region::NTSC_K) @@ -613,7 +626,7 @@ void VolumeVerifier::CheckMisc() // https://forums.dolphin-emu.org/Thread-wiiware-chronos-twins-dx AddProblem(Severity::High, // i18n: This is "common" as in "shared", not the opposite of "uncommon" - GetStringT("This non-Korean title is set to use the Korean common key.")); + Common::GetStringT("This non-Korean title is set to use the Korean common key.")); } } @@ -622,11 +635,12 @@ void VolumeVerifier::CheckMisc() constexpr u32 NKIT_MAGIC = 0x4E4B4954; // "NKIT" if (m_volume.ReadSwapped<u32>(0x200, PARTITION_NONE) == NKIT_MAGIC) { - AddProblem(Severity::Low, - GetStringT("This disc image is in the NKit format. It is not a good dump in its " - "current form, but it might become a good dump if converted back. " - "The CRC32 of this file might match the CRC32 of a good dump even " - "though the files are not identical.")); + AddProblem( + Severity::Low, + Common::GetStringT("This disc image is in the NKit format. It is not a good dump in its " + "current form, but it might become a good dump if converted back. " + "The CRC32 of this file might match the CRC32 of a good dump even " + "though the files are not identical.")); } } } @@ -725,8 +739,9 @@ void VolumeVerifier::Process() { if (!CheckContentIntegrity(content)) { - AddProblem(Severity::High, - StringFromFormat(GetStringT("Content %08x is corrupt.").c_str(), content.id)); + AddProblem( + Severity::High, + StringFromFormat(Common::GetStringT("Content %08x is corrupt.").c_str(), content.id)); } m_content_index++; @@ -822,8 +837,8 @@ void VolumeVerifier::Finish() { const std::string name = GetPartitionName(m_volume.GetPartitionType(partition)); std::string text = StringFromFormat( - GetStringT("Errors were found in %zu blocks in the %s partition.").c_str(), blocks, - name.c_str()); + Common::GetStringT("Errors were found in %zu blocks in the %s partition.").c_str(), + blocks, name.c_str()); AddProblem(Severity::Medium, std::move(text)); } } @@ -834,8 +849,8 @@ void VolumeVerifier::Finish() { const std::string name = GetPartitionName(m_volume.GetPartitionType(partition)); std::string text = StringFromFormat( - GetStringT("Errors were found in %zu unused blocks in the %s partition.").c_str(), blocks, - name.c_str()); + Common::GetStringT("Errors were found in %zu unused blocks in the %s partition.").c_str(), + blocks, name.c_str()); AddProblem(Severity::Low, std::move(text)); } } @@ -848,14 +863,15 @@ void VolumeVerifier::Finish() if (m_is_datel) { - m_result.summary_text = GetStringT("Dolphin is unable to verify unlicensed discs."); + m_result.summary_text = Common::GetStringT("Dolphin is unable to verify unlicensed discs."); return; } if (m_is_tgc) { - m_result.summary_text = GetStringT("Dolphin is unable to verify typical TGC files properly, " - "since they are not dumps of actual discs."); + m_result.summary_text = + Common::GetStringT("Dolphin is unable to verify typical TGC files properly, " + "since they are not dumps of actual discs."); return; } @@ -864,26 +880,28 @@ void VolumeVerifier::Finish() case Severity::None: if (IsWii(m_volume.GetVolumeType()) && !m_is_not_retail) { - m_result.summary_text = - GetStringT("No problems were found. This does not guarantee that this is a good dump, " - "but since Wii titles contain a lot of verification data, it does mean that " - "there most likely are no problems that will affect emulation."); + m_result.summary_text = Common::GetStringT( + "No problems were found. This does not guarantee that this is a good dump, " + "but since Wii titles contain a lot of verification data, it does mean that " + "there most likely are no problems that will affect emulation."); } else { - m_result.summary_text = GetStringT("No problems were found."); + m_result.summary_text = Common::GetStringT("No problems were found."); } break; case Severity::Low: - m_result.summary_text = GetStringT("Problems with low severity were found. They will most " - "likely not prevent the game from running."); + m_result.summary_text = + Common::GetStringT("Problems with low severity were found. They will most " + "likely not prevent the game from running."); break; case Severity::Medium: - m_result.summary_text = GetStringT("Problems with medium severity were found. The whole game " - "or certain parts of the game might not work correctly."); + m_result.summary_text = + Common::GetStringT("Problems with medium severity were found. The whole game " + "or certain parts of the game might not work correctly."); break; case Severity::High: - m_result.summary_text = GetStringT( + m_result.summary_text = Common::GetStringT( "Problems with high severity were found. The game will most likely not work at all."); break; } @@ -891,13 +909,14 @@ void VolumeVerifier::Finish() if (m_volume.GetVolumeType() == Platform::GameCubeDisc) { m_result.summary_text += - GetStringT("\n\nBecause GameCube disc images contain little verification data, " - "there may be problems that Dolphin is unable to detect."); + Common::GetStringT("\n\nBecause GameCube disc images contain little verification data, " + "there may be problems that Dolphin is unable to detect."); } else if (m_is_not_retail) { - m_result.summary_text += GetStringT("\n\nBecause this title is not for retail Wii consoles, " - "Dolphin cannot verify that it hasn't been tampered with."); + m_result.summary_text += + Common::GetStringT("\n\nBecause this title is not for retail Wii consoles, " + "Dolphin cannot verify that it hasn't been tampered with."); } } |
