Commit Graph

478 Commits

Author SHA1 Message Date
Alfred Wingate d7c93d87be
Add support for libfmt-11
fmt::join was moved into fmt/ranges.h

Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-08-22 16:54:35 +03:00
JosJuice 9594ce871d UnitTests: Remove MSBuild input/output tracking
Input/output tracking is intended to speed up incremental builds by
skipping a target when it doesn't need to be built. However, this seems
to be unreliable for UnitTests' AfterBuild target. Let's remove it.

It's still the case that UnitTests' AfterBuild target will be skipped if
UnitTests doesn't need to be rebuilt. (Note that UnitTests always needs
to be rebuilt if SCMRevGen changed.)

I haven't seen these problems with DolphinQt's rather similar
input/output tracking. This may be because DolphinQt's one also has the
exe file as an input/output.
2024-08-17 15:59:45 +02:00
JosJuice f695a65aad UnitTests: Delete output Sys folder before copying to it
Like the previous commit, but for UnitTests. This time all operating
systems were affected.

I also made UnitTests.vcxproj use the same way of copying as
DolphinQt.vcxproj, just for consistency.
2024-08-16 21:09:10 +02:00
Tilka 07557e5d9c
Merge pull request #13015 from tygyh/Use-boolean-literals
Replace boolean constants with boolean literals
2024-08-16 20:04:45 +01:00
mitaclaw 9fa4eb9aab Use 'contains' method 2024-08-15 14:20:16 -07:00
Dr. Dystopia 309df9ed5b Replace boolean constants with boolean literals 2024-08-15 07:14:43 +02:00
Dr. Dystopia 15500198d8 Remove self-comparison 2024-08-14 14:50:15 +02: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
Admiral H. Curtiss 3f0f5b3b4e
Merge pull request #12815 from Dentomologist/enable_hotkeys_and_controllers_for_focused_tas_input
TAS Input: Enable emulator hotkeys and controller input when TAS Input window has focus
2024-06-15 15:25:40 +02:00
Admiral H. Curtiss 04c246d11f
Merge pull request #12837 from JosJuice/cmake-one-tests-binary
CMake: Put all unit tests in one binary
2024-06-10 22:47:45 +02:00
Niel Lebeck 9b0dcc83d1 Add some unit tests for the `Rectangle` class 2024-06-09 16:28:35 -07:00
JosJuice f404edb4dc CMake: Put all unit tests in one binary
We currently have 32 different binaries containing unit tests. At least
when I build for Android, each one takes up over 200 MiB, and linking
them all increases my incremental build times by over a minute. I'd
like to change this for the sake of my productivity and disk space.

For reference, MSBuild is already putting all tests in a single binary.
2024-06-06 19:30:43 +02:00
Dentomologist c3bdd05d2a TAS Input: Enable hotkeys and controller input when Input has focus
Enable emulator hotkeys and controller input (when that option is
enabled) when a TAS Input window has focus, as if it was the render
window instead.  This allows TASers to use frame advance and the like
without having to switch the focused window or disabling Hotkeys Require
Window Focus which also picks up keypresses while other apps are active.

Cursor updates are disabled when the TAS Input window has focus, as
otherwise the Wii IR widget (and anything else controlled by the mouse)
becomes unusable. The cursor continues to work normally when the render
window has focus.
2024-05-31 15:14:44 -07:00
JosJuice 2c91367429
Merge pull request #12737 from nlebeck/settingshandler-split
Eliminate SettingsHandler's `SetBytes` and `Reset` methods
2024-05-05 22:35:23 +02:00
Pokechu22 fbbfea8e8e Replace Common::BitCast with std::bit_cast 2024-05-03 18:43:51 -07:00
Niel Lebeck 36cdb4a544 Eliminate SettingsHandler's `SetBytes` and `Reset` methods
Also make the `Decrypt` method private.

As far as I can tell, the only motivation for exposing the `SetBytes`
and `Reset` methods is to allow `CBoot::SetupWiiMemory` to use the same
`SettingsHandler` instance to read settings data and then write it back.
It seems cleaner to just use two separate instances, and require a given
`SettingsHandler` instance to be used for either writing data to a
buffer or reading data from a buffer, but not both.

A natural next step is to split the `SettingsHandler` class into two
classes, one for writing data and one for reading data. I've deferred
that change for a future PR.
2024-04-23 17:19:01 -07:00
Guilherme Janczak 50dc0ffbce
port to OpenBSD 2024-04-22 20:50:47 +00:00
Niel Lebeck d2b96736e0 Pass SettingsHandler buffers by const ref instead of rvalue ref 2024-04-12 18:50:21 -07:00
Tilka 9a9be5ca51
Merge pull request #12614 from nlebeck/settingshandler-edgecase
Add SettingsHandler unit tests exercising the edge case fixed in PR #8704
2024-04-12 17:32:51 +01:00
Pokechu22 a3951dc2d7 Fix out of bounds accesses for invalid vertex component formats
On all platforms, this would result in out of bounds accesses when getting the component sizes (which uses stuff from VertexLoader_Position.h/VertexLoader_TextCoord.h/VertexLoader_Normal.h). On platforms other than x64 and ARM64, this would also be out of bounds accesses when getting function pointers for the non-JIT vertex loader (in VertexLoader_Position.cpp etc.). Usually both of these would get data from other entries in the same multi-dimensional array, but the last few entries would be truly out of bounds. This does mean that an out of bounds function pointer can be called on platforms that don't have a JIT vertex loader, but it is limited to invalid component formats with values 5/6/7 due to the size of the bitfield the formats come from, so it seems unlikely that this could be exploited in practice.

This issue affects a few games; Def Jam: Fight for New York (https://bugs.dolphin-emu.org/issues/12719) and Fifa Street are known to be affected.

I have not done any hardware testing for this PR specifically, though I *think* I previously determined that at least a value of 5 behaves the same as float (4). That's what I implemented in any case. I did previously determine that both Def Jam: Fight for New York and Fifa Street use an invalid normal format, but don't actually have lighting enabled when that normal vector is used, so it doesn't change rendering in practice.

The color component format also has two invalid values, but VertexLoader_Color.h/.cpp do check for those invalid ones and return a default value instead of doing an out of bounds access.
2024-04-04 12:50:34 -07:00
Admiral H. Curtiss a2074a8583
Merge pull request #12645 from mitaclaw/ppc-symbols-signal
DolphinQt: A Ubiquitous Signal For When Symbols Change
2024-03-31 06:36:09 +02:00
mitaclaw b52a08d533 DolphinQt: A Ubiquitous Signal For When Symbols Change
There were three distinct mechanisms for signaling symbol changes in DolphinQt: `Host::NotifyMapLoaded`, `MenuBar::NotifySymbolsUpdated`, and `CodeViewWidget::SymbolsChanged`. The behavior of these signals has been consolidated into the new `Host::PPCSymbolsUpdated` signal, which can be emitted from anywhere in DolphinQt to properly update symbols everywhere in DolphinQt.
2024-03-28 09:57:22 -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
Niel Lebeck 9029b7a082 Add SettingsHandler unit tests exercising the edge case in PR #8704 2024-03-06 22:08:30 -08:00
Niel Lebeck 0344ec6d79 Add simple unit tests for SettingsHandler 2024-03-01 20:52:45 -08: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
Dentomologist 7dbf463ddf BitSet64: Fix iterator incrementation
Use 1 of the same type as the stored value when shifting left. This
prevents undefined behavior caused by shifting an int more than 31 bits.

Previously iterator incrementation could either hang or prematurely
report it had reached the end of the bitset.
2024-01-01 00:41:48 -08:00
Dentomologist 58c5ae3de9 UnitTests: Refactor BitSetTest
Group numbers and their bitcounts together in pairs, which allows for
range-based loop iteration.
2023-12-31 12:10:50 -08:00
Tilka 773ffd04b8
Merge pull request #11497 from vyuuui/debugger_assembler_ui
Built-in assembler for debugger interface
2023-12-16 21:15:31 +00:00
Admiral H. Curtiss 190c4e8cda
Merge pull request #12427 from JosJuice/jitarm64-msr-updated-logical-imm
JitArm64: Fix MSRUpdated(ARM64Reg) with FEATURE_FLAG_PERFMON set
2023-12-16 17:22:23 +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
vyuuui 00e94d3630 Added tests 2023-12-13 05:32:47 -08:00
Tilka 7588f5e2da
Merge pull request #12395 from lioncash/test
VertexLoaderTest: Resolve -Wdangling-else warnings
2023-12-12 20:40:49 +00:00
Lioncash 4229d76ad6 VertexLoaderTest: Resolve -Wdangling-else warnings
The ways the assertion macros expand end up generating -Wdangling-else
warnings. Trivial enough to fix by just bracing the if statements.
2023-12-11 18:45:25 -05:00
Lioncash 017b9a0af7 FloatUtilsTest: Resolve -Wsign-compare warning 2023-12-11 18:08:52 -05:00
Pokechu22 1ee6824324 VertexLoaderTest: Add test for skipped texture coordinates
Jimmie Johnson's Anything with an Engine is known to use texture coordinate 7 (and only texture coordinate 7) in some cases. There are a lot of possible edge-cases, so this test brute-forces all combinations with coordinates 0, 1, and 2.
2023-12-02 15:54:52 -08:00
Pokechu22 530590d162 VertexLoaderTest: Add test for skipped colors
This test fails with the non-JIT vertex loader due to an issue fixed in a later commit in this PR. (Note that the non-JIT vertex loader is only used on machines where no JIT is available or if COMPARE_VERTEXLOADERS is enabled in VertexLoaderBase.cpp.)
2023-12-02 15:53:59 -08: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
Admiral H. Curtiss 76d605639b
Merge pull request #11881 from JosJuice/aarch64-function-call
JitArm64: Add utility for calling a function with arguments
2023-11-25 17:30:42 +01:00
Admiral H. Curtiss ec69ed2173
Merge pull request #12133 from mandar1jn/skylanders-improved-generation
Skylanders: Improve figure data view and generation
2023-11-05 18:29:19 +01: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
JosJuice c248a69268 JitArm64: Add utility for calling a function with arguments
With this, situations where multiple arguments need to be moved
from multiple registers become easy to handle, and we also get
compile-time checking that the number of arguments is correct.
2023-11-01 19:01:58 +01:00
Sintendo ef7f3b5bac UnitTests: Test ApproximateReciprocalSquareRoot 2023-10-30 22:39:12 +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
Admiral H. Curtiss 2502e412b3
Merge pull request #12117 from JosJuice/config-callback-cpu
Don't call RunAsCPUThread in config callbacks
2023-08-26 16:34:46 +02: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
Dentomologist 4ccac53e9f X64EmitterTest: Check bytes instead of disassembly in JMP test
Check bytes directly to avoid ambiguity in the disassembly between short
and near jumps, which could hypothetically cause the test to pass when
it shouldn't.
2023-08-05 13:51:42 -07:00
Dentomologist dcd5ba6587 x64EmitterTest: add J/J_CC/CALL unit tests 2023-08-05 13:51:42 -07:00