Commit Graph

3518 Commits

Author SHA1 Message Date
Emmanuel Gil Peyrot 3d662e746b Core: Fix a -Wshadow warning in gcc 11
This moves the only direct call to zlib’s crc32() into its own
translation unit, but that operation is cold enough that this won’t
matter in the slightest.  crc32_z() would be more appropriate, but
Android has an older zlib version…
2021-11-02 13:50:21 +01:00
Pokechu22 04d8cdfe88 Convert LOG_TYPE and LOG_LEVELS to enum class 2021-10-24 11:48:36 -07:00
Pokechu22 ba107819ec Create EnumMap 2021-10-24 11:48:36 -07:00
Admiral H. Curtiss a4da56e5e6
CommonPaths: Add a Riivolution subfolder in Load. 2021-10-24 00:09:06 +02:00
Admiral H. Curtiss f972ddf32f
Common/FileUtil: Fix incorrect (32-bit) stat struct being used on Windows, which was hidden by a define in CommonFuncs.h. 2021-10-23 03:50:47 +02:00
Léo Lam fd7df2ccae
Use fmt::localtime instead of thread-unsafe std::localtime
fmt::localtime is also less awkward to use compared to std::localtime.
2021-10-15 22:49:13 +02:00
Léo Lam 7855e5f73b
Turn MAX_LOGLEVEL into a true constant (and fix self-comparison warning)
This replaces the MAX_LOGLEVEL define with a constexpr variable
in order to fix self-comparison warnings in the logging macros
when compiling with Clang. (Without this change, the log level check
in the logging macros is expanded into something like this:
`if (LINFO <= LINFO)`, which triggers a tautological compare warning.)
2021-10-15 21:51:01 +02:00
JosJuice 44beaeaff5 Arm64Emitter: Check end of allocated space when emitting code
JitArm64 port of 5b52b3e.
2021-10-13 21:52:16 +02:00
Pokechu22 78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Pokechu22 aacc1a5e49 IOFile: Add std::array functions 2021-10-13 11:44:28 -07:00
Léo Lam f19da1cf92
Merge pull request #10118 from lioncash/messageid
NetPlayProto: Remove lots of casts to MessageId when inserting enum values into packets
2021-10-13 02:27:52 +02:00
JMC47 3bfb3fa52b
Merge pull request #9884 from JosJuice/jitarm64-paired-loadstore-addr
JitArm64: Improve psq_l/psq_st address checking
2021-10-11 16:49:26 -04:00
Pokechu22 ec9db320d3 Fix AbortOnPanicAlert with PanicAlertFmt
PR #10066 added functionality to call std::abort when a panic alert occurs; however, that PR only implemented it for MsgAlert and not MsgAlertFmtImpl, meaning that the functionality was not used with PanicAlertFmt (only PanicAlert, which is not used frequently).
2021-10-02 17:24:09 -07:00
Lioncash 07af775afa SFMLHelper: Add stream insertion overload helpers for enum types
Will be used in future changes to eliminate the need to cast when
inserting various message IDs
2021-09-22 15:42:01 -04:00
Léo Lam 6129290d31
Merge pull request #10057 from JosJuice/jitarm64-divwx
JitArm64: Optimize divwx
2021-09-20 15:37:57 +02:00
Léo Lam b43cee8fe4
Merge pull request #10098 from AdmiralCurtiss/scan-dir-tree-trailing-slash
Common/FileUtil: Strip trailing path separator in ScanDirectoryTree().
2021-09-20 14:50:11 +02:00
Pokechu22 b8f4a4ae44 GLInterface: Remove unneeded wglShareLists call
When RenderDoc is attached, wglShareLists fails for some reason (see baldurk/renderdoc#2361).  wglCreateContextAttribsARB has a parameter for the share context, so there's no reason to use a separate wglShareLists call.

Co-authored-by: baldurk <baldurk@baldurk.org>
2021-09-14 10:55:33 -07:00
Admiral H. Curtiss f76aaf65f6 Common/FileUtil: Strip trailing path separator in ScanDirectoryTree(). 2021-09-14 17:39:38 +02:00
JosJuice de21dc5fd9 JitArm64: Add bitset constants for caller saved registers 2021-09-08 21:26:05 +02:00
Léo Lam e091c2e817
Add an option to abort when a panic alert occurs
Prompted by https://dolphin.ci/#/builders/24/builds/985

A 1-character typo in a recent PR caused FifoCI builds to break
horribly and spew millions of panic alerts until buildbot crashed.

This PR adds a new config option -- defaulting to off -- that allows
Dolphin to abort early on when a panic alert occurs instead of
continuing forever.
2021-08-29 02:02:07 +02:00
JosJuice 9889e7eb33 JitArm64: divwx - Optimize power-of-two divisors
Power-of-two divisors can be done more elegantly, so handle them
separately.
2021-08-26 15:04:55 +02:00
JosJuice 09cdb076a3 JitArm64: 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.
2021-08-26 14:50:01 +02:00
OatmealDome e5a80995dc Bump minimum macOS to 10.13 High Sierra 2021-08-17 16:27:22 -04:00
JosJuice a90b0a1c93 JitArm64: Implement mtfsfx
The sixth and final part of implementing the FPSCR system register
instructions.
2021-07-31 23:50:20 +02:00
Dentomologist f5e5e8553c StringUtil: Remove unused function BuildCompleteFilename 2021-07-21 12:39:00 -07:00
JMC47 a1e806ed76
Merge pull request #9600 from Bonta0/mgba-pr
Full GBA Controllers Integration with mGBA
2021-07-21 02:36:43 -04:00
Dentomologist fe670a3e68 FileUtil: Remove duplication in FileInfo constructor 2021-07-19 11:50:17 -07:00
Shawn Hoffman 8bddd8c675 remove SetRoundMode
we only care about SSE rounding mode, and set
that manually in SetSIMDMode
2021-07-17 19:29:22 -07:00
Tilka 3c90b657f3
Merge pull request #9907 from shuffle2/roundmode-bitfield
make FPSCR.RN an enum
2021-07-18 03:12:28 +01:00
Shawn Hoffman 197075293d make FPSCR.RN an enum 2021-07-17 18:55:06 -07:00
Shawn Hoffman c89ae53677 msvc: remove warning disables which no longer fire 2021-07-17 18:24:36 -07:00
Shawn Hoffman f5b05ae080 remove an outdated comment
seems to have been solved 5 years ago by
b707e199c2
2021-07-17 17:46:57 -07:00
Bonta 45f2461a53 NetPlay: GBA Support 2021-07-13 16:43:59 +02:00
Bonta 110887435c Config: GBA settings 2021-07-13 16:41:18 +02:00
Bonta 44aaf108d1 Externals: Integrate mGBA as a submodule 2021-07-13 16:39:29 +02:00
Léo Lam 162af2a7bb
Merge pull request #9870 from OatmealDome/ui-thread
macOS: Move UI API calls to the main thread
2021-07-13 03:29:49 +02:00
JosJuice 8af5095ff4 JitArm64: Stop using hand-encoded logical immediates 2021-07-12 22:25:49 +02:00
JosJuice 9e80db123f JitArm64: Encode logical immediates at compile-time where possible
Manually encoding and decoding logical immediates is error-prone.
Using ORRI2R and friends lets us avoid doing the work manually,
but in exchange, there is a runtime performance penalty. It's
probably rather small, but still, it would be nice if we could
let the compiler do the work at compile-time. And that's exactly
what this commit does, so now I have no excuse for trying to
manually write logical immediates anymore.
2021-07-10 20:43:59 +02:00
JosJuice 10861ed8ce JitArm64: Turn IsImmLogical into a constexpr constructor 2021-07-10 20:31:28 +02:00
JosJuice ab024b218e JitArm64: Accept LogicalImm struct as bitwise inst parameter 2021-07-10 20:13:11 +02:00
JosJuice cbbd3d3956 Arm64Emitter: Fix 64-bit TBZ/TBNZ encoding
We haven't actually used 64-bit TBZ/TBNZ anywhere in Dolphin, so
this mistake hasn't broken anything, but let's fix it regardless.
2021-07-07 12:21:07 +02:00
OatmealDome 8c728945fb AGL: Silence OpenGL deprecation warnings 2021-07-06 14:31:01 -04:00
OatmealDome 4d944342fc AGL: Move more UI API calls to the main thread 2021-07-06 14:30:15 -04:00
Léo Lam 954f27c5d7
Merge pull request #9709 from AdmiralCurtiss/upnp-error-log
UPnP: Improve error messages on initialization failure.
2021-07-06 15:36:38 +02:00
Léo Lam b82b0683d5
MathUtil: Mark IntLog2 as constexpr
Mostly everything else was already marked as constexpr, and the only
function IntLog2 calls (CountLeadingZeros) is already constexpr.
2021-07-06 15:01:38 +02:00
Mai M ffdc8538a1
Merge pull request #9862 from delroth/spdx-tags
Use SPDX for Dolphin licensing info
2021-07-06 01:02:57 -04:00
Léo Lam 27c560fdfa
Merge pull request #8915 from OatmealDome/updater-temp-dir
macOS: Untranslocate the app bundle's path for the updater
2021-07-06 02:22:28 +02:00
Pierre Bourdon f4e34703c0
licensing: convert "public domain" to CC0 1.0
Public domain does not have an internationally agreed upon definition,
As such it's generally preferred to use an extremely liberal license,
which can explicitly list the rights granted by the copyright holder.
The CC0 license is the usual choice here.

This "relicensing" is done without hunting down copyright holders, since
it is presumed that their release of this work into the public domain
authorizes us to redistribute this code under any other license of our
choosing.
2021-07-05 04:43:55 +02:00
Pierre Bourdon 0cf041de24
licensing: various one-off conversions to SPDX tags 2021-07-05 04:35:56 +02:00
Pierre Bourdon 90379e243e
licensing: switch GLExtensions/ to use SPDX tags 2021-07-05 04:35:56 +02:00
Pierre Bourdon 51cdc5542c
licensing: fix license info for Crypto/{bn,ec}
This code was part of Dolphin's relicensing from v2 to v2+ a while back,
we just never updated these copyright headers. I double-checked that
segher gave us permission to relicense this code to v2+ on 2015-05-16.
2021-07-05 04:35:56 +02:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Tilka 901a4fb5f4
Merge pull request #9811 from JosJuice/fprf-denormal-singles
Fix FPRF handling of denormal singles
2021-06-29 03:18:18 +01:00
Tillmann Karras afb9398059 x64Emitter: remove unused x87 instructions 2021-06-28 02:56:37 +01:00
JosJuice d56721ebb9 Interpreter: Fix FPRF handling of denormal singles 2021-06-27 20:34:49 +02:00
JosJuice 2b88a46b1a Common: Set bFMA to true for AArch64
Without this, the code added in ac28b89 misbehaves and considers
AArch64 netplay clients to not have hardware FMA support, telling
all clients to disable FMA support, which causes a desync between
x64 and AArch64 due to JitArm64 not being able to disable FMA support.
2021-06-14 15:51:59 +02:00
Léo Lam 4e3e3bfd60
Merge pull request #9804 from JosJuice/revert-fma
NetPlay/Jit64: Avoid using software FMA
2021-06-13 12:38:09 +02:00
Léo Lam 8ef4bd682b
Merge pull request #9805 from JosJuice/rounding-mode-savestate
PowerPC: Set host CPU rounding mode on init and savestate
2021-06-13 11:49:29 +02:00
xvrc 0ad13db633 MsgHandler: Correct question and warning captions 2021-06-12 17:42:27 -04:00
JosJuice 9db0ebd4b6 PowerPC: Set host CPU rounding mode on init and savestate
Not doing this can cause desyncs when TASing. (I don't know
how common such desyncs would be, though. For games that
don't change rounding modes, they shouldn't be a problem.)
2021-06-10 20:12:15 +02:00
JosJuice ac28b89fa5 NetPlay/Jit64: Avoid using software FMA
When I added the software FMA path in 2c38d64 and made us use
it when determinism is enabled, I was assuming that either the
performance impact of software FMA wouldn't be too large or CPUs
that were too old to have FMA instructions were too slow to run
Dolphin well anyway. This was wrong. To give an example, the
netplay performance went from 60 FPS to 30 FPS in one case.

This change makes netplay clients negotiate whether FMA should
be used. If all clients use an x64 CPU that supports FMA, or
AArch64, then FMA is enabled, and otherwise FMA is disabled.
In other words, we sacrifice accuracy if needed to avoid massive
slowdown, but not otherwise. When not using netplay, whether to
enable FMA is simply based on whether the host CPU supports it.

The only remaining case where the software FMA path gets used
under normal circumstances is when an input recording is created
on a CPU with FMA support and then played back on a CPU without.
This is not an especially common scenario (though it can happen),
and TASers are generally less picky about performance and more
picky about accuracy than other users anyway.

With this change, FMA desyncs are avoided between AArch64 and
modern x64 CPUs (unlike before 2c38d64), but we do get FMA
desyncs between AArch64 and old x64 CPUs (like before 2c38d64).
This desync can be avoided by adding a non-FMA path to JitArm64 as
an option, which I will wait with for another pull request so that
we can get the performance regression fixed as quickly as possible.

https://bugs.dolphin-emu.org/issues/12542
2021-06-09 22:56:26 +02:00
Filoppi 038b57fecc ControllerInterface: DInput Joystick fix non thread safe static variable
also fix devices being added to its own custom list of devices even when rejected by the CI
2021-06-07 11:07:06 +03:00
Admiral H. Curtiss c3560f033e UPnP: Improve error messages on initialization failure. 2021-06-07 00:36:35 +02:00
JosJuice acc7d3710d
Merge pull request #9780 from Techjar/freelook-config-fix
Common/FileUtil: Add some missing configs to D_CONFIG_IDX
2021-06-05 13:40:37 +02:00
Techjar 7111d11161 Common/FileUtil: Add some missing configs to D_CONFIG_IDX 2021-06-05 07:34:36 -04:00
JMC47 638909aec6
Merge pull request #9751 from JosJuice/jitarm64-fcmpx-ftz
JitArm64: Make fcmpX with flush-to-zero enabled less bad
2021-06-05 05:27:52 -04:00
Shawn Hoffman 4ce22c093c msvc: remove workarounds for old compiler issues 2021-06-03 18:33:24 -07:00
JosJuice 21ebc176fe JitArm64: Set FPCR.AH
Only tested on a CPU which does not support FEAT_AFP.
2021-06-02 20:15:24 +02:00
Dentomologist 99ed43280d Updater: Escape HTML characters in commit descriptions 2021-06-01 17:22:19 -07:00
OatmealDome c87241479a FileUtil: Handle app translocation on macOS 2021-05-31 16:25:34 -04:00
Techjar 1377f31cf8 NetPlay: Check file names when receiving GCI folder 2021-05-29 17:52:49 -04:00
JosJuice e0c81ae54a JitArm64: Fix MSVC warnings 2021-05-28 15:34:08 +02:00
Skyler Saleh 76ed9310f2 Apple M1: RAII Wrapper for JITPageWrite*Execute*()
Added RAII wrapper around the the JITPageWriteEnableExecuteDisable() and
JITPageWriteDisableExecuteEnable() to make it so that it is harder to forget to
pair the calls in all code branches as suggested by leoetlino.
2021-05-22 15:25:18 -07:00
Skyler Saleh 38861f6782 Apple M1: x86_64 MAP_JIT
- Enabled MAP_JIT on x86_64 after confirming that pthread_jit* calls are only
required for MAP_JIT pages on Apple Silicon
2021-05-22 15:25:18 -07:00
Skyler Saleh 4ff429266a Apple M1: MacOS 11.2 mprotect restrictions
In MacOS 11.2 mprotect can no longer change the access protection settings of
pages that were previously marked as executable to anything but PROT_NONE. This
commit works around this new restriction by bypassing the mprotect based write
protection and instead relying on the write protection provided by MAP_JIT.
2021-05-22 15:25:18 -07:00
Skyler Saleh 61448a9b2f Apple M1: Refactor ArmCPUDetect.cpp
Merges two nested #ifndefs into a single #if around hw cap includes.
2021-05-22 15:25:17 -07:00
Skyler Saleh 4542038cd0 Apple M1: OS version checking for MAP_JIT
- Added MacOS version checking around MAP_JIT to prepare code for x86 MAP_JIT
2021-05-22 15:25:17 -07:00
Skyler Saleh 948764d37b Apple M1: Build, Analytics, and Memory Management
Analytics:
- Incorporated fix to allow the full set of analytics that was recommended by
  spotlightishere

BuildMacOSUniversalBinary:
- The x86_64 slice for a universal binary is now built for 10.12
- The universal binary build script now can be configured though command line
  options instead of modifying the script itself.
- os.system calls were replaced with equivalent subprocess calls
- Formatting was reworked to be more PEP 8 compliant
- The script was refactored to make it more modular
- The com.apple.security.cs.disable-library-validation entitlement was removed

Memory Management:
- Changed the JITPageWrite*Execute*() functions to incorporate support for
  nesting

Other:
- Fixed several small lint errors
- Fixed doc and formatting mistakes
- Several small refactors to make things clearer
2021-05-22 15:25:17 -07:00
Skyler Saleh 4ecb3084b7 Apple M1 Support for MacOS
This commit adds support for compiling Dolphin for ARM on MacOS so that it can
run natively on the M1 processors without running through Rosseta2 emulation
providing a 30-50% performance speedup and less hitches from Rosseta2.

It consists of several key changes:

- Adding support for W^X allocation(MAP_JIT) for the ARM JIT
- Adding the machine context and config info to identify the M1 processor
- Additions to the build system and docs to support building universal binaries
- Adding code signing entitlements to access the MAP_JIT functionality
- Updating the MoltenVK libvulkan.dylib to a newer version with M1 support
2021-05-22 15:25:17 -07:00
JosJuice 27cc0b539a Avoid including scmrev.h except in Version.cpp
Any file which includes scmrev.h must be rebuilt when scmrev.h
is regenerated. By not including scmrev.h from any file other
than Version.cpp, incremental builds become a little faster.
2021-05-21 17:03:01 +02:00
Mai M 1054abc9cc
Merge pull request #9712 from JosJuice/jitarm64-fmul-rounding
JitArm64: Fix fmul rounding issues
2021-05-20 10:25:02 -04:00
Mai M 6958df5967
Merge pull request #9695 from JosJuice/jitarm64-fres
JitArm64: Implement fres and frsqrte
2021-05-20 10:23:49 -04:00
JosJuice 11be2314fe JitArm64: Fix fmul rounding issues
This is a port of 4f18f60 to JitArm64.
2021-05-15 23:27:34 +02:00
JosJuice 85226e09f0 JitArm64: Implement fres 2021-05-15 19:16:32 +02:00
JosJuice 8a0f5ea04a Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
Mat M 964fed77c5
Merge pull request #9707 from JosJuice/remove-atomic-header
Remove Atomic.h
2021-05-14 14:33:24 -04:00
Scott Mansell 9f91fb6447
Merge pull request #9688 from Filoppi/input_cleanup
Input cleanup
2021-05-14 20:51:33 +12:00
JosJuice b93983b50a Remove Atomic.h
The STL has everything we need nowadays.

I have tried to not alter any behavior or semantics with this
change wherever possible. In particular, WriteLow and WriteHigh
in CommandProcessor retain the ability to accidentally undo
another thread's write to the upper half or lower half
respectively. If that should be fixed, it should be done in a
separate commit for clarity. One thing did change: The places
where we were using += on a volatile variable (not an atomic
operation) are now using fetch_add (actually an atomic operation).

Tested with single core and dual core on x86-64 and AArch64.
2021-05-13 18:56:27 +02:00
Mat M 7a72a5b997
Merge pull request #9703 from Filoppi/fix_expression_serialization
Fix serialization of control expressions with line breaks
2021-05-13 06:47:38 -04:00
Mat M 725ea3d9c1
Merge pull request #9637 from JosJuice/jitarm64-fprf
JitArm64: Implement FPRF updates
2021-05-13 06:39:28 -04:00
JosJuice 749db94dec Arm64Emitter: Implement more variants of FMOV 2021-05-13 10:13:59 +02:00
Filoppi 574477866f InputCommon: fix serialization of control expression with line breaks
The control expression editor allows line breaks, but the serialization was
losing anything after the first line break (/r /n).
Instead of opting to encode them and decode them on serialization
(which I tried but was not safe, as it would lose /n written in the string by users),
I opted to replace them with a space.
2021-05-12 18:25:56 +03:00
Léo Lam a6f6211dde
Merge pull request #9633 from Pokechu22/BitfieldExtract-pointer-to-member
Change BitfieldExtract to use a pointer to the bitfield member
2021-05-08 00:21:15 +02:00
Pokechu22 0f7c9ef767 Change BitfieldExtract to use a pointer to the bitfield member 2021-05-07 15:11:17 -07:00
Léo Lam 2b632f6d5d
Merge pull request #9641 from lynlevenick/ash/texture-cache-opt
Remove spurious memory allocations in TextureCacheBase::SerializeTexture and DeserializeTexture
2021-05-07 15:01:23 +02:00
Filoppi 81092cf7e4 InputCommon: replace SerialInterface log with ControllerInterface
where appropriate. SerialInterface was a leftover from the past,
and makes no sense to be used on actual/real controllers.
2021-05-05 00:16:08 +03:00
JosJuice 1d106ceaf5 JitArm64: Optimize ConvertSingleToDouble, part 2
If we can prove that FCVT will provide a correct conversion,
we can use FCVT. This makes the common case a bit faster
and the less likely cases (unfortunately including zero,
which FCVT actually can convert correctly) a bit slower.
2021-04-25 15:56:19 +02:00
JosJuice f96ee475e4 Implement ArmFPURoundMode.cpp
Fixes https://bugs.dolphin-emu.org/issues/12388. Might also fix
other games that have problems with float/paired instructions
in JitArm64, but I haven't tested any.
2021-04-25 15:56:19 +02:00
Léo Lam 18174d3ed6
Merge pull request #9649 from leoetlino/cmake-auto-update-track
Make it possible to enable auto-updates by default with CMake builds
2021-04-24 19:44:51 +02:00
Lioncash e1dfcda8a6 BlockingLoop: Add explicit [[fallthrough]] annotations 2021-04-19 17:34:46 -04:00