Commit Graph

3603 Commits

Author SHA1 Message Date
Scott Mansell 876f6651b4
cmake: fix PCH to work with msvc/ninja
Ninja puts way more effort into compiling targets in parallel, and
ignores dependenceis until link time.

So we need to jump though hoops to force ninja to compile
pch.cpp before any targets which depend on the PCH.
2022-05-22 00:29:47 +02:00
Scott Mansell 0909e00117
cmake: fix MSVC PCH support
I'm not sure if the previous implementation ever worked.
2022-05-22 00:29:47 +02:00
Scott Mansell 987f270083
cmake: fix buggy target sources on windows
I have no idea why cmake supports PUBLIC on target_sources,
but it does. It causes all targets that depend on this target
to try and include the files in their sources.
Except it doesn't take paths into account, so it breaks. Mabye
it would work if you used an abolute source? But I'm not sure
there is a sane usecase.
2022-05-22 00:29:46 +02:00
Pokechu22 5f9212dd84 Common/LogManager: Remove old printf-style logging functions 2022-05-19 12:41:58 -07:00
Shawn Hoffman fa17153ebc fmt: use make_format_args instead of make_args_checked
make_args_checked is deprecated
see https://github.com/fmtlib/fmt/pull/2760 and the linked comment
2022-05-10 19:25:48 -07:00
Tilka ac643825ce
Merge pull request #10628 from Minty-Meeo/force_inline-minor-change
Change _WIN32 check to a _MSC_VER check in Inline.h
2022-05-03 23:07:40 +01:00
Minty-Meeo 9c22205ab1 Change _WIN32 check to a _MSC_VER check in Inline.h
This is compiler dependent, not OS dependent.
2022-05-02 01:57:36 -05:00
Shawn Hoffman 2808909a97 msbuild: simplify lang/scm projects a bit 2022-04-27 15:06:04 -07:00
Admiral H. Curtiss ef760ee012
Common/PointerWrap: Prevent reads/writes past the end of the buffer. 2022-04-18 23:48:00 +02:00
Admiral H. Curtiss 853cf4f818
Common/PointerWrap: Hide internals. 2022-04-18 03:41:14 +02:00
Admiral H. Curtiss 0a4805c0b9
Merge pull request #10582 from AdmiralCurtiss/fmt-float
Common/StringUtil: Use simpler formatting for floats and doubles.
2022-04-16 03:42:55 +02:00
Admiral H. Curtiss 5c687fc2a3
Common/StringUtil: Use simpler formatting for floats and doubles. 2022-04-12 23:35:19 +02:00
Shawn Hoffman ef8e461ca2 windows: buildfix if pch not used 2022-04-12 12:28:57 -07:00
Admiral H. Curtiss 36134abd0e
Common/LogManager: Add generic printf-style log function that takes a va_list instead of va_args. 2022-04-09 01:41:40 +02:00
Admiral H. Curtiss 23508cafb2
Merge pull request #7675 from TryTwo/Debugger_Code_Features
Debugger: Get target memory in load/store instructions
2022-04-08 05:28:22 +02:00
TryTwo 53cf78d413 Gekko constistancy changes. Add context item to codeview to show or copy a load/store target memory address from instructions at or near PC when paused. 2022-03-17 12:53:38 -07:00
Léo Lam bf261f6144
Merge pull request #10493 from jordan-woyak/netplay-show-traversal-external-port
NetPlayDialog: Display external IP/Port as seen by the traversal server.
2022-03-15 16:03:28 +01:00
Léo Lam da6f86f381
Merge pull request #10496 from JosJuice/mappingcommon-split
Move parts of MappingCommon out of DolphinQt
2022-03-15 15:54:04 +01:00
Jordan Woyak c058c8e1a6 NetPlayDialog: Display external IP/Port as seen by the traversal server when it's used. 2022-03-15 01:56:16 -05:00
Pokechu22 0f3832dec6 Common/FileUtil: Change logging to debug level
These messages hid other, more important, ones often.  I have left AttemptMaxTimesWithExponentialDelay and GetSysDirectory/SetSysDirectory as info, since those are called infrequently and can be useful to the end-user.
2022-03-08 14:07:37 -08:00
JosJuice 1bc057614e Move parts of MappingCommon out of DolphinQt
Some of the functions in MappingCommon would be useful to use on
mobile in the future.
2022-03-06 14:30:49 +01:00
JosJuice 5446daaef9 Common: Make DynamicLibrary non-copyable
The default implementations of DynamicLibrary's copy and move
constructors and assignment operators are unsafe.
2022-03-05 23:40:41 +01:00
Léo Lam bcc14d32b8
Merge pull request #10482 from Dentomologist/remove_redundant_statement
FileUtil: Remove redundant statement
2022-03-02 12:27:21 +01:00
JMC47 ea116fbbdf
Merge pull request #9834 from AdmiralCurtiss/fastmem-reserve-region-linux
MemArena: Keep fastmem memory region mapped on Linux to ensure nothing allocates within the fastmem space.
2022-02-28 12:46:34 -05:00
Dentomologist 01bd5e15ba FileUtil: Remove redundant statement 2022-02-25 21:16:07 -08:00
JosJuice 128fa8aec3
Merge pull request #10388 from Dentomologist/android-fix-unused-variable-warning
[Android] Fix unused variable warning
2022-02-20 18:56:50 +01:00
JosJuice 35b436bd6b
Merge pull request #10377 from Pokechu22/warning-fixes-jan-2022
Fix several compile warnings on GCC
2022-02-18 21:05:42 +01:00
Merry be81fe86e1 JitRegister: Use fmt
Prefer fmt to printf-style formatting.
2022-02-16 20:09:38 +00:00
Admiral H. Curtiss ffbe6cb21f
MemArena: Keep fastmem region mapped on Linux. 2022-02-14 22:14:41 +01:00
Admiral H. Curtiss 4a9553bf6d
MemArena: Load UnmapViewOfFileEx dynamically to restore Windows 7 support. 2022-02-14 21:57:18 +01:00
Admiral H. Curtiss 3a4de2b306
MemArena: Use Common::DynamicLibrary for m_api_ms_win_core_memory_l1_1_6_handle. 2022-02-14 21:57:15 +01:00
Pokechu22 15f80f7234 MathUtil: Mark lo in SaturatingCast as [[maybe_unused]]
It's unused in the case that T is unsigned and dest is signed (e.g. SaturatingCast<int, size_t> which appears SetIsoPaths in MainSettings.cpp)
2022-02-13 14:38:59 -08:00
JosJuice 989bdb8d6d Common/CodeBlock: Call ResetCodePtr when decreasing region_size
Fixes https://bugs.dolphin-emu.org/issues/12827.

A description of what was going wrong:

JitArm64::Init first calls CodeBlock::AllocCodeSpace, after which
CodeBlock and Arm64Emitter consider us to have 96 MB of code space
available. JitArm64::Init then calls AddChildCodeSpace, which is
supposed to take 64 MiB of that space and give it to m_far_code.
CodeBlock's view of how much space there is gets updated from 96 MiB
to 32 MiB, but due to the missing call, Arm64Emitter keeps thinking
that it has 96 MiB of space available.

The last thing JitArm64::Init does is to call ResetFreeMemoryRanges.
This function asks Arm64Emitter how much code space is available and
stores a range of that size in m_free_ranges_near, meaning that
m_free_ranges_near ends up being backed by both nearcode and farcode!
This is a ticking time bomb; as soon as we grab memory from
m_free_ranges_near which is backed by farcode, we're in trouble.
The crash I ran into in my testing was caused by fastmem code being
allocated in farcode (our backpatch handler only handles accesses made
from nearcode), but you may as well get errors caused by code intended
for nearcode overwriting code intended for farcode or vice versa.

So why did NBA Live 2005 crash when most games had no problems,
and why was the bug bisected to the commit that increased the size
of far code from 16 MiB to 64 MiB? Well, as long as we're only
using the first 32 MiB of the big 96 MiB range, everything works.
What happens with NBA Live 2005 (I have not investigated exactly
through what mechanism this happens) is that at some point the range
in m_free_ranges_near gets split into two ranges, one which is
backed by nearcode and one which is backed by farcode. Dolphin
prefers to select the biggest range available (we don't want to
pick a tiny 1 KiB range that may not be able to fit the whole block
we're about to emit, after all), and after increasing the size of
farcode to 64 MiB, farcode is bigger than nearcode.
2022-02-12 17:51:32 +01:00
Admiral H. Curtiss 79405de103
MemArena: Use placeholders on Windows. 2022-02-06 18:06:04 +01:00
Admiral H. Curtiss a336c4386c
IOFile: Rename Clear() to ClearError() for clarity. 2022-01-29 06:49:22 +01:00
Admiral H. Curtiss 36cfcb530f
IOFile: Make origin parameter to Seek() an enum class. 2022-01-29 06:49:21 +01:00
Dentomologist d3ae1bd415 [Android] Fix unused variable warning
Add [[maybe_unused]] attribute to ConsoleListener's m_use_color
2022-01-25 14:15:18 -08:00
JosJuice 7b8e846d0a
Merge pull request #10367 from Pokechu22/fmt-8.1.1
Update to fmt 8.1.1
2022-01-20 21:14:41 +01:00
Pokechu22 6e5f4125e3 Use Common::ToLower and Common::ToUpper 2022-01-16 17:00:12 -08:00
Pokechu22 aaec64501a Create Common::ToLower and Common::ToUpper 2022-01-16 16:56:53 -08:00
Pokechu22 fefde0481d Use EnumFormatter to generate names for EXI devices
This simplifies the code in GameCubePane, and allows us to use the EXIDeviceType enum in error messages.
2022-01-14 20:24:53 -08:00
Léo Lam 83c5446d85
Fix static initialisation order fiasco issue for Version variables
Fixes a crash that could occur if the static constructor function for
the MainSettings.cpp TU happened to run before the variables in
Common/Version.cpp are initialised. (This is known as the static
initialisation order fiasco.)

By using wrapper functions, those variables are now guaranteed to be
constructed on first use.
2022-01-14 00:04:22 +01:00
Pokechu22 fd04f4f32d Replace use of of unsigned char* with fmt
Using unsigned char* or signed char* results in a deprecation warning, which is treated as an error.  It needs to be casted to regular char* for it to work.
2022-01-13 11:11:08 -08:00
Pokechu22 1a92699455 Cast to int for enums that are not formattable 2022-01-13 11:11:08 -08:00
Pokechu22 ac46b91673 Make all fmt::formatter constructors constexpr 2022-01-13 11:11:08 -08:00
Pokechu22 78e43a4404 Make all custom fmt::formatter's format functions const
fmt 8.0.0 requires this.
2022-01-13 11:11:08 -08:00
Pokechu22 cc592ab814 Use fmt::runtime in FmtFormatT
This format string is by definition dynamic and can't be checked at compile time.  There are other similar strings in the log handler and in asserts, but they use vformat and thus don't need fmt::runtime.  We might be able to do a similar thing where the untranslated string is compile-time checked, but FmtFormatT is used in so few places that I don't want to handle that in this PR.
2022-01-13 11:11:08 -08:00
Pokechu22 54cf8d030c Add fmt/xchar includes where wstring is used 2022-01-13 11:11:08 -08:00
Pokechu22 140c8217f6 Common: Create HRWrap
HRWrap now allows HRESULT to be formatted, giving useful information beyond "it failed" or a hex code that isn't obvious to most users.  This commit does not add any uses of it, though.
2022-01-09 12:44:15 -08:00
Pokechu22 c296c34e00 Common/MsgHandler: Use caller's file and line number in log messages
This will assist with finding the source of a panic alert based on logs; before, Common\MsgHandler.cpp:113 (or similar) was always used.
2022-01-09 12:44:14 -08:00
Pokechu22 f55571ee5d Common/MsgHandler: Fix PanicAlertFmtT not actually being translated 2022-01-09 12:44:14 -08:00
Pokechu22 2a5016c2f8 Common/MsgHandler: Remove use of lambda, as it breaks __func__
Specifically, this meant that __func__ in macros (namely ASSERT) would always be evaluate to "operator ()".
2022-01-09 12:44:14 -08:00
Pokechu22 558de04cfc Common/Assert: Actually use the ASSERT_MSG's log type parameter
Since it was unused, nonexistent values were used in a few places.  I've replaced them.
2022-01-09 12:44:14 -08:00
Pokechu22 bab3ff0157 Common/MsgHandler: Remove non-format variants of PanicAlert
They're no longer used.
2022-01-09 12:44:14 -08:00
Pokechu22 44e93e91d7 Common/Assert: Switch to fmt 2022-01-09 12:43:11 -08:00
Pokechu22 1c0ca09e6f Common/Assert: Include the condition and function in the message 2022-01-09 12:43:11 -08:00
JosJuice 804f78e0e4 Android: Mark s_android_send_report as static
Fixes a compiler warning.
2022-01-06 12:20:09 +01:00
Mai M 7bd14c5d9f
Merge pull request #10338 from Pokechu22/natvis-improvements
Natvis improvements
2022-01-06 04:01:25 -05:00
JMC47 9a914d33d5
Merge pull request #9414 from DevJPM/master
Fix CPU Core Count detection and Enable Parallel Shader Compilation
2022-01-04 10:15:12 -05:00
Pokechu22 8e2b06906b Create EnumMap natvis 2022-01-02 15:36:47 -08:00
Pokechu22 b96297f2ee Improve BitField natvis
Now, enums are properly displayed, and BitFieldArray is also displayed nicely.  Signed values also work correctly, and 1-bit fields are not treated as bools unless the bitfield is explicitly marked as a bool.
2022-01-02 14:39:34 -08:00
Pokechu22 301bc49efe Common: Remove MD5.h
It uses DiscIO, and Common shouldn't depend on DiscIO.  Instead, put this code in NetPlayClient.cpp.
2022-01-01 11:52:53 -08:00
Pokechu22 0c19f895d3 Replace remaining uses of zlib crc32 with Common/Hash.h 2022-01-01 10:36:38 -08:00
Pokechu22 2652aed85c Common: Merge CRC32.h into Hash.h
This makes it easier to find the relevant functions.
2022-01-01 10:36:38 -08:00
Léo Lam 9a61514073
Merge pull request #10241 from AdmiralCurtiss/user-dir-consistency
Ensure user paths are stored in a consistent manner.
2022-01-01 02:32:24 +01:00
JMC47 1c8a7f1867
Merge pull request #10277 from AdmiralCurtiss/memarena-cleanup
MemArena: Cleanup & interface changes for safer memory mapping.
2021-12-29 19:06:47 -05:00
Admiral H. Curtiss 319b00f1fd
Config: Allow unregistering callbacks. 2021-12-25 23:32:49 +01:00
Admiral H. Curtiss e54657254a
Core: Make format of D_WIIROOT_IDX consistent with the rest of the user directories. 2021-12-25 20:21:32 +01:00
Admiral H. Curtiss 3e1511ce98
Common/FileUtil: Ensure consistency for custom user paths. 2021-12-25 20:21:32 +01:00
Admiral H. Curtiss 1554128560
MemArena: Prepare interface for proper memory reservation. 2021-12-25 20:20:36 +01:00
Admiral H. Curtiss 812cc8b632
MemArena: Split into three separate files for each OS. 2021-12-25 20:20:36 +01:00
Pokechu22 95e0f833f9 Fifo analyzer: Display equations for color/alpha combiners 2021-12-18 15:21:48 -08:00
Pokechu22 2025763420 Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
Pokechu22 8cf841ecc7 Fix saving RGBA images
PNG_FORMAT_RGB and PNG_COLOR_TYPE_RGB both evaluate to 2, but PNG_FORMAT_RGBA evaluates to 3 while PNG_COLOR_TYPE_RGBA evaluates to 6; the bit indicating a palette is 1 while the bit indicating alpha is 4.
2021-11-24 14:56:12 -08:00
Pokechu22 99e589cc98 Log libpng warnings and errors 2021-11-24 14:56:12 -08:00
Léo Lam aa5cb35c86
Merge pull request #10143 from Pokechu22/png-compression-level
Add option for setting the PNG zlib compression level
2021-11-23 16:40:34 +01:00
JMC47 e5a4a86672
Merge pull request #10055 from JosJuice/jitarm64-reuse-memory
JitArm64: Codegen space reuse
2021-11-20 17:35:24 -05:00
DevJPM 61cfd8696e Fix CPU Core Count detection and Enable Parallel Shader Compilation
This does this following things:

- Default to the runtime automatic number of threads for pre-compiling shaders
- Adds a distinct automatic thread count computation for pre-compilation  (which has less other things going on
and should scale better beyond 4 cores)
- Removes the unused logical_core_count field from the CPU detection
- Changes the semantics of num_cores from maximaum addressable number of cores to actually available CPU cores
(which is also how it was actually used)
- Updates the computation of the HTT flag now that AMD no longer lies about it for its Zen processors
- Background shader compilation is *not* enabled by default
2021-11-20 16:08:10 +01:00
Pokechu22 94ccf765af Add option for setting the PNG zlib compression level 2021-11-18 13:10:22 -08:00
Pokechu22 d2041b4c2a VideoCommon: Add signed version of BitfieldExtract 2021-11-17 20:04:33 -08:00
JosJuice 3e84279919
Merge pull request #10208 from thatSteveFan/patch-1
Minor comment fix in Matrix.cpp
2021-11-13 15:09:28 +01:00
Shawn Hoffman 4008188654 msvc: update to vs2022 and windows sdk 10.0.22000 2021-11-11 08:01:26 -08:00
thatSteveFan 834a59d89b
Minor comment fix in Matrix.cpp
Fix comment to say (NxM times MxP).
2021-11-08 15:30:39 -08:00
Mai M 6c72e6814d
Merge pull request #10169 from leoetlino/fmt-localtime
Use fmt::localtime instead of thread-unsafe std::localtime
2021-11-07 00:08:14 -04:00
Merry 7c2b09e156 Arm64Emitter: Add FRINTI instruction 2021-11-06 19:15:26 +00:00
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