Commit Graph

2859 Commits

Author SHA1 Message Date
Léo Lam 93f49b1ca4 Config: Make Load() and Save() slightly faster
Only invoke config changed callbacks from Config::Save, not
Layer::Save. The latter results in callbacks being called
once per layer, up to 7 times per save.
2018-05-23 16:07:18 +02:00
Sepalani 8fa898fe9a DebugInterface: MemoryPatches methods added
CodeView: Restore instruction added
2018-05-22 10:31:31 +04:00
Léo Lam cec7fded60 IOSC: Implement VerifyPublicKeySign for ECC 2018-05-20 20:04:53 +02:00
Léo Lam 355b1b5d5b ec: Improve readability and clarity
- Move all of the ec functions into the Common::ec namespace.

- Give the public functions better names and some usage information.

- Move all of the "elt" related functions into an "elt" class including
  all of the arithmetic operations, so that the logic becomes clearer
  and feels less like assembly.

  This also makes it much more obvious what the parameters are, instead
  of only using unsigned char* (which doesn't tell anything about what
  the pointer is used for or the size).

- Similarly, add a new "Point" class and move point functions there.
  Overload the arithmetic operators to make calculations easier to read
2018-05-20 19:59:26 +02:00
Léo Lam e83591f188 ec: Avoid exposing internal function 2018-05-20 19:59:26 +02:00
Léo Lam b9dd94b9b2 bn: Use int instead of u32 for sizes
The loops relied on unsigned integer overflow, which is not immediately
obvious. Replace them with less clever variants that are clearer.

Also implement bn_compare using std::memcmp.
2018-05-20 19:59:26 +02:00
JosJuice 10ff6d73c2 Fix compatibility with versions of libpng older than 1.5 2018-05-20 13:44:42 +02:00
Emmanuel Gil Peyrot 17e65a7167 VideoCommon: Replace SOIL with libpng for hires textures 2018-05-20 13:44:38 +02:00
Lioncash 1c63a48fab Common/CodeBlock: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-17 15:57:29 -04:00
Lioncash 011ee110bc Common/Hash: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-16 15:39:23 -04:00
Lioncash 947fa271be Common: Add MemArena.h/cpp to the Common namespace
Brings more common code under the Common namespace.
2018-05-15 18:27:32 -04:00
Léo Lam f91b729b61
Merge pull request #6825 from leoetlino/onion-types
Config: Fix implicit conversions/enum config types
2018-05-12 21:59:43 +02:00
Lioncash 0ef7dca0d4 SettingsHandler: Remove redundant type qualifier in SetBytes()
Given the qualifier isn't used for the constructor taking a buffer, remove it here
to be consistent.
2018-05-12 13:53:42 -04:00
Lioncash 1da2091801 SettingsHandler: Remove unnecessary includes
All Windows-specific includes aren't needed here anymore.
2018-05-12 13:53:37 -04:00
Lioncash 5677e5d74a SettingsHandler: Namespace code under the Common namespace
Adds another file in Common to the Common namespace.
2018-05-12 13:39:37 -04:00
Léo Lam 6763a3fce1 Config: Add support for enums
This makes it possible to use enums as the config type.
Default values are now clearer and there's no need for casts
when calling Config::Get/Set anymore.

In order to add support for enums, the common code was updated to
handle enums by using the underlying type when loading/saving settings.

A copy constructor is also provided for conversions from
`ConfigInfo<Enum>` to `ConfigInfo<underlying_type<Enum>>`
so that enum settings can still easily work with code that doesn't care
about the actual enum values (like Graphics{Choice,Radio} in DolphinQt2
which only treat the setting as an integer).
2018-05-12 18:10:26 +02:00
Léo Lam 7dca7c237e Config: Fix template deduction for implicit conversions
This excludes the second argument from template deduction.

Otherwise, it is required to manually cast the second argument to
the ConfigInfo type (because implicit conversions won't work).

e.g. to set the value for a ConfigInfo<std::string> from a string
literal, you'd need a ugly `std::string("yourstring")`.
2018-05-12 14:30:18 +02:00
Lioncash a85aa73c4d
FileUtil: Remove unnecessary IOFile GetHandle() call in ReadFileToString()
We can just use IOFile's GetSize() function to do the same thing. While
we're at it, get rid of unnecessary variables.
2018-05-11 16:27:33 -04:00
Anthony 968779e623
Merge pull request #6814 from lioncash/sd
SDCardUtil: Minor changes
2018-05-11 12:39:17 -07:00
Jonathan Hamilton 791c8401c1 Update mpark::variant implementation to 1.3.0
Fixes building on the latest clang shipping on MacOS
(Apple LLVM version 9.1.0 (clang-902.0.39.1))
2018-05-11 11:15:06 -07:00
Lioncash cdeed038bd
SDCardUtil: Replace macros with typed equivalents
Instead use a general template and specify which type we're writing out.
2018-05-11 12:33:07 -04:00
Lioncash 3b0139b258
SDCardUtil: Namespace SDCardUtil
Brings yet another header in the common library under the Common
namespace.
2018-05-11 09:19:30 -04:00
Lioncash 4e1547b3b2
SDCardUtil: Remove the use of IOFile's GetHandle() function
GetHandle() should really not even be part of IOFile's interface, but
since it is (for the time being), we can cull unnecessary usages of it.
In this case, the WriteBytes() function does what we need without using
the underlying handle directly.
2018-05-11 09:19:29 -04:00
Lioncash ad4150dae9
SDCardUtil: Join variables with declarations where applicable 2018-05-11 09:19:26 -04:00
Lioncash 1ffd0d2572
SDCardUtil: Make type of write_empty's "count" parameter size_t
This allows getting rid of casts. We can also leverage std::min to allow
making relevant variables const. Also make the "empty" table const to
allow it to be read-only.
2018-05-11 08:55:05 -04:00
Lioncash c26de8107d
SDCardUtil: Convert return type of write_* functions to bool
Converts them from 0 == success, 1 == failure to using the built-in
standard bool. Also while we're at it, const qualify write_sector's
"sector" parameter, since nothing in the function modifies the data
being pointed to.
2018-05-11 08:29:37 -04:00
Lioncash 5fc18aa639
SDCardUtil: Replace sector size magic value with relevant named constant
Makes variable use consistent throughout the file.
2018-05-11 08:25:35 -04:00
Léo Lam e1866d35e5
Merge pull request #6807 from leoetlino/boot
Boot: Migrate to new filesystem interface
2018-05-11 10:41:00 +02:00
Lioncash 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
Léo Lam 722d31124c SettingsHandler: Fix const correctness 2018-05-10 21:35:27 +02:00
Léo Lam 09d2afa91f SettingsHandler: Migrate to new filesystem interface
Change SettingsHandler to take a buffer instead of assuming that the
setting file to read is always on the host filesystem for more
flexibility and make it possible to use the new filesystem interface.
2018-05-10 21:35:27 +02:00
Lioncash 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
Lioncash bde4e970f1
FloatUtils: Clean up memcpy usages
Now that we have BitCast, we can use that instead.
2018-05-10 12:28:09 -04:00
Lioncash 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
Léo Lam 169e1d3368
Merge pull request #6795 from lioncash/atomic
Atomic_Win32: Replace deprecated (and since been removed) barrier intrinsics
2018-05-09 19:46:00 +02:00
Lioncash 593bad3253 Atomic_Win32: Replace deprecated (and since been removed) barrier intrinsics
As of VS 15.7, these seem to have been removed. Given we shouldn't have
been using these for some time, just replace them with the standard
library equivalent.

This fixes building on Windows with VS 15.7
2018-05-09 11:35:35 -04:00
Lioncash f29e7fea2a FloatUtils: Remove union type punning from ClassifyX functions
Type-punning via unions is undefined behavior in C++

Also take the liberty of cleaning these up a little bit by removing
unnecessary else usages.
2018-05-09 10:25:23 -04:00
Lioncash fe218ea3f6 FloatUtils: Remove union type punning from ApproximateReciprocal functions
This form of type punning invokes undefined behavior in C++
2018-05-09 10:05:29 -04:00
Lioncash 46a4243d9a FloatUtils: Remove using namespace std in ApproximateReciprocal()
This was made quite a long time ago when we supported 32-bit ARM targets
2018-05-09 09:36:23 -04:00
Léo Lam a9987588eb
Merge pull request #6768 from spycrab/qt_stylesheet
Qt: Allow custom stylesheets
2018-05-08 15:20:19 +02:00
spycrab 0170052f5d Qt: Allow custom stylesheets 2018-05-08 15:07:50 +02:00
Léo Lam f0e6fcfb07
Merge pull request #6785 from JosJuice/stringutil-order
StringUtil.h: Move ThousandSeparate down
2018-05-08 14:31:57 +02:00
JosJuice 965c423f1c StringUtil.h: Move ThousandSeparate down
It calls UTF16ToUTF8 on Windows, so it should come after UTF16ToUTF8.
2018-05-08 13:55:07 +02:00
Léo Lam f97711ac02
Merge pull request #6777 from lioncash/header
Common: Move floating-point utility functions to FloatUtils.h/.cpp
2018-05-08 11:55:25 +02:00
booto 823fdda30c intrinsics: stop defining _xgetbv/_XCR_XFEATURE_ENABLED_MASK, which are reserved 2018-05-08 17:25:33 +08:00
Lioncash 86018b503b Common: Move floating-point utility functions to FloatUtils.h/.cpp
Keeps all of the floating-point utility functions in their own file to
keep them all together. This also provides a place for other
general-purpose floating-point functions to be added in the future,
which will be necessary when improving the flag-setting within the
interpreter.
2018-05-07 02:56:32 -04:00
Lioncash 82b1518342 x64Emitter: Use an enum class to represent FixupBranch branch types
Gets rid of the use of magic values and replaces them with strongly
typed symbolic names.
2018-05-06 22:05:03 -04:00
Léo Lam 76b031184c
Merge pull request #6341 from sepalani/debug-watches
DebugInterface: Watches methods added
2018-05-06 13:25:26 +02:00
Léo Lam d8549d172c
Merge pull request #6651 from leoetlino/nand-paths
NandPaths: Return paths that are relative to Wii NAND
2018-05-05 11:01:35 +02:00
spycrab db0e5108dc Win32/FileUtil: Fix IsDirectory() not working for certain directories 2018-05-04 23:53:41 +02:00