Commit graph

3100 commits

Author SHA1 Message Date
Silent
3b21d32865
Remove MAX_PATH limit from:
- GetTempFilenameForAtomicWrite
- SetUserDirectory
2019-10-07 22:45:16 +02:00
Connor McLaughlin
b319f823bf
Merge pull request #8337 from CookiePLMonster/log-widget-improvements
Log widget improvements
2019-10-01 23:42:16 +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
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