Commit Graph

34496 Commits

Author SHA1 Message Date
Léo Lam e6d8af3188
Merge pull request #9553 from sepalani/ghidra-tools
Tools: Dolphin symbol map ghidra scripts added
2021-03-16 09:47:03 +01:00
Léo Lam 064a00634e
Merge pull request #9590 from JosJuice/android-recreate-main
Android: Fix recreating main activity
2021-03-16 09:42:31 +01:00
Léo Lam 13f79321f7
Merge pull request #9574 from Pokechu22/enumformatter-warnings
EnumFormatter: fix signed/unsigned comparison warnings
2021-03-16 09:39:42 +01:00
Léo Lam 3b0b221fcf
Merge pull request #9567 from Dentomologist/fix_various_warnings
Fix various build warnings
2021-03-16 09:33:01 +01:00
JosJuice fcb19a228b Android: Fix recreating main activity
4752ec8 broke this because I wasn't aware that a fragment
has to have a constructor with no parameters in order for
activity recreation to work.
2021-03-15 21:44:09 +01:00
JosJuice c0f840525f JitArm64: Improve srawx special case carry calculation
At a first glance it may look like a part of the code I added to
srawx in efeda3b has a bug when a == s. The code actually happens
to work correctly, but in the interest of making the code easier
to reason about, I'd like to change the way it's implemented. This
change should improve the pipelining a little in the a == s case too.
2021-03-14 18:55:42 +01:00
Dentomologist f0f206714f Arm64Gen: Convert ARM64Reg to enum class
Most changes are just adding ARM64Reg:: in front of the constants.
2021-03-13 10:10:59 -08:00
Dentomologist 48273b401e Gamelist: Fix 'Open Containing Folder'
Fix Gamelist context menu item 'Open Containing Folder' opening wrong
target on Windows when game parent folder is [foobar] and grandparent
folder contains file [foobar].bat or [foobar].exe

Add trailing directory separator to parent folder path to force Windows
to interpret path as directory.

Fixes https://bugs.dolphin-emu.org/issues/12411
2021-03-11 12:45:16 -08:00
JosJuice 18d95dfcca
Merge pull request #8316 from CookiePLMonster/wasapi-code-improvements
WASAPI code improvements
2021-03-11 21:18:16 +01:00
Phillip Stephens 1dc015cc65 [Updater] Check whether we've already had an update triggered 2021-03-11 02:48:46 -08:00
JosJuice e47c9764de DVDThread: Set ReadError instead of BlockOOB for failed reads
With DVDInterface catching out-of-bounds reads, we can let
DVDThread use a more accurate error code for situations like
a disk failure.
2021-03-10 00:16:40 +01:00
JosJuice e2b3aadad7 DVDInterface: Make the WBFS/CISO hack only affect WBFS/CISO
21c152f added a small hack to DVDInterface to keep WBFS and CISO
files working with Nintendo's "Error #001" anti-piracy check.
Unfortunately I don't think it's possible to support WBFS and
CISO without any kind of hack or heuristic, but what we can do
is replace the 21c152f hack (which applies regardless of file
format) with a hack that only is active when using WBFS or CISO.

This change is similar to 2a5a399, but the disc size is
calculated in a different way.
2021-03-10 00:16:40 +01:00
JosJuice 7d570f1edb DiscIO: Move magic constants for discs to DiscUtils 2021-03-10 00:16:37 +01:00
JosJuice b14bf82732 DiscIO: Move some code from VolumeVerifier to DiscUtils 2021-03-10 00:16:12 +01:00
JosJuice 49ccc77ebb DiscIO: Move some code from DiscExtractor to new file DiscUtils 2021-03-09 20:34:24 +01:00
InusualZ c37d826715 Display a progress bar to notify the user, about the work is being done 2021-03-08 16:22:26 +00:00
InusualZ 490db42e44 Fix detecting rso modules 2021-03-08 16:22:26 +00:00
Pokechu22 fa124e657f EnumFormatter: fix signed/unsigned comparison warnings 2021-03-07 13:54:13 -08:00
JosJuice 72a6fff36c Translation resources sync with Transifex 2021-03-07 19:24:53 +01:00
Dentomologist 486a25dd2b Touchscreen: Add override specifiers
Fix -Winconsistent-missing-override warnings on Android
2021-03-07 10:10:02 -08:00
Dentomologist 1fd332d3b7 ControllerInterface: Fix unused-result warning
Add ! before unused variables to 'use' them.

Ubuntu-x64 emits warnings for unused variables because gcc decides
it should ignore the void cast around them. See thread for discussion:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
2021-03-07 10:10:02 -08:00
Dentomologist 7ff8e3367f GraphicsWidget: Remove unused field
Fixes warning on freebsd-x64
2021-03-07 10:10:02 -08:00
Dentomologist fa61fc4f9c Fix shadowing warnings
Fixes type/variable shadowing warnings on debian and ubuntu
2021-03-07 10:10:02 -08:00
Dentomologist 636bf38824 IOS: Add maybe_unused attribute to variables
Fixes Wunused-const-variable warning on freebsd-x64 and android
2021-03-07 10:10:00 -08:00
Dentomologist 95c86ee48b FreeLookCamera: Add override specifiers 2021-03-07 10:10:00 -08:00
Dentomologist 1c71d33ed5 FreeLookCamera: Remove unused variable 2021-03-07 10:10:00 -08:00
Dentomologist 692aaed60c FreeLookController: Fix signed/unsigned warning
Loop index int i was being compared against GetControllerCount() which
returned a size_t.  This was the only place GetControllerCount() was
called from so the change of return type doesn't disturb anything else.

Changing the loop index to size_t wouldn't work as well since it's
passed into GetController(), which takes an int and is called from many
places, so it would need a cast anyway on an already busy line.
2021-03-07 10:09:59 -08:00
Dentomologist 686314b548 Arm64Gen: Move constant and make constexpr
Namespace-scope variable was only used in one function so move it there
2021-03-07 10:09:59 -08:00
Dentomologist dffcbcc6c4 Arm64Gen: Remove unused constant 2021-03-07 10:09:59 -08:00
Sintendo defe7162f5 Jit64: divwx - Simplify divisor == -1 case
Suggested by @MerryMage. Thanks!

Co-authored-by: merry <MerryMage@users.noreply.github.com>
2021-03-07 18:29:12 +01:00
Sintendo 83f38388a1 Jit64: divwx - Micro-optimize default case
Both the normal path and the overflow path end with the same
instruction, so their tails can be merged.

Before:
41 8B C7             mov         eax,r15d
45 85 C0             test        r8d,r8d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0E                jne         normal_path
41 83 F8 FF          cmp         r8d,0FFFFFFFFh
75 08                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
44 8B F0             mov         r14d,eax
EB 07                jmp         done
normal_path:
99                   cdq
41 F7 F8             idiv        eax,r8d
44 8B F0             mov         r14d,eax
done:

After:
41 8B C7             mov         eax,r15d
45 85 C0             test        r8d,r8d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0B                jne         normal_path
41 83 F8 FF          cmp         r8d,0FFFFFFFFh
75 05                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
EB 04                jmp         done
normal_path:
99                   cdq
41 F7 F8             idiv        eax,r8d
done:
44 8B F0             mov         r14d,eax
2021-03-07 18:29:12 +01:00
Sintendo 1865035798 Jit64: divwx - Optimize division by 2
...and let's optimize a divisor of 2 ever so slightly for good measure.
I wouldn't have bothered, but most GameCube games seem to hit this on
launch.

- Division by 2
Before:
41 BE 02 00 00 00    mov         r14d,2
41 8B C2             mov         eax,r10d
45 85 F6             test        r14d,r14d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0E                jne         normal_path
41 83 FE FF          cmp         r14d,0FFFFFFFFh
75 08                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
44 8B F0             mov         r14d,eax
EB 07                jmp         done
normal_path:
99                   cdq
41 F7 FE             idiv        eax,r14d
44 8B F0             mov         r14d,eax
done:

After:
45 8B F2             mov         r14d,r10d
41 C1 EE 1F          shr         r14d,1Fh
45 03 F2             add         r14d,r10d
41 D1 FE             sar         r14d,1
2021-03-07 18:29:12 +01:00
Sintendo 0637a7ec59 Jit64: divwx - Optimize power-of-two divisors
Power-of-two divisors can be done more elegantly, so handle them
separately.

- Division by 4
Before:
41 BD 04 00 00 00    mov         r13d,4
41 8B C0             mov         eax,r8d
45 85 ED             test        r13d,r13d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0E                jne         normal_path
41 83 FD FF          cmp         r13d,0FFFFFFFFh
75 08                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
44 8B E8             mov         r13d,eax
EB 07                jmp         done
normal_path:
99                   cdq
41 F7 FD             idiv        eax,r13d
44 8B E8             mov         r13d,eax
done:

After:
45 85 C0             test        r8d,r8d
45 8D 68 03          lea         r13d,[r8+3]
45 0F 49 E8          cmovns      r13d,r8d
41 C1 FD 02          sar         r13d,2
2021-03-07 18:29:12 +01:00
Sintendo 530475dce8 Jit64: divwx - Micro-optimize certain divisors
When the multiplier is positive (which is the most common case), we can
generate slightly better code.

- Division by 30307
Before:
49 63 C5             movsxd      rax,r13d
48 69 C0 65 6B 32 45 imul        rax,rax,45326B65h
4C 8B C0             mov         r8,rax
48 C1 E8 3F          shr         rax,3Fh
49 C1 F8 2D          sar         r8,2Dh
44 03 C0             add         r8d,eax

After:
49 63 C5             movsxd      rax,r13d
4C 69 C0 65 6B 32 45 imul        r8,rax,45326B65h
C1 E8 1F             shr         eax,1Fh
49 C1 F8 2D          sar         r8,2Dh
44 03 C0             add         r8d,eax
2021-03-07 18:29:12 +01:00
Sintendo 95698c5ae1 Jit64: divwx - Optimize constant divisor
Optimize division by a constant into multiplication. This method is also
used by GCC and LLVM.

We also add optimized paths for divisors 0, 1, and -1, because they
don't work using this method. They don't occur very often, but are
necessary for correctness.

- Division by 1
Before:
41 BF 01 00 00 00    mov         r15d,1
41 8B C5             mov         eax,r13d
45 85 FF             test        r15d,r15d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0E                jne         normal_path
41 83 FF FF          cmp         r15d,0FFFFFFFFh
75 08                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
44 8B F8             mov         r15d,eax
EB 07                jmp         done
normal_path:
99                   cdq
41 F7 FF             idiv        eax,r15d
44 8B F8             mov         r15d,eax
done:

After:
45 8B FD             mov         r15d,r13d

- Division by 30307
Before:
41 BA 63 76 00 00    mov         r10d,7663h
41 8B C5             mov         eax,r13d
45 85 D2             test        r10d,r10d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0E                jne         normal_path
41 83 FA FF          cmp         r10d,0FFFFFFFFh
75 08                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
44 8B C0             mov         r8d,eax
EB 07                jmp         done
normal_path:
99                   cdq
41 F7 FA             idiv        eax,r10d
44 8B C0             mov         r8d,eax
done:

After:
49 63 C5             movsxd      rax,r13d
48 69 C0 65 6B 32 45 imul        rax,rax,45326B65h
4C 8B C0             mov         r8,rax
48 C1 E8 3F          shr         rax,3Fh
49 C1 F8 2D          sar         r8,2Dh
44 03 C0             add         r8d,eax

- Division by 30323
Before:
41 BA 73 76 00 00    mov         r10d,7673h
41 8B C5             mov         eax,r13d
45 85 D2             test        r10d,r10d
74 0D                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0E                jne         normal_path
41 83 FA FF          cmp         r10d,0FFFFFFFFh
75 08                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
44 8B C0             mov         r8d,eax
EB 07                jmp         00000000161737E7
normal_path:
99                   cdq
41 F7 FA             idiv        eax,r10d
44 8B C0             mov         r8d,eax
done:

After:
49 63 C5             movsxd      rax,r13d
4C 69 C0 19 25 52 8A imul        r8,rax,0FFFFFFFF8A522519h
49 C1 E8 20          shr         r8,20h
44 03 C0             add         r8d,eax
C1 E8 1F             shr         eax,1Fh
41 C1 F8 0E          sar         r8d,0Eh
44 03 C0             add         r8d,eax
2021-03-07 18:29:01 +01:00
Sintendo 5bb8798df6 JitCommon: Signed 32-bit division magic constants
Add a function to calculate the magic constants required to optimize
signed 32-bit division.

Since this optimization is not exclusive to any particular architecture,
JitCommon seemed like a good place to put this.
2021-03-07 18:27:36 +01:00
Sintendo c9adc60d73 Jit64: divwx - Special case dividend == 0
Zero divided by any number is still zero. For whatever reason, this case
shows up frequently too.

Before:
B8 00 00 00 00       mov         eax,0
85 F6                test        esi,esi
74 0C                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0C                jne         normal_path
83 FE FF             cmp         esi,0FFFFFFFFh
75 07                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
8B F8                mov         edi,eax
EB 05                jmp         done
normal_path:
99                   cdq
F7 FE                idiv        eax,esi
8B F8                mov         edi,eax
done:

After:
Nothing!
2021-03-07 18:27:30 +01:00
Sintendo c081e3f2b3 Jit64: divwx - Optimize constant dividend
When the dividend is known at compile time, we can eliminate some of the
branching and precompute the result for the overflow case.

Before:
B8 54 D3 E6 02       mov         eax,2E6D354h
85 FF                test        edi,edi
74 0C                je          overflow
3D 00 00 00 80       cmp         eax,80000000h
75 0C                jne         normal_path
83 FF FF             cmp         edi,0FFFFFFFFh
75 07                jne         normal_path
overflow:
C1 F8 1F             sar         eax,1Fh
8B F8                mov         edi,eax
EB 05                jmp         done
normal_path:
99                   cdq
F7 FF                idiv        eax,edi
8B F8                mov         edi,eax
done:

After:
85 FF                test        edi,edi
75 04                jne         normal_path
33 FF                xor         edi,edi
EB 0A                jmp         done
normal_path:
B8 54 D3 E6 02       mov         eax,2E6D354h
99                   cdq
F7 FF                idiv        eax,edi
8B F8                mov         edi,eax
done:

Fairly common with constant dividend of zero. Non-zero values occur
frequently in Ocarina of Time Master Quest.
2021-03-07 18:25:08 +01:00
JosJuice 1dfeb73589 Force RTC bias to 0 when custom RTC is disabled too
Whether the custom RTC setting is enabled shouldn't in itself
affect determinism (as long as the actual RTC value is properly
synced). Alters the logic added in 4b2906c.

I'm not entirely certain that this is correct, but the current
code doesn't really make sense to me... If we need to force the
RTC bias to 0 when custom RTC is enabled, why don't we need to
do it when custom RTC is disabled? The code for getting the
host system's current time doesn't contain any special handling
for the guest's RTC bias as far as I can tell.
2021-03-07 14:22:54 +01:00
JosJuice 46dbb455e1 Boot: Initialize Wii root before saving SYSCONF file
Fixes netplay and movie overrides of SYSCONF settings not applying.
2021-03-07 14:22:53 +01:00
JosJuice 359ed5348a Config: Give Movie and Netplay higher priority than CommandLine
Avoiding desyncs is more important than honoring what the user
specified on the command line.
2021-03-07 14:22:53 +01:00
JosJuice a9862b5395 NetPlay: Sync more settings 2021-03-07 14:22:53 +01:00
JosJuice 14bfc0be78 DiscIO: Fix reading certain WIA chunks with many exceptions
The loop in WIARVZFileReader::Chunk::Read could terminate
prematurely if the size argument was smaller than the size
of an exception list which had only been partially loaded.
2021-03-07 14:14:45 +01:00
JosJuice 96ebf01ea8 VolumeVerifier: Fix potential crash when cancelling
The async operations may contain references to class members, so
any running async operations must end before destroying the class.
2021-03-07 13:56:06 +01:00
Léo Lam 61198541a0
Merge pull request #9562 from sepalani/dis-icons
Breakpoints: Change icon when disabled
2021-03-07 12:14:12 +01:00
Léo Lam ac687bc364
Merge pull request #9568 from JosJuice/android-delay-save-tab
Android: Don't save settings immediately after switching platform tab
2021-03-07 12:03:46 +01:00
Léo Lam a5555c6300
Merge pull request #9569 from JosJuice/android-mainpresenter-skip-scan
Android: Move "skip scanning" logic to MainPresenter
2021-03-07 11:51:03 +01:00
Pokechu22 5b1c632862 Software: Invert backface test when viewport is positive
Fixes Jimmie Johnson's Anything with an Engine.
2021-03-06 22:00:16 -08:00
Pokechu22 058c7db80b Software: Fix out of bounds accesses in CopyRegion
Fixes issue 11393.

The problem is that left and top make no sense for a width by height array; they only make sense in a larger array where from which a smaller part is extracted.  Thus, the overall size of the array is provided to CopyRegion in addition to the sub-region.  EncodeXFB already handles the extraction, so CopyRegion's only use there is to resize the image (and thus no sub-region is provided).
2021-03-06 21:58:28 -08:00
JMC47 089250fde6
Merge pull request #9497 from Pokechu22/better-fifo-analyzer
Graphics refactoring + add names and descriptions in FIFO analyzer
2021-03-07 00:21:11 -05:00