Commit Graph

2927 Commits

Author SHA1 Message Date
Lioncash 397b27e665 MemoryPatches: In-class initialize is_enabled state for MemoryPatch instances
Given this is what occurs in both constructors (as one just passes
through to another), we can just initialize the member directly.

While we're at it, amend the struct to follow the general ordering
convention of:

<new types>
<functions>
<variables>
2018-05-29 18:04:06 -04:00
Lioncash 4c33bb8dda MemoryPatches: std::move std::vector in the constructor
We can avoid copying the vector contents in this instance.
2018-05-29 18:01:16 -04:00
Lioncash 97c5a840db PcapFile: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-29 17:56:15 -04:00
spycrab 44784cf363 Common/HttpRequest: Add option to set cookies 2018-05-29 03:56:28 +02:00
Lioncash 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
Markus Wick 40d3163b12
Merge pull request #6998 from lioncash/log
Common: Remove unnecessary ~9 year old LOGGING preprocessor define
2018-05-28 09:33:21 +02:00
Lioncash ee434d4f01 Common: Remove unnecessary ~9 year old LOGGING preprocessor define
This was added in 4bdb4aa0d1 back in
2009-02-27. The only usage spot of this macro involves the same checks
that were used to define that preprocessor macro, so we can simply
remove the macro
2018-05-27 21:33:25 -04:00
Lioncash a745666a60 ColorUtil: Amend function name casing
Makes the function names conform to our coding style.
2018-05-27 21:04:48 -04:00
Lioncash ac474ff1da ColorUtil: Namespace code under the Common namespace
Given this is within Common, it should be in the Common namespace
itself.
2018-05-27 21:00:54 -04:00
Lioncash c056708dc8 CDUtils: Remove unused parameter in IsCDROM()
It was only ever passed nullptr, and even then, nothing was actually
done with the parameter.
2018-05-27 18:48:23 -04:00
Lioncash 470b09fe9d CDUtils: Amend function names
Amends the function names to follow our coding style.
2018-05-27 18:48:09 -04:00
Lioncash 1f75fa0aff CDUtils: Namespace code under the Common namespace 2018-05-27 18:30:58 -04:00
Lioncash f4ec419929 SymbolDB: Namespace code under the Common namespace
Moves more common code into the Common namespace where it belongs.
2018-05-27 18:01:40 -04:00
Lioncash 72e8058fb8 SymbolDB: Default constructor and destructor within the cpp file
Given this is a class with non-trivial data-members, it's preferable to
default the constructor and destructor in the cpp file.
2018-05-27 17:25:22 -04:00
Lioncash a1a81c7bc9 SymbolDB: Convert typedefs into using aliases 2018-05-27 17:23:55 -04:00
Lioncash e9b9797a86 SymbolDB: Normalize variable names
Normalizes variable naming so that it adheres to our coding style

While we're at it do minor cleanup relating to modified lines
2018-05-27 17:23:10 -04:00
Léo Lam bea1e38c67 Move ECCSignature to Common::ec and give it a less confusing name 2018-05-27 14:01:38 +02:00
Lioncash b60ad2425d Common: Namespace GekkoDisassembler.cpp/.h
Moves more common code into the Common namespace where it belongs
2018-05-25 16:55:09 -04:00
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
Léo Lam 8317a66ea5 NandPaths: Return paths that are relative to Wii NAND
Since all FS access will go through the new FS interface (PR #6421)
in order to keep track of metadata properly, there is no need to return
absolute paths anymore.

In fact, returning host paths is a roadblock to using the FS interface.

This starts the migration work by adding a way to get paths that are
relative to the Wii NAND instead of always getting absolute paths
on the host FS.

To prepare for future changes, this commit also makes returned paths
canonical by removing the trailing slash when it's unneeded.

Eventually, once everything has been migrated to the new interface,
we can remove the "from" parameter.
2018-05-04 19:52:17 +02:00
spycrab 11f83c1e36 HttpRequest/Curl: Use a more intelligent timeout method 2018-05-04 13:30:49 +02:00
JosJuice 6e96f62b41 Remove code related to UI.ini
We don't use it for anything, we just create it and leave it empty.
2018-05-02 18:18:27 +02:00
Mat M 0cd46f4d21
Merge pull request #6690 from lioncash/nand
Common/NandPaths: Minor cleanup
2018-04-28 13:43:33 -04:00
Sepalani 74d4a4478f DebugInterface: Watches methods added
Move Watches to Common
2018-04-28 17:46:51 +04:00
spycrab 7749e18ecc ConfigManager: Enable Auto-Updater by default 2018-04-26 15:12:15 +02:00
Lioncash 4637579375 Common: Amend CommonTypes include within BitSet.h
We do includes relative to the root, rather than direct pathing.
2018-04-23 00:14:00 -04:00
Lioncash d68f437e67 Common: Move BitSet helper functions into the Common namespace 2018-04-23 00:13:55 -04:00
Lioncash c1c360d9b1 NandPaths: Make function parameters consistent
Also drops trailing underscores from said parameter names.
2018-04-22 23:49:20 -04:00
Lioncash 62242331d8 NandPaths: Remove unused header inclusions 2018-04-22 23:49:16 -04:00
Lioncash 2ce0f42c14 Common: Move BitSet into the Common namespace
This should be under the common namespace, considering where it's living
2018-04-22 23:43:07 -04:00
Lioncash c23a998f9d
TraversalClient: Use u32 instead of enet_uint32
Lessens the dependence on the enet library (and we really don't need to rely on a third-party library for a 32-bit integer type)
2018-04-16 16:46:48 -04:00
Lioncash f1e92a1eae
TraversalClient: Make TestPacket() private
This is only used by the private InterceptCallback()
2018-04-16 16:46:48 -04:00
Lioncash 1b8ad49d1e
TraversalClient: In-class initialize members where applicable 2018-04-16 16:46:48 -04:00
Lioncash ca6a2970ea
TraversalClient: Make data externally read-only members private
These are only ever queried for state, not written. Therefore, prevent writing to the members
and make them private.
2018-04-16 16:46:44 -04:00
Léo Lam dfd6a228a6
Merge pull request #6654 from lioncash/log
Common/Logging/Log: Wrap GENERIC_LOG macro's body in do { } while (0)
2018-04-16 20:38:22 +02:00
Lioncash 236aed9fd1
Common/CMakeLists: Link curl and VTune libraries in privately
These are only used internally.
2018-04-16 12:38:24 -04:00
Lioncash b0dc823472
Common/Logging/Log: Wrap GENERIC_LOG macro's body in do { } while (0)
Enforces the termination of GENERIC_LOGs with semicolons.
2018-04-16 12:11:32 -04:00
Lioncash 939c5671a9 Common/Config: Remove unused header inclusions 2018-04-15 22:35:00 -04:00
Lioncash 4836739663 Common/Config: Remove unnecessary function declaration
This prototype declaration is already provided by the Config.h header
2018-04-15 22:33:53 -04:00
Mat M eecdb51709
Merge pull request #6645 from JosJuice/tie-constexpr
x64Emitter: Don't assume that std::tie is constexpr
2018-04-15 03:11:31 -04:00
JosJuice 8a146d5210 x64Emitter: Don't assume that std::tie is constexpr
Using constexpr tie broke building with older GCC versions according to
https://forums.dolphin-emu.org/Thread-build-error-on-linux-mint-18-3
2018-04-15 08:30:01 +02:00
Léo Lam 371f807e67
Merge pull request #6615 from leoetlino/sysconf
SysConf: Migrate to new filesystem interface
2018-04-14 23:29:25 +02:00
Lioncash b31281527a
CMakeLists: Define an OProfile target and use it
Allows us to bring includes and relevant libraries into scope by explicitly declaring linkage against the target
as opposed to using a variable. Also removes the dumping of OProfile includes into the top-level directory.
2018-04-13 19:35:17 -04:00
Léo Lam 52905a5fae
Merge pull request #6627 from sepalani/map-strip
PPCSymbolDB: Do not truncate fixed size symbols
2018-04-13 20:48:28 +02:00
Lioncash e28d063539 x64Emitter: Make the Align* functions return a non-const data pointer
There's no real requirement to make this const, and this should also
be decided by the calling code, considering we had places that would
simply cast away the const and carry on.
2018-04-12 19:46:55 -04:00
Tilka bbd1bb8eaa
Merge pull request #6636 from phire/fix_autoformatting
Fix change in comment meaning by autoformat.
2018-04-12 22:52:06 +01:00
Scott Mansell 0e6d01220a Fix change in comment meaning by autoformat. 2018-04-13 09:20:27 +12:00
Tilka 27515f4c9b
Merge pull request #6626 from lioncash/dcbz_l-disasm
GekkoDisassembler: Fix disassembly of dcbz_l
2018-04-12 22:18:56 +01:00
Léo Lam a287bbc3bd Move SysConf to Core
It's not common code that could be reused for, say, Citra;
it's absolutely specific to Wii emulation and only used by the Dolphin
core, so let's move it there.

Another reason for doing this is to avoid having Common depend on Core.
2018-04-12 22:16:37 +02:00
Léo Lam 0856d4a68a SysConf: Migrate to new filesystem interface
It was discovered that some titles rely on filesystem metadata to work
properly. Currently, in master they either simply won't find their
save files (for example Bolt) or will complain about the Wii system
memory being corrupted (on first use or every time depending on
the title).

In order to even be able to keep track of file metadata, we first need
to eliminate all direct accesses to the NAND and make all kinds of
operations go through the filesystem code added in PR 6421.

This commit starts the migration process by making SysConf use
the new FS interface.
2018-04-12 22:16:37 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00