Commit Graph

5139 Commits

Author SHA1 Message Date
mitaclaw 728663bdc0 Modernize `std::binary_search` with ranges
In VolumeVerifier.cpp, constructing a `std::string_view` of the volume's GameID is unnecessary, as `std::`(`ranges::`)`binary_search` supports heterogeneous lookup. The usage in GameFile.cpp is a perfect example.
2024-10-10 00:53:48 -07:00
mitaclaw ebf7cebc32 Modernize `std::sort` with ranges 2024-10-10 00:53:48 -07:00
mitaclaw 9bd1dae41d Modernize `std::fill` with ranges
In DSPCore.cpp, there were two `std::fill` uses that could be simplified using `std::fill_n`. Due to their proximity with other `std::fill` algorithms being modernized with ranges, I chose to make these examples into the rare `std::ranges::fill_n`.
2024-10-10 00:53:48 -07:00
Pokechu22 929bcbdde9 Fifo analyzer: Fix indexed XF loads showing "bytes" instead of "words"
Indexed XF loads specify the number of 32-bit words (generally floats, but light data has some integers) to load, not the number of bytes. This was only a mistake in the fifo analyzer text; the actual implementation already loaded words.
2024-10-06 21:56:48 -07:00
JMC47 339f9311fb
Merge pull request #12918 from JosJuice/revert-revert-audit-get-state
Partially revert "Revert "Audit uses of IsRunning and GetState""
2024-10-06 11:26:06 -04:00
Jules Blok b191c0f7d8
Merge pull request #12208 from PatrickFerry/add-vertex-depth-range-case
Use Vertex Depth Range when zRange Exceeds farZ
2024-10-05 14:14:11 +02:00
JosJuice 6ca2da53e8 Partially revert "Revert "Audit uses of IsRunning and GetState""
This reverts the revert commit bc67fc97c3,
except for the changes in BaseConfigLoader.cpp, which caused the bug
that made us revert 72cf2bdb87. PR 12917
contains an improved change to BaseConfigLoader.cpp, which can be merged
(or rejected) independently.

A few changes have also been made based on review comments.
2024-10-04 18:35:41 +02:00
JosJuice 2da3e49b1e
Merge pull request #13078 from Dentomologist/videobackendbase_only_populate_backend_info_when_uninitialized
VideoBackendBase: Only populate backend info when uninitialized
2024-10-04 18:31:06 +02:00
JMC47 e259831bcf
Merge pull request #13087 from TellowKrinkle/PresentSkip
VideoBackends:Vulkan: Prevent freezes during window resize on Linux
2024-10-02 21:09:25 -04:00
TellowKrinkle 7e1a9490c0 VideoBackends:Vulkan: Don't try to present if swapchain acquire failed 2024-10-02 19:22:16 -05:00
TellowKrinkle fd94ff252d VideoCommon: Dirty pixel shader manager on efb scale changes 2024-09-30 01:12:55 -05:00
Dentomologist dc1b961c09 VideoBackendBase: Only populate backend info when uninitialized
Prevent potential issues when creating the Graphics window (and thus
calling PopulateBackendInfo) while the core state is Stopping, like we
already do while it's Starting or Running.
2024-09-27 12:20:48 -07:00
Dentomologist 0a1084fad5 VideoBackendBase: Check Core state in PopulateBackendInfo
Remove the PopulateBackendInfoFromUI function, which had a single caller
(GraphicsWindow::OnBackendChanged) and checked that the core wasn't
running or starting before calling PopulateBackendInfo.

Move the core state check into PopulateBackendInfo and have
OnBackendChanged call that instead. This guarantees the check is
performed by all callers of PopulateBackendInfo, preventing
potential reintroduction of the crash fixed in 3d4ae63f if another call
to PopulateBackendInfo is added.

As of the previous commit the only other caller of PopulateBackendInfo
is Core::Init shortly before s_state is set to Starting, so it will
always pass the check and so maintain its current behavior.
2024-09-26 17:12:26 -07:00
Dentomologist 91f7b776ca GraphicsWindow: Fix crash when opening during emulation startup
Fix a crash when opening the Graphics window for the first time during
emulation startup when the backend is Vulkan, D3D11, or D3D12.

Don't call PopulateBackendInfo() from the Host thread when the core is
starting up. First, the function has already been called in Core::Init()
so we don't need to again. More importantly, PopulateBackendInfo() calls
g_video_backend->InitBackendInfo(), and the Vulkan and D3D
implementations of those functions load and then unload libraries (and
their associated function pointers) which are potentially in use by
other threads.

This crash was reliably reproducible with the following steps:
1) Select an affected backend.
2) Enable "Compile Shaders Before Starting"
3) Delete the cached shaders (but not the .uidcache file) for the game
   you're testing.
4) Close and reopen Dolphin.
5) Start the game.
6) While the game is still booting or compiling shaders, open the
   Graphics window for the first time in that Dolphin session.

Fixes https://bugs.dolphin-emu.org/issues/13634.
2024-09-26 17:12:26 -07:00
Dentomologist c3d6d2189a Texture Dumping: Show OSD message on startup and when toggled
If texture dumping is enabled, notify the user on emulation startup
using an On Screen Display message.

Also notify the user when texture dumping is toggled.

Addresses https://bugs.dolphin-emu.org/issues/12445.
2024-09-06 13:00:25 -07:00
Admiral H. Curtiss e1b1e4b4cf
Merge pull request #13031 from parona-source/libfmt-11
Add support for libfmt-11
2024-08-31 15:34:48 +02:00
Alfred Wingate d7c93d87be
Add support for libfmt-11
fmt::join was moved into fmt/ranges.h

Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-08-22 16:54:35 +03:00
Bryan Jacobs 7ec6d116e8 Graphics: Adapt aspect ratio when SBS/TAB 3D is used
Adds support for choosing to present the full resolution
independently to each eye when using side-by-side or
top-and-bottom 3D.
2024-08-22 07:11:43 +10:00
Dr. Dystopia 9602f36248 Remove redundant semicolons 2024-08-20 14:59:54 +02:00
Tillmann Karras 20f4643c74 VideoCommon: force 32-byte alignment for display list address and size 2024-08-18 05:00:38 +01:00
mitaclaw 9fa4eb9aab Use 'contains' method 2024-08-15 14:20:16 -07:00
Dr. Dystopia 618b41a459 Use 'contains' method 2024-08-14 22:18:28 +02:00
Dentomologist d627b78c46 Adjust order and spacing of various #includes
Move some #includes around to match the Contributing guidelines.
2024-07-26 14:28:34 -07:00
TellowKrinkle cab6e7c12e Properly link against xxhash
Things using dolphin_find_optional_system_library need to link against the name used there or they won't work with both the system and bundled cases
2024-07-06 16:56:44 -05:00
iwubcode 36ccbbc06e VideoCommon: add ability to serialize a texture asset metadata to json 2024-06-29 14:50:40 -05:00
iwubcode 1c3402502b VideoCommon: set individual texture asset filter/wrap values when loading from json 2024-06-29 14:50:40 -05:00
iwubcode 75a0a1ed67 VideoCommon: update texture asset to properly set near sampler state value 2024-06-29 14:50:40 -05:00
Admiral H. Curtiss ce2f4101f3
Core/VideoCommon: Revert change from #12828
This causes Dual Core to lock up during the boot sequence, because it tries to wait for a not-yet-running GPU thread.

Fixes https://bugs.dolphin-emu.org/issues/13559
2024-06-23 03:44:05 +02:00
Admiral H. Curtiss 9b33b777cf
Merge pull request #12828 from JosJuice/unify-state-variables-2
Clean up Core::GetState
2024-06-22 20:20:54 +02:00
JosJuice 72cf2bdb87 Audit uses of IsRunning and GetState
Some pieces of code are calling IsRunning because there's some
particular action that only makes sense when emulation is running, for
instance showing the state of the emulated CPU. IsRunning is appropriate
to use for this. Then there are pieces of code that are calling
IsRunning because there's some particular thing they must avoid doing
e.g. when the CPU thread is running or IOS is running. IsRunning isn't
quite appropriate for this. Such code should also be checking for the
states Starting and Stopping. Keep in mind that:

* When the state is Starting, the state can asynchronously change to
  Running at any time.
* When we try to stop the core, the state gets set to Stopping before we
  take any action to actually stop things.

This commit adds a new method Core::IsUninitialized, and changes all
callers of IsRunning and GetState that look to me like they should be
changed.
2024-06-21 20:52:55 +02:00
JosJuice 962230f91e Core: Store current state in less places
Core::GetState reads from four different pieces of state: s_is_stopping,
s_hardware_initialized, s_is_booting, and CPUManager::IsStepping.
I'm keeping that last one as is for now because there's code in Dolphin
that sets it directly, but we can unify the other three to make things
easier to reason about.

This commit also gets rid of s_is_started. This was previously used in
Core::IsRunningAndStarted to ensure true wouldn't be returned until the
CPU thread was started, but it wasn't used in Core::GetState, so
Core::GetState would happily return State::Running after we had
initialized the hardware but before we had initialized the CPU thread.
As far as I know, there are no callers that have any real need to know
whether the boot process is currently initializing the hardware or the
CPU thread. Perhaps once upon a time there was a desire to make the
apploader debuggable, but a long time has passed without anyone stepping
up to implement it, and the way CBoot::RunApploader is implemented makes
it rather difficult. So this commit makes all the functions in Core.cpp
consider the core to still be starting until the CPU thread is started.
2024-06-21 20:46:44 +02:00
Admiral H. Curtiss 5728ebf7ad
Merge pull request #12867 from AdmiralCurtiss/uicommon-dependency
CMake dependency fixes
2024-06-21 20:01:44 +02:00
LillyJadeKatrin 45563a872c Scale challenge icons based on screen height 2024-06-19 13:59:59 -04:00
JMC47 9886199cb1
Merge pull request #12859 from LillyJadeKatrin/retroachievements-challenge-hide
Hide Challenge Icons when OSD Messages Disabled
2024-06-19 02:29:08 -04:00
LillyJadeKatrin 9e1f5ed4b5 Stack Challenge Icons Horizontally 2024-06-15 22:42:40 -04:00
LillyJadeKatrin a79f428972 Fix margins on icon-only messages
Messages with an icon and no text (such as in the game start sequence) had an oversized margin due to ImGui adding padding for an empty string.
2024-06-15 22:42:35 -04:00
LillyJadeKatrin 1b00b4e3d8 OSD messages display horizontally
OSD messages with an icon and text will display the text to the right of the icon instead of below it.
2024-06-15 22:30:39 -04:00
Admiral H. Curtiss c5a030e7ab
VideoCommon: Fix format string injection vulnerability from leaderboards 2024-06-15 23:12:19 +02:00
Admiral H. Curtiss a95c3dbc97
Merge pull request #12818 from iwubcode/json_file_operations
Common: add Json helper utilities for loading or saving to a file
2024-06-15 16:43:38 +02:00
Admiral H. Curtiss f71d6498d0
Merge pull request #12855 from LillyJadeKatrin/retroachievements-challenge-refactor
Refactored Challenge Icons to handle icon updates
2024-06-15 16:24:24 +02:00
LillyJadeKatrin 3d5a1f7d33 Refactored Challenge Icons to handle icon updates
If an icon is displayed on screen before it downloads, it was displaying a default icon but it would fail to load the actual icon even after it was downloaded. This fixes that.
2024-06-15 07:36:49 -04:00
LillyJadeKatrin 7eec723f3f Hide Challenge Icons when OSD Messages Disabled 2024-06-14 00:19:45 -04:00
JMC47 71171a9e4d
Merge pull request #12819 from iwubcode/texture_asset_sampler_in_pipeline
VideoCommon: update custom pipeline to use a texture's sampler instead of linear sampler if the texture is used
2024-06-11 21:13:57 -04:00
JMC47 16c7869ab2
Merge pull request #12721 from iwubcode/custom_shader_alpha
VideoCommon: allow custom shaders to set the alpha value
2024-06-11 21:13:24 -04:00
iwubcode fa5a6547c6 VideoCommon: add texture type to texture config comparison 2024-06-08 14:28:11 -05:00
Admiral H. Curtiss 81b6bfaa1e
Merge pull request #12832 from JosJuice/retro-achievements-less-ifdefs
Use a stub AchivementManager when USE_RETRO_ACHIEVEMENTS isn't defined
2024-06-06 22:42:53 +02:00
JosJuice 22aa88109f Use a stub AchivementManager when USE_RETRO_ACHIEVEMENTS isn't defined
This lets us reduce the number of USE_RETRO_ACHIEVEMENTS ifdefs in the
code base, reducing visual clutter. In particular, needing an ifdef for
each call to IsHardcodeModeActive was annoying to me. This also reduces
the risk that someone writes code that accidentally fails to compile
with USE_RETRO_ACHIEVEMENTS disabled.

We could cut down on ifdefs even further by making HardcodeWarningWidget
always exist, but that would result in non-trivial code ending up in the
binary even with USE_RETRO_ACHIEVEMENTS disabled, so I'm leaving it out
of this PR. It's not a lot of code though, so I might end up revisiting
it at some point.
2024-06-06 08:26:20 +02:00
Scott Mansell dbe7616bdd
Merge pull request #12817 from iwubcode/imgui-mouse-position-event
VideoCommon: use imgui mouse position event when the mouse position changes
2024-06-05 18:50:26 +12:00
iwubcode c2bc2ccd23 VideoCommon: pull texture sampler out of texture cache so that it can be used in other places in the future 2024-06-01 23:21:04 -05:00
iwubcode 11c37de695 VideoCommon: update custom pipeline to use a a texture's sampler if the texture is in use 2024-05-31 23:19:51 -05:00