Commit graph

3519 commits

Author SHA1 Message Date
Lioncash
e1dfcda8a6 BlockingLoop: Add explicit [[fallthrough]] annotations 2021-04-19 17:34:46 -04:00
ash!!
43ceba4fef optimize TextureCacheBase::SerializeTexture, ::DeserializeTexture
texture serialization and deserialization used to involve many memory
allocations and deallocations, along with many copies to and from
those allocations. avoid those by reserving a memory region inside the
output and writing there directly, skipping the allocation and copy to
an intermediate buffer entirely.
2021-04-18 13:40:42 -07:00
Léo Lam
5f355690e0
Make it possible to enable auto-updates by default with CMake builds
This adds a CMake option (DOLPHIN_DEFAULT_UPDATE_TRACK) to allow
configuring SCM_UPDATE_TRACK_STR. This is needed to enable auto-updates
in Windows CMake builds by default.
2021-04-17 19:45:43 +02:00
Léo Lam
48712168b8
MathUtil: Add SaturatingCast to cast floats more safely 2021-04-06 23:27:23 +02:00
JMC47
ce8e87c64b
Merge pull request #8747 from iwubcode/map-freelook
Support controlling Free Look via input bindings (motion controls, gamepad, etc!)
2021-04-01 01:05:00 -04:00
Léo Lam
da534c7d75
Merge pull request #9571 from JosJuice/netplay-sync-more-settings
NetPlay: Sync more settings
2021-03-27 01:38:33 +01:00
JosJuice
4c2cdb61df JitArm64: Constant carry flag optimizations
If we know at compile time that the PPC carry flag definitely
has a certain value, we can bake that value into the emitted code
and skip having to read from PPCState.
2021-03-19 22:40:19 +01:00
iwubcode
602cb39101 Common: Add function to get Euler angles from a Quaternion 2021-03-17 20:58:33 -05:00
JosJuice
a45a0a2066
Merge pull request #9494 from Dentomologist/convert_arm64reg_to_enum_class
Arm64Gen: Convert ARM64Reg to enum class
2021-03-17 00:05:23 +01:00
Léo Lam
13f79321f7
Merge pull request #9574 from Pokechu22/enumformatter-warnings
EnumFormatter: fix signed/unsigned comparison warnings
2021-03-16 09:39:42 +01:00
Dentomologist
f0f206714f Arm64Gen: Convert ARM64Reg to enum class
Most changes are just adding ARM64Reg:: in front of the constants.
2021-03-13 10:10:59 -08:00
Pokechu22
fa124e657f EnumFormatter: fix signed/unsigned comparison warnings 2021-03-07 13:54:13 -08:00
Dentomologist
686314b548 Arm64Gen: Move constant and make constexpr
Namespace-scope variable was only used in one function so move it there
2021-03-07 10:09:59 -08:00
Dentomologist
dffcbcc6c4 Arm64Gen: Remove unused constant 2021-03-07 10:09:59 -08:00
JosJuice
359ed5348a Config: Give Movie and Netplay higher priority than CommandLine
Avoiding desyncs is more important than honoring what the user
specified on the command line.
2021-03-07 14:22:53 +01:00
Pokechu22
f697e17dd1 Create BitFieldArray 2021-03-06 17:34:03 -08:00
Pokechu22
1273c5e395 Add fmt support to BitField 2021-03-06 14:58:32 -08:00
Pokechu22
cf95deaf6d Allow specifying StorageType for BitField
This is useful for BitFields that are bools.
2021-03-06 14:57:44 -08:00
Pokechu22
6653bd7199 Create EnumFormatter 2021-03-06 14:57:42 -08:00
JMC47
fc86e554e0
Merge pull request #9559 from iwubcode/gdb-stub-raii
Common / Core: add raii object that cleans up WSA on destruction in gdb-stub
2021-03-05 05:28:31 -05:00
iwubcode
00bc7e6b38 Common: Add RAII object that initializes and cleans up winsock 2021-03-04 13:44:12 -06:00
Sepalani
6786340a7c Watches: Fix Save and Load from strings 2021-03-04 17:55:52 +04:00
JMC47
9843412440
Merge pull request #8996 from AdmiralCurtiss/memcard-save-import-export-refactor
Various improvements for the Memory Card Manager.
2021-03-03 14:51:31 -05:00
iwubcode
158674c274 Common: Move 'GetSection' functions to be public 2021-02-27 12:21:23 -06:00
Filoppi
e020b2e8ea Common: don't call OnConfigChanged() unless it has actually changed
DualShock UDP Client is the only place in the code that assumed OnConfigChanged()
is called at least once on startup or it won't load up the setting, so I took care of that
2021-02-26 01:14:00 +02:00
JosJuice
1e500d96b0 JitArm64: Workaround for GCC ICE 2021-02-15 23:46:08 +01:00
JosJuice
9ad4f724e4 Arm64Emitter: Use ORR in MOVI2R 2021-02-13 21:04:13 +01:00
JosJuice
0d5ed06daf Arm64Emitter: Improve MOVI2R
More or less a complete rewrite of the function which aims
to be equally good or better for each given input, without
relying on special cases like the old implementation did.

In particular, we now have more extensive support for
MOVN, as mentioned in a TODO comment.
2021-02-13 20:23:03 +01:00
JosJuice
4e107935ac Arm64Emitter: Allow specifying 21th bit of ADRP imm 2021-02-13 11:33:27 +01:00
JosJuice
d226b8f825 Arm64Emitter: Remove optimize parameter from MOVI2R
I don't really see the use of this. (Maybe in the past it
was used for when we need a constant number of instructions
for backpatching? But we don't use MOVI2R for that now.)
2021-02-13 11:33:27 +01:00
Léo Lam
1fc6fbc2c0
Merge pull request #6075 from sepalani/pcap-log
PCAP logging with fake TCP/UDP packet
2021-02-11 00:15:37 +01:00
JosJuice
3e4bf57c69
Merge pull request #9423 from MerryMage/arm64-movi2r-test
UnitTests: Add MOVI2R test
2021-02-08 10:58:09 +01:00
JosJuice
efeda3b759 JitArm64: More constant propagation optimizations
PR 9262 added a bunch of Jit64 optimizations, some of
which were already in JitArm64 and some which weren't.
This change ports the latter ones to JitArm64.
2021-02-07 13:55:35 +01:00
MerryMage
f65c1df094 Random: Add seeded PRNG 2021-01-31 13:16:45 +00:00
MerryMage
8aa2013a2d Arm64Emitter: Add additional assertions to BFI/UBFIZ 2021-01-31 12:04:57 +00:00
MerryMage
75d92ad628 Arm64Emitter: Prefer BFM/UBFM to EncodeBitfieldMOVInst 2021-01-31 12:04:57 +00:00
MerryMage
be6aec9932 Arm64Emitter: Add BFXIL 2021-01-31 12:04:57 +00:00
Sepalani
82bb5d9915 NetworkCaptureLogger: PCAP support added
Log TCP/UDP read/write with fake packet.
2021-01-30 19:35:09 +04:00
JosJuice
2d9ea42df2 Arm64Emitter: Add asserts for LDP/STP imm out of range 2021-01-30 00:25:33 +01:00
Admiral H. Curtiss
3286d2df3d Common/VariantUtil: Add 'overloaded' helper struct for use with std::variant. 2021-01-28 22:01:32 +01:00
Léo Lam
c386c5acc2
Merge pull request #9366 from iwubcode/freelook_camera_quaternion
VideoCommon: allow Free Look to be manipulated by a quaternion
2021-01-28 01:34:09 +01:00
iwubcode
d35287b6e4 Common: update Quaternion to allow rotating pitch, yaw, and roll all at once 2021-01-27 18:22:10 -06:00
iwubcode
544692f96a Common: add convenience function to convert a Quaternion to a Matrix44 2021-01-27 18:22:10 -06:00
Shawn Hoffman
500a694ca8 msbuild: bundle all dolphin "core" code into single library 2021-01-27 14:29:49 -08:00
Shawn Hoffman
84128d9532 rename Common/File to Common/IOFile 2021-01-27 14:29:48 -08:00
Shawn Hoffman
07fd02f207 rename Core/Analytics to Core/DolphinAnalytics 2021-01-27 14:29:47 -08:00
Markus Wick
2ada5b422d
Merge pull request #9448 from JosJuice/blr-x30
JitArm64: Avoid using X30 with BLR
2021-01-27 20:07:24 +01:00
Léo Lam
70447d0281
Merge pull request #9454 from JosJuice/android-ingame-settings-save
Android: Fix in-game settings changes not getting saved
2021-01-27 18:17:27 +01:00
JosJuice
67491979ab JitArm64: Avoid using X30 with BLR
At least on some CPUs (I found out about this from the
Arm Cortex-A76 Software Optimization Guide), using X30
with BLR is one cycle slower than using another register.
2021-01-23 10:32:44 +01:00
Lioncash
b425250a7b TraversalClient: Make use of std::string_view with ConnectToClient()
Same behavior, but allows the use of non-allocating string types with
the interface.
2021-01-20 12:24:06 -05:00
Lioncash
cb4ca7837a TraversalClient: Prevent uninitialized values from occurring in MakeENetAddress
Previously, eaddr would only be partially initialized in the ipv6 case.
Even if there's no support for it, we may as well ensure that the
variable always has deterministic initialization.

While we're at it, we can make the parameter a const reference, given no
members are modified.
2021-01-20 12:24:05 -05:00
Lioncash
f0c6e696fd TraversalProto: Convert typedefs into using aliases
Same behavior, more straightforward reading.
2021-01-20 12:24:05 -05:00
Lioncash
d48b5615ae TraversalProto: Collapse version enum into a typed variable
Same behavior, less code.
2021-01-20 12:24:05 -05:00
Lioncash
d2ea94195c TraversalProto: Convert TraversalPacketType into an enum class
Makes for strong typing and prevents namespace pollution.
2021-01-20 12:24:05 -05:00
Lioncash
2f0fb2056e TraversalProto: Convert TraversalConnectFailedReason into an enum class 2021-01-20 12:24:05 -05:00
Lioncash
2021175809 TraversalClient: Convert state enum into an enum class
Prevents implicit conversions and prevents identifiers from polluting
the class scope.
2021-01-20 12:24:03 -05:00
JosJuice
5978550b2f Android: Fix in-game settings changes not getting saved
EmulationActivity has an instance of Settings. If you go to
SettingsActivity from EmulationActivity and change some settings,
the changes get saved to disk, but EmulationActivity's Settings
instance still contains the old settings in its map of all
settings (assuming the EmulationActivity was not killed by the
system to save memory). Then, once you're done playing your
game and exit EmulationActivity, EmulationActivity calls
Settings.saveSettings. This call to saveSettings first overwrites
the entire INI file with its map of all settings (which is
outdated) in order to save any legacy settings that have changed
(which they haven't, since the GUI doesn't let you change legacy
settings while a game is running). Then, it asks the new config
system to write the most up-to-date values available for non-legacy
settings, which should make all the settings be up-to-date again.
The problem here is that the new config system would skip writing
to disk if no settings changes had been made since the last time
we asked it to write to disk (i.e. since SettingsActivity exited).

NB: Calling Settings.loadSettings in EmulationActivity.onResume
is not a working solution. I assume this is because
SettingsActivity saves its settings in onStop and not onPause.
2021-01-18 15:27:16 +01:00
Dentomologist
e3237661ec Arm64Emitter: Convert ShiftType to enum class 2021-01-17 16:21:38 -08:00
Dentomologist
70c54065ab Arm64Emitter: Convert IndexType to enum class 2021-01-15 23:27:11 -08:00
Shawn Hoffman
fc65f65891 BitUtils: cleanup constexpr usage for msvc clz 2021-01-10 10:06:30 -08:00
Shawn Hoffman
65ecf1e43e BitUtils: loosen clz to inline on msvc/arm64 2021-01-09 23:44:00 -08:00
Shawn Hoffman
1e5e5ea855 BitUtils: initialize variables
fixes C3615 on some msvc/cmake configs
2021-01-09 22:18:29 -08:00
Léo Lam
eafb9de047
Merge pull request #9323 from waddlesplash/haiku
Rehabilitate Haiku support.
2021-01-05 16:09:43 +01:00
MerryMage
6106d6481f BitUtils: __builtin_clz is undefined when value == 0 2021-01-03 17:35:15 +00:00
waddlesplash
2df11d3911 Rehabilitate Haiku support. 2021-01-02 16:54:24 -05:00
Lioncash
36af39853d Arm64Emitter: Remove unused OpType enum
This isn't used anywhere, so we can remove it.
2021-01-01 11:06:05 -05:00
Lioncash
95cc53edec Arm64Emitter: Convert ArithOption enums into enum classes
Makes the enums strongly typed. While we're at it, we can also make
these enums private.
2021-01-01 07:10:41 -05:00
Léo Lam
f59ee87031
Merge pull request #9402 from lioncash/emitter
Arm64Emitter: Interface cleanup
2021-01-01 00:52:40 +01:00
JosJuice
7bf590ee5a
Merge pull request #9403 from lioncash/guard
ArmCommon: Add missing header guard
2020-12-31 12:17:28 +01:00
Lioncash
e45aa019ec ArmCommon: Mark NO_COND as constexpr
Allows it to be used in compile-time expressions if ever necessary.
2020-12-30 20:54:05 -05:00
Lioncash
c9711a5eca ArmCommon: Add missing header guard
Prevents any multiple inclusion errors from occurring.
2020-12-30 20:53:31 -05:00
Lioncash
cca0dffebd Arm64Emitter: Add shorthand member functions for hint instructions
Allows for more concise code.
2020-12-30 20:49:20 -05:00
Lioncash
6046a15267 Arm64Emitter: Make ShiftAmount enum an enum class
Reduces namespace pollution and makes the enum strongly typed.
2020-12-30 20:49:20 -05:00
Lioncash
fab2053439 Arm64Emitter: Make RoundingMode enum an enum class
Prevents namespace pollution and makes the enum members strongly typed.
2020-12-30 20:49:20 -05:00
Lioncash
d87ec71615 Arm64Emitter: Make PStateField enum an enum class
Prevents namespace pollution and makes the enum members strongly typed.
2020-12-30 20:49:20 -05:00
Lioncash
5c3f2fde22 Arm64Emitter: Make BarrierType enum an enum class
Prevents namespace pollution and enforces strong typing.
2020-12-30 20:49:20 -05:00
Lioncash
f21c740919 Arm64Emitter: Make SystemHint enum an enum class
Avoids polluting the namespace and makes the members strongly typed.
2020-12-30 20:49:20 -05:00
Lioncash
5011c155ec Arm64Emitter: Make type member of FixupBranch an enum class
Eliminates some magic numbers and makes the type member strongly typed.
2020-12-30 20:49:20 -05:00
Lioncash
2fa4729815 Arm64Emitter: Annotate switch fallthrough
Silences warnings and makes intent explicit.
2020-12-30 20:49:20 -05:00
Lioncash
d780ad1102 Arm64Emitter: Make use of std::optional
Allows eliminating some out variables in favor of optional, which allows
narrowing visible scope of variables.
2020-12-30 20:49:16 -05:00
JosJuice
c1d041b888
Merge pull request #9318 from JosJuice/android-saf-games
Android: Use storage access framework for game list
2020-12-30 11:10:35 +01:00
Léo Lam
9ffd345df0
Config: Fix cache not being invalidated when callbacks are suppressed
The config version should always be incremented whenever config is
changed, regardless of callbacks being suppressed or not.
Otherwise, getters can return stale data until another config change
(with callbacks enabled) happens.
2020-12-29 22:07:47 +01:00
JosJuice
d78277c063 Android: Add specialized content provider implementation of DoFileSearch 2020-12-28 21:00:10 +01:00
Léo Lam
3f68aceaca
Merge pull request #9348 from lioncash/dsp-deglobal
DSP: Eliminate most global state
2020-12-28 15:48:11 +01:00
iWeaker4you
a636fcf230
BitUtils: Fix uint64_t gcc compile (Linux) 2020-12-28 11:50:57 +01:00
MerryMage
d695fcb126 BitUtils: Add CountLeadingZeros 2020-12-27 22:56:43 +00:00
Lioncash
7d1bd565a6 DSP: Eliminate most global state
An unfortunately large single commit that deglobalizes the DSP code.
(which I'm very sorry about).

This would have otherwise been extremely difficult to separate due to
extensive use of the globals in very coupling ways that would result in
more scaffolding to work around than is worth it.

Aside from the video code, I believe only the DSP code is the hairiest
to deal with in terms of globals, so I guess it's best to get this dealt
with right off the bat.

A summary of what this commit does:
  - Turns the DSPInterpreter into its own class
    This is the most involved portion of this change.
    The bulk of the changes are turning non-member functions into member
    functions that would be situated into the Interpreter class.

  - Eliminates all usages to globals within DSPCore.
    This generally involves turning a lot of non-member functions into
    member functions that are either situated within SDSP or DSPCore.

  - Discards DSPDebugInterface (it wasn't hooked up to anything,
    and for the sake of eliminating global state, I'd rather get rid of
    it than think up ways for this class to be integrated with
    everything else.

  - Readjusts the DSP JIT to handle calling out to member functions.
    In most cases, this just means wrapping respective member function
    calles into thunk functions.

Surprisingly, this doesn't even make use of the introduced System class.
It was possible all along to do this without it. We can house everything
within the DSPLLE class, which is quite nice =)
2020-12-27 06:38:02 -05:00
Léo Lam
d2f9991b0f
Merge pull request #9360 from Minty-Meeo/osreport-split
Split OSREPORT logging type
2020-12-26 11:41:18 +01:00
Minty-Meeo
b430d66cdc Split OSREPORT logging type
The enumerated LOG_TYPE "OSREPORT" is currently used in both EXI_DeviceIPL.cpp and HLE_OS.cpp.  In many games, the multitude of game functions detected by HLE_OS.cpp for OSREPORT logging results in poor log readability.  This Pull Request remedies that by adding a new enumerated LOG_TYPE "OSREPORT_HLE" for log usage in HLE_OS.cpp.

In the future, further changing how logging in HLE_OS.cpp works may be desirable.  As it is, game functions are detected that send a single character to the log.  This is a major source of poor readability.
2020-12-24 23:38:59 -06:00
iwubcode
27acba620c Core: Add new Free Look settings and config 2020-12-24 13:49:25 -06:00
MerryMage
29fceeb37f MemoryUtil: Use HW_PHYSMEM64 sysctl in MemPhysical
HW_PHYSMEM is deprecated on OpenBSD and only supplies a 32-bit value on NetBSD
2020-12-20 22:25:36 +00:00
JosJuice
2126f62111 Android: Add content provider support to File::ScanDirectoryTree 2020-12-20 13:24:54 +01:00
JosJuice
a7c05d7e84 Android: Add content provider support to File::FileInfo 2020-12-20 13:24:54 +01:00
JosJuice
99ffee9a0a Android: Add content provider support to File::OpenFStream 2020-12-20 13:24:54 +01:00
LC
0315ca5e37
Merge pull request #9332 from leoetlino/warning-fixes
Core: Fix various warnings
2020-12-19 21:45:21 -05:00
LC
2097de603c
Merge pull request #9339 from AdmiralCurtiss/utf8-libpng
Common: Write PNGs in two steps to allow Unicode target paths.
2020-12-19 21:43:05 -05:00
Admiral H. Curtiss
5bbd5fce2f Common: Write PNGs in two steps to allow Unicode target paths. 2020-12-20 03:30:17 +01:00
Admiral H. Curtiss
f5170dc69b Common/LinearDiskCache: Handle truncated shadercache files. 2020-12-19 19:09:33 +01:00
Admiral H. Curtiss
e91a347a07 Common/LinearDiskCache: Use unique_ptr instead of new/delete. 2020-12-19 19:09:33 +01:00
Léo Lam
0ad2f3da45
Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings 2020-12-16 16:04:19 +01:00
David Carlier
2c355b81f2
Add NetBSD support 2020-12-15 02:34:25 +01:00
JosJuice
d8744e6db8 Add caching to Config::Info
The goal of this change is to make Config::Get(const Info<T>&)
fast so that we can use it in hot paths.
2020-12-12 13:58:50 +01:00
JosJuice
b285991b88 Turn Config::Info into a class with getters 2020-12-11 19:54:16 +01:00
Léo Lam
fd5c69deca
Merge pull request #9289 from AdmiralCurtiss/simple-png-api-write
Use Simplified libpng API for writing PNGs.
2020-12-11 10:24:16 +01:00
Léo Lam
2e63cc8313
Merge pull request #9307 from Dentomologist/add-deleted-file-missing-warning-flag
Add File::Delete and File::DeleteDir warning flags
2020-12-11 02:06:28 +01:00
JMC47
75899b0e11
Merge pull request #9221 from JosJuice/android-saf-sd-card
Android: Use storage access framework for custom SD card paths
2020-12-10 16:32:43 -05:00
Dentomologist
4a55511e18 Add warning flags to File deletion functions
Adds a flag to File::Delete and File::DeleteDir functions to control
whether a console warning is emitted when the file or directory doesn't
exist. The flag is optional and true by default to match current behavior.
2020-12-05 16:13:46 -08:00
Dentomologist
c434eefe94 Change File::DeleteDir return value
Makes File::DeleteDir return true when attempting to delete a
nonexistent path.

The purpose of DeleteDir is to ensure the path doesn't exist after the
call, which is better reflected by the new return value. Additionally,
none of the current callers actually check the return value so this
won't break any existing code.
2020-12-03 13:31:53 -08:00
Lioncash
139d4fc76e General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
2020-12-02 13:38:33 -05:00
Léo Lam
2a85534805
Merge pull request #9283 from JosJuice/config-get-speedup
Common: Optimize Config::Get
2020-11-27 02:36:33 +01:00
Admiral H. Curtiss
2de3b12e9d Common: Add SavePNG() function that writes PNGs using the simplified libpng API. 2020-11-26 23:55:05 +01:00
Léo Lam
4c9ffb58fa
Merge pull request #9250 from Dentomologist/fix-fst-error
Fix file rename errors on Windows
2020-11-26 02:09:30 +01:00
Dentomologist
1734cf55d8 Fix file rename errors on Windows
On Windows, when the Rename function fails to replace an existing file
it will now retry the operation multiple times with increasingly long
delays between attempts.  This fixes transient rename failures.

I've been getting sporadic yet annoyingly frequent errors saying:
'IOS_FS: Failed to rename temporary FST file'
These typically appear on startup but I've also gotten them randomly.

Investigation shows this happens when the Windows ReplaceFile function
returns the error ERROR_UNABLE_TO_REMOVE_REPLACED.  That happens in the
context of using ReplaceFile to perform an atomic file overwrite, which
is required when saving updates to a file to avoid corruption.  The
error mainly happens with the /Wii/fst.bin file but I've seen it
happen with multiple other files as well.

I haven't been able to definitively pin down why the error occurs,
though online discussions suggest antivirus scanning may be a major
culprit.  That said, I've excluded the Dolphin folder from Windows
Defender scans to no avail and don't have any other antivirus running,
so this is likely to be a problem others are experiencing as well.

The number and duration of retry delays is arbitrary but I feel like a
combined second or so in the worst case is an acceptable tradeoff for
the reduction (actually elimination in my experience) of those errors.
This is even more true when you consider the time it takes to read and
dismiss the error dialogs.
2020-11-25 16:12:58 -08:00
JosJuice
2f264c6448 Common: Optimize Config::Get
The way Config::Get works in master, it first calls
Config::GetActiveLayerForConfig which searches for the
setting in all layers, and then calls Config::Layer::Get
which searches for the same setting again within the given
layer. We can remove this second search by combining the
logic of Config::GetActiveLayerForConfig and
Config::Layer::Get into one function.
2020-11-25 16:26:13 +01:00
Admiral H. Curtiss
9c590e215f IOFile: Add WriteString() method to replace fprintf string writing. 2020-11-25 15:41:25 +01:00
Léo Lam
82f1e6204d
Fix -Wsign-compare warnings 2020-11-21 02:08:09 +01:00
JosJuice
e4ceed2bed Common: Assert that translatable strings use positional arguments
Like PR 9260, but for a different requirement (see PR 9253).
2020-11-20 20:24:30 +01:00
Léo Lam
419dfe4be4
Merge pull request #9260 from leoetlino/fmt-checks
Common/Log: Add compile-time format string checks
2020-11-20 16:05:25 +01:00
Léo Lam
bca82bb942
Merge pull request #9239 from altimumdelta/FFDUMP_Separate_Logging
FrameDump Logging: Separate log type and migrate to fmt
2020-11-20 02:21:57 +01:00
Léo Lam
dde6090e98
Common/MsgHandler: Add compile-time format string checks 2020-11-19 17:09:24 +01:00
Léo Lam
62eeb05519
Common: Validate the number of {} fields in format strings
Unfortunately, {fmt} allows passing too many arguments to a format call
without raising any runtime or compile-time error [1].

As this is a common source of bugs since we started migrating to {fmt},
this commit adds some custom logic to validate the number of
replacement fields in format strings in addition to {fmt}'s own checks.

[1] https://github.com/fmtlib/fmt/issues/492
2020-11-19 17:09:24 +01:00
Léo Lam
47c91696ee
Common/Log: Check format strings
Helps with catching incorrect format strings.

PanicAlertFmt already uses FMT_STRING and fmt::make_args_checked.
2020-11-19 17:09:24 +01:00
Léo Lam
31d7be521c
Merge pull request #7714 from cristian64/avoid_leaking_gamelistmodel
DolphinQt: Avoid leaking the GameListModel instance to gracefully shutdown the GameTracker and prevent a crash on exit
2020-11-18 02:14:51 +01:00
altimumdelta
f44b13ffcd FrameDump Logging: Separate log type and migrate to fmt 2020-11-10 17:17:43 +01:00
Lioncash
7b21f7af2e Common/MsgHandler: Add fmt-capable variants of the alert macros
Adds an interface that uses fmt under the hood, which is much more
flexible than printf, particularly for localization purposes, given fmt
supports positional formatters in a cross-platform manner out of the box
with no configuration necessary.
2020-11-09 08:48:17 -05:00
altimumdelta
77dc289517 CPUDetect: Indicate slow PDEP/PEXT only for Zen1/+/2 (Family 23) 2020-11-08 14:27:24 +01:00
JosJuice
70df5446d3 Android: Make the handling of SAF open modes more robust 2020-11-06 17:40:03 +01:00
JosJuice
28aa04312c Common/LinearDiskCache: Replace std::fstream with File::IOFile
File::IOFile is better suited to this type of task.
Split out from a future PR.
2020-11-05 00:31:17 +01:00
Thomas May
72e1131123
Common: Fix logger related crash when HTTP response is empty 2020-10-29 21:20:59 +01:00
Sergei Trofimovich
447de580ab Source/Core/Common/Config/Config.cpp: add missing <mutex> include
Noticed missing include as a build failure on gcc-11:

```
[ 15%] Building CXX object Source/Core/Common/CMakeFiles/common.dir/Config/Config.cpp.o
Source/Core/Common/Config/Config.cpp:23:24:
  error: 'unique_lock' in namespace 'std' does not name a template type
    23 | using WriteLock = std::unique_lock<std::shared_mutex>;
        |                        ^~~~~~~~~~~
Source/Core/Common/Config/Config.cpp:11:1:
  note: 'std::unique_lock' is defined in header '<mutex>';
  did you forget to '#include <mutex>'?
```

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2020-10-28 08:53:15 +00:00
Léo Lam
2d921da860
FileUtil: Fix format string
Fixes a recent regression: https://github.com/dolphin-emu/dolphin/pull/9187#issuecomment-716835091
2020-10-26 22:47:56 +01:00
Lioncash
4e8df93f41 Common: Migrate logging to fmt
Continues the migration of our code over to the fmt logger.
2020-10-23 14:58:03 -04:00
Lioncash
dcb0c910af Common/Matrix: Allow TVec classes to be used in constexpr contexts
Much of these classes are operating on integral types and are pretty
standard behavior as far as vectors go. Some member functions can be
made constexpr to make them more flexible and allow them to be used in
constexpr contexts.
2020-10-21 17:44:02 -04:00
LC
de96fe0860
Merge pull request #9162 from jordan-woyak/quaternion
Replace stateful rotational matrices with quaternions.
2020-10-21 17:34:11 -04:00
Léo Lam
09e87b79f1
Merge pull request #9173 from lioncash/fmtlog
Common/Log: Add basic fmt-capable functions to the interface.
2020-10-21 19:11:19 +02:00
Lioncash
425f2aa013 Common/Log: Add basic fmt-capable functions to the interface.
Provides a basic extension to the interface to begin migration off of
the printf-based logging system.

Everything will go through macros with the same style naming as the old
logging system, except the macros will have the _FMT suffix, while the
migration is in process.

This allows for peacemeal migration over time instead of pulling
everything out and replacing it all in a single pull request, which
makes for much easier reviewing.
2020-10-21 10:49:35 -04:00
Lioncash
57534777d4 Common: Move OSThreads into core
Common shouldn't be depending on APIs in Core (in this, case depending
on the PowerPC namespace). Because of the poor separation here, this
moves OSThread functionality into core, so that it resolves the implicit
dependency on core.
2020-10-21 07:35:42 -04:00
Léo Lam
fc3b474cce
Merge pull request #8318 from iwubcode/dynamic_input_textures
InputCommon: Dynamic Input Textures
2020-10-20 02:10:29 +02:00
Léo Lam
98875346bd
Merge pull request #9104 from JosJuice/cmd-unicode
DolphinQt: Handle non-ASCII characters in Windows cmd arguments
2020-10-20 01:45:28 +02:00
Jordan Woyak
39030ea33c Common/Matrix: Add Quaternion class. 2020-10-19 16:18:31 -05:00
JosJuice
1084cfec1a Add helper function for fmt::format(GetStringT(... 2020-10-19 14:36:08 +02:00
iwubcode
fd3af4c5d3 InputCommon: Introducing the "Dynamic Input Texture". Configuration links an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image. 2020-10-03 17:10:35 -05:00
Christian Aguilera
213610e95d Extended WorkQueueThread class with Clear(), Cancel() and IsCancelled(). 2020-10-01 22:09:45 +02:00
Jordan Woyak
1063c4e940 MathUtil: Add Population (vs Sample) versions of Variance and StandardDeviation to RunningVariance. 2020-09-28 18:09:33 -05:00
JosJuice
16d2ef1ea9 DolphinQt: Handle non-ASCII characters in Windows cmd arguments
CommandLineParse expects UTF-8 strings. (QApplication, on the
other hand, seems to be designed so that you can pass in the
char** argv untouched on Windows and get proper Unicode handling.)
2020-09-21 17:26:29 +02:00
JosJuice
3805b84906 Android: Add content provider support to File::Delete 2020-09-16 18:38:53 +02:00
JosJuice
6e1e6d2311 Android: Add content provider support to File::IOFile
Taking the hit now to prepare us for when Google Play will
force us to use scoped storage...
2020-09-16 18:38:53 +02:00
JMC47
a31c204ca8
Merge pull request #8765 from AdmiralCurtiss/jit-reuse-memory
Jit64 codegen space reuse.
2020-09-09 08:16:09 -04:00
Jordan Woyak
0a63340c20
Merge pull request #9037 from shuffle2/code-cleanup
Code cleanup
2020-08-30 19:43:23 -05:00
Shawn Hoffman
969ea6e4f5 msvc: enable /Zc:preprocessor and make build compile cleanly 2020-08-27 21:58:48 -07:00
Kate
5981a1929d Add support for FreeBSD/arm64 2020-08-27 21:54:04 +01:00
Admiral H. Curtiss
5b52b3e9cb x64Emitter: Check end of allocated space when emitting code. 2020-08-24 19:31:32 +02:00
Shawn Hoffman
fcc8dfd189 Common/Assert: no longer needs special impl for msvc 2020-08-23 13:57:05 -07:00
Shawn Hoffman
12ea56a6b2 remove extraneous WIN32_LEAN_AND_MEAN definition 2020-08-23 13:57:05 -07:00
Shawn Hoffman
181e0dba21 apply if constexpr in a couple places 2020-08-23 13:57:05 -07:00
Shawn Hoffman
c22748dc38 windows: fix some incorrect string lengths 2020-08-23 13:55:15 -07:00
Shawn Hoffman
b021573a70 GekkoDisassembler: fix rld* 2020-08-23 13:55:14 -07:00
Shawn Hoffman
49590c9a42 FileUtil: handle some error conditions 2020-08-23 13:55:14 -07:00
Shawn Hoffman
3bc8a26083 don't use std::move on const variables 2020-08-23 13:55:14 -07:00
Shawn Hoffman
1b1fc39f02 handle to GetFileVersionInfoW must be zero 2020-08-23 13:55:14 -07:00
Shawn Hoffman
6ef9d70701 name some threads 2020-08-22 17:22:07 -07:00
Shawn Hoffman
a769dff1d0 windows: additionally set thread name via SetThreadDescription 2020-08-22 17:22:07 -07:00
LC
4a34b74e68
Merge pull request #9035 from shuffle2/vs-pretty
misc vcxproj cleanup
2020-08-22 20:13:25 -04:00
Shawn Hoffman
cff4806d8d windows: fix build if pch were to be disabled 2020-08-22 16:18:24 -07:00
Shawn Hoffman
2f47f486af msbuild: re-enable standalone vcxproj processing 2020-08-22 16:17:50 -07:00
Shawn Hoffman
94bf48b67c msbuild: refactor stuff out of project files (for dolphin) 2020-08-22 16:17:50 -07:00
Shawn Hoffman
36ace8eb52 prettify some constructs in vcxproj files 2020-08-22 16:17:50 -07:00
Ryan Meredith
6020133f5b LogManager: Add missing include 2020-08-02 19:52:10 -04:00
JosJuice
234eaa0ff9
Merge pull request #7252 from Ebola16/Log
Android: Add Log Configuration to UI
2020-08-02 22:00:48 +02:00
Pokechu22
59dc7cfe7d Use size_t in some DSP code code 2020-07-24 15:06:39 -07:00
Ryan Meredith
fdcc6a436b Android: Add Log Configuration to UI 2020-07-24 13:59:13 -04:00
LC
487cd7abd9
Merge pull request #8905 from JosJuice/jni-encoding
Android: Use correct encoding when converting strings
2020-07-18 22:13:14 -04:00
Techjar
037aa2192f NetPlay: Limit nickname length
Ridiculously long nicknames cause UI silliness, so 30 characters seems
like a reasonable limit, as it's the same as the forum.
2020-07-16 19:03:54 -04:00
LC
c59648337a
Merge pull request #8955 from JosJuice/android-no-ashmem
Android: Don't access /dev/ashmem on newer Android versions
2020-07-16 14:23:51 -04:00
JosJuice
00cde7cbbd Android: Don't access /dev/ashmem on newer Android versions
Fixes a critical regression where 95945a0 made us unable to
start emulation on Android 10 and newer. Android is restricting
direct access to /dev/ashmem starting with the new SDK version,
but we can use the new (and simpler) ASharedMemory API instead.
We have to keep using the /dev/ashmem approach on old versions
of Android, though.
2020-07-16 20:06:58 +02:00
JosJuice
f2cc3a2948 Add Android check for strerror_r variant
I don't know why Android does it like this, but at least
it's easy to fix. (We are currently at __ANDROID_API__ == 21.)
2020-07-16 18:51:58 +02:00
Tilka
695a96498a
Merge pull request #8922 from Filoppi/timer-fixes
Timer fixes
2020-07-13 00:16:45 +01:00
Jordan Woyak
eab07866a3 Common/Timer: Fix integer underflow in Timer::GetDoubleTime for dates before ~2008. 2020-07-12 12:55:02 -05:00
JosJuice
f5da6e07d7 Android: Use correct encoding when converting strings
The functions with "UTF" in the name use "modified UTF-8" rather
than the standard UTF-8 which Dolphin uses, at least according
to Oracle's documentation, so it is incorrect for us to use them.
This change fixes the problem by converting between UTF-8 and
UTF-16 manually instead of letting JNI do it for us.
2020-07-08 14:52:05 +02:00
JosJuice
38791eec18 Common: Never convert from UCS-2 in WStringToUTF8
Probably not something we would run into in practice since
Windows uses a separate implementation, but let's do it
for the sake of correctness.
2020-07-08 14:51:35 +02:00
JosJuice
15d9fab0bb Common: Rename UTF16ToUTF8
This function does *not* always convert from UTF-16. It converts
from UTF-16 on Windows and UTF-32 on other operating systems.

Also renaming UTF8ToUTF16 for consistency, even though it
technically doesn't have the same problem since it only was
implemented on Windows.
2020-07-08 14:51:35 +02:00
Filoppi
4b5ca9923c Fixes the timer returning 1 when it should return 0. The case mentioned by the comment does not exist anymore.
Also added a IsRunning function as it was impossible to know whether it had been started or not (I will use it in later PRs but it should be there anyway)
2020-07-01 22:29:30 +03:00
JosJuice
293745afce Support the new MSVC preprocessor
Intends to fix https://bugs.dolphin-emu.org/issues/12170.
2020-06-29 13:50:59 +02:00
Tilka
9f5e6edc34
Merge pull request #8809 from Ebola16/ABB
Replace some acronyms
2020-06-14 14:30:52 +01:00
Ryan Meredith
2a70d86d55 Replace some acronyms 2020-06-14 08:37:24 -04:00
iwubcode
85e11cd4ab Common / Core: Update StringUtil to allow specifying the base, default to 0. Fix ActionReplay code to use this instead of prepending '0x' in front 2020-05-23 18:40:10 -05:00
JosJuice
2137fb7813 Externals: Add zstd
I had to rename Source/Common/Compiler.h because the VS build
confuses it with Externals/zstd/lib/common/compiler.h otherwise.
2020-05-13 20:53:10 +02:00
Sepalani
39d34e133f Debugger: Add a Thread widget
DebugInterface: Add GetThreads

WatchWidget: Update widget on AddWatch
2020-05-03 20:48:30 +04:00
Léo Lam
07ab79db64 MathUtil: Fix Rectangle::GetWidth/Height for unsigned types
`std::abs(x - y)` where x and y are unsigned integers fails to compile
with an "call of overloaded 'abs(unsigned int)' is ambiguous" error
on GCC, and even if it did compile, that expression still wouldn't
give the correct result since `x - y` is unsigned.
2020-05-03 14:41:58 +02:00
Léo Lam
19da101164 Remove redundant Config prefix from ConfigInfo/ConfigLocation
Both structs are already in the Config namespace.
2020-05-02 14:40:14 +02:00
degasus
fc0df37d94 Fix windows build system. 2020-04-29 12:56:52 +02:00
degasus
f8f592c345 Externals: Update minizip search path. 2020-04-29 12:41:36 +02:00
JosJuice
5d6f23e424 SettingsHandler: Don't output null bytes
https://bugs.dolphin-emu.org/issues/12019, take two.
2020-03-24 17:01:15 +01:00
JosJuice
76b97a4183
Merge pull request #8680 from Leseratte10/master
SettingsHandler: Always decode the whole settings.txt file
2020-03-24 00:21:29 +01:00
Jun Su
7c7a41ecd8 Cleanup warnings of -Wunused-variable
remove unused variables.
2020-03-23 14:24:27 +08:00
Florian Bach
cba4acc54b SettingsHandler: Always decode the whole settings.txt file 2020-03-20 16:08:25 +01:00
Léo Lam
4711b76cc4
Merge pull request #8655 from Techjar/fix-hotkey-groups
Core/HotkeyManager: Fix group names in config
2020-03-18 12:03:07 +01:00
JosJuice
5f6598f9e9 StringUtil: Add PathToFileName function 2020-03-16 21:03:34 +01:00
Florian Bach
3487e5037e Fix settings.txt parsing in case of weird line endings 2020-03-15 00:12:19 +01:00
Stenzek
86db015c23 Common: Add a render_window field to WindowSystemInfo
We need this because we need to pass the layer to MoltenVK, not
the view handle. But the input subsystem still needs the window.
2020-03-11 23:09:30 +10:00