Commit Graph

3190 Commits

Author SHA1 Message Date
Pokechu22 a695b05b21 Add support for std::optional to PointerWrap 2020-01-04 11:43:26 -08:00
Jordan Woyak 0e8d4cb6ac StringUtil: Make TryParse of floats handle comma and dot decimal separators. 2020-01-04 07:19:15 -06:00
Léo Lam ad75215bb0 Fix several warnings
A small, nonexhaustive set of warning fixes. The DiscIO Volume change
is a workaround for a GCC bug [1] that causes returning an unengaged
std::optional to emit annoying -Wmaybe-uninitialized warnings.
This last change alone fixes pages upon pages of warnings since
Volume.h is included from several files.

-Wstringop-truncation is another irrelevant warning for us, but
unfortunately there seems to be no way to disable it without
adding ugly pragmas wherever the warning appears.
2020-01-04 12:11:39 +01:00
Jordan Woyak 8ab3694f51 Common: Add Matrix33::FromQuaternion. 2020-01-02 15:16:37 -06:00
George Talusan b1a6cbc3b4 MacOS: Dispatch GL calls to main thread to prevent crashes on Catalina 2020-01-01 23:06:19 -05:00
David Korth c2dd2e8a2e Use std::istringstream or std::ostringstream instead of std::stringstream where possible.
This removes std::iostream from the inheritance chain, which reduces
overhead slightly.
2019-12-29 23:45:02 -05:00
David Korth a23b3d26f4 GLExtensions.cpp: Use arrays of `const char *const` instead of `std::string`.
The strings end up being copied, so we might as well initialize the
std::string in the unordered_map directly.
2019-12-29 23:45:02 -05:00
Stenzek d744c5a148 Compile fixes for Windows-on-ARM64 2019-12-28 19:20:41 +10:00
Stenzek 6fcb1c6c46 Add an ARM64 target to Visual Studio projects 2019-12-28 19:20:41 +10:00
Techjar 79092cdda0 Common/BitUtils: Implement BitCast(To|From)Array 2019-12-22 14:48:47 -05:00
S David 21f42fafb7 MacOS: Fixes configuration hang; bump MacOS SDK.
Removed conditional use of std::mutex instead of std::shared_mutex on MacOS.

Because MacOS < 10.12 did not support std::shared_mutex, a previous commit
naïvely substituted std::mutex, which does not have the same behavior.

Reverses PR #8273, which substitues std::mutex for std::shared_mutex on
macOS, and results in several bugs that seem to only affect MacOS

- https://bugs.dolphin-emu.org/issues/11919
- https://bugs.dolphin-emu.org/issues/11842
- https://bugs.dolphin-emu.org/issues/11845

This change eliminates conditional code for MacOS in the core configuration
layer code and enables the use of modern language features that are more
secure and thread-safe.
2019-12-22 00:49:17 -05:00
Lioncash 81edcca8db Common/Network: Use std::nullopt in StringToMacAddress
Prevents unnecessary zeroing out of std::optional's internal buffer in
some implementations.
2019-12-06 09:59:11 -05:00
Lioncash cbfacc41ba Common/Network: Remove unused header inclusions
Removes unused header dependencies.
2019-12-06 09:51:28 -05:00
Lioncash f06461d208 Common/Network: Make StringToMacAddress use a string_view
This function only ever reads the contents of the string in a non-owning
manner, so we can change the parameter over to being a string view.
2019-12-06 09:45:25 -05:00
Stenzek dd23a1ee79 Update VS projects/solutions to VS2019 2019-11-30 13:42:52 +10:00
Lioncash c792961000 Common: Unify logging namespace with Common
Previously the logging was a in a little bit of a disarray. Some things
were in namespaces, and other things were not.

Given this code will feature a bit of restructuring during the
transition over to fmt, this is a good time to unify it under a single
namespace and also remove functions and types from the global namespace.

Now, all functions and types are under the Common::Log namespace. The
only outliers being, of course, the preprocessor macros.
2019-11-28 05:13:21 -05:00
tinyredpanda fe9e7d5578 Prefer MessageBoxW to MessageBoxA 2019-11-23 13:56:05 +00:00
Marshall Mohror 0334dde2cf
Fix typo in comment 2019-11-11 13:20:04 -06:00
Pierre Bourdon 066012b80d
Merge pull request #8454 from jordan-woyak/motion-input-indicators
DolphinQt: Add accelerometer/gyroscope mapping indicators.
2019-11-10 18:57:31 +01:00
Léo Lam eebc64aaf8
Merge pull request #8460 from jordan-woyak/evdev-motion-data
InputCommon: Detect when evdev exposes acceleration/gyroscope data.
2019-11-09 23:34:51 +01:00
Léo Lam f4e12f85bc
Merge pull request #8393 from CookiePLMonster/long-paths
Support Windows 10 long paths
2019-11-09 21:10:16 +01:00
Jordan Woyak 1180c231a6 InputCommon: Detect when evdev exposes acceleration/gyroscope data. 2019-11-09 13:34:29 -06:00
Jordan Woyak 1e028025e5 Common: Add additional Matrix/Vec functions. 2019-11-08 15:46:45 -06:00
Connor McLaughlin a89fdb628c
Merge pull request #8343 from stenzek/fbdev
DolphinNoGUI: Add a FBDev platform
2019-11-08 11:05:53 +10:00
Pierre Bourdon 1f3d1a9b7f
Merge pull request #8352 from rlnilsen/motion-controller-support-via-cemuhook-protocol
Support for motion controllers like the DualShock 4
2019-10-28 16:39:10 +01:00
rlnilsen da1f153b47 Rename all instances of "CemuhookUDPServer"/"UDPServer" to "DualShockUDPClient"/"DSUClient". 2019-10-27 16:05:22 +01:00
rlnilsen 4cb3baba5c Add support for motion controllers via the CemuHook controller input protocol.
This is done by:
1) Implementing said protocol in a new controller input class CemuHookUDPServer.
2) Adding functionality in the WiimoteEmu class for pushing that motion input to the emulated Wiimote and MotionPlus.
3) Suitably modifying the UI for configuring an Emulated Wii Remote.
2019-10-26 02:19:53 +02:00
JosJuice 2210a0a70c Rebuild D_REDUMPCACHE_IDX path when needed 2019-10-25 20:49:28 +02:00
JosJuice 2c79c63608
Merge pull request #8330 from JosJuice/redump-integration
VolumeVerifier: Add Redump.org integration
2019-10-23 16:43:52 +02:00
Jordan Woyak 0d254d9cb8 StringUtil: Require TryParse of float types to use the entire string. 2019-10-18 19:56:48 -05:00
JMC47 d39555919d
Merge pull request #8395 from CookiePLMonster/improve-work-queue
Improvements to WorkQueueThread
2019-10-13 15:24:56 -04:00
Silent 26ebf5b650
Improvements to WorkQueueThread
- Do not use a lambda for std::thread as invoke constructor exists
- Use simpler std::lock_guard wherever possible
- Do not require T to be default constructible
- Move T out of the queue instead of copying
2019-10-08 22:57:33 +02:00
Silent 45890c20cf
Remove obsolete "Windows compatibility" macros 2019-10-07 22:46:37 +02:00
Silent 689378b435
Move GetModuleName to Common
This unifies GetModuleFileName calls between Dolphin and WinUpdater
and allows to gracefully remove MAX_PATH limit from GetExePath
2019-10-07 22:46:36 +02:00
Silent 3b21d32865
Remove MAX_PATH limit from:
- GetTempFilenameForAtomicWrite
- SetUserDirectory
2019-10-07 22:45:16 +02:00
Stenzek 4fd262d0b8 FixedSizeQueue: Work around GCC generating large amounts of debug info 2019-10-06 16:23:45 +10:00
Connor McLaughlin b319f823bf
Merge pull request #8337 from CookiePLMonster/log-widget-improvements
Log widget improvements
2019-10-01 23:42:16 +10:00
Stenzek 0a75e71672 DolphinNoGUI: Add a FBDev platform
And the associated GLContext bits
2019-09-01 14:00:40 +10:00
Stenzek 43fe02ee9b GLContext: Get size using eglQuerySurface()
Also no longer assumes that a nullptr display is not headless (needed for fbdev)
2019-09-01 13:35:11 +10:00
Silent 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
Silent eab086b880
ConsoleListenerWin: Properly output console logging in UTF-16 so UTF-8 displays properly 2019-08-31 00:44:44 +02:00
JosJuice 3eb360b818 VolumeVerifier: Add zip support for datfile 2019-08-24 16:37:19 +02:00
JosJuice 22933d8502 VolumeVerifier: Add datfile parsing 2019-08-24 16:37:19 +02:00
Anthony 288dd649da
Merge pull request #8273 from CookiePLMonster/config-threading-fixes
Threading fixes for config layers
2019-08-21 08:55:03 -07:00
QuellaZhang e67eb4693e
Fix implicit false-to-nullptr conversions 2019-08-15 17:49:57 +02:00
Silent 48a4b62125
Change Layer code not to create superfluous std::optional entries in LayerMap 2019-08-01 22:22:05 +02:00
Silent cb4eecde52
Fix race conditions in Config Layers
API has been made stricter, layers are now managed with shared pointers,
so using them temporarily increased their reference counters.
Additionally, any s_layers map has been guarded by a read/write lock,
as concurrent write/reads to it were possible.
2019-07-30 22:10:17 +02:00
JosJuice 117a60ceb2 StringUtil: Comply with variable naming style 2019-07-23 14:49:13 +02:00
JosJuice a2a1e04fc9 StringUtil: Use std::string_view more 2019-07-23 14:49:12 +02:00
Anthony 66e7a11139
Merge pull request #8235 from lioncash/move
Common/DebugInterface: Minor cleanup changes
2019-07-22 15:07:14 -07:00
Léo Lam 15679a9a70
Merge pull request #8227 from lioncash/gekko
Common/GekkoDisassembler: Don't print out '\0' as a character
2019-07-22 21:39:49 +08:00
JosJuice 73a9b4148b
Merge pull request #8257 from CookiePLMonster/assert-fixes
Fixes to assertions
2019-07-22 08:47:13 +02:00
Silent 518d96ad48
Remove duplicated "Ignore and countinue?" 2019-07-21 15:36:24 +02:00
Silent e792a67dc6
Improve thread safety and remove an unnecessary string allocation from MsgAlert
s_msg_handler still seems thread unsafe, not sure if it should be or not
2019-07-20 21:03:45 +02:00
Lioncash 13a454d603 Common/SettingsHandler: Use fmt for printing out the serial number
Same thing, less code.
2019-07-16 04:23:20 -04:00
Lioncash af576839d8 Common/SettingsHandler: Use std::string_view where applicable
Allows passed in strings to be non-allocating.
2019-07-16 04:15:25 -04:00
Lioncash d2d7bf5c3b Common/DebugInterface: Remove GetInstructionSize()
This is completely unused, so it can be removed.
2019-07-09 14:19:40 -04:00
Lioncash 92c1782726 Common/DebugInterface: Mark a few member functions as const
Quite a few member functions act as a means to query information. Given
these don't actually modify object state, they can be made const.
2019-07-09 14:19:40 -04:00
Lioncash d4d485b692 Common/DebugInterface: Make return value of GetColor() a u32
At its only usage point, its return value is stored into a u32, and the
default implementation returns 0xFFFFFFFF (-1), which would be an
unsigned integer. Given all of the bits are used to determine a color,
it makes slightly more sense to treat this as an unsigned value as
opposed to a signed one.
2019-07-09 14:19:38 -04:00
Lioncash a9a9b193bb Common/DebugInterface: Use forward declarations where applicable
We're allowed (by the standard) to forward declare types within
std::vector, so we can replace direct includes with forward declarations
and then include the types where they're directly needed.

While we're at it, we can remove an unused inclusion of <cstring>, given
nothing in the header uses anything from it. This also revealed an
indirect inclusion, which this also resolves.
2019-07-08 18:59:11 -04:00
Lioncash 457bff92c1 Common/DebugInterface: Use u32 instead of unsigned int consistently
Previously u32 was being used for part of the interface and unsigned int
was being used for other parts. This makes the interface fully consistent by
using only one type.

We opt for u32 here given they communicate the same thing (for platforms
we care about where int is 32-bit), while also being less to read.
2019-07-08 18:52:45 -04:00
Lioncash b1b9c6aa1e Common/DebugInterface: Default virtual destructor
While we're at it, we can also default the constructor and destructor of
inheriting classes in their respective cpp file to prevent the
construction and destruction of non-trivial types being inlined into
other regions of code.
2019-07-08 17:44:58 -04:00
Lioncash bc8778203e Common/Watches: std::move strings where applicable
Allows calling code to move the std::string into the Watch instances,
avoiding copies.
2019-07-08 17:41:06 -04:00
Lioncash ce30efc6cf Common/GekkoDisassembler: Don't print out '\0' as a character
Prevents a few instructions from having mangled names in some cases.
2019-07-03 20:12:50 -04:00
Connor McLaughlin e388f01e11
Merge pull request #8215 from CookiePLMonster/appverifier-sanitize
Fixed various errors spotted with Application Verifier
2019-06-30 01:27:25 +10:00
Léo Lam a88deda307
Merge pull request #8193 from lioncash/disasm
Common/GekkoDisassembler: Minor changes
2019-06-29 10:38:36 +02:00
Léo Lam 58c78a495d
Merge pull request #8213 from JosJuice/filesystem-u8string
Work around C++20 std::filesystem changes related to u8string
2019-06-28 19:42:34 +02:00
Silent 9eab3feddf
Fix out of bounds read in HttpRequest::Impl::Fetch logging 2019-06-23 21:44:51 +02:00
JosJuice c0a6fa5dcc Work around C++20 std::filesystem changes related to u8string 2019-06-21 18:34:21 +02:00
Anthony 84b9b37fef
Merge pull request #8210 from spycrab/httpreq_error_msg
Common/HttpRequest: Use CURLOPT_ERRORBUFFER for error messages
2019-06-20 10:59:25 -07:00
spycrab ba4c1c5947 Common/HttpRequest: Use CURLOPT_ERRORBUFFER for error messages 2019-06-20 19:44:51 +02:00
JosJuice 63bb646721 Fix opening controller config when there is no profile directory
https://bugs.dolphin-emu.org/issues/11771
2019-06-20 18:35:14 +02:00
Léo Lam 973bba7c1e
Merge pull request #8191 from lioncash/ini
Common/IniFile: Use std::string_view where applicable
2019-06-20 13:44:20 +02:00
Léo Lam 4885130799
Merge pull request #8194 from lioncash/common-msg
Common/MsgHandler: Tidy up interface and namespace code
2019-06-20 13:37:24 +02:00
JosJuice fab15edb53 Replace <experimental/filesystem> includes with <filesystem>
https://bugs.dolphin-emu.org/issues/11770
2019-06-20 10:39:56 +02:00
Lioncash 4f1f55093f Common/MsgHandler: Namespace code within the Common namespace
Closes another gap in the Common library where code isn't being
namespaced under it.
2019-06-19 16:03:55 -04:00
Lioncash e7dd46a531 Common/MsgHandler: Brace if statement in MsgAlert
The condition travels more than one line, so the body should be braced.
While we're at it, make the comparison against nullptr explicit.
2019-06-19 16:03:33 -04:00
Lioncash 0eddf6dd8f Common/MsgHandler: Use std::string's empty for emptiness checking in MsgAlert
Provides more straightforward code compared to negating a length check.
2019-06-19 16:00:16 -04:00
Léo Lam ff96dc0e6f
Merge pull request #8199 from lioncash/namespace
General: Use nested namespace specifiers where applicable
2019-06-18 11:33:08 +02:00
Lioncash c4def7c814 Common: Add missing header guards 2019-06-17 18:37:56 -04:00
Lioncash 8e030a4a45 Common: Use nested namespace specifiers where applicable 2019-06-17 16:36:48 -04:00
Lioncash 1968643297 Common/MsgHandler: Amend file-scope variable names
Makes them follow our coding style.
2019-06-16 23:37:03 -04:00
Lioncash 76b675e9f0 Common/MsgHandler: Make default message handler and translator's internally linked
Previously these functions were declared without the static specifier,
giving them external linkage, which isn't really ideal.

Instead, we can place these functions up by the relevant file-scope
variables and place them inside an anonymous namespace with said variables,
giving them internal linkage.
2019-06-16 23:37:03 -04:00
Lioncash d1475f6d59 Common/MsgHandler: Convert type aliases over to using
Same thing, nicer to read.
2019-06-16 23:37:03 -04:00
Lioncash 027c17558f Common/MsgHandler: Use fmt::print on non-Windows OSes
Provides the same behavior.
2019-06-16 23:37:00 -04:00
Lioncash 188234b4cd Common/GekkoDisassembler: Use std::string_view where applicable
Avoids the use of the null pointer to represent an empty string.
Instead, we can simply pass an empty string_view instance. Using
std::string_view enforces this invariant at the API level.
2019-06-16 19:51:23 -04:00
Lioncash d8c3f09c9f Common/GekkoDisassembler: Amend disassembly of operations expecting a character literal
Due to the lack of cast here, this will actually print out the ascii
value, rather than the character itself, due to promoting to integral
values. Instead, we can eliminate the use of character operands and just
print the value itself directly, given it's equivalent behavior with
less code.
2019-06-16 19:33:28 -04:00
Lioncash 0cde8ab9e8 Common/GekkoDisassembler: Make all lookup tables immutable
Allows these arrays to be placed within the read-only segment (and
enforces the immutability in the code itself). While we're at it, we can
make use of std::array here.
2019-06-16 19:21:07 -04:00
Lioncash 78d1716251 Common/IniFile: Make use of std::string_view where applicable
Now that the std::map less-than comparitor is capable of being used with
heterogenous lookup, we're able to convert many of the querying
functions that took std::string references over to std::string_view.

Now these functions may be used without potentially allocating a
std::string instance unnecessarily.
2019-06-16 18:20:08 -04:00
Lioncash de7e9557dc Common/IniFile: Make CaseInsensitiveStringCompare usable with heterogenous lookup
Previously, when performing find() operations or indexing operations on
the section map, it would need to operate on a std::string key.

This means cases like:

map.find(some_string_view)

aren't usable, which kind of sucks, especially given for most cases, we
use regular string literals to perform operations in calling code.
However, since C++14, it's possible to use heterogenous lookup to avoid
needing to construct exact key types. In otherwords, we can perform the
above or use string literals without constructing a std::string instance
around them implicitly.

We simply need to specify a member type within our comparison struct
named is_transparent, to allow std::map to perform automatic type
deduction.

We also slightly alter the algorithm to an equivalent compatible with
std::string_view (which need not be null-terminated), as strcasecmp
requires null-terminated strings.

While we're at it, we can also provide a helper function to the struct
for comparing string equality rather than only less than. This allows
removing other usages of strcasecmp in other functions, allowing for the
transition of them to std::string_view.
2019-06-16 18:20:03 -04:00
Léo Lam b3525ad774
Merge pull request #8186 from lioncash/view
{Common/SymbolDB, Core/HLE/HLE}: Make use of std::string_view where applicable
2019-06-16 16:20:02 +02:00
Lioncash 9952dfe293
GekkoDisassmbler: Amend erroneous formatting specifiers
fmt diverges from printf in that '.' as a precision specifier may only
be used for floating-point values (makes sense, given it's indicating
precision after the decimal point).
2019-06-16 02:05:16 -04:00
Lioncash 936aa5dbaa
Common/SymbolDB: Use std::string_view where applicable
These strings are only used for comparison against other strings, so a
string view can be used here.
2019-06-16 01:10:02 -04:00
Lioncash 5b92d5076a
Common: Use fmt where applicable
Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().

Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.
2019-06-14 15:04:09 -04:00
Lioncash d52e69bab1
Common/CMakeLists: Link in fmt
While not currently used by common, this will become the case when the
logging system eventually transitions to it, among other things.
2019-06-10 15:26:46 -04:00
Connor McLaughlin 67a9fc6784
Merge pull request #8163 from lioncash/config
Core/ConfigManager: Use forward declarations where applicable
2019-06-08 20:01:15 +10:00
Lioncash 5512876842 General: Migrate from deprecated mbedTLS functions
As indicated by mbedTLS' documentation, all of the relevant functions
have been superseded by _ret-suffixed variants in mbedTLS version
2.7.0.
2019-06-07 22:51:58 -04:00
Lioncash c0c0e412e0 Core/ConfigManager: Use forward declarations where applicable
Avoids dragging in IniFile, EXI device and SI device headers in this header which is
quite widely used throughout the codebase.

This also uncovered a few cases where indirect inclusions were being
relied upon, which this also fixes.
2019-06-07 19:54:39 -04:00
Léo Lam 3f4952d57c
Merge pull request #8152 from lioncash/array-size
Common/CommonFuncs: Remove now-unneccessary ArraySize function
2019-06-06 13:35:57 +02:00
Lioncash 7935c27b52 Common/Analytics: Convert std::string overload into std::string_view
Allows for both string types to be non-allocating. We can't remove the
const char* overload in this case due to the fact that pointers can
implicitly convert to bool, so if we removed the overload all const
char arrays passed in would begin executing the bool overload instead of
the string_view overload, which is definitely not what we want to occur.
2019-06-05 13:24:31 -04:00