Commit Graph

123 Commits

Author SHA1 Message Date
mitaclaw c46060e298 Modernize `std::count` with ranges 2024-10-10 00:53:48 -07:00
mitaclaw 9fa4eb9aab Use 'contains' method 2024-08-15 14:20:16 -07:00
LillyJadeKatrin ae87bf9af5
Add Unit Test for Patch Allowlist
This unit test compares ApprovedInis.json with the contents of the GameSettings folder to verify that every patch marked allowed for use with RetroAchievements has a hash in ApprovedInis.json. If not, that hash is reported in the test logs so that the hash may be updated more easily.
2024-07-07 21:29:03 +02:00
Pokechu22 fbbfea8e8e Replace Common::BitCast with std::bit_cast 2024-05-03 18:43:51 -07:00
Bram Speeckaert 825a10616c DivUtils: Add unsigned division magic function
Takes the logic from Jit64 and moves it into DivUtils, so it can be
reused by other backends as well.
2024-03-23 20:13:15 +01:00
Admiral H. Curtiss 9a3e770c23
Migrate SConfig::bWii to System. 2024-01-31 12:54:07 +01:00
Admiral H. Curtiss 42d61cfc4c
Core/HW/MMIO: Pass System through Read() and Write(). 2024-01-12 08:28:01 +01:00
JosJuice e0eb4ef5bc JitArm64: Use enum class for LogicalImm size parameter
This should prevent issues like the one fixed in the previous commit
from happening again.
2023-12-16 16:48:26 +01:00
JosJuice 255ee3fdce JitArm64: Use LSL+CLS for classifying floats
This is a little trick I came up with that lets us restructure our float
classification code so we can exit earlier when the float is normal,
which is the case more often than not.

First we shift left by 1 to get rid of the sign bit, and then we count
the number of leading sign bits. If the result is less than 10 (for
doubles) or 7 (for floats), the float is normal. This is because, if the
float isn't normal, the exponent is either all zeroes or all ones.
2023-11-28 18:30:45 +01:00
Zopolis4 f0d2ce4683
Remove _M_X86 in favour of _M_X86_64 2023-11-28 23:03:20 +11:00
Mandar1jn afdf6de041
Skylanders: Improve figure data view and generation
Co-authored-by: deReeperJosh <joshua@dereeper.co.nz>
2023-11-05 18:06:10 +01:00
Dentomologist 75a62e116c PageFaultTest: Use GTEST_SKIP instead of early return
Using GTEST_SKIP instead of just returning from the function shows that
a test was skipped in the test summary. If GTEST_SKIP is called the rest
of the function won't be run, just like with the return.

GTEST_SKIP wasn't available until gtest 1.10, and we updated to 1.12 in
597f8f1b87.
2023-08-29 12:24:11 -07:00
JosJuice 1104b93ee4 UnitTests: Declare as CPU thread when using CPUThreadConfigCallback
This fixes a bunch of DEBUG_ASSERTs in the unit tests.
2023-08-17 19:19:25 +02:00
Admiral H. Curtiss 17f2072e1c
UnitTests: Enable cluster check in FileSystemTest.GetDirectoryStats. 2023-07-14 04:20:57 +02:00
Admiral H. Curtiss 23843583bf
PowerPC: Refactor to class, move to System. 2023-04-09 21:48:37 +02:00
Admiral H. Curtiss 62de9c593b
UnitTests: Avoid ppcState global. 2023-04-05 20:09:32 +02:00
Admiral H. Curtiss 7f50c070b2
JitInterface: Convert m_jit to unique_ptr. 2023-03-26 14:38:07 +02:00
Admiral H. Curtiss 9217a9eba4
JitInterface: Refactor to class, move to System. 2023-03-26 14:38:07 +02:00
Admiral H. Curtiss 9c0226b7e3
JitBase: Avoid System::GetInstance() and ppcState. 2023-03-25 02:37:00 +01:00
Lioncash 0888c93d48 Common: Move FPU-related helpers into Common namespace
Makes these utilities' namespace consistent with the majority of the
Common library.
2023-03-21 10:58:13 -04:00
Shawn Hoffman 2c2fb869a2 use std-provided randomness for JitArm64 unittests
decreases runtime significantly and lessens dependency on mbedtls
2023-02-22 12:55:12 -08:00
Admiral H. Curtiss 61ba516570
PowerPC: Move a few functions to PowerPCState. 2023-01-27 15:22:44 +01:00
Admiral H. Curtiss daa70533cd
CoreTiming: Store Globals in CoreTimingManager. 2022-11-27 03:47:12 +01:00
Admiral H. Curtiss c9558ecb4c
CoreTiming: Refactor to class. 2022-11-27 03:47:12 +01:00
Admiral H. Curtiss 86f17511fc
CoreTiming: Move the 'Globals' instance into Core::System. 2022-11-26 04:22:32 +01:00
Admiral H. Curtiss 0a6fdb9c13
HW: Pass System to MMIO handlers. 2022-11-23 05:52:21 +01:00
Admiral H. Curtiss a36a5c1308
CoreTiming: Pass Core::System to Events. 2022-11-06 17:54:58 +01:00
Tilka fb45ed3981
Merge pull request #10883 from Pokechu22/pi-fifo-reset-gp-fifo
ProcessorInterface: Reset both GPFifo and Fifo on PI_FIFO_RESET
2022-07-31 17:06:37 +02:00
Pokechu22 7a03b1fe16 UnitTests: Fix warnings from HermesText
Most of these correspond to changes made in devkitPro/libogc@b1b8ecab3a.

The numeric vlaues of ACC0 and ACC1 in Dolphin are different (see b06d38389b, though I'm not sure when this difference first appeared). Technically it's not even necessary to list the registers at the start like this anymore, but old programs do it, so it seems useful to have a test that covers it.

The binary itself does not need to be changed; the warnings were simply stating that "although you wrote $ACL0, the generated binary instead is using $ACC0" or similar; by changing the code to use $ACC0 directly the warnings are resolved.
2022-07-26 11:52:31 -07:00
Pokechu22 1c833ddc3c Create constant for GPFifo physical address 2022-07-22 22:22:33 -07:00
Merry 4d99506b4c UnitTests/MovI2R: Test all logical immediates 2022-07-10 22:17:09 +01:00
Pokechu22 dec48ed7de UnitTests: Remove unused include from DSPAssemblyTest 2022-06-14 13:07:14 -07:00
Pokechu22 5ea3efaedf UnitTests: Fix license for HermesBinary.cpp
This is an assembled version of HermesText.cpp, so the same license applies to it.
2022-06-14 12:22:06 -07:00
Pokechu22 75ff89e8c7 UnitTests: Edit wait_for_dsp_mail in HermesText to match HermesBinary
I don't know what happened here, unfortunately.  The version of dsp_mixer.s added to libogc on Nov 14, 2008 in c76d8b851f uses andcf and jlz here, and the version we have matches the one from Feb 5, 2009 in ae5c3a5fb5 exactly (prior to the fixes in my previous commit).  I can't see any reason why wait_for_dsp_mail would be changed like this.

ANDCF and ANDF were previously swapped and JNE/JEQ/JZR/JNZ became JNZ/JZ/JLNZ/JLZ on Apr 3, 2009 in 7c4e654253, corresponding to a change Hermes made on Nov 10, 2008 in 2cea6d99ad. But these predate the test being added.

The only other information I can find is that ASNDLIB 1.0 released on November 11, 2008, at https://web.archive.org/web/20120326145022/http://www.entuwii.net/foro/viewtopic.php?f=6&t=87 (but there aren't any surviving links from there).
2022-06-14 12:22:06 -07:00
Pokechu22 36769017c0 UnitTests: Update DSP test text for old renames
This change makes assembling DSPTestText match DSPTestBinary, though HermesText doesn't yet match HermesBinary.

The test data was originally added on April 18, 2009 in e7e4ef4481.  Then, set16 and set40 were swapped on April 22, 2009 89178f411c, which updated the DSPSpy version of dsp_code, but not the version in DSPTool used for testing.  So, when the test was made, the assembled data matched the text, but a few days after it no longer did.

Similarly, on Jul 7, 2009 in 1654c582ab the conditional instructions were adjusted, and 0x1706 was changed from JRL to JRNC and 0x0297 was changed from JGE to JC.

For what it's worth, devkitPro made the same changes on May 31, 2010 in 8a65c85c9b and updated their version of the asnd ucode (which is this ucode) on June 11, 2011 in b1b8ecab3a (though this update also includes other feature changes). Note that at the time, they didn't reassemble the ucode unless they made changes to it; the assembled was stored in the repo until bfb705fe16~...d20f9bdcfb43260c6c759f4fb98d724931443f93.

This fixes the following failures with Hermes:

!! 0015 : 8e00 vs 8f00 - set16         vs  set40
!! 016f : 8e00 vs 8f00 - set16         vs  set40

and with Hermes:

!! 0014 : 8e00 vs 8f00 - set16         vs  set40
!! 0063 : 8e00 vs 8f00 - set16         vs  set40
!! 019b : 1706 vs 1701 - jrnc        $AR0  vs  jrl         $AR0
!! 01bf : 0297 vs 0290 - jc          0x01dc  vs  jge         0x01dc
!! 01d2 : 0297 vs 0290 - jc          0x01dc  vs  jge         0x01dc

Hermes has the remaining failures:

!! 027b : 03c0 vs 03a0 - andcf       $AC1.M, #0x8000  vs  andf        $AC1.M, #0x8000
!! 027d : 029d vs 0294 - jlz         0x027a  vs  jnz         0x027a
2022-06-14 12:22:06 -07:00
Pokechu22 d52528a6f0 UnitTests: Add tests for assembling DSP code to expected binary
We already have the data for this, so this seems like a useful thing to do.  However, neither of the new tests currently pass...
2022-06-14 12:22:06 -07:00
Pokechu22 6a2ec825a2 UnitTests: Fail DSPAssemblyTest if the assembled code doesn't match the expected result
This reveals that both HermesText and HermesBinary fail.  HermesBinary would have failed on master, too, if this had been implemented.
2022-06-14 12:22:06 -07:00
Pokechu22 d8803a1298 UnitTests: Use fmt::print in DSPAssemblyTest 2022-06-14 12:22:05 -07:00
Pokechu22 8fac249581 UnitTests: Use fmt::print in PageFaultTest 2022-06-14 12:22:05 -07:00
Pokechu22 dd66dac5c1 UnitTests: Fix typo in DSPAssemblyTest 2022-06-14 12:22:05 -07:00
Pokechu22 3cb0976367 UnitTests: Use hermes.s as part of an actual test
Before, the file just existed as the source code for HermesBinary.cpp, but we can test that things assemble correctly too (compare DSPTestBinary.cpp and DSPTestText.cpp).

A bit of jank is needed due to MSVC limitations (see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-170).
2022-06-14 12:22:05 -07:00
Dentomologist 2999cca41b UnitTests: Fix -Wrange-loop-construct warnings
Don't use reference variable bound to a temporary value
2022-06-03 22:28:17 -07:00
Dentomologist 6ffd938f98 UnitTests: Skip PageFaultTest if exception handlers are not supported
Page faults should only occur on architectures that support exception
handlers, so skip the test on other architectures to avoid spurious test
failures.
2022-05-19 12:26:41 -07:00
Pokechu22 161c627466 Treewide: Remove unused inclusions of <cinttypes>
Most of these became unneeded when fmt was introduced.
2022-01-09 12:43:11 -08:00
Admiral H. Curtiss cae4b545bd
Config: Port CPU overclock settings to new config system. 2021-12-25 21:52:50 +01:00
Dylan Smit 9de7ef6d8d Fix improper naming
I'm so sorry
2021-11-24 17:04:30 +01:00
JMC47 e5a4a86672
Merge pull request #10055 from JosJuice/jitarm64-reuse-memory
JitArm64: Codegen space reuse
2021-11-20 17:35:24 -05:00
JosJuice 44beaeaff5 Arm64Emitter: Check end of allocated space when emitting code
JitArm64 port of 5b52b3e.
2021-10-13 21:52:16 +02:00
Pokechu22 78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Pierre Bourdon 0cf041de24
licensing: various one-off conversions to SPDX tags 2021-07-05 04:35:56 +02:00