Commit Graph

307 Commits

Author SHA1 Message Date
bbc8631357 IOS/FS: Fix CreateFullPath to not create directories that already exist
This fixes CreateFullPath to not create directories when it is known
that they already exist, instead of calling CreateDirectory anyway
and checking if the error is AlreadyExists. (That doesn't work
now that we have an accurate implementation of CreateDirectory
that performs permission checks before checking for existence.)

I'm not sure what I was thinking when I wrote that function.

Also adds some tests for CreateFullPath.
2020-01-30 18:07:03 +01:00
73aea8af6b Merge pull request #8539 from leoetlino/fs-accuracy
IOS/FS: Reimplement many functions in a more accurate way
2020-01-25 23:00:10 +00:00
119ccc5e4f Merge pull request #8556 from Sintendo/bestrest
x64Emitter: Avoid 8-bit displacement when possible
2020-01-25 19:10:47 +00:00
709862b818 Merge pull request #8120 from MerryMage/cdts
Jit64: Make DoubleToSingle a common asm routine
2020-01-25 19:10:37 +00:00
031c63eb8a UnitTests/FS: Improve deletion test
* Test recursive directory deletion
* Test "in use" check for both files and directories
2020-01-25 17:54:58 +01:00
af416c60b0 UnitTests/FS: Add ReadDirectory ordering test (issue 10234) 2020-01-25 17:54:58 +01:00
8789a6ddb3 UnitTests/FS: Fix file rename tests
Files cannot be given a different file name, only moved across
directories.

Add a test for that behaviour and fix the existing
RenameWithExistingTargetFile test.
2020-01-25 17:54:58 +01:00
d4ba0acb3a UnitTests/FS: Add path validity and splitting tests 2020-01-25 17:54:57 +01:00
484cfb9328 UnitTests/FS: Add metadata tests 2020-01-25 17:53:39 +01:00
d5cb858165 x64Emitter: Unit test memory addressing modes
Test the behavior of OpArg::WriteRest by using MOV with the various
addressing modes (MatR, MRegSum, etc.) in the source operand.

Both the instruction and the instruction length are validated.
2020-01-13 08:43:30 +01:00
6e18dfb600 Merge pull request #8133 from Sintendo/mov64imm32
x64Emitter: Emit shorter MOVs for 32-bit immediates
2020-01-06 13:12:56 +01:00
6fcb1c6c46 Add an ARM64 target to Visual Studio projects 2019-12-28 19:20:41 +10:00
dd23a1ee79 Update VS projects/solutions to VS2019 2019-11-30 13:42:52 +10:00
85ceb37ccd InputCommon: Make the "input gate" not racey. 2019-11-06 16:31:02 -06:00
b3969e91d9 FixedSizeQueue: Bugfixes and improvements
- Fixed a bug where pushing items over queue's size left it in a corrupted state
- For non-trivial types, have clear() and pop() run destructors
- Added emplace(args...)
- Added empty()

FixedSizeQueue has semantics of a circular buffer,
so pushing items continuously is expected to keep overwriting oldest elements gracefully.

Tests have been updated to verify correctness of a previously bugged behaviour
and to verify correctness of destructing non-trivial types
2019-08-31 21:18:07 +02:00
a9663669dc Common/CommonFuncs: Remove now-unneccessary ArraySize function
Since C++17, non-member std::size() is present in the standard library
which also operates on regular C arrays. Given that, we can just replace
usages of ArraySize with that where applicable.

In many cases, we can just change the actual C array ArraySize() was
called on into a std::array and just use its .size() member function
instead.

In some other cases, we can collapse the loops they were used in, into a
ranged-for loop, eliminating the need for en explicit bounds query.
2019-06-01 10:07:57 -04:00
9fe3150358 x64EmitterTest: Test 64-bit MOV with 32-bit immediate 2019-05-29 01:04:16 +02:00
12314577c1 Jit64AsmCommon: Make ConvertDoubleToSingle use RSCRATCH as output 2019-05-25 23:07:50 +01:00
ec8d57d882 UnitTests/Jit64Common: Test GenConvertDoubleToSingle 2019-05-25 23:07:50 +01:00
8417c78b7a Update Discord rich presence when the title changes
This allows us to update the rich presence description if a channel
is launched from the Wii Menu. It also handles other PPC title
launches, e.g. Smash Bros. Masterpieces.

Host.h: Added Host_TitleChanged().

DolphinNoGUI/MainNoGUI.cpp: Implemented Host_TitleChanged().
DolphinQt/Host.cpp: Implemented Host_TitleChanged().

Android/jni/MainAndroid.cpp: Stubbed Host_TitleChanged().
DSPTool/StubHost.cpp: Stubbed Host_TitleChanged().
UnitTests/StubHost.cpp: Stubbed Host_TitleChanged().
2019-05-24 14:12:48 +02:00
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
c110ffcdaa Remove redundant initialization 2019-04-30 01:22:24 +02:00
113bd60fe7 Implement D3D12 backend 2019-04-01 11:24:55 +10:00
61350b3d98 Core/Host: Allow frontends to block inputs 2019-03-21 13:16:21 +01:00
bfb9b1aca5 Merge pull request #7602 from CrystalGamma/stop-g_jit
stop using g_jit outside of JitInterface
2018-12-27 23:12:14 +01:00
b7b552f20a x64EmitterTest: Add some missing tests 2018-12-26 15:22:45 +00:00
2f490e44fb stop using g_jit outside of JitInterface
Replace g_jit in x86-64 ASM routines code by m_jit member reference
2018-12-15 01:58:58 +01:00
a3961750a7 Drop Host_GetRenderSurface and pass display to backend 2018-10-20 21:11:34 +10:00
134d967be2 Refactoring and cleanup of GLInterface (now GLContext) 2018-10-20 21:11:34 +10:00
97cc9894e4 Update to Visual Studio's default Windows SDK 2018-10-20 00:53:08 +01:00
ecd4897d43 Merge pull request #7437 from stenzek/graphics-options-race
Fix race condition caused by opening graphics options while running
2018-10-12 10:29:28 -04:00
32ef8706e5 Merge pull request #7414 from Sintendo/shortmovs
x64Emitter: emit shorter MOVs for 64-bit immediates
2018-10-06 00:01:35 +01:00
826bcad3a5 UnitTets: Add tests for frsqrte 2018-09-28 18:11:30 +01:00
a877d5f6dc Remove unused Host_ShowVideoConfig 2018-09-28 14:05:53 +10:00
8a93dd0105 x64EmitterTest: Fix linting issues 2018-09-16 19:52:12 +02:00
58a0d0f117 x64EmitterTest: test MOV with 64-bit immediates 2018-09-16 19:52:12 +02:00
c4fb07f428 Common, DSP: Only compile in x86-64 emitter related utilities on x86 platforms
Previously these were required to be built into the executable so that
the JIT portion of the DSP code would build properly, as the
x86-64-specifics were tightly coupled to the DSP common code. As this is
no longer the case, this is no longer necessary.
2018-06-21 06:53:31 -04:00
6f473b96d0 PowerPC: Convert CPUCore enum into an enum class
Makes the enum values strongly-typed and prevents the identifiers from
polluting the PowerPC namespace. This also cleans up the parameters of
some functions where we were accepting an ambiguous int type and
expecting the correct values to be passed in.

Now those parameters accept a PowerPC::CPUCore type only, making it
immediately obvious which values should be passed in. It also turns out
we were storing these core types into other structures as plain ints,
which have also been corrected.

As this type is used directly with the configuration code, we need to
provide our own overloaded insertion (<<) and extraction (>>) operators
in order to make it compatible with it. These are fairly trivial to
implement, so there's no issue here.

A minor adjustment to TryParse() was required, as our generic function
was doing the following:

N tmp = 0;

which is problematic, as custom types may not be able to have that
assignment performed (e.g. strongly-typed enums), so we change this to:

N tmp;

which is sufficient, as the value is attempted to be initialized
immediately under that statement.
2018-06-15 10:27:59 -04:00
4d55cb745c UnitTests: Fix MSVC compilation 2018-06-12 15:28:59 +02:00
ccf9ecbb03 UnitTests/VertexLoaderTest: Fix compilation on newer GTest versions 2018-06-12 14:59:57 +02:00
8074192a85 Merge pull request #7057 from leoetlino/string
Config/StringUtil/IniFile: Get rid of some duplicated code
2018-06-04 12:44:57 +02:00
7154bfd825 UnitTest: Add StringUtil ToString/TryParse test
Only a single one, but the main one for ini files:
Check if the written values can be parsed again.
2018-06-03 23:12:32 +02:00
6b9aef7042 FS: Add a struct for modes
As suggested here: https://dolp.in/pr7059#pullrequestreview-125401778

More descriptive than having a std::tuple of FS::Mode, and lets us
give names to known triplets of modes (like in ES). Functions that
only forward mode arguments are slightly less verbose now too.
2018-06-03 20:45:35 +02:00
4288bfe0f9 Common: Move host communication enum to Host.h
Given this is actually a part of the Host interface, this should be
placed with it.

While we're at it, turn it into an enum class so that we don't dump its
contained values into the surrounding scope. We can also make
Host_Message take the enum type itself directly instead of taking a
general int value.

After this, it'll be trivial to divide out the rest of Common.h and
remove the header from the repository entirely
2018-05-28 14:34:59 -04:00
cec7fded60 IOSC: Implement VerifyPublicKeySign for ECC 2018-05-20 20:04:53 +02:00
67ce7e34e9 UnitTests: Add basic tests for ec crypto code
Verifies that PrivToPub and ComputeSharedSecret give expected results.
2018-05-20 19:59:26 +02:00
ba01f6dba3 CommonFuncs: Convert ROUND_UP_POW2 macro to a function
Also move it to MathUtils where it belongs with the rest of the
power-of-two functions. This gets rid of pollution of the current scope
of any translation unit with b<value> macros that aren't intended to be
used directly.
2018-05-10 19:42:20 -04:00
0a3631cc76 FloatUtils: Remove IntDouble and IntFloat
Type punning via unions in C++ invokes undefined behavior. Instead, leverage BitCast,
our variant of C++2a's std::bit_cast
2018-05-10 12:28:09 -04:00
b3292298c9 BitUtils: Add C++14/C++17 compatible equivalent of std::bit_cast from C++2a
Given bit conversions between types are quite common in emulation
(particularly when it comes to floating-point among other things) it
makes sense to provide a utility function that keeps all the boilerplate
contained; especially considering it makes it harder to accidentally
misuse std::memcpy (such as accidentally transposing arguments, etc).

Another benefit of this function is that it doesn't require separating
declarations from assignments, allowing variables to be declared const.
This makes the scenario of of uninitialized variables being used less
likely to occur.
2018-05-10 12:28:05 -04:00