Commit Graph

27806 Commits

Author SHA1 Message Date
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
Anthony
f0c5b76186
Merge pull request #6677 from 404-Name-Not-Found/master
Fix test rumble feature in controller configuration
2018-05-11 12:51:52 -07:00
Anthony
968779e623
Merge pull request #6814 from lioncash/sd
SDCardUtil: Minor changes
2018-05-11 12:39:17 -07:00
Anthony
ee1a175205
Merge pull request #6816 from leoetlino/kd
IOS/KD: Migrate to new filesystem interface
2018-05-11 12:37:10 -07:00
Mat M
b938e15699
Merge pull request #6818 from JonnyH/WIP/variant-update
Update mpark::variant implementation to 1.3.0
2018-05-11 15:36:23 -04:00
Anthony
2d6a0b8025
Merge pull request #6820 from spycrab/qt_netplay_ipfix
Qt/NetPlayDialog: Fix broken IP label
2018-05-11 12:35:25 -07:00
spycrab
0abce1419b Qt/NetPlayDialog: Fix broken IP label 2018-05-11 21:22:57 +02:00
spycrab
76f6c7523f
Merge pull request #6810 from spycrab/qt_fix_hotkey_conf
Qt/MappingButton: Fix occasionally broken indicator
2018-05-11 21:05:43 +02:00
Léo Lam
e942b14676
Merge pull request #6817 from spycrab/qt_hotkey_onion
Qt/HotkeyScheduler: Use onion config
2018-05-11 21:01:56 +02:00
spycrab
49d2f6f15a Qt/HotkeyScheduler: Use onion config 2018-05-11 20:47:30 +02:00
Léo Lam
1b070c4b6f IOS/KD: Migrate to new filesystem interface 2018-05-11 20:30:22 +02: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
Léo Lam
b10bbea393
Merge pull request #6815 from spycrab/osd_refactor
VideoCommon/RenderBase: Refactor OSD messages
2018-05-11 18:33:45 +02: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
spycrab
16e2ac9257 VideoCommon/RenderBase: Refactor OSD messages 2018-05-11 18:24:08 +02:00
spycrab
082573bd6b
Merge pull request #6808 from spycrab/qt_hotkey_osd
Qt/HotkeyScheduler: Show OSD information
2018-05-11 15:51:37 +02: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
spycrab
66190ae4d6 Qt/HotkeyScheduler: Show OSD information 2018-05-11 12:49:20 +02:00
spycrab
242fadc76f Qt/MappingButton: Fix occasionally broken indicator 2018-05-11 12:37:48 +02: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
Léo Lam
5071973a51
Merge pull request #6805 from spycrab/qt_netplay
Qt/NetPlayDialog: Multiple improvements
2018-05-11 10:39:53 +02:00
Léo Lam
d1bb5249ec
Merge pull request #6801 from stenzek/copy-filter-typo
D3D/Vulkan: Fix incorrect clamp in EFB RAM copy
2018-05-11 10:36:47 +02:00
Léo Lam
066e4ea463
Merge pull request #6809 from lioncash/macro
CommonFuncs: Convert ROUND_UP_POW2 macro to a function
2018-05-11 10:16:29 +02:00
spycrab
2b8d69f476
Merge pull request #6812 from lioncash/mem
DolphinQt2/MemoryWidget: Use QString's toUtf8() where applicable instead of toStdString()
2018-05-11 08:31:45 +02:00
Lioncash
6d0cab3743 DolphinQt2/MemoryWidget: Use QString's toUtf8() where applicable instead of toStdString()
Avoids needing to iterate and append the characters in one case. This also
alters the function to not need to construct a temporary std::string
(QString's toUtf8() is sufficient, as QByteArray exposes iterators).

toStdString() is equivalent to retrieving the QString's underlying
QByteArray via calling QString's .toUtf8 member function and then
calling .toStdString() on the result of it (discarding the QByteArray
afterwords), so this just trims off an unnecessary step in the process.

This is also somewhat more indicative of the conversions going on:
toStdString() converts the underlying character sequence of a
QString to UTF-8, not strict ASCII, so we're really using a superset of
ASCII.
2018-05-10 22:10:45 -04: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
a977a56434 Boot: Migrate to new filesystem interface 2018-05-10 22:34:03 +02:00
Léo Lam
e6c489f1d4 ES: Move title dir creation logic into separate function
Since we're going to need it in the boot code, move it out to a
separate, easily reusable function. This also makes the InitImport
logic clearer.
2018-05-10 22:33:49 +02: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
spycrab
3cca051850
Merge pull request #6806 from spycrab/qt_iowindow_crash
Qt/IOWindow: Fix crash
2018-05-10 21:18:48 +02:00
spycrab
146979f67e Qt/IOWindow: Fix crash 2018-05-10 21:12:19 +02:00
spycrab
09449e2bca Qt/NetPlayDialog: Use QToolButton instead of a QComboBox 2018-05-10 20:51:12 +02:00
spycrab
26bee93943 Qt/NetPlayDialog: Show more friendly interface names 2018-05-10 20:51:12 +02:00
spycrab
0141ce9305 Qt/NetPlayDialog: Restore window geometry 2018-05-10 20:51:12 +02:00
spycrab
0ee7bddd4f Qt/NetPlayDialog: Add splitter 2018-05-10 20:51:12 +02:00
spycrab
6ea2b2e7e5 Qt/NetPlayDialog: Fix duplicate messages 2018-05-10 20:51:12 +02:00
spycrab
7550389c72 Qt/NetPlayDialog: Escape HTML in chat 2018-05-10 19:19:09 +02:00
spycrab
893c5e694e Qt/NetPlayDialog: Use more readable colors 2018-05-10 19:14:19 +02:00
Léo Lam
d8e1d2d573
Merge pull request #6803 from lioncash/tidy
FloatUtils: Remove IntDouble and IntFloat
2018-05-10 19:04:49 +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
spycrab
6e9d0ff6de
Merge pull request #6802 from Neui/qt-remember-main-window-position-and-size
Qt: Save and restore main window size and position
2018-05-10 18:26:38 +02:00