Commit graph

29390 commits

Author SHA1 Message Date
Shawn Hoffman
1e5e5ea855 BitUtils: initialize variables
fixes C3615 on some msvc/cmake configs
2021-01-09 22:18:29 -08:00
Shawn Hoffman
cce275c16e Revert "msvc: temporary workaround for C4789 false positive"
This reverts commit deb73d0167.
2021-01-09 19:22:36 -08:00
Shawn Hoffman
c8316f70a4 msvc: bump _MSC_FULL_VER check to 192829335 2021-01-09 19:21:03 -08:00
Sintendo
305cd31bd9 Jit64: Fix FinalizeCarryOverflow XER[OV/SO]
FinalizeCarryOverflow didn't maintain XER[OV/SO] properly due to an
oversight. Here's the code it would generate:

0:  9c                      pushf
1:  80 65 3b fe             and    BYTE PTR [rbp+0x3b],0xfe
5:  71 04                   jno    b <jno>
7:  c6 45 3b 03             mov    BYTE PTR [rbp+0x3b],0x3
000000000000000b <jno>:
b:  9d                      popf

At first glance it seems reasonable. The host flags are carefully
preserved with PUSHF. The AND instruction clears XER[OV]. Next, an
conditional branch checks the host's overflow flag and, if needed, skips
over a MOV that sets XER[OV/SO]. Finally, host flags are restored with
POPF.

However, the AND instruction also clears the host's overflow flag. As a
result, the branch that follows it is always taken and the MOV is always
skipped. The end result is that XER[OV] is always cleared while XER[SO]
is left unchanged.

Putting POPF immediately after the AND would fix this, but we already
have GenerateOverflow doing it correctly (and without the PUSHF/POPF
shenanigans too). So let's just use that instead.
2021-01-09 22:52:18 +01:00
Léo Lam
0776263c5e
Merge pull request #9428 from JosJuice/tv-folder-picker
Android: Use old folder picker on Android TV
2021-01-09 11:54:02 +01:00
JosJuice
116a5a79da Android: Use old folder picker on Android TV
See the comment I added to the code. This is a rather serious
issue for Android TV users from what I've heard.
2021-01-08 16:27:33 +01:00
Léo Lam
4cdcbb6ab2
Merge pull request #9308 from smurf3tte/re23_patch
Patches for Resident Evil 2/3 audio issues
2021-01-06 01:52:15 +01:00
Léo Lam
0b1db65aa1
Merge pull request #9405 from Filoppi/patch-7
Rename "Use Fullscreen" setting to "Start in Fullscreen"
2021-01-06 01:44:46 +01:00
Pierre Bourdon
27013e8d18
Merge pull request #9300 from leoetlino/ncd-wd-fixes
IOS: WD and NCD fixes
2021-01-06 00:51:33 +01:00
Sintendo
df70077e6b JitArm64: subfx - Special case a == b 2021-01-05 18:52:24 +01:00
Léo Lam
eafb9de047
Merge pull request #9323 from waddlesplash/haiku
Rehabilitate Haiku support.
2021-01-05 16:09:43 +01:00
Léo Lam
840ecfb32f
Merge pull request #9409 from AdmiralCurtiss/wii-save-import-tmd
Make WiiSave::Import() behave closer to the Wii System Menu's SD Card save copying.
2021-01-05 15:36:36 +01:00
Filippo Tarpini
a5a6ef8512
Fix a couple of typos
[committer note: fixed commit message style]
2021-01-05 15:24:21 +01:00
Filippo Tarpini
0805b58302
DolphinQt: Remove some useless includes
[committer note: fixed commit message style]
2021-01-05 15:24:13 +01:00
Filippo Tarpini
3acd1726b9
Core: Fix variable naming conventions
[committer note: squashed two commits]
2021-01-05 15:23:40 +01:00
Léo Lam
ee25f03ff9
Merge pull request #9418 from Filoppi/patch-10
Fix DualShockUDP not adding/removing devices correctly
2021-01-05 15:15:53 +01:00
Pierre Bourdon
bd89523e63
Merge pull request #9392 from smurf3tte/audio_wmask
DSP: Fix write masks on AUDIO_*/AR_* MMIO registers
2021-01-05 15:08:06 +01:00
Sintendo
c0be34aa81 Jit64: subfx - Special case a == b
Soul Calibur II does this.

Before:
2B F6                sub         esi,esi

After:
Nothing!
2021-01-05 00:26:26 +01:00
Sintendo
b0be20560f Jit64: subfx - Special case b == 0
Happens in Super Mario Sunshine. You could probably do something similar
for b == -1 (like we do for subfic), but I couldn't find any titles that
do this.

- Case 1: d == a

Before:
41 8B C7             mov         eax,r15d
41 BF 00 00 00 00    mov         r15d,0
44 2B F8             sub         r15d,eax

After:
41 F7 DF             neg         r15d

- Case 2: d != a

Before:
BF 00 00 00 00       mov         edi,0
41 2B FD             sub         edi,r13d

After:
41 8B FD             mov         edi,r13d
F7 DF                neg         edi
2021-01-05 00:11:16 +01:00
Sintendo
57548b456b Jit64: subfx - Special case a == 0
Occurs a bunch of times in Super Mario Sunshine.

Before:
41 83 EE 00          sub         r14d,0

After:
Nothing!
2021-01-04 23:54:15 +01:00
Sintendo
b805223108 Jit64: subfx - Optimize more constant a cases
Consider the case where d and a refer to the same PowerPC register,
which is known to hold an immediate value by the RegCache. We place a
ReadWrite constraint on this register and bind it to an x86 register.
The RegCache then allocates a new register, initializes it with the
immediate, and returns a RCX64Reg for both d and a.

At this point information about the immediate value becomes unreachable.
In the case of subfx, this generates suboptimal code:

Before 1:
BF 1E 00 00 00       mov         edi,1Eh       <- done by RegCache
8B C7                mov         eax,edi
8B FE                mov         edi,esi
2B F8                sub         edi,eax

Before 2:
BE 00 AC 3F 80       mov         esi,803FAC00h <- done by RegCache
8B C6                mov         eax,esi
8B 75 EC             mov         esi,dword ptr [rbp-14h]
2B F0                sub         esi,eax

The solution is to explicitly handle the constant a case before having
the RegCache allocate registers for us.

After 1:
8D 7E E2             lea         edi,[rsi-1Eh]

After 2:
8B 75 EC             mov         esi,dword ptr [rbp-14h]
81 EE 00 AC 3F 80    sub         esi,803FAC00h
2021-01-04 23:02:22 +01:00
Pokechu22
e825af7b1b Software: Remove normalization special case
The special case doesn't appear to make a significant difference in any games, and the current implementation has a (minor, fixable) issue that breaks Super Mario Sunshine (both with a failed assertion (https://bugs.dolphin-emu.org/issues/11742) and a rendering issue (https://bugs.dolphin-emu.org/issues/7476)).  Hardware testing wasn't able to reproduce the special case, either, so it may just not exist.

PR #9315 contains a fixed implementation of the special case on all video backends, and can serve as a basis for it being reintroduced if it is found to exist under more specific circumstances.  For now, I don't see a reason to keep it present.
2021-01-03 23:22:48 -08:00
Filippo Tarpini
1e4a1bee43 Fix DualShockUDP not adding/removing devices correctly
-If adding 2 devices with the same name, they their unique id wouldn't be increased, causing a conflict.
-Removing a device wouldn't actually remove it from the internal devices list because the list of devices had already been updated when going through it.
-It was possible to remove devices belonging to other sources by adding a device with the same name and then removing it.
2021-01-03 21:06:06 +02:00
MerryMage
6106d6481f BitUtils: __builtin_clz is undefined when value == 0 2021-01-03 17:35:15 +00:00
LC
4b9259d691
Merge pull request #9415 from Filoppi/patch-8
Fix cursor going to +infinite if the window size was 0
2021-01-03 11:26:11 -05:00
MerryMage
8ae0bf93e7 JitArm64: Do not use offsetof on non-standard-layout types
Applying PR #8687 to Arm64 JIT.
2021-01-03 15:26:01 +00:00
waddlesplash
2df11d3911 Rehabilitate Haiku support. 2021-01-02 16:54:24 -05:00
Filippo Tarpini
8813ba69f5 Fix Quartz cursor going to +infinite if the window size was 0 2021-01-02 19:55:19 +02:00
Admiral H. Curtiss
2932b5f8cd Qt: Give better error messages when Wii save importing fails. 2021-01-02 17:46:12 +01:00
Admiral H. Curtiss
d9c686db30 WiiSave: Delete existing save, if any, before importing one. 2021-01-02 17:46:12 +01:00
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
iwubcode
16dc2fa379 VideoCommon: Fix crash that occurs on loading a fifo log due to uninitialized Free Look control type 2020-12-26 17:26:21 -06:00
MerryMage
e1024fc6ba Jit_Integer: Use RORX where possible 2020-12-26 23:00:04 +00:00
JosJuice
ce599f9f46
Merge pull request #9359 from leoetlino/gdbstub-on
Fix GDBStub build and build it by default
2020-12-26 12:02:36 +01:00
Léo Lam
dcc313fd96
Merge pull request #9346 from Sintendo/jitarm64ub
JitArm64: Fix signed bitwise left shift UB
2020-12-26 11:56:33 +01: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
Sintendo
67d2fa11f1 Jit64: srawx - Handle constant zero input
Shifting zero by any amount always gives zero.

Before:
41 B9 00 00 00 00    mov         r9d,0
41 8B CF             mov         ecx,r15d
49 C1 E1 20          shl         r9,20h
49 D3 F9             sar         r9,cl
49 C1 E9 20          shr         r9,20h

After:
Nothing, register is set to constant zero.

Before:
41 B8 00 00 00 00    mov         r8d,0
41 8B CF             mov         ecx,r15d
49 C1 E0 20          shl         r8,20h
49 D3 F8             sar         r8,cl
41 8B C0             mov         eax,r8d
49 C1 E8 20          shr         r8,20h
44 85 C0             test        eax,r8d
0F 95 45 58          setne       byte ptr [rbp+58h]

After:
C6 45 58 00          mov         byte ptr [rbp+58h],0

Occurs a bunch of times in Super Mario Sunshine. Since this is an
arithmetic shift a similar optimization can be done for constant -1
(0xFFFFFFFF), but I couldn't find any game where this happens.
2020-12-25 19:30:51 +01:00
Sintendo
10d65519f9 Jit64: slwx - Handle constant zero input
Shifting zero by any amount always gives zero.

Before:
41 BF 00 00 00 00    mov         r15d,0
8B CF                mov         ecx,edi
49 D3 E7             shl         r15,cl
45 8B FF             mov         r15d,r15d

After:
Nothing, register is set to constant zero.

All games I've tried hit this optimization on launch. In Soul Calibur II
it occurs very frequently during gameplay.
2020-12-25 19:30:51 +01:00
Sintendo
1a52fdf7e3 Jit64: rlwnmx - Optimize rotate by constant
Only removes the scratch register and a MOV, but hey.

Before:
B9 02 00 00 00       mov         ecx,2
41 8B F5             mov         esi,r13d
D3 C6                rol         esi,cl
83 E6 01             and         esi,1

After:
41 8B F5             mov         esi,r13d
C1 C6 02             rol         esi,2
83 E6 01             and         esi,1
2020-12-25 19:30:51 +01:00
Sintendo
cb70d5ee4f Jit64: srawix - Handle constant input register
Much like we did for srawx. This was already implemented on JitArm64.

Before:
B8 00 00 00 00       mov         eax,0
8B F0                mov         esi,eax
C1 E8 1F             shr         eax,1Fh
23 C6                and         eax,esi
D1 FE                sar         esi,1
88 45 58             mov         byte ptr [rbp+58h],al

After:
C6 45 58 00          mov         byte ptr [rbp+58h],0
2020-12-25 19:30:51 +01:00
Sintendo
8ac40162da Jit64: srawx - Handle constant input registers
If both input registers hold known values at compile time, we can just
calculate the result on the spot.

Code has mostly been copied from JitArm64 where it had already been implemented.

Before:
BF FF FF FF FF       mov         edi,0FFFFFFFFh
8B C7                mov         eax,edi
C1 FF 10             sar         edi,10h
C1 E0 10             shl         eax,10h
85 F8                test        eax,edi
0F 95 45 58          setne       byte ptr [rbp+58h]

After:
C6 45 58 01          mov         byte ptr [rbp+58h],1
2020-12-25 19:30:51 +01:00
Sintendo
b968120f8a Jit64: srawx - Optimize shift by constant
More efficient code can be generated if the shift amount is known at
compile time. We can once again take advantage of shifts with the shift
amount in an 8-bit immediate to eliminate ECX as a scratch register,
reducing register pressure and removing the occasional spill. We can
also do 32-bit shifts instead of 64-bit operations.

We recognize four distinct cases:

- The special case where we're dealing with the PowerPC's quirky shift
  amount masking. If the shift amount is a number from 32 to 63, all
  bits are shifted out and the result it either all zeroes or all ones.

Before:
B9 F0 FF FF FF       mov         ecx,0FFFFFFF0h
8B F7                mov         esi,edi
48 C1 E6 20          shl         rsi,20h
48 D3 FE             sar         rsi,cl
8B C6                mov         eax,esi
48 C1 EE 20          shr         rsi,20h
85 F0                test        eax,esi
0F 95 45 58          setne       byte ptr [rbp+58h]

After:
8B F7                mov         esi,edi
C1 FE 1F             sar         esi,1Fh
0F 95 45 58          setne       byte ptr [rbp+58h]

- The shift amount is zero. Not calculation needs to be done, just clear
  the carry flag.

Before:
B9 00 00 00 00       mov         ecx,0
49 C1 E5 20          shl         r13,20h
49 D3 FD             sar         r13,cl
41 8B C5             mov         eax,r13d
49 C1 ED 20          shr         r13,20h
44 85 E8             test        eax,r13d
0F 95 45 58          setne       byte ptr [rbp+58h]

After:
C6 45 58 00          mov         byte ptr [rbp+58h],0

- The carry flag doesn't need to be computed. Just do the arithmetic
  shift.

Before:
B9 02 00 00 00       mov         ecx,2
48 C1 E7 20          shl         rdi,20h
48 D3 FF             sar         rdi,cl
48 C1 EF 20          shr         rdi,20h

After:
C1 FF 02             sar         edi,2

- The carry flag must be computed. In addition to the arithmetic shift,
  we do a shift to the left and and them together to know if any ones
  were shifted out. It's still better than before, because we can do
  32-bit shifts.

Before:
B9 02 00 00 00       mov         ecx,2
49 C1 E5 20          shl         r13,20h
49 D3 FD             sar         r13,cl
41 8B C5             mov         eax,r13d
49 C1 ED 20          shr         r13,20h
44 85 E8             test        eax,r13d
0F 95 45 58          setne       byte ptr [rbp+58h]

After:
41 8B C5             mov         eax,r13d
41 C1 FD 02          sar         r13d,2
C1 E0 1E             shl         eax,1Eh
44 85 E8             test        eax,r13d
0F 95 45 58          setne       byte ptr [rbp+58h]
2020-12-25 19:30:51 +01:00
Sintendo
17dc870847 Jit64: slwx - Optimize shift by constant
More efficient code can be generated if the shift amount is known at
compile time. Similar optimizations were present in JitArm64 already,
but were missing in Jit64.

- By using an 8-bit immediate we can eliminate the need for ECX as a
  scratch register, thereby reducing register pressure and occasionally
  eliminating a spill.

Before:
B9 18 00 00 00       mov         ecx,18h
41 8B F7             mov         esi,r15d
48 D3 E6             shl         rsi,cl
8B F6                mov         esi,esi

After:
41 8B CF             mov         ecx,r15d
C1 E1 18             shl         ecx,18h

- PowerPC has strange shift amount masking behavior which is emulated
  using 64-bit shifts, even though we only care about a 32-bit result.
  If the shift amount is known, we can handle this special case
  separately, and use 32-bit shift instructions otherwise. We also no
  longer need to clear the upper 32 bits of the register.

Before:
BE F8 FF FF FF       mov         esi,0FFFFFFF8h
8B CE                mov         ecx,esi
41 8B F4             mov         esi,r12d
48 D3 E6             shl         rsi,cl
8B F6                mov         esi,esi

After:
Nothing, register is set to constant zero.

- A shift by zero becomes a simple MOV.

Before:
BE 00 00 00 00       mov         esi,0
8B CE                mov         ecx,esi
41 8B F3             mov         esi,r11d
48 D3 E6             shl         rsi,cl
8B F6                mov         esi,esi

After:
41 8B FB             mov         edi,r11d
2020-12-25 19:30:51 +01:00
Sintendo
17db359979 Jit64: srwx - Optimize shift by constant
More efficient code can be generated if the shift amount is known at
compile time. Similar optimizations were present in JitArm64 already,
but were missing in Jit64.

- By using an 8-bit immediate we can eliminate the need for ECX as a
  scratch register, thereby reducing register pressure and occasionally
  eliminating a spill.

Before:
B9 18 00 00 00       mov         ecx,18h
45 8B C1             mov         r8d,r9d
49 D3 E8             shr         r8,cl

After:
45 8B C1             mov         r8d,r9d
41 C1 E8 18          shr         r8d,18h

- PowerPC has strange shift amount masking behavior which is emulated
  using 64-bit shifts, even though we only care about a 32-bit result.
  If the shift amount is known, we can handle this special case
  separately, and use 32-bit shift instructions otherwise.

Before:
B9 F8 FF FF FF       mov         ecx,0FFFFFFF8h
45 8B C1             mov         r8d,r9d
49 D3 E8             shr         r8,cl

After:
Nothing, register is set to constant zero.

- A shift by zero becomes a simple MOV.

Before:
B9 00 00 00 00       mov         ecx,0
45 8B C1             mov         r8d,r9d
49 D3 E8             shr         r8,cl

After:
45 8B C1             mov         r8d,r9d
2020-12-25 19:30:51 +01:00
Sintendo
2e4e2ad1ff Jit64: subfic - Handle constants
Occurs surprisingly often. Prevents generating silly code like this:

BE 03 00 00 00       mov         esi,3
83 EE 08             sub         esi,8
0F 93 45 58          setae       byte ptr [rbp+58h]
2020-12-25 19:30:51 +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
Léo Lam
ae187818f5
PowerPC: Fix GDBStub build 2020-12-25 01:15:31 +01:00
iwubcode
c7b24d6213 VideoCommon: Update active config when we check for config changes, this ensures Free Look settings are copied at the start of the frame. Also update the camera's controller type at this time 2020-12-24 13:51:46 -06:00
iwubcode
a893c25b01 Core: Refresh the Free Look configuration when Free Look is initialized, ensuring that the configuration updates appropriately with any changes 2020-12-24 13:49:25 -06:00
iwubcode
b4c41adac4 Core: Only respond to Free Look controller buttons when the camera is active 2020-12-24 13:49:25 -06:00
iwubcode
b9d9b27a81 DolphinQt: Only trigger Free Look mouse movement when the Free Look camera is active 2020-12-24 13:49:25 -06:00
iwubcode
bcf63c463b VideoCommon: Add 'Active' state to FreelookCamera to future proof if we ever add multiple cameras 2020-12-24 13:49:25 -06:00
iwubcode
a37fd8c5d9 VideoCommon: Update Free Look camera with settings change... 2020-12-24 13:49:25 -06:00
iwubcode
670f34af60 Core: Update state to account for save system change 2020-12-24 13:49:25 -06:00
iwubcode
9bd4e0939e DolphinQt: Update mapping window device to use expanding size policy 2020-12-24 13:49:25 -06:00
iwubcode
9a744ab25b DolphinQt: Move Free Look out of Graphics/Hotkey and into its own configuration window. Launched from a new menu option - "Free Look Settings". The HotKeyScheduler still calls the Free Look functionality to reduce the total number of threads 2020-12-24 13:49:25 -06:00
iwubcode
9ac6090c9a Core: Add Free Look controllers that are initialized at boot 2020-12-24 13:49:25 -06:00
iwubcode
27acba620c Core: Add new Free Look settings and config 2020-12-24 13:49:25 -06:00
iwubcode
f6ab9a9b6f Core / VideoCommon: Remove old Free Look config 2020-12-24 13:49:25 -06:00
iwubcode
e7ac095ba1 HotkeyManager: Remove Free Look functionality in preparation for replacement 2020-12-24 13:48:38 -06:00
iwubcode
d5bc209eb6 VideoCommon: Change 'Zoom' to 'MoveForward' since it really isn't a zoom 2020-12-24 13:48:38 -06:00
iwubcode
cb6ae6a4b1 VideoCommon: Add speed to Free Look camera 2020-12-24 13:48:38 -06:00
LC
d61c64684b
Merge pull request #9357 from JosJuice/android-one-settings-entrypoint
Android: Only have one settings entrypoint per activity/dialog
2020-12-24 12:46:43 -05:00
JosJuice
8c723d0584 Android: Only have one settings entrypoint per activity/dialog
Basically, instead of having one button for config, one button
for graphics settings and so on, we now have just one settings
button which takes you to a screen where you pick between
config/graphics/GameCube controllers/Wii Remotes.

The main reason I want to do this is because people still have
trouble finding Overlay Controls in the "new" in-game menu.
Typically (depending on the screen size and the length of the
game name), the scrollable part of the menu can fit 4 items,
and merging Config and Graphics Settings into one item would
move Overlay Controls from 5th place to 4th place (assuming the
user doesn't have savestates enabled), which makes it findable
even for users who don't realize the menu can be scrolled.

The dialog that's shown when long pressing a game in the game
list is also shortened. While not a pressing matter, I think
it was getting a bit long.

An additional reason to do this is because we probably will
want to make it possible to edit the controller settings
from the in-game menu at some point in the future. With the
old approach, this would require us to dedicate a whopping 4
menu items just for settings (not including Overlay Controls),
which I think is excessive.
2020-12-24 16:48:20 +01:00
JosJuice
8f475371b9 JitArm64: Call UpdatePerformanceMonitor 2020-12-24 16:23:24 +01:00
JosJuice
6f05c40013 Android: Correctly save in-game settings changes to disk 2020-12-24 13:37:33 +01:00
JosJuice
8c0f32e6be Interpreter: Call UpdatePerformanceMonitor 2020-12-23 17:34:47 +01:00
JosJuice
2dcd0b248f CachedInterpreter: Call UpdatePerformanceMonitor 2020-12-23 17:34:32 +01:00
JosJuice
f8f3548ca9 CoreTiming: Call UpdatePerformanceMonitor on idle 2020-12-23 17:34:02 +01:00
Markus Wick
1d489b3fd5
Merge pull request #9347 from JosJuice/fpr-utilization
Jit64: Fix FPURegCache::GetRegUtilization
2020-12-21 18:37:03 +01:00
JosJuice
9460467e7c Jit64: Fix FPURegCache::GetRegUtilization
This performance bug was probably a simple copy-paste error.
(The function was identical to GPRRegCache::GetRegUtilization.)
2020-12-21 18:02:43 +01:00
Sintendo
567357e12d JitArm64: srawix - Fix undefined behavior
Signed bitwise left shift invokes UB when shifting a negative value.
2020-12-21 11:05:22 +01:00
Sintendo
97eb616719 JitArm64: srawx - Fix undefined behavior
Signed bitwise left shift invokes UB when shifting a negative value.
2020-12-21 11:01:42 +01:00
LC
4c8ccc63b5
Merge pull request #9345 from MerryMage/analytics
Analytics: Add rarer OSes to analytics
2020-12-20 18:55:34 -05:00
MerryMage
d109451ad5 Analytics: Add rarer OSes to analytics 2020-12-20 22:32:07 +00: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
399ede37a6 Android: Catch all exceptions in ContentHandler 2020-12-20 13:24:54 +01:00
JosJuice
ae8de35105 Android: Use storage access framework for game list 2020-12-20 13:24:54 +01:00
JosJuice
2126f62111 Android: Add content provider support to File::ScanDirectoryTree 2020-12-20 13:24:54 +01:00
JosJuice
525268f043 Android: Fix opening games with extensionless URI 2020-12-20 13:24:54 +01:00
JosJuice
e60665da94 Android: Use storage access framework for picking single games 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
Ryan Meredith
64afe97491 Android: Convert ISOPaths to INI settings 2020-12-20 13:24:54 +01:00
Lioncash
142406f337 Core: Add initial System class
Introduces the system class that will eventually contain all relevant
system state, as opposed to everything being distributed all over the
place as global variables.

Throughout the codebase we have code that from its interface-view, does
not actually require its dependencies to be described in the interface,
and we routinely run into issues with initialization where we sometimes
make use of a facility before it's been initialized, which leads to
annoying to debug cases, because the reader needs to run through the
codebase and see what order things get initialized in, and how they're
being used. This is particularly a frequent issue in the video code.

Further, we also have a lot of code that makes use of file-scope
variables (many of which are non-trivial), which must all be default
initialized before the application can actually enter main(). While this
may not be a huge issue in itself, some of these are allocating, which
means that the application may need to use memory that it otherwise
wouldn't need to (e.g. when a game isn't running, this excess memory is
being used).

Being able to wrap all these subsystems into objects would be nicer,
since they can be constructed when they're actually needed. Them being
objects also means we can better express dependencies on subsystems as
types directly in the interface, making them explicit to the reader
instead of a change randomly blowing up, said reader inspecting it, and finding
out that something needed to be initialized beforehand. With the global
turned into a function parameter, the dependency is explicit and they
know just by reading it, that the given subsystem needs to be in a valid
state before calling the function.

For a prior example of an emulator that has moved to this model, see
yuzu, which has been migrated off of global variables all over the place
and replaced with a system instance (which has now reached the stage,
where the singleton can be removed).
2020-12-19 23:22:06 -05:00
LC
5493a86086
Merge pull request #9330 from leoetlino/tapserver-define
EXI_Device: Always define EXIDEVICE_ETHTAPSERVER for consistency
2020-12-19 21:46:01 -05: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
iwubcode
e55342ae88 DolphinQt: Fix all instances of <gameid> in AdvancedWidget to use the appropriate html code instead 2020-12-18 22:50:06 -06:00
Léo Lam
0ad2f3da45
Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings 2020-12-16 16:04:19 +01:00
Léo Lam
eafe005672
Fix -Wclass-memaccess warnings
We want to clear/memset the padding bytes, not just each member,
so using assignment or {} initialization is not an option.

To silence the warnings, cast the object pointer to u8* (which is not
undefined behavior) to make it explicit to the compiler that we want
to fill the object representation.
2020-12-16 15:37:43 +01:00
Léo Lam
6018525992
Qt: Fix deprecated use of MidButton
MidButton has been deprecated since Qt 4.7. The replacement is
MiddleButton.
2020-12-16 14:45:11 +01:00
Léo Lam
efdb620783
Qt/Config: Remove unused includes 2020-12-16 14:43:26 +01:00
Léo Lam
c59372dbb0
EXI_Device: Always define EXIDEVICE_ETHTAPSERVER for consistency
This keeps the enum values consistent across platforms in case new
entries are added after EXIDEVICE_ETHTAPSERVER.
2020-12-15 20:49:29 +01:00
Léo Lam
2615da820d
Merge pull request #9157 from jordan-woyak/wm-emu-tilt-wrap-around
WiimoteEmu: Allow tilt to wrap around and simulate full 360 degree rotations.
2020-12-15 03:14:14 +01:00
Jordan Woyak
4bb0a885d0 WiimoteEmu/DolphinQt: Fix tilt indicator for wrapped around angles. 2020-12-14 20:02:49 -06:00
Martin Michelsen
a9486d087f
Add tap-like fake Ethernet network interface for macOS
TunTap has recently become unmaintained, and it seems Apple wants developers to move away from kexts in general. TunTap currently takes some finagling to work on Catalina, and it may not work at all on Big Sur, necessitating a non-kext-based solution. Fortunately, fake Ethernet devices were introduced in Sierra and can be used similarly to tap adapters. This commit adds a new type of BBA interface implementation which uses fake Ethernet devices via tapserver (https://github.com/fuzziqersoftware/tapserver) to communicate with the host. This implementation was tested with PSO Episodes I & II, which can successfully connect to a private server running locally.

This implementation is only available on macOS, since that's the only place it's needed - Windows/Linux/Unix are unaffected by TunTap being deprecated.
2020-12-15 03:01:04 +01:00
Jordan Woyak
fffd005178 WiimoteEmu: Allow tilt to wrap around and simulate full 360 degree rotations. 2020-12-14 19:43:28 -06:00
David Carlier
2c355b81f2
Add NetBSD support 2020-12-15 02:34:25 +01:00
Léo Lam
ed1564515b
Merge pull request #9326 from Subject38/wiimote_deadlock
InputCommon: Fix callback dispatch deadlock
2020-12-15 01:16:59 +01:00
Léo Lam
2c2ec16b53
Merge pull request #9320 from JosJuice/remove-patch-crash
DolphinQt: Fix crash after removing extra patch line
2020-12-15 00:01:07 +01:00
Léo Lam
214ea8ff18
Merge pull request #9328 from AdmiralCurtiss/memory-view-crash
Core/AddressSpace: Return null accessors when no game is running to prevent out-of-bounds memory accesses.
2020-12-14 03:18:45 +01:00
Admiral H. Curtiss
668b8d60c8 Core/AddressSpace: Return null accessors when no game is running to prevent out-of-bounds memory accesses. 2020-12-13 06:21:07 +01:00
Léo Lam
3634508e46
Merge pull request #9311 from JosJuice/config-get-fast-2
Add caching to Config::Info
2020-12-13 03:55:39 +01:00
seth
00ec25d520 InputCommon: Fix callback dispatch deadlock
Make sure m_is_populating_devices is true when a WM_INPUT_DEVICE_CHANGE
event is received directly on the ciface thread, so that callbacks do
not occur while removing devices. This breaks a hold-and-wait deadlock
between the ciface thread and the CPU thread when using emulated
Wiimotes.

Co-authored-by: brainleq <brainleq@users.noreply.github.com>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
2020-12-13 00:30:27 +00:00
Jordan Woyak
0fa6bde374 HW/WiimoteReal: Drop stale data reports to prevent read queue from filling up and causing input delays. 2020-12-12 12:18:10 -06: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
3c6ad495b4 DolphinQt: Fix crash after removing extra patch line 2020-12-11 22:13:10 +01:00
JosJuice
633ab2dd7c Store pointers in Config::SYSCONF_SETTINGS
Not strictly necessary, but it reduces memory usage a little,
and the next commit will make copying an Info object slower.
2020-12-11 19:54:16 +01:00
JosJuice
b285991b88 Turn Config::Info into a class with getters 2020-12-11 19:54:16 +01:00
JosJuice
11e8783893 Core: Don't copy default _Enabled sections to user INIs 2020-12-11 15:38:11 +01:00
Léo Lam
7d9276c340
Merge pull request #9317 from JosJuice/default-enabled-codes
GameSettings: Enable compatibility patches by default
2020-12-11 10:40:03 +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
JosJuice
d77a9ad1b6 Core: Save the disabling of default enabled codes
The previous commit adjusted the code for loading
and this commit adjusts the code for saving.
2020-12-11 10:08:20 +01:00
JosJuice
366cfd0f8c Core: Allow overriding the enabling of a code
If we want to enable codes in the default game INIs,
we should have some way for users to disable them.
This commit accomplishes that by adding a *_Disabled
section corresponding to each *_Enabled section.
2020-12-11 10:02:14 +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
760e7e664a Add File::Delete and File::DeleteDir tests 2020-12-10 09:48:30 -08:00
Ryan Meredith
bd02caba4b Android: Expand WiimoteProfileSetting to more setting types 2020-12-10 11:55:24 -05:00
JosJuice
c9e83867a1
Merge pull request #9089 from JosJuice/android-orientation-setting
Android: Move orientation setting to main settings screen
2020-12-10 16:17:44 +01:00
Léo Lam
19324e6ed9
Merge pull request #9313 from leoetlino/check-content-hashes
WiiUtils: Check hashes to determine if a title is installed and up-to-date
2020-12-08 15:45:12 +01:00
Markus Wick
3328eb4523
Merge pull request #9293 from JosJuice/jitarm64-stack-pointer
JitArm64: Properly set m_stack_pointer
2020-12-08 07:56:30 +01:00
JosJuice
9f3ad58588 JitArm64: Properly set m_stack_pointer
In order to reach the middle guard (at m_stack_base + GUARD_OFFSET)
before the bottom guard (at m_stack_base), the stack pointer
must start at an address which is higher than the middle guard.
It also didn't make sense that we were allocating memory
and then not using the top part of it.
2020-12-08 01:05:23 +01:00
Markus Wick
1827a0738b
Merge pull request #9299 from JosJuice/jitarm64-downcount
JitArm64: Do downcount immediately before jumping to dispatcher
2020-12-08 00:14:32 +01:00
JosJuice
0cebbb590e JitArm64: Call dispatcher_no_check after CompileExceptionCheck
The flags are not set correctly for a call to the version
of the dispatcher which does have a check. Jit64 uses
dispatcher_no_check here.
2020-12-07 15:08:09 +01:00
Léo Lam
f7d7bbf55f
WiiUtils: Check hashes to determine if a title is installed and up-to-date
Nintendo's official title installation code and ES both only look at
content IDs but we should probably check for content hashes in addition
to checking for IDs for at least two reasons:

1. Some of the installed contents could be corrupted -- this cannot be
   easily detected without checking hashes.

2. Some mod distributors do not bother to update content IDs, which
   means that installing updates from the UI would not actually
   update the installed game. This is confusing for users.

To keep the existing semantic (for IOS especially), the new content
hash checks are opt-in for callers of GetStoredContentsFromTMD.

This commit changes WiiUtils's WAD installation logic to enable
the content hash checks.
2020-12-06 01:53:55 +01: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
Léo Lam
2952f99f69
Merge pull request #9312 from iwubcode/dynamic-input-textures-fix
InputCommon: fix dynamic input textures when host key isn't mapped
2020-12-06 00:46:06 +01:00
iwubcode
39e78ce873 InputCommon: fix dynamic input textures being not generated when the key or device isn't mapped 2020-12-05 17:22:57 -06:00
Léo Lam
c8cb330df0
Merge pull request #9310 from leoetlino/compile-time-errors-format
Turn format string issues into compile-time errors
2020-12-05 23:58:04 +01:00
Léo Lam
d8b9a040ed
Merge pull request #9275 from JosJuice/framedump-boot-time
FrameDump: Start timing at 0 ticks when starting from boot
2020-12-05 23:57:41 +01:00
Léo Lam
585899dba3
Turn format string issues into compile-time errors
If the compiler can detect an issue with a format string at compile
time, then we should take advantage of that and turn the issue into a
hard compile-time error as such problems almost always lead to UB.

This helps with catching logging or assertion messages that have been
converted over to fmt but are still using the old, non-fmt variants
of the logging macros.

This commit also fixes all incorrect usages that I could find.
2020-12-04 18:06:02 +01: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
LC
a34823df61
Merge pull request #9306 from JosJuice/recursive-extract
DiscIO: Fix recursive directory extraction
2020-12-03 15:31:00 -05:00
JosJuice
b43f7c85cc DiscIO: Fix recursive directory extraction
https://bugs.dolphin-emu.org/issues/12331
2020-12-03 21:13:53 +01:00
Léo Lam
b148b56fba
Merge pull request #9304 from lioncash/panic
General: Convert PanicAlerts over to fmt equivalent
2020-12-02 20:45:27 +01: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
Ryan Meredith
aaafb9ba04 Android: Add "Generate a New Statistics Identity" 2020-11-30 13:20:58 -05:00
LC
ea2ec64ab4
Merge pull request #9298 from Ebola16/AClearLog
Android: Clear Log file
2020-11-30 09:34:57 -05:00
LC
558ba19314
Merge pull request #9301 from Ebola16/ADebug
Android: Add "Disable Fastmem" debug setting
2020-11-30 09:33:59 -05:00
Léo Lam
a5880fa402
Qt: Add missing tr calls for tooltip descriptions 2020-11-30 14:04:08 +01:00
Ryan Meredith
777da89830 Android: Add "Disable Fastmem" debug setting 2020-11-29 17:41:10 -05:00
JosJuice
2863b3ff5b JitArm64: Do downcount immediately before jumping to dispatcher
Fixes https://bugs.dolphin-emu.org/issues/12327.

When we started using fmt in CheckExternalExceptions, JitArm64
mysteriously stopped working even though the code path where
fmt was used never was reached. This is because the compiler
added a function prologue and epilogue to set up the stack,
since the code path that used fmt required the use of the stack.

However, the breakage didn't actually have anything to do
with the usage of the stack in itself, but rather with the
compiler's insertion of a stack canary. In the function
epilogue, a cmp instruction was inserted to check that the
stack canary had not been overwritten during the execution
of the function. This cmp instruction overwriting the status
flags ended up having a disastrous side effect once execution
returned to code emitted by JitArm64::WriteExceptionExit.

JitArm64's dispatcher contains a branch to the "do_timing"
code which is intended to be taken if the PPC downcount is
negative. However, the dispatcher doesn't update the status
flags on its own before this conditional branch, but rather
expects the calling code to have set them as a side effect
of DoDownCount. The root cause of our bug was that
JitArm64::WriteExceptionExit was calling DoDownCount before
Check(External)Exceptions instead of after.
2020-11-29 14:01:14 +01:00
Léo Lam
d043c5f81d
Merge pull request #9153 from iwubcode/qt_custom_tooltip
Remove description box in graphics tabs and use custom tooltips instead
2020-11-29 12:37:31 +01:00
Ryan Meredith
f18cd9e288 Android: Clear Log file 2020-11-29 02:37:22 -05:00
Léo Lam
361bf25cf8
Merge pull request #9254 from flagrama/fallback-region-selection
Fallback Region Option
2020-11-29 00:19:15 +01:00
Léo Lam
738e1a6dbb
Merge pull request #9297 from JosJuice/movie-game-id-comparison
Movie: Fix 83b9fef regressions
2020-11-29 00:09:30 +01:00
JosJuice
5642772ec4 Movie: Fix 83b9fef regressions
1. Comparing string_views does not behave the same as strncmp
   in the case where SConfig's game ID is longer than 6 chars.
2. DTMHeader::GetGameID wasn't excluding null bytes for game IDs
   shorter than 6 chars.
3. == was accidentally used instead of !=.
2020-11-28 23:35:55 +01:00
Léo Lam
cf32c4d479
Merge pull request #9296 from JosJuice/issue-12327-workaround
JitArm64: Add a workaround for issue 12327
2020-11-28 22:44:37 +01:00
JosJuice
d2a34fdab7 JitArm64: Add a workaround for issue 12327
This issue is both severe and surprisingly difficult to find
the root cause of, so I think it would make sense to add a simple
hotfix for now. https://bugs.dolphin-emu.org/issues/12327
2020-11-28 22:35:49 +01:00
Vincent Cunningham
db5aec019c
Add Fallback Region to configuration menu
Fallback Region
A user-selected fallback to use instead of the default PAL

This is used for unknown region or region free titles to give them
the ability to force region to use. This replaces the current fallback region
of PAL. This can be useful if a user is trying to play a region free
tilte that is originally NTSC and expects to be run at NTSC speeds. This
may be done when a user attempts to dump a WAD of their own without
understanding the settings they have chosen, or could be an intentional
decision by a developer of a ROM hack that can be injected into a
Virtual Console WAD.

Remove using System Menu region being checked in GetFallbackRegion

Use DiscIO::Region instead of std::String for fallback

Add explanation text for Fallback Region
2020-11-28 15:40:21 -05:00
Léo Lam
c0f7f91507
Core: Fix an assertion that mistakenly uses a fmt format string
Unfortunately, adding a DEBUG_ASSERT_MSG_FMT isn't actually possible
right now because of compiler bugs:
https://github.com/dolphin-emu/dolphin/pull/9284

We could require a newer version of GCC (10) but that would require
updating GCC on the build machines.

For what it's worth, older versions of GCC (8, 9) are broken in
many ways: adding constexpr to some Matrix functions causes GCC 8
to generate bugged code that causes the Wii IR pointer to disappear,
which means that the generated builds are already unusable
(see https://dolp.in/i12324).

Additionally,  we've already had to add workarounds for those versions
in the format macros to fix compilation bugs. This time, it looks like
workarounds won't cut it; even applying the workaround
described in https://github.com/fmtlib/fmt/pull/1580 does not help.
2020-11-28 21:11:27 +01:00
iwubcode
cc837a59d6 Core / DolphinQt: Add ini only option to force low-contrast tooltips 2020-11-28 11:49:14 -06:00
iwubcode
9c204428fe DolphinQt: Add tooltip support to Software Renderer Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode
2bfb8ebf96 DolphinQt: Add tooltip support to Hacks Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode
1673442794 DolphinQt: Add tooltip support to Advanced Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode
d083dae7fd DolphinQt: Add tooltip support to Enhancements Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode
b9eae86704 DolphinQt: Add tooltip support to General Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode
a9271aa167 DolphinQt: Add the ability to show a tooltip for custom graphics controls 2020-11-28 11:49:14 -06:00
iwubcode
af0161cafd DolphinQt: Add generic tooltip controls 2020-11-28 11:49:14 -06:00
iwubcode
613d8b1cba DolphinQt: Remove description box handling from graphics widget and window 2020-11-28 11:49:14 -06:00
iwubcode
c754b02aae DolphinQt: Add BalloonTip which is built off of an internal Qt class. It gives the ability to show a tooltip with an arrow! 2020-11-28 11:49:14 -06:00
Léo Lam
a9845e0a3d
Merge pull request #9191 from sepalani/net-interface
IP/Top: Add Android network interface
2020-11-28 18:22:33 +01:00
Léo Lam
a34f19cb96
Merge pull request #9291 from lioncash/alert-audio
AudioCommon: Convert alerts over to fmt-based variants
2020-11-28 16:33:50 +01:00
JosJuice
d69f243c32 FrameDump: Start timing at 0 ticks when starting from boot 2020-11-27 17:54:08 +01:00
Sepalani
20ebed51bb IP/Top: Add Android network interface 2020-11-27 19:10:28 +04:00
Lioncash
56d233c47c AudioCommon: Convert alerts over to fmt-based variants
Continues the migration over to fmt

Converts two panic alerts into error logs, since they aren't really
things a user can do anything about.
2020-11-27 10:10:11 -05:00
Markus Wick
26302c2257
Merge pull request #9280 from blaahaj/OpenGL-ES-3.1-ARB_shader_storage_buffer_object
Fix bounding box incorrectly disabled on OpenGL ES 3.1, 3.2
2020-11-27 15:56:50 +01:00
Léo Lam
9b03cdf93e
Merge pull request #9101 from sepalani/fix-ip-fallback
IP/Top: Fix fallback IP address
2020-11-27 02:39:15 +01: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
324de7fa02 VideoCommon: Use Common::SavePNG() to write textures. 2020-11-26 23:55:05 +01:00
Admiral H. Curtiss
33c1a5b941 InputCommon: Use Common::SavePNG() to write images. 2020-11-26 23:55:05 +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
Lioncash
978e5469af Core: Remove commented out logs
Commented out logs shouldn't be kept around, since it makes performing
renames and migrations harder, as tooling generally doesn't inspect
comments.
2020-11-26 07:49:37 -05:00
Lioncash
ffbf3d71f0 Frontends: Migrate logs over to fmt 2020-11-25 21:19:08 -05: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
Léo Lam
e00572dd07
Merge pull request #9282 from lioncash/core-log5
Core: Convert logging over to fmt pt.5
2020-11-26 02:06:41 +01:00
Léo Lam
d573ce34d7
Merge pull request #9281 from AdmiralCurtiss/iofile-write-string
IOFile: Replace fprintf with WriteString/fmt.
2020-11-26 01:39:56 +01:00
Léo Lam
3891ac2682
Merge pull request #9232 from AdmiralCurtiss/show-result-value-in-expression-editor
Qt/IOWindow: Show result value in expression editor.
2020-11-26 01:30:12 +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
Admiral H. Curtiss
11e226a91a Qt/IOWindow: Remove Apply button. 2020-11-26 00:47:37 +01:00
Admiral H. Curtiss
334100509b Qt/IOWindow: Show the current value of the expression. 2020-11-26 00:46:51 +01:00
Admiral H. Curtiss
ddfb8fa404 Qt/IOWindow: Apply expressions immediately so we can query the current value of the expression. 2020-11-26 00:45:31 +01:00
Admiral H. Curtiss
45d4746a5d IOFile: Replace all fprintf string writing with calls to WriteString. 2020-11-25 22:11:21 +01:00
Lioncash
ef75e9acd8 Core: Convert logging over to fmt pt.5
Converts the remaining PowerPC code over to fmt-capable logging.

Now, all that's left to convert over are the lingering remnants within
the frontend code.
2020-11-25 13:23:48 -05: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
e2a019ae9a
Merge pull request #9276 from lioncash/core-log4
Core: Convert logging over to fmt pt.4
2020-11-25 13:21:23 +01:00
Léo Lam
140daf5960
Merge pull request #9268 from leoetlino/devicememcard-minor-cleanup
EXI_DeviceMemoryCard: Medium cleanup
2020-11-25 10:07:44 +01:00
Léo Lam
12a215c232
Merge pull request #9277 from JosJuice/gles-vertex-uber
Fix vertex ubershader GLES compile errors
2020-11-25 10:04:45 +01:00
Léo Lam
4a21be5d77
Merge pull request #9278 from lioncash/latent
Core: Convert missed log calls over to fmt
2020-11-25 09:58:40 +01:00
blåhaj
bf0fe0281a Fix bounding box incorrectly disabled on OpenGL ES 3.1, 3.2 2020-11-24 21:22:39 +01:00
JosJuice
d01f85cfd8 Add Rock Band 3 MIDI PRO Adapter to known Wii peripherals
Based on info from https://forums.dolphin-emu.org/Thread-emulate-midi-pro-adapter
2020-11-24 14:25:19 +01:00
Lioncash
eedfe2abf1 Core: Convert missed log calls over to fmt 2020-11-23 12:20:02 -05:00
Lioncash
6cd718163f Core: Convert logging over to fmt pt.4
Continues the migration of logging in the Core library. This part
finishes up the remaining log calls within the IOS code.
2020-11-23 11:53:21 -05:00
JosJuice
28c696fa74 Fix vertex ubershader GLES compile errors
Regression from 51724c1.
2020-11-23 11:42:41 +01:00
Léo Lam
17b11cf4a4
Merge pull request #9095 from JosJuice/android-reset-setting
Android: Long press a setting to reset it
2020-11-23 02:50:40 +01:00
Léo Lam
b555f0fb93
Merge pull request #9265 from lioncash/core-log3
Core: Convert logging over to fmt pt.3
2020-11-23 02:46:58 +01:00
JosJuice
b53127a1fa
Merge pull request #9274 from JosJuice/av-register-all
FrameDump: Re-add call to av_register_all
2020-11-22 12:45:59 +01:00
Sepalani
79f50cd4fd IP/Top: Fix fallback IP address 2020-11-22 15:34:27 +04:00
Léo Lam
5d9eb8f6ce
Merge pull request #9271 from leoetlino/warnings
Fix several warnings and only enable extra warnings for our own code
2020-11-22 02:04:53 +01:00
JosJuice
118d056410 FrameDump: Re-add call to av_register_all
This was removed in 4902146329.
We still need this for the ffmpeg version we're using on Windows.
2020-11-22 00:11:23 +01:00
Lioncash
cbbf044064 Core: Convert logging over to fmt pt.3
Continues the migration over to fmt up to IOS' ES module.
2020-11-21 05:56:37 -05:00
LC
41b79a66c7
Merge pull request #9270 from leoetlino/dtm-gameid-null
Core/Movie: Fix a likely out-of-bounds read for PanicAlertT
2020-11-21 01:53:15 -05:00
Léo Lam
9efc81ae98
Fix variable shadowing warnings 2020-11-21 02:08:09 +01:00
Léo Lam
7840f61524
Silence "missing switch cases" warnings 2020-11-21 02:08:09 +01:00
Léo Lam
6ab1ab1f12
Fix -Wmaybe-uninitialized warnings 2020-11-21 02:08:09 +01:00
Léo Lam
82f1e6204d
Fix -Wsign-compare warnings 2020-11-21 02:08:09 +01:00
Léo Lam
4b7f784d1b
Disable -Wstringop-truncation warnings
Disable -Wstringop-truncation warnings as they result in many false
positives.

In most (all?) cases where std::strncpy is used, we want to fill the
entire buffer or match emulated code that also ignores the null
terminator, so the warnings are not useful.

Given that Dolphin itself mostly uses std::string, they do not
really help catch any bugs.
2020-11-21 02:08:08 +01:00
Léo Lam
83b9feff90
Core/Movie: Fix a likely out-of-bounds read for PanicAlertT
gameID isn't null terminated since it is just an std::array<char, 6>
and .data() returns a char* so {fmt} would go way beyond the bounds of
the array when it attempts to determine the length of the string.

The fix is to pass a std::string_view to {fmt}. This commit adds
a GetGameID() function that can also be used to simplify
string comparisons.
2020-11-21 01:30:02 +01:00
Léo Lam
ade9f92a63
Enable extra warnings in Source CMakeLists, not in root CMakeLists
Having extra warnings enabled for everything including external
libraries produces an overwhelming amount of warnings in code that
isn't even part of our codebase.

Move the various warning flags to Source/CMakeLists.txt to get rid
of those useless warnings.

Note that the Source CMakeLists.txt is already where the MSVC warnings
are defined, so this commit improves consistency as well.
2020-11-21 00:59:17 +01:00
Stenzek
d6ce8eef36 Software: Use same logic for colors as hardware backends 2020-11-20 15:54:06 -08:00
Stenzek
51724c1ccd LightingShaderGen: Always calculate lighting for both color channels
Cel-damage depends on lighting being calculated for the first channel
even though there is no color in the vertex format (defaults to the
material color). If lighting for the channel is not enabled, the vertex
will use the default color as before.

The default value of the color is determined by the number of elements in
the vertex format. This fixes the grey cubes in Super Mario Sunshine.

If the color channel count is zero, we set the color to black before the
end of the vertex shader. It's possible that this would be undefined
behavior on hardware if a vertex color index that was greater than the
channel count was used within TEV.
2020-11-20 15:54:04 -08:00
Léo Lam
fa73b1a23f
Merge pull request #9269 from JosJuice/fmt-positional-checks
Common: Assert that translatable strings use positional arguments
2020-11-21 00:29:43 +01:00
JosJuice
115dedec63 Android: Fix default values for GC/Wii controller 1 2020-11-20 22:17:00 +01:00
JosJuice
0dcb6794d3 Android: Remove "Reset Paths to Default Settings"
There is now a more general way of resetting settings,
so we don't need this.
2020-11-20 22:17:00 +01:00
JosJuice
064cde9774 Android: Long press a setting to reset it
This is particularly important for game INIs, where a setting being
unset is not the same as it being set to the default value.
2020-11-20 22:17:00 +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
JosJuice
e63b00e562 Fix translatable strings which contain non-positional arguments 2020-11-20 20:24:30 +01:00
Léo Lam
f82145d9dd
EXI_DeviceMemoryCard: Use std::array 2020-11-20 19:41:23 +01:00
Léo Lam
f81062f561
EXI_DeviceMemoryCard: Use enum class for Command 2020-11-20 19:38:07 +01:00
Léo Lam
b2f00be637
EXI_DeviceMemoryCard: Fix member variable names 2020-11-20 19:37:39 +01:00
Léo Lam
1f15119f80
EXI_DeviceMemoryCard: Use override rather than virtual 2020-11-20 19:36:34 +01:00
Léo Lam
279197b278
EXI_DeviceMemoryCard: Use more efficient overload of find_last_of 2020-11-20 19:36:34 +01:00
Léo Lam
4ad88ce2e4
EXI_DeviceMemoryCard: Clean up casts and implicit conversions 2020-11-20 19:36:33 +01:00
Léo Lam
e144d20dd6
EXI_DeviceMemoryCard: Remove unused include 2020-11-20 18:51:16 +01:00
Léo Lam
2631243379
EXI_DeviceMemoryCard: Rename variables to follow our naming conventions 2020-11-20 18:51:16 +01:00
JosJuice
730f9cb7bd Android: Fix IllegalStateException on startup
See https://github.com/dolphin-emu/dolphin/pull/9095#pullrequestreview-535576465
2020-11-20 18:33:00 +01:00
Léo Lam
542c49bab0
Core: Fix invalid lambda captures
PR #9260 made the MsgAlert macros use lambdas so that local
constexpr variables can be added while keeping the ability to
return a boolean from the macros.

Unfortunately, C++17 forbids referring to structured bindings in lambda
captures. This is fixed in P1091R3 but we cannot rely on C++20 yet...
2020-11-20 18:27:56 +01:00
Léo Lam
f45a4a5916
Merge pull request #9263 from lioncash/core-log2
Core: Convert logging over to fmt pt.2
2020-11-20 16:36:47 +01:00
Léo Lam
88cc1b7c8a
DSP: Fix one DEBUG_LOG call 2020-11-20 16:21:05 +01:00
Lioncash
a0f9b041a0 Core: Convert logging over to fmt pt.2
Continues the core migration of logs up to the EXI handling code.
2020-11-20 10:05:44 -05: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
Jonathan Marek
a20e69ff51
Vulkan: fix validation error in bSupportsGeometryShaders=false case
In CreateDescriptorSetLayouts(), one less dynamic binding is created when
bSupportsGeometryShaders=false. Reduce the dynamicOffsetCount argument by
one in that case. Avoids this validation error:

Attempting to bind 3 descriptorSets with 2 dynamic descriptors, but
dynamicOffsetCount is 3. It should exactly match the number of dynamic
descriptors. The Vulkan spec states: dynamicOffsetCount must be equal to
the total number of dynamic descriptors in pDescriptorSets

Signed-off-by: Jonathan Marek <jonathan@marek.ca>

[Applied clang-format]
Signed-off-by: Léo Lam <leo@leolam.fr>
2020-11-20 12:23:34 +01:00
Léo Lam
c580a70a12
Merge pull request #9210 from Dentomologist/regions-show-hide-all
DolphinQt: Add Show/Hide All options to gamelist region menu
2020-11-20 11:35:22 +01:00
Dentomologist
7ded075561 DolphinQt: Add Show/Hide All options to gamelist region menu 2020-11-19 20:39:49 -08:00
Léo Lam
858d7612ef
Merge pull request #9170 from JosJuice/android-extension-hack-2
Android: Remove hacks for Wii Remote extension setting, round 2
2020-11-20 02:47:23 +01:00
Léo Lam
30bffca5c3
Merge pull request #9193 from JosJuice/android-clear-motioncontrolsenabled
Android: Re-add motionControlsEnabled to clearWiimoteNewIniLinkedPreferences
2020-11-20 02:37:51 +01:00
Léo Lam
7f7fd4d8d3
Merge pull request #9220 from jordan-woyak/ext-crypto
WiimoteEmu: Implement extension encryption edge case.
2020-11-20 02:28:17 +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
5921a93d71
Merge pull request #9247 from Dentomologist/fix-updater-temporary-folder
Fix updater not always cleaning up temp directory
2020-11-20 02:01:43 +01:00
Léo Lam
eff566b318
Merge pull request #9258 from lioncash/core-log
Core: Convert logging over to fmt pt. 1
2020-11-19 20:32:19 +01:00
Lioncash
958cbf38a4 Core: Convert logging over to fmt pt. 1
Converts up to the DSP-related files for easier reviewing, the rest will
be progressively moved over after this change gets merged.
2020-11-19 14:21:06 -05:00
Léo Lam
e3247b567d
Merge pull request #9185 from Losuc/skipEFBaccessHotkey
Add a Skip EFB Access Hotkey
2020-11-19 17:28:45 +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
Admiral H. Curtiss
83c235b7cb WiiUtils: Create Wii Shop log files when installing a WAD.
Fixes https://bugs.dolphin-emu.org/issues/12269
2020-11-19 03:26:27 +01:00