Commit graph

3293 commits

Author SHA1 Message Date
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
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
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
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