Commit graph

29110 commits

Author SHA1 Message Date
Admiral H. Curtiss
700d53e00f WiiSave: In Import(), make sure the TMD exists or can be reinstalled before allowing save to be imported. 2021-01-02 17:46:11 +01:00
Admiral H. Curtiss
46e4c17db3 WiiUtils: Add utility functions to handle prep-work for importing 'SD-card export' style Wii saves. 2021-01-02 17:46:11 +01:00
Filippo Tarpini
5a5c815ff0
Fix DInput cursor going to +infinite if the window size was 0 2021-01-02 18:33:13 +02:00
Filippo Tarpini
75f35393c3
Fix XInput2 cursor going to +infinite if the window size was 0 2021-01-02 18:30:14 +02: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
merry
71a996e33b Jit_Integer: srawx: Handle a != b case with SARX
Suggested by @Sintendo

Co-authored-by: Sintendo <bram.speeckaert@gmail.com>
2021-01-01 10:32:01 +00:00
Léo Lam
452aad29f1
Merge pull request #9401 from lioncash/jittable
JitArm64_Tables: Construct tables at compile-time
2021-01-01 01:22:49 +01:00
Léo Lam
344a74aa11
Merge pull request #9396 from lioncash/arm
JitArm64_RegCache: Interface cleanup
2021-01-01 01:03:55 +01:00
Léo Lam
f59ee87031
Merge pull request #9402 from lioncash/emitter
Arm64Emitter: Interface cleanup
2021-01-01 00:52:40 +01:00
Admiral H. Curtiss
7abe1085e3 IOS/ES: Pass relevant caller title information to ImportTmd() and ExportTitleInit(). 2020-12-31 17:13:46 +01:00
Filippo Tarpini
57c59c18d4
Rename "Use Fullscreen" setting to "Start in Fullscreen"
The name was confusing as changing it at runtime would not change the window to fullscreen, as it effectively only affects the start of the emulation.
Also blocked the ability to change it when the emulation is running, to be more inline with other similar settings, like "Render to main Window".
2020-12-31 13:39:45 +02: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
Lioncash
5b5b3a9979 JitArm64_Tables: Move Instruction alias to the JIT class
Does what the comment says I should do :p
2020-12-30 19:28:37 -05:00
Lioncash
c9c874d7fb JitArm64_Tables: Construct tables at compile-time
Migrates the Aarch64 JIT over to the same tabling mechanism as the x64
JIT.
2020-12-30 19:26:29 -05:00
JosJuice
31780a6059
Merge pull request #9399 from lioncash/fallthrough
JitArm64_LoadStore: Explicitly annotate switch fallthrough cases
2020-12-30 20:59:38 +01:00
Lioncash
fa63367738 JitArm64_LoadStore: Explicitly annotate switch fallthrough cases
Makes it explicit that these are intentional. Also prevents compiler
warnings.
2020-12-30 14:41:37 -05:00
Lioncash
fabf79e09a JitArm64_RegCache: Make RegType enum an enum class
Avoids polluting the namespace and makes the members of the enumeration
strongly typed.
2020-12-30 10:37:16 -05:00
Lioncash
4ff597cf21 JitArm64_RegCache: Mark several member functions as const
Many of these don't modify member state, so they can be marked as const.
2020-12-30 09:52:30 -05:00
Lioncash
e9aaa46c2f JitArm64_RegCache: Mark register constants as constexpr
Also moves comments to make for less wonky formatting.
2020-12-30 09:44:49 -05:00
Lioncash
e2bb9fd147 JitArm64_RegCache: Mark HostReg operator== as const
Also provides operator!= for logical symmetry.

We can also take the arguments by value, as the arguments are trivially
copyable enum values which fit nicely into registers already.
2020-12-30 09:42:29 -05:00
Lioncash
e7538b10c6 JitArm64_RegCache: In-class initialize member variables where applicable
Same behavior, but in-place initializes all values and makes it visually
explicit at the declaration site.
2020-12-30 09:32:24 -05:00
Lioncash
fe54226575 JitArm64_RegCache: Make FlushMode an enum class
Prevents namespace pollution and makes the enum members strongly typed.
This also mirrors the x64 variant as well.
2020-12-30 09:26:29 -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
smurf3tte
c2da12ca75 DSP: Fix write masks on AUDIO_*/AR_* MMIO registers
https://bugs.dolphin-emu.org/issues/6749

This change fixes the scratchy audio in Teenage Mutant Ninja Turtles (SX7E52/SX7P52). The game starts an audio interface DMA with an unaligned address, and because Dolphin was not masking off the low 5 bits of AUDIO_DMA_START_LO, all future AI DMAs were misaligned. To understand why, it is instructive to refer to AUDIO_InitDMA() in libogc, which behaves the same as the official SDK:

_dspReg[25] = (_dspReg[25]&~0xffe0)|(startaddr&0xffff);

The implementation does not mask off the low bits of the passed in value before it ORs them with low bits of the current register value. Therefore, if they are not masked off by the hardware itself, they become permanently stuck once set.

Adding a write mask for AUDIO_DMA_START_LO is enough to fix the bug in TMNT, but I decided to run some tests on GC and Wii to find the correct write masks for the surrounding registers, as only a couple were already being masked. Dolphin has gotten away with not masking the rest because many are already A) masked on read (or never read) by the SDK and/or B) masked on use (or never used) in Dolphin.

This leaves just three registers where the difference may be observable: AR_DMA_CNT_H and AUDIO_DMA_START_HI/LO.
2020-12-30 01:34:48 -08:00
Léo Lam
8a3b14d7dc
Merge pull request #9391 from lioncash/find-str
IOS: Allow for heterogenous name lookup
2020-12-30 01:47:01 +01:00
Lioncash
0e91470828 IOS: Make use of insert_or_assign with AddDevice()
operator[] performs a default construction if an object at the given key
doesn't exist before overwriting it with the one we provide in operator=

insert_or_assign performs optimal insertion by avoiding the default
construction if an entry doesn't exist.

Not a game changer, but it is essentially a "free" change.
2020-12-29 19:32:18 -05:00
Lioncash
ba0540b9c5 IOS: Allow for heterogenous name lookup
Allows lookups to be done with std::string_view or any other string
type. This allows for non-allocating strings to be used with the name
lookup without needing to construct a std::string.
2020-12-29 19:32:14 -05:00
Léo Lam
806a4f3a9a
Merge pull request #9393 from lioncash/sysconf
SysConf: Make use of std::string_view
2020-12-30 01:22:39 +01:00
Lioncash
1bbfde62d1 SysConf: std::move name in Entry constructor
Allows code to move into the constructor, avoiding copies entirely.
2020-12-29 19:09:57 -05:00
Lioncash
05094ab51f SysConf: Return emplaced reference from AddEntry()
Allows GetOrAddEntry() to be implemented in a manner that doesn't result
in a redundant lookup in the event an addition needs to be made.
2020-12-29 19:08:30 -05:00
Lioncash
74224c94a7 SysConf: Make use of std::string_view
We can allow strings to be used with the SysConf interface in
potentially non-allocating manners.
2020-12-29 19:08:25 -05:00
MerryMage
d3ca5d812b Jit_Integer: Use SHLX, SHRX, SARX 2020-12-29 23:51:54 +00:00
Lioncash
e527b69d54 Core: Use C++17 deduction guides with locked recursive mutexes
Cleans up some locks that explicitly specify the recursive mutex type in
it. Meant to be included with the previous commit that cleaned out
regular mutexes, but I forgot.
2020-12-29 18:31:31 -05:00
smurf3tte
f4c579e720 Fix bad memory references in NewPatchDialog
This code was storing references to patch entries which could move around in memory if a patch was erased from the middle of a vector or if the vector itself was reallocated. Instead, NewPatchDialog maintains a separate copy of the patch entries which are committed back to the patch if the user accepts the changes.
2020-12-29 14:31:05 -08:00
smurf3tte
f3b8a985e7 Patches for Resident Evil 2/3 audio issues
These games are erroneously zeroing buffers before they can be fully copied to ARAM by DMA. The responsible memset() calls are followed by a call to DVDRead() which issues dcbi instructions that effectively cancel the memset() on real hardware. Because Dolphin lacks dcache emulation, the effects of the memset() calls are observed, which causes missing audio.

In a comment on the original bug, phire noted that the issue can be corrected by simply nop'ing out the offending memset() calls. Because the games dynamically load different .rel executables based on the character and/or language, the addresses of these calls can vary.

To deal generally with the problem of code being dynamically loaded to fixed, known addresses, the patch engine is extended to support conditional patches which require a match against a known value. This sort of thing is already achievable with Action Replay/Gecko codes, but their use depends on enabling cheats globally in Dolphin, which is not a prerequisite shared by patches.

Patches are included for every region, character, and language combination. They are enabled by default.

The end result is an approximation of the games' behavior on real hardware without the associated complexity of proper dcache emulation.

https://bugs.dolphin-emu.org/issues/9840
2020-12-29 14:24:46 -08:00
Léo Lam
3b2e31230f
Merge pull request #9386 from leoetlino/config-cache-invalidate
Config: Fix cache not being invalidated when callbacks are suppressed
2020-12-29 22:22:15 +01:00
Jordan Woyak
92de0431a2
Merge pull request #9389 from lioncash/deduction
Core: Make use of C++17 deduction guides with locks
2020-12-29 15:18:45 -06: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
Lioncash
a8b0661fb0 Core: Make use of C++17 deduction guides with locks
C++17 allows omitting the mutex type, which makes for both less reading
and more flexibility (e.g. The mutex type can change and all occurrences
don't need to be updated).
2020-12-29 16:06:17 -05:00
Lioncash
f4e1f48b4f DSPCore: Make IRAM CRC and step counter private
We can construct an API around these two members to allow them to be
private.
2020-12-29 14:32:11 -05:00
Lioncash
5fb1f0bfd3 DSPCore: Make ifx registers private
These aren't used externally, so they can be made private.
2020-12-29 14:22:39 -05:00
Lioncash
e3de37e47b DSPCore: Make the accelerator private
This is only used internally.
2020-12-29 14:15:04 -05:00
Lioncash
e1f41bab1c DSP: Make mailboxes use std::array
Makes the array strongly typed and prevents pointer decay. This also
allows for tuning bounds checks with various implementations.
2020-12-29 12:27:56 -05:00
Lioncash
f9d8d06037 DSP: Make mailboxes private
These aren't used externally anywhere and can be made private.
2020-12-29 12:27:40 -05:00
Lioncash
024e983c3a DSP: Make Mailbox enum strongly typed
Avoids implicit conversions and also prevents dumping identifiers into
the current namespace.
2020-12-29 12:20:00 -05:00
Léo Lam
ee048ad83c
Merge pull request #9377 from lioncash/analyzer
DSPAnalyzer: Migrate off file-scope state
2020-12-29 18:04:54 +01:00
Léo Lam
5ff2cb9a74
Merge pull request #9383 from lioncash/cr-fn
DSP: Eliminate some magic values related to the CR register
2020-12-29 17:37:24 +01:00
Léo Lam
15d4ddf5da
Merge pull request #9379 from Pokechu22/audio-latency-disable
Fix latency field being initially enabled on audio backends not supporting it
2020-12-29 17:28:10 +01:00
Léo Lam
5e186f4830
Merge pull request #9382 from lioncash/precise
DSPCore: Move PRECISE_BACKLOG define to the interpreter code
2020-12-29 17:17:59 +01:00
Léo Lam
f21e1d1859
Merge pull request #9381 from JosJuice/fix-core-filters
Fix Core.vcxproj.filters
2020-12-29 17:16:56 +01:00
Lioncash
359fe0d8c3 DSPCore: Move PRECISE_BACKLOG define to the interpreter code
The only usages of this define are within this source file.
2020-12-29 09:50:40 -05:00
Lioncash
64f93610ee DSP: Eliminate some magic values related to the CR register
Makes some values more immediately readable.
2020-12-29 09:43:04 -05:00
JosJuice
732887ec85 Fix Core.vcxproj.filters
Without this, Visual Studio will try to fix the problem on
its own any time the file is changed.
2020-12-29 13:50:37 +01:00
Pokechu22
147636986d Fix latency field being initially enabled on audio backends not supporting it 2020-12-28 17:06:02 -08:00
JosJuice
d78277c063 Android: Add specialized content provider implementation of DoFileSearch 2020-12-28 21:00:10 +01:00
Lioncash
8aecaf784c DSPAnalyzer: Separate instruction searching and idle skip finding
Places them into their own function to keep their functionality isolated
and self-documenting.
2020-12-28 13:15:48 -05:00
Lioncash
cc512a7524 DSPAnalyzer: Break tight coupling to SDSP
Allows the analyzer to exist independently of the DSP structure. This
allows for unit-tests to be created in a nicer manner.

SDSP is only necessary during the analysis phase, so we only need to
keep a reference around to it then as opposed to the entire lifecycle of
the analyzer.

This also allows the copy/move assignment operators to be defaulted, as
a reference member variable prevents that.
2020-12-28 13:15:48 -05:00
Lioncash
f9c488f0d9 DSPAnalyzer: Merge Analyzer namespace into DSP namespace
Now that the Analyzer class fully encapsulates all analyzer state, the
namespace is no longer necessary.
2020-12-28 13:15:48 -05:00
Lioncash
9d1c8fe492 DSPAnalyzer: Make CodeFlags private to the analyzer
Now that we have the convenience functions around the flag
bit manipulations, there's no external usages of the flags, so we can
make these private to the analyzer implementation.

Now the Analyzer namespace is largely unnecessary and can be merged with
the DSP namespace in the next commit.
2020-12-28 13:15:48 -05:00
Lioncash
2ff4d04785 DSPAnalyzer: Add convenience functions over bit tests
Makes it harder to accidentally misuse and increases readability.
2020-12-28 13:15:45 -05:00
JosJuice
01b964b01a Android: Don't consider .dff files valid for game list 2020-12-28 18:53:20 +01:00
JosJuice
73855168f3 Android: Show a message when adding a folder with no games
To catch people who try to use unsupported formats.
2020-12-28 18:53:18 +01:00
Lioncash
5756ece7ce DSPAnalyzer: Implement DSP analyzer skeleton and use it
Attempts to simply make use of the interface. Cleanup will follow in
subsequent commits to make for nicer review.
2020-12-28 11:37:29 -05:00
Lioncash
8f4c6ad7b1 DSPAnalyzer: Add basic class skeleton
Adds the non-functional skeleton for the to-be Analyzer interface with
deglobalized components.
2020-12-28 10:47:12 -05:00
Léo Lam
9b3cdd0645
IOS/WD: Report game quirk if unimplemented ioctl is used
Lets us find games to test more easily.
2020-12-28 16:15:17 +01:00
Léo Lam
9a87d27612
IOS/WD: Implement more parts of the interface
This commit implements the following commands:

* open
* close
* GetMode
* SetLinkState (used to actually trigger scanning)
* GetLinkState (used to check if the driver is in the expected state)
* GetInfo
* RecvFrame and RecvNotification (stubbed)
* Disassociate (stubbed)

GetInfo was already implemented, but the structure wasn't initialized
correctly so the info was being rejected by official titles.
That has also been fixed in this commit.

Some of the checks may seem unimportant but official titles actually
require WD to return error codes... Failing to do so can cause hangs
and softlocks when DS communications are shut down.

This minimal implementation is enough to satisfy the Mii channel
and all other DS games, except Tales of Graces (https://dolp.in/i11977)
which still softlocks because it probably requires us to actually
feed it frame data.
2020-12-28 16:15:17 +01:00
Léo Lam
dcbe81b880
IOS: Simplify usage of GetVector
By making GetVector return nullptr for invalid indices, we don't have
to check the total number of vectors all the time before calling
GetVector.
2020-12-28 16:12:04 +01:00
Léo Lam
4fea832f49
IOS/NCD: Implement Lock/Unlock more accurately
NCD returns an error if it receives a request to lock the driver
when it is already locked.

Emulating this may seem pointless, but it turns out PPC-side code
expects NCD to return an error and will immediately fail and stop
initialising wireless stuff if NCD succeeds.
2020-12-28 16:12:04 +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
LC
28a666a35f
Merge pull request #9363 from MerryMage/rorx
Jit_Integer: Use RORX where possible
2020-12-27 22:25:03 -05:00
LC
4b24215efb
Merge pull request #9371 from MerryMage/rlwinmx-BEXTR
Jit_Integer: rlwinmx: Use BEXTR where possible
2020-12-27 22:24:17 -05:00
LC
fcd86e9b21
Merge pull request #9370 from MerryMage/rlwinmx
Jit_Integer: rlwinmx: Generalize byte/word extract plus shift case
2020-12-27 22:23:18 -05:00
LC
d06d59e9c2
Merge pull request #9262 from Sintendo/jit64imm
Jit64: More constant propagation optimizations
2020-12-27 22:21:25 -05:00
MerryMage
e415580f54 Jit_Integer: Use Common::CountLeadingZeros in cntlzwx 2020-12-28 01:08:50 +00:00
MerryMage
7e9824611e Interpreter_Integer: Use Common::CountLeadingZeros in cntlzwx 2020-12-28 01:08:50 +00:00
MerryMage
d695fcb126 BitUtils: Add CountLeadingZeros 2020-12-27 22:56:43 +00:00
Léo Lam
4705af59c6
Merge pull request #9355 from JosJuice/perfmon
Call UpdatePerformanceMonitor when needed
2020-12-27 16:13:36 +01:00
MerryMage
73b6166f18 Jit_Integer: rlwinmx: Use BEXTR where possible 2020-12-27 15:08:45 +00:00
MerryMage
11643ee2f0 Jit_Integer: rlwinmx: Generalize byte/word extract plus shift case 2020-12-27 14:43:51 +00:00
LC
263784639b
Merge pull request #9368 from JosJuice/android-game-properties-one-settings
Android: Only have one settings entrypoint in game properties
2020-12-27 07:08:34 -05:00
JosJuice
7cf62fed59 Android: Only have one settings entrypoint in game properties
In 8c723d0, I intended to update the main activity, emulation
activity and game properties dialog, but I forgot to actually
update the game properties dialog. This commit fixes that.

The changes outside of GamePropertiesDialog.java are just
to hide the Wii controller settings for GameCube games.
2020-12-27 13:05:26 +01:00
JosJuice
74ba993b4a
Merge pull request #9364 from MerryMage/AndWithMask
Jit_Integer: Add trivial AndWithMask cases
2020-12-27 12:45:34 +01:00
Lioncash
5f65bad68c DSP: Migrate code that modifies m_dsp into SDSP itself
Localizes code that modifies m_dsp into the struct itself. This reduces
the overal coupling between DSPCore and SDSP by reducing access to its
member variables.

This commit is only code movement and has no functional changes.
2020-12-27 06:38:23 -05: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
2917af03ec
Merge pull request #9362 from iwubcode/freelook_fix_crash
VideoCommon: Fix crash that occurs on loading a fifo log when Free Look is enabled
2020-12-27 11:37:50 +01:00
MerryMage
bea6a86893 Jit_Integer: Add trivial AndWithMask cases
Add cases to handle all one and all zero masks.
2020-12-27 00:18:06 +00:00
MerryMage
946e1b9054 Jit_Integer: Missed AndWithMask in rlwimix 2020-12-26 23:33:33 +00:00