Commit Graph

5153 Commits

Author SHA1 Message Date
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
iwubcode 50b95bbea9 InputCommon / VideoCommon: update to use new JsonFromFile function 2024-05-31 23:13:25 -05:00
iwubcode 51b69bb339 VideoCommon: use imgui mouse position event when the mouse position changes 2024-05-31 22:31:54 -05:00
LillyJadeKatrin dc8f3f6eae Refactored Achievement Badges into Texture Layers
Achievement badges/icons are refactored into the type CustomTextureData::ArraySlice::Level as that is the data type images loaded from the filesystem will be. This includes everything that uses the badges in the Qt UI and OnScreenDisplay, and similarly removes the OSD::Icon type because Level already contains that information.
2024-05-23 10:41:45 -04:00
Admiral H. Curtiss 5c2f73986a
Merge pull request #12537 from TellowKrinkle/MTLSubgroup
VideoCommon: More specific subgroup op bugs
2024-05-21 22:17:22 +02:00
iwubcode d7a8ec4353 VideoCommon: use imgui input queue for mouse clicks, this helps keep input smooth regardless of frame-times and matches keyboard events, this system was introduced in 1.87 2024-05-18 11:49:19 -05:00
Tilka c442c0d5e5
Merge pull request #10957 from Pokechu22/std-bitcast
Replace Common::BitCast with std::bit_cast
2024-05-04 08:24:59 +01:00
Pokechu22 fbbfea8e8e Replace Common::BitCast with std::bit_cast 2024-05-03 18:43:51 -07:00
mitaclaw 0df401b164 Core::IsRunning: Avoid Global System Accessor 2024-05-01 08:54:17 -07:00
LillyJadeKatrin 7895b739ee Display active leaderboard data on screen
Up to four leaderboards are displayed in a window in the bottom right of the screen (vertically above challenge icons, if there are any). As per RetroAchievements standards, the markers only display the current leaderboard values with no further context necessary.
2024-05-01 06:43:19 -04:00
iwubcode 9d28c371e7 VideoCommon: allow custom shaders to set the alpha value for use when blending is enabled 2024-04-28 18:15:27 -05:00
sowens99 3ab1334cd9 VideoCommon: Only show input count when recording 2024-04-26 20:06:57 -04:00
JosJuice c204b33314 VideoCommon/BPStructs: Add a missing bounds check
Happened to find this when working on the previous commit.
2024-04-20 18:31:08 +02:00
JosJuice 3cfa233b63 VideoCommon: Use GetSpanForAddress safely in texture decoding
Now only VertexLoader remains... But that one might be tricky.
2024-04-20 18:31:08 +02:00
JosJuice 5c9bb80638 Memmap: Replace GetPointer with GetSpanForAddress
To ensure memory safety, callers of GetPointer have to perform a bounds
check. But how is this bounds check supposed to be performed?
GetPointerForRange contained one implementation of a bounds check, but
it was cumbersome, and it also isn't obvious why it's correct.

To make doing the right thing easier, this commit changes GetPointer to
return a span that tells the caller how many bytes it's allowed to
access.
2024-04-20 18:31:08 +02:00
Jordan Woyak df7dd5d36a Config: Expose GFX_OVERLAY_PROJ_STATS setting in UI. 2024-04-18 14:45:28 -05:00
Jordan Woyak 1e27183dff VideoCommon: Show the average projection to viewport ratio in statistics
window.
2024-04-18 14:45:28 -05:00
Admiral H. Curtiss 8268ae1cf7
Merge pull request #12698 from iwubcode/xfb_copy_hash_in_present
VideoCommon: add xfbs hashes to present info if available
2024-04-18 17:11:49 +02:00
Dentomologist dbaa844e57 Remove defined-out code 2024-04-15 12:17:35 -07:00
Admiral H. Curtiss b3939052b4
Merge pull request #12436 from Filoppi/frame-dump-raw-internal-resolution
Frame dump at raw internal resolution
2024-04-13 03:39:37 +02:00
Admiral H. Curtiss 2f13be5a2d
VideoConfig: Adjust FrameDumpResolutionType enum class to style guidelines 2024-04-13 03:21:39 +02:00
iwubcode abf380b705 VideoCommon: add xfb hash values (if available) to present information 2024-04-09 18:59:33 -05:00
iwubcode e5b7b2e9ee VideoCommon: add xfbs presented to video events 2024-04-09 18:57:32 -05:00
JosJuice 54773bc5d2 VideoCommon: Remove calls to GetPointer
This fourth part of my series of patches to get rid of unsafe uses of
GetPointer takes care of the "easy" cases in VideoCommon. Three uses of
GetPointer now remain in Dolphin: VertexLoaderManager, TextureInfo, and
the software renderer's TextureSampler.
2024-04-09 21:08:57 +02:00
mitaclaw eb92d6f0a8 Core::GetState: Avoid Global System Accessor 2024-04-08 16:23:23 -07:00
Filoppi 66592f79f2 Video: remove enforced resolution least common multiple of 4 when dumping screenshots and not videos (only videos encoders have this limit).
NOTE: this will likely trigger FIFOCI differences.
2024-04-08 22:54:45 +03:00
Filoppi 72db62e178 Video: split frame dumping settings into 3 resolution dumping modes
also polish aspect ratio related code for clarity
2024-04-08 22:54:45 +03:00
Pokechu22 a3951dc2d7 Fix out of bounds accesses for invalid vertex component formats
On all platforms, this would result in out of bounds accesses when getting the component sizes (which uses stuff from VertexLoader_Position.h/VertexLoader_TextCoord.h/VertexLoader_Normal.h). On platforms other than x64 and ARM64, this would also be out of bounds accesses when getting function pointers for the non-JIT vertex loader (in VertexLoader_Position.cpp etc.). Usually both of these would get data from other entries in the same multi-dimensional array, but the last few entries would be truly out of bounds. This does mean that an out of bounds function pointer can be called on platforms that don't have a JIT vertex loader, but it is limited to invalid component formats with values 5/6/7 due to the size of the bitfield the formats come from, so it seems unlikely that this could be exploited in practice.

This issue affects a few games; Def Jam: Fight for New York (https://bugs.dolphin-emu.org/issues/12719) and Fifa Street are known to be affected.

I have not done any hardware testing for this PR specifically, though I *think* I previously determined that at least a value of 5 behaves the same as float (4). That's what I implemented in any case. I did previously determine that both Def Jam: Fight for New York and Fifa Street use an invalid normal format, but don't actually have lighting enabled when that normal vector is used, so it doesn't change rendering in practice.

The color component format also has two invalid values, but VertexLoader_Color.h/.cpp do check for those invalid ones and return a default value instead of doing an out of bounds access.
2024-04-04 12:50:34 -07:00
Filoppi 1f34adf216 Video: move all padding added for frame dumping to a single function,
which also avoids the output window from being resized randomly to be a multiple of 4
2024-04-03 13:32:01 +03:00
Filoppi d6230bbad8 Video: Change the frame dumper to actually use the raw emulation output resolution, avoiding any scaling if possible.
This should make comparisons much more reliable as pixels wouldn't be smushed together or stretched.
2024-04-03 13:32:01 +03:00
Jordan Woyak 550e008774 VideoCommon: Scan texture dumping directory + subdirectories to not re-dump existing files. 2024-03-21 20:27:34 -05:00
Jordan Woyak ac5c2d9bf2 VideoCommon: Prefer D3D11/12 over OpenGL on Windows. 2024-03-15 19:51:04 -05:00
Admiral H. Curtiss 58616a6e4c
Merge pull request #12438 from Filoppi/custom_relative_aspect_ratio
Add Custom Relative and Raw (Squared Pixels) aspect ratios
2024-03-02 14:14:19 +01:00
Filoppi 41b19e262f Add custom relative and raw (squared pixels) aspect ratio modes 2024-02-29 21:11:19 +02:00
Lioncash 7bf77a56f4 VertexManagerBase: Initialize m_ticks_elapsed on construction
Ensures that this always has a deterministic value on construction like
everything else in the class.
2024-02-28 10:21:08 -05:00
Admiral H. Curtiss 5090a028e6
Merge pull request #12435 from Filoppi/fix-aspect-ratio-stuck
Fix aspect ratio heuristics getting stuck to a state
2024-02-20 21:36:43 +01:00
Filoppi 48fbbdba7c Video: update widescreen heuristic code to never get stuck to specific old values when changing settings 2024-02-20 22:26:19 +02:00
Filoppi 3f102ea8c2 Video: Make the game resolution (within the window) snap to the XFB size if they are within a ~1 pixel treshold on one axis only.
This takes care of making the image clearer in some edge cases where the game was already running at near perfect
 4:3 with no stretching, and the VI aspect ratio didn't match the XFB by one pixel, making the image stretched and blurry.
-Video: Fix `FindClosestIntegerResolution() using the window aspect ratio and not the draw aspect ratio, causing it to prefer
 stretching over black bars in cases when it wasn't desirable.
2024-02-20 03:09:11 +02:00
Filoppi 95ee0ac781 Video: Fix aspect ratio heuristics getting stuck to widescreen (or to non widescreen) (`m_is_game_widescreen` variable) if the user first forced the aspect ratio to 16:9/4:3 and then set it back to Auto. 2024-02-20 02:42:52 +02:00
iwubcode a1147dae6e VideoCommon: move factory names to be a static inside each action class, so that they can be reused in the future for serialization 2024-02-18 15:45:10 -06:00
Admiral H. Curtiss 9b5fd5d34e
Merge pull request #12281 from TellowKrinkle/AsahiGL33
VideoCommon: Don't use indexed output for fbfetch
2024-02-18 02:33:50 +01:00
Mai 21300bb21b
Merge pull request #12457 from iwubcode/asset_memory_limit
VideoCommon: handle asset memory going over reserved limit correctly
2024-02-16 15:46:52 -05:00
iwubcode 2ab877586d VideoCommon: make mesh asset data loadable by asset loader 2024-02-12 21:45:32 -06:00
iwubcode 60772ed9d2 VideoCommon: add functionality to prepare for a mesh asset that is loaded from a GLTF file 2024-02-11 13:28:00 -06:00
TellowKrinkle 5949911a5a VideoCommon: Don't use indexed output for fbfetch
A nonzero index makes no sense, and Mesa doesn't like it when you supply an index
2024-02-07 03:52:31 +01:00
Admiral H. Curtiss df5baab873
Merge pull request #12550 from lioncash/dead
VertexLoaderManager: Remove unused entry struct
2024-02-03 02:38:02 +01:00
Lioncash 4f40bdf501 VertexLoaderManager: Use fill() in Init()
Same behavior, less code.
2024-02-01 23:04:40 -05:00
Lioncash ea95c82a01 VertexLoaderManager: Remove unused entry struct
This isn't used anywhere, so it can be removed.
2024-02-01 23:04:39 -05:00
Lioncash 7096f99f79 CustomPipeline: Mark arrays as constexpr
Ensures that these go into the ro section.
2024-02-01 23:02:45 -05:00
Lioncash 59211589b9 CustomPipeline: Make use of emplace_back() in GlobalConflicts()
We can use the string_view arguments to directly construct strings
inside of the global_result vector.
2024-02-01 23:02:45 -05:00
Lioncash 353ceedb50 CustomPipeline: Resolve unused variable warning
We can just use holds_alternative here instead.
2024-02-01 23:02:45 -05:00
Admiral H. Curtiss da6b5dd38a
Merge pull request #12546 from lioncash/event
VideoCommon/Statistics: Remove global system accessor from s_after_frame_event
2024-01-31 21:16:21 +01:00
Admiral H. Curtiss 18abf7c768
Merge pull request #12544 from lioncash/getmod
GraphicsModGroup: Allow heterogenous lookup for GetMod()
2024-01-31 20:17:26 +01:00
Lioncash cac66317aa VideoCommon/Statistics: Remove global system accessor from s_after_frame_event
Instead, we make the event take a reference to the system and then pass
it in when the event is triggered.

This does introduce two other accessors, but these are much easier to
refactor out over time, and without modification to the existing event
interface.
2024-01-31 13:12:09 -05:00
Lioncash 0dfefacdf4 VertexLoaderBase: Collapse std namespace for hash and mark noexcept
Makes the hash specialization a little less noisy. Also we mark it
noexcept, since hashes shouldn't be throwing exceptions (and this can be
optimized on).
2024-01-31 12:43:00 -05:00
Lioncash 8e4b2565cd TextureConfig: Collapse std namespace for hash
Lets us collapse the namespacing and make the specialization a little
less noisy.
2024-01-31 12:41:33 -05:00
Lioncash b63dcd504d RenderState: Collapse std namespace for hash
We can specify the namespace on the hash to make the specialization a
little less noisy.
2024-01-31 12:40:10 -05:00
Lioncash 5bfaa3a966 NativeVertexFormat: Collapse std namespace and mark hash noexcept
We can just tag the std:: onto the end of the specialization to make it
less noisy.

Also mark it as noexcept, since hashes shouldn't throw exceptions.
2024-01-31 12:37:44 -05:00
Lioncash 40b050fe37 GraphicsModGroup: std::move graphics_mod in Load()
The config object is quite heavyweight, so we should move this instead
of copying.
2024-01-31 12:27:43 -05:00
Lioncash ccacda5e2c GraphicsModGroup: Simplify try_add_mod()
We can use contains() here, and also move the mod config if it's valid
instead of copying it, since it contains quite a bit of allocated data.
2024-01-31 12:23:21 -05:00
Lioncash a1879ea099 GraphicsModGroup: Allow heterogenous lookup for GetMod()
Allows using keys that aren't directly std::string as the key. This lets
us use std::string_view for the incoming path name, making it more
flexible with other string types.
2024-01-31 12:05:17 -05:00
Admiral H. Curtiss 9a3e770c23
Migrate SConfig::bWii to System. 2024-01-31 12:54:07 +01:00
TellowKrinkle b7a451fc87 VideoCommon: Post to analytics when bug is overridden 2024-01-28 23:24:23 -06:00
TellowKrinkle 99f0c3fa01 VideoCommon: Add ability for backends to override bugs 2024-01-28 23:24:22 -06:00
TellowKrinkle 463269f704 VideoBackends:Multiple: Split up BUG_BROKEN_SUBGROUP_OPS
We now use subgroup ops for more than just a minor performance optimization
2024-01-28 23:20:39 -06:00
Admiral H. Curtiss 8482a50154
Merge pull request #12530 from iwubcode/custom_shaders_compilation_fixes
VideoCommon: fix some issues when compiling custom shaders
2024-01-28 14:30:37 +01:00
Admiral H. Curtiss 4843705061
Merge pull request #12534 from iwubcode/custom-pipeline-refactor
VideoCommon: refactor the custom pipeline logic to be reusable
2024-01-28 14:28:23 +01:00
Admiral H. Curtiss c9715e7e7d
Merge pull request #12535 from iwubcode/vertexmanager_draw_refactor
VideoCommon: refactor drawing into its own function
2024-01-28 14:27:41 +01:00
JosJuice 990303a028
Merge pull request #12519 from lioncash/leak
PostProcessing: Don't potentially leak memory in BlitFromTexture()
2024-01-27 22:29:45 +01:00
iwubcode c34b3ae390 VideoCommon: refactor drawing into its own function 2024-01-27 14:45:34 -06:00
iwubcode 3e3967ff94 VideoCommon: refactor the custom pipeline logic in the graphics mod action into a separate class, so it is reusable 2024-01-27 00:12:49 -06:00
Admiral H. Curtiss c3652a7129
Merge pull request #12532 from lioncash/json
GraphicsMod/ShaderAsset: Lessen object churn a little bit
2024-01-26 18:52:52 +01:00
Mai a553308775
Merge pull request #12443 from iwubcode/custom_pipeline_action_material_cubemap
VideoCommon: update custom pipeline action to support a variety of texture samplers, support for materials, and more!
2024-01-26 12:39:37 -05:00
Lioncash 7a59ecc39d GraphicsTarget: Reduce object churn a little 2024-01-24 23:00:01 -05:00
Lioncash 1b7da37114 GraphicsTargetGroup: Reduce object churn a little 2024-01-24 22:52:58 -05:00
Lioncash 24f952c12b GraphicsModFeature: Reduce object churn a little 2024-01-24 22:48:53 -05:00
Lioncash 0385b40bd8 GraphicsModAsset: Reduce object churn a little 2024-01-24 22:47:22 -05:00
Lioncash 2253d9a95d GraphicsModGroup: Mark move constructor and assignment as noexcept
Allows containers to optimize off of std::move_if_noexcept
2024-01-24 22:41:30 -05:00
Lioncash 0327b11e0b GraphicsModGroup: Reduce object churn
We can emplace and move to avoid doing object copies.
2024-01-24 22:40:05 -05:00
Lioncash e3e20df185 GraphicsMod: Avoid some object churn
We have quite a bit of allocation churn going on here, so we can emplace
and move where appropriate to alleviate that a little.
2024-01-24 22:34:50 -05:00
Lioncash 7b6463ef1f ShaderAsset: Emplace value instances when possible in ToJson()
Constructs elements directly inside the container and also makes it
shorter to read in certain instances.
2024-01-24 18:47:44 -05:00
iwubcode cf081e839d VideoCommon: fix compilation error in pixel shaders when per-pixel lighting isn't set for custom shaders 2024-01-23 21:50:42 -06:00
iwubcode a8d45b8e55 VideoCommon: fix compilation error in uber pixel shaders when pixel shader lighting isn't set for custom shaders 2024-01-23 21:50:42 -06:00
iwubcode 7118fc5b7b VideoCommon: fix pixel shader compilation error that happens when uint output is defined 2024-01-23 21:50:42 -06:00
iwubcode a37fd83218 VideoCommon: fix uber shader pixel compilation error that happens when uint output is defined 2024-01-23 21:50:41 -06:00
iwubcode 3a688aa35e VideoCommon: add function to serialize MaterialAsset to json 2024-01-23 13:01:33 -06:00
Lioncash 5aeadb1ef8 PostProcessing: Don't potentially leak memory in BlitFromTexture()
All release() does is relinquish the pointer, rather than free the
memory associated with it.
2024-01-23 13:34:40 -05:00
Lioncash a3f9f2c7aa PostProcessing: Remove unnecessary get() calls in BlitFromTexture()
We can just use operator-> instead.
2024-01-23 13:34:16 -05:00