Commit Graph

2888 Commits

Author SHA1 Message Date
Léo Lam 6ce9c96d91
Merge pull request #7027 from leoetlino/cleanup
Use some C++17 features available since GCC 6
2018-06-04 20:50:50 +02:00
Léo Lam 83324fe77d StringUtil: Remove ValueToString(std::string)
Doesn't make a lot of sense to have a function that gives the string
representation for a string.
2018-06-03 15:11:59 +02:00
Léo Lam 7e79bf97ab IniFile: Use templates for Get()
Gets rid of duplicated code.
2018-06-03 14:53:56 +02:00
Léo Lam cba32b12e7 IniFile: Use templates for Set() 2018-06-03 14:53:56 +02:00
Léo Lam fc0193c4b1 Move Config ValueToString to StringUtil
An identical implementation is used by IniFile, so move those functions
to StringUtil. A future commit will modify IniFile to use them.
2018-06-03 14:10:52 +02:00
Lioncash 81e11b2406 x64Emitter: Amend parameter ordering for WriteModRM()'s prototype
The definition of the function uses the ordering {mod, reg, rm}, which
is correct. Match the prototype to this, so that the parameter list
isn't misleading.
2018-05-30 09:30:24 -04:00
Léo Lam 5b90aba624 ChunkFile: Replace macro with a variable template
Note that std::is_trivially_copyable_v cannot be used yet (C++17 only).
2018-05-30 11:39:30 +02:00
Léo Lam 8a00a9e149 Remove old GCC version checks 2018-05-30 10:59:15 +02:00
Markus Wick 4bebd52850
Merge pull request #7017 from lioncash/arm
Arm64Emitter: Use Common::BitCast where applicable
2018-05-30 09:50:59 +02:00
JosJuice 243f353688
Merge pull request #7016 from lioncash/mem
MemoryPatches: Minor changes
2018-05-30 07:45:34 +02:00
Lioncash 6fd7a79b93 Arm64Emitter: Use Common::BitCast where applicable
Gets rid of the need to set up memcpy boilerplate to reinterpret between
floating-point and integers.

While we're at it, also do a minor bit of tidying.
2018-05-29 18:19:01 -04:00
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