Commit Graph

1379 Commits

Author SHA1 Message Date
Jordan Woyak 31a3de819d
Merge pull request #13540 from tygyh/DiscIO-Remove-redundant-qualifiers
DiscIO: Remove redundant qualifiers
2025-04-22 20:00:03 -05:00
Dr. Dystopia ecafd8058f DiscIO: Remove redundant qualifiers 2025-04-22 13:54:10 +02:00
Zopolis4 8d94d25203
Implement Triforce ID parsing 2025-04-21 22:05:25 +10:00
Zopolis4 71f654cdc4
Add Triforce platform and preliminary boot.id parsing 2025-04-21 22:05:25 +10:00
Tilka 7e7b75c1e6
Merge pull request #13537 from tygyh/DiscIO-Make-variables-constexpr
DiscIO: Make variables constexpr
2025-04-21 00:52:18 +01:00
Tilka 9504916f72
Merge pull request #13538 from tygyh/DiscIO-Use-default-to-define-a-trivial-destructor
DiscIO: Use `= default` to define a trivial destructor
2025-04-20 22:32:12 +01:00
Tilka 45ed4b2be9
Merge pull request #13541 from tygyh/DiscIO-Remove-redundant-zero-initializers-in-aggregate-initializations
DiscIO: Remove redundant zero initializers in aggregate initializations
2025-04-20 22:07:58 +01:00
Dr. Dystopia 77b4270981 DiscIO: Remove redundant zero initializers in aggregate initializations 2025-04-19 22:04:50 +02:00
Dr. Dystopia 7123fcd19b DiscIO: Use `= default` to define a trivial destructor 2025-04-19 17:43:18 +02:00
Dr. Dystopia f6ba69f99a DiscIO: Make variables constexpr 2025-04-19 17:17:02 +02:00
Dr. Dystopia 301cc5ee63 DiscIO: Make classes final 2025-04-19 09:05:22 +02:00
Dr. Dystopia 3bb925c1c7 DiscIO/Volume: Fix Partition struct comparison operators 2025-04-15 12:18:23 +02:00
JMC47 9819d66a47
Merge pull request #13221 from mitaclaw/nrvo-fails-1
GCC: Remedy NRVO Fails
2025-03-29 03:26:46 -04:00
mitaclaw 433c6ce0f2 GCC: Remedy NRVO Fails
Using the `-Wnrvo` flag introduced by GCC 14, I identified a few places where NRVO was clearly intended, but is fumbled.
2025-03-10 12:38:03 -07:00
mitaclaw c9f589faa5 Modernize `std::stable_sort` with ranges and projections 2025-03-09 13:26:38 -07:00
mitaclaw 8b9f92a0af Modernize `std::sort` with ranges and projections
In PPCTables.cpp, the code is currently unused so I was unable to test it.

In CustomPipeline.cpp, a pointer to member function cannot be used due to 16.4.5.2.1 of the C++ Standard regarding "addressable functions". https://eel.is/c++draft/namespace.std#6

In Fs.cpp and DirectoryBlob.cpp, these examples used projections in a previous iteration of this commit, but no longer do. Still, they remain in this commit because the PR they would actually belong to is already merged.
2025-03-09 13:26:38 -07:00
mitaclaw 62b2b939b5 Simplify `std::find_if` with `std::ranges::find` and projections
In LabelMap.cpp, the code is currently unused so I was unable to test it.

In WiiUtils.cpp, the magic value `1u` was replaced by the constant value `DiscIO::PARTITION_UPDATE`.
2025-03-09 13:26:35 -07:00
Joshua Vandaële fa442dc90b
Fix build with minizip-ng 4.0.8 2025-01-19 10:30:41 +01:00
mitaclaw 527841f1df Simplify `std::search` with `Common::ContainsSubrange` 2025-01-01 09:52:03 -08:00
mitaclaw 110d32729e Simplify `std::find` with `Common::Contains`
In NandPaths.cpp, the `std::initializer_list<char>` of illegal characters has been turned into a `char[]` (similar to the one in GameList.cpp).

The reverse iteration in ResourcePack.cpp seemed to provide no benefits, and doing without it it seemed to have no ill effects.
2025-01-01 09:52:03 -08:00
JMC47 532a8621da
Merge pull request #13116 from mitaclaw/ranges-modernization-8-trivial-of
Ranges Algorithms Modernization - Of
2024-12-26 16:51:53 -05:00
mitaclaw 140252ffc0 Modernize `std::any_of` with ranges
In WiimoteReal.cpp, JitRegCache.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those.

In ConvertDialog.cpp, the `std::mem_fn` helper was removed because ranges algorithms are able to handle pointers to member functions as predicates.
2024-12-15 19:54:16 -08:00
mitaclaw 860e6cf5cb Modernize `std::all_of` with ranges
In DITSpecification.cpp, MaterialAsset.cpp, and ShaderAsset.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those.

In NetPlayClient.cpp, the non-trivial `NetPlay::Player` elements were being passed by value in `NetPlayClient::DoAllPlayersHaveGame()`. This has been fixed.

In WIABlob.cpp, the second example's predicate was returning the `std::optional` by value instead of implicitly converting it to a bool. This has been fixed.
2024-12-15 19:50:34 -08:00
mitaclaw 826e2bbf98 StringUtil: More Wrappers For <cctype>
`Common::IsLower(char)` was omitted as nothing needed it.
2024-12-15 19:50:34 -08:00
mitaclaw 4fde0f2868 Modernize `std::search` with ranges
The new return value is `std::ranges::subrange`.
2024-10-17 18:38:34 -07:00
JosJuice 07605bf67c
Merge pull request #13090 from mitaclaw/ranges-modernization-1-trivial
Ranges Algorithms Modernization - Trivial
2024-10-15 17:08:55 +02:00
Jordan Woyak 23ba1c9133 DolphinQt: Restrict size of banner image in game properties info tab. 2024-10-11 22:56:33 -05:00
Tilka d2a56b321f
Merge pull request #13095 from mitaclaw/ranges-modernization-6-n
Ranges Algorithms Modernization - N
2024-10-11 20:28:06 +01:00
Tilka c1832d17f6
Merge pull request #13117 from mitaclaw/ranges-modernization-9-trivial-find
Ranges Algorithms Modernization - Find
2024-10-11 20:27:18 +01:00
mitaclaw e8d5fb89e4 C++20: Synthesize `operator!=` From `operator==`
The inequality operator is automatically generated by the compiler if `operator==` is defined.
2024-10-10 20:23:55 -07:00
mitaclaw e4fb837f4b Modernize `std::find_if` with ranges
In BTEmu.cpp, `std::mem_fn` was not necessary for the predicate to compile.
2024-10-10 15:28:11 -07:00
mitaclaw 728663bdc0 Modernize `std::binary_search` with ranges
In VolumeVerifier.cpp, constructing a `std::string_view` of the volume's GameID is unnecessary, as `std::`(`ranges::`)`binary_search` supports heterogeneous lookup. The usage in GameFile.cpp is a perfect example.
2024-10-10 00:53:48 -07:00
mitaclaw ebf7cebc32 Modernize `std::sort` with ranges 2024-10-10 00:53:48 -07:00
mitaclaw b6ec8ddc20 Simplify `std::fill` with `std::fill_n` 2024-10-07 15:34:56 -07:00
mitaclaw 7c96762f5f Simplify `std::copy` with `std::copy_n`
+ a surprise `std::memcpy` in VolumeVerifier.cpp.
2024-10-07 15:34:56 -07:00
mitaclaw c60accc96d VolumeVerifier: Promote `DEBUG_ASSERT` to `static_assert`
This runtime assertion was added before `std::is_sorted` became constexpr in the codebase.
2024-09-28 23:12:12 -07:00
JosJuice e72b23df91 DiscIO: Fix a typo in an RVZPack comment 2024-09-08 12:38:10 +02:00
Ferdinand Bachmann 6245dcd57d RVZ: Fix undefined behaviour when copying 0 bytes to a null pointer
A vector of length 0 can have a null data pointer, which causes UB when
passed to memcpy, so only copy when we actually have data to copy. This
caused crashes in certain cases when compiling Dolphin with Clang and
LTO enabled.
2024-08-27 18:16:43 +02:00
Dr. Dystopia 9602f36248 Remove redundant semicolons 2024-08-20 14:59:54 +02:00
Tillmann Karras 982893b04c Use C++20 erase_if() instead of erase(remove_if()) (NFC) 2024-07-21 16:36:06 +01:00
JosJuice 22aa88109f Use a stub AchivementManager when USE_RETRO_ACHIEVEMENTS isn't defined
This lets us reduce the number of USE_RETRO_ACHIEVEMENTS ifdefs in the
code base, reducing visual clutter. In particular, needing an ifdef for
each call to IsHardcodeModeActive was annoying to me. This also reduces
the risk that someone writes code that accidentally fails to compile
with USE_RETRO_ACHIEVEMENTS disabled.

We could cut down on ifdefs even further by making HardcodeWarningWidget
always exist, but that would result in non-trivial code ending up in the
binary even with USE_RETRO_ACHIEVEMENTS disabled, so I'm leaving it out
of this PR. It's not a lot of code though, so I might end up revisiting
it at some point.
2024-06-06 08:26:20 +02:00
Tillmann Karras 4619db2ae9 DiscIO: drop unused Volume::CheckContentIntegrity() overload
The offset-based overload hasn't been in use since
f754a1a548.
2024-05-26 00:10:26 +01:00
LillyJadeKatrin ad969dfc0d Disabled Hardcore Mode when Achievements disabled
Bugfix for hardcore-disabled items being disabled when hardcore was true but achievement integration was false, which should mean hardcore is effectively disabled. Now everything checks the IsHardcoreModeActive method in AchievementManager which processes the setting AND the game state to determine if hardcore mode is actually active.
2024-05-02 04:44:52 -04:00
Lioncash b728e37086 RiivolutionParser: Remove usages of global system accessor
We can retrieve the encompassing system instance through the
CPUThreadGuard instance instead.
2023-12-12 12:48:40 -05:00
Lioncash c2e39e0d68 RiivolutionParser: Make use of std::span where applicable
The main interface for these only take in patches and iterate over them
in a contiguous sequence, so we can reasonably generify the interface.
2023-12-12 12:38:43 -05:00
LillyJadeKatrin 1a19a92943 Disable memory patches in hardcore mode
Memory patches would be an easy way to manipulate the memory needed to calculate achievement logic, so they must be disabled. Riivolution patches that do not affect memory are allowed, as they will be hashed with the game file.
2023-12-02 16:41:16 -05:00
Lexi Larkin 71dfa66d8b Tool/Header: Add JSON output mode; game data 2023-11-28 08:49:28 +00:00
JosJuice 9c53c110f8 DiscIO: Remove unintentional use of comma operator 2023-11-05 09:24:49 +01:00
LillyJadeKatrin 335cf4f2db Added CopyReader to BlobReader and all subclasses
A deep-copy method CopyReader has been added to BlobReader (virtual) and all of its subclasses (override). This should create a second BlobReader to open the same set of data but with an independent read pointer so that it doesn't interfere with any reads done on the original Reader.

As part of this, IOFile has added code to create a deep copy IOFile pointer onto the same file, with code based on the platform in question to find the file ID from the file pointer and open a new one. There has also been a small piece added to FileInfo to enable a deep copy, but its only subclass at this time already had a copy constructor so this was relatively minor.
2023-10-01 09:04:06 -04:00
JosJuice 0f64df3e3e DiscIO: Don't keep volume pointer in DiscScrubber
Keeping the pointer creates use-after-free opportunities, and we don't
have much reason to keep it around anyway.
2023-08-19 17:30:22 +02:00