Commit Graph

128 Commits

Author SHA1 Message Date
Hyper
ab382deb04 video: fix profiler not revealing mouse cursor in fullscreen (#391) 2025-02-13 15:43:03 +03:00
Darío
3081aec7c1 Collect samples over one second for FPS counter and average. (#377) 2025-02-12 00:25:03 +00:00
Hyper
a07610fb7a Implemented FPS overlay (#361) 2025-02-11 15:15:28 +00:00
Darío
0194c372e9 Replace the default value when applying low end defaults so reset button works properly. (#359)
* Replace the default value when applying low end defaults so reset button works properly.

* Update video.cpp
2025-02-11 15:13:43 +03:00
Darío
0441845f2a Add Auto Graphics API option, add AMD driver workaround. (#358)
* Add Auto Graphics API option, add AMD driver workaround.

* Remove unused line.
2025-02-11 14:22:03 +03:00
Darío
f6d820faae GPU Profiling functionality. (#363)
* Added profiling timestamps to Vulkan. Added more profilers in general.

* Add timestamps to D3D12.

* Add update director to the profiler.

---------

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
2025-02-11 14:21:43 +03:00
Darío
d2a3818700 Add support for preferred device to configuration. (#355)
* Preferred device support.

* Add GraphicsDevice option and fix error in Config class to accept strings.

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2025-02-11 00:01:12 +03:00
Skyth (Asilkan)
7c1aea4e24 Fix the custom UI drawing in front of ImGui windows. (#335) 2025-02-09 14:25:06 +03:00
Darío
266d436c28 Block exit button from terminating the installer while it's in progress. (#300)
* Block exit button from terminating the installer while it's in progress.

* Fix quit prompt not appearing when closing the game from the taskbar.

---------

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
2025-02-07 01:21:18 +03:00
Skyth (Asilkan)
9549ba54aa Implement black bar drawing for loading and cutscenes. (#298) 2025-02-07 00:30:08 +03:00
Skyth (Asilkan)
96108e1759 Use a separate upload buffer allocator for the main thread. (#281) 2025-02-05 17:02:27 +03:00
Skyth
2d56566924 Remove the yield from the render thread. 2025-02-05 12:59:42 +03:00
Skyth (Asilkan)
11d0fd2f9c Implement rasterization path for framebuffer copy operations. (#270)
* Move all copies & resolves to rasterization.

* Fix Vulkan crash.

* Implement hardware resolve path for both color and depth targets.
2025-02-03 23:02:47 +03:00
Skyth (Asilkan)
aaad10d797 Implement copy bypass optimization. (#262)
* Initial work on copy bypass optimization.

* Force depth stencil textures to be transient.

* Get rid of texture copying for shadow maps.

* Move barrier populate function.

* Set viewport/scissor rect explicitly for MSAA depth resolve.
2025-02-02 21:29:47 +03:00
Darío
9d98d507b0 Add low-end defaults for low-end devices. (#252)
* Add low-end defaults for low-end devices. Uses either the reported type by the API or the VRAM.

* Update video.cpp

* Check for UMA flag on D3D12 to detect integrated GPUs.

* Display device type and UMA in inspector.

* Dynamic depth bias on F1.

---------

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
2025-01-31 22:43:23 +03:00
Darío
cd38776576 Update checker. (#251)
* Update checker.

* Fix build and enum class.

* Get rid of submodule for httplib.

* Get rid of submodule for curl.

* Minor style changes and fix video.cpp Linux build error.

* CTitleStateIntro_patches: implemented update message

* Update update_checker.cpp

* CTitleStateIntro_patches: fix fade out accepting input

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2025-01-31 16:47:15 +03:00
Darío
54d5588d79 Add fallback for creating other video backends. (#254)
* Add fallback for creating other video backends.

* Update video.cpp
2025-01-31 15:45:48 +03:00
Hyper
8cba851212 api: added globals struct 2025-01-31 02:35:00 +00:00
Skyth (Asilkan)
21c1d36836 Allow specifying all corners for ImGui gradients. (#247) 2025-01-30 23:25:19 +03:00
Hyper
93f120ae83 Implemented toggle light (#237)
* Implemented toggle light, moved common textures to imgui_utils

* Fix compilation error.
2025-01-29 14:52:45 +03:00
Skyth (Asilkan)
50529a95fc Make pipeline precompilation/recompilation part of the consumer thread queue. (#229) 2025-01-28 18:24:53 +03:00
Hyper
7b9b4245de SDL/HID fixes and clean-up (#224) 2025-01-28 00:38:46 +00:00
Skyth (Asilkan)
64a927615d Fix aspect ratio option sometimes crashing the game when changing it. (#218) 2025-01-27 23:47:34 +03:00
Skyth (Asilkan)
a9677084ea Fix faulty ImGui clip rect usage. (#211) 2025-01-27 01:24:05 +03:00
Skyth (Asilkan)
81d4390076 Fix ImGui mouse position events not working at boxed aspect ratios. (#205) 2025-01-26 17:23:29 +03:00
Skyth (Asilkan)
76ec5f032d Implement aspect ratio adjustments for inspire overlays. (#201)
* Handle texture/movie overlays for original 4:3.

* Implement aspect ratio adjustments for texture/movie overlays.

* Fix fade scale for original 4:3.
2025-01-26 13:19:39 +03:00
Skyth (Asilkan)
e88ed2502c Restore previous fade values after resizing. (#187) 2025-01-25 16:29:38 +03:00
Skyth (Asilkan)
372c04fedd Implement ImGui additive rendering. (#152) 2025-01-23 16:25:31 +03:00
Skyth (Asilkan)
4e149b0640 Implement proper post process scaling based on aspect ratio. (#148)
* Fix post process scaling for narrow aspect ratios.

* Compare width to pick gaussian blur quality for narrow aspect ratios.

* Account for world map disabling VERT+ for post process scaling.
2025-01-22 19:14:40 +03:00
Skyth (Asilkan)
1efb4943b3 Replace uses of SWA with UnleashedRecomp & rebrand the recompilers. (#138) 2025-01-19 23:21:05 +03:00
Skyth (Asilkan)
312f913a92 Remove detail namespaces. (#137) 2025-01-19 21:09:47 +03:00
Skyth (Asilkan)
40a8bf557b Scale 2D coordinates to backbuffer resolution. (#124)
* Starting with backbuffer scaling refactor.

* CSD & primitive 2Ds refactored.

* More refactoring.

* Fix primitive 2D, and on screen 3D items.

* Fix right side offset scaling.

* Fix Inspire letterbox.

* Fix offset scaling in world map.

* Fix custom menus.

* Remove debugging code.
2025-01-18 23:56:47 +03:00
Skyth
0b675628ea Fix compilation error on Linux. 2025-01-18 13:42:59 +03:00
Skyth
d3edee1945 Fix Vulkan dynamic depth bias validation error. 2025-01-18 12:58:02 +03:00
Skyth (Asilkan)
d56b823b00 Aspect ratio adjustments. (Part 1) (#90)
* Map CSD structures by full path.

* Initial work for unstretching & aligning to edges.

* Add extend flag, fix cast lookups.

* Add right extend flag.

* Fill the flags map with a bunch of casts.

* Implement unstretching.

* Set more title casts to unscretch.

* Add some more flags.

* Move CSD patches to its own file.

* Replace CSD vertex shaders to get rid of pixel snapping.

* Snap to pixel on the CPU.

* Current work trying to get 3D screen position casts working correctly.

* Fix and properly align font, handle most 3D screen positions.

* Add stretch flags for background casts.

* Use 4:3 as the base aspect ratio instead of 16:9.

* Replicate the game's 4:3 downscaling behavior.

* World map now identical to original 4:3.

* Replace camera aspect ratio/field of view logic.

* Make original 4:3 scaling a separate option, use custom behavior for auto.

* Keep UI scale same only above Steam Deck aspect ratio.

* Release paths when the YNCP file gets freed.

* Add more path flags.

* Interpolate to original 4:3 scale.

* Scaling animation offset to prevent offscreen casts from showing up in ultrawide.

* Queue draw calls without actually executing anything to extract the corner.

* Clean unnecessary hooks.

* Add result screen modifiers.

* Stretch loading primitive 2D.

* Scale DoF correctly at different aspect ratios.

* Remove stretch option.

* Make aspect ratio a global variable.

* Ultrawide patch for HUD 3D items.

* Fix world map 3D to 2D projection.

* Right align world map info box.

* Set medal positions.

* Respect center option in more places.

* Implement the aspect ratio option.

* Use viewport dimensions for snapping CSD pixels.

* Fix DoF fix not using viewport height.

* Implement aspect ratio patches for 2D drop ring emitter.

* Implement inspire letterbox.

* Add cutscene aspect ratio option.

* Shift subtitles by aspect ratio.

* Fix crash in earth restoration cutscenes.

* Offset scale patches for Tornado Defense.

* Scale new record arrow casts.

* Expose aspect ratio variables globally.

* Properly center the achievements menu.

* 4:3 scaling for options menu.

* Fix procedural filtering logic in ImGui pixel shader.

* Fix button guide offset.

* UI scaling for installer.

* Remove grid snaps in the installer.

* Handle center UI scale option for rings going to HUD.

* Remove unnecessary diff.

* Revert temporary changes.

* Fix typo.
2025-01-18 01:51:45 +03:00
Skyth (Asilkan)
064d0a1736 Async PSO improvements. (#80)
* Fix how planar reflections are handled & compile SDR pipelines for particles.

* Improve pipeline handling for particles.

* Recompile pipelines on option change.

* Fix counter logic for pipeline recompilation.

* Playing around with thread priorities.

* Prioritize loading for threading priorities.

* Compile pipelines in model consumer thread during boot sequence.

* Remove a good chunk of async pipelines from the cache.

* Remove even more async pipelines from the cache.

* Delete a few more async pipelines.

* Compile morph pipelines asynchronously.

* Remove morph pipelines from the cache.

* Implement dynamic depth bias.

* Add upreel/pulley shadow pipelines.

* Disable debug macros.

* Reduce depth bias function calls in D3D12.

* Compile instanced models asynchronously.

* Fix the logic for determining if depth bias is used.
2025-01-15 15:09:14 +03:00
Skyth
27a541b7a3 Place function table after the executable. 2025-01-15 02:01:59 +03:00
Skyth
30fded0685 Potential fix for async PSO freezing issue. 2025-01-13 01:10:52 +03:00
Hyper
e24fa84e16 options_menu: implemented Miles Electric transition 2025-01-02 22:07:27 +00:00
Skyth
967a0ce17f Combine guest memory and function table into one virtual allocation. 2025-01-02 14:46:31 +03:00
Skyth
038edfdebd Handle 32 bit index buffers when uploading data. 2025-01-02 13:44:42 +03:00
Skyth
281535ad51 Stub out buggy render game scene function. 2024-12-30 14:20:21 +03:00
Skyth
8f4f1ea33e Handle the anisotropic filtering option in config. 2024-12-26 16:13:21 +03:00
Skyth
0b5281d652 Prevent SDL events from getting flushed outside the main thread. 2024-12-25 22:15:01 +03:00
Skyth
b054e16461 Fix buffers getting copied with a closed command list. 2024-12-25 22:12:17 +03:00
Skyth (Asilkan)
fd009bcada Sync render thread present with main thread. (#62)
* Experimenting with syncing the render thread.

* Separate wait functions for swap chains.

* Sync render thread present to the main thread.

* Move present to main thread and frame limit after presenting.

* g_next -> s_next

* Fix Vulkan validation errors.

* Make max frame latency configurable.

* Fix loading thread breaking waitable swap chain order.
2024-12-25 16:29:15 +03:00
Dario
c1cafacf22 Add video driver to debugger panel. 2024-12-22 18:23:14 -03:00
Darío
02022c3a1d Do not default to Wayland, add CLI option for choosing SDL video driver. (#61) 2024-12-23 00:07:27 +03:00
Skyth (Asilkan)
f1416c85ba Implement frame limiter. (#60)
* Implement audio timing with integer math.

* Add busy loop to audio thread.

* Implement a frame limiter.

* Implement implot.

* Add more stuff to the profiler window.

* Redo frame limiter logic to fix drifting.

* Move frame limiter, add limiters for SFD & loading screen.

* Update waiting logic for audio thread.

* Correct small delta time errors.

* Decrease delta time error threshold.

* Set busy wait threshold to 2ms.

* Change spin wait in D3D12 present to infinite wait.

* Replace FPS literals with constants.
2024-12-22 19:58:06 +03:00
Skyth (Asilkan)
67633917bf Linux support. (#54)
* Initial Linux attempt.

* Add clang toolchain & make tools compile.

* vcpkg as submodule.

* First implementation of IO rewrite. (#31)

* Fix directory iteration resolving symlinks.

* Refactor kernel objects to be lock-free.

* Implement guest critical sections using std::atomic.

* Make D3D12 support optional. (#33)

* Make D3D12 support optional.

* Update ShaderRecomp, fix macros.

* Replace QueryPerformanceCounter. (#35)

* Add Linux home path for GetUserPath(). (#36)

* Cross-platform Sleep. (#37)

* Add mmap implementations for virtual allocation. (#38)

* Cross-platform TLS. (#34)

* Cross-platform TLS.

* Fix front() to back(), use Mutex.

* Fix global variable namings.

---------

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>

* Unicode support. (#39)

* Replace CreateDirectoryA with Unicode version.

* Cross platform thread implementation. (#41)

* Cross-platform thread implementation.

* Put set thread name calls behind a Win32 macro.

* Cross-platform semaphore implementation. (#43)

* xam: use SDL for keyboard input

* Cross-platform atomic operations. (#44)

* Cross-platform spin lock implementation.

* Cross-platform reference counting.

* Cross-platform event implementation. (#47)

* Compiling and running on Linux. (#49)

* Current work trying to get it to compile.

* Update vcpkg.json baseline.

* vcpkg, memory mapped file.

* Bitscan forward.

* Fix localtime_s.

* FPS patches high res clock.

* Rename Window to GameWindow. Fix guest pointers.

* GetCurrentThreadID gone.

* Code cache pointers, RenderWindow type.

* Add Linux stubs.

* Refactor Config.

* Fix paths.

* Add linux-release config.

* FS fixes.

* Fix Windows compilation errors & unicode converter crash.

* Rename physical memory allocation functions to not clash with X11.

* Fix NULL character being added on RtlMultiByteToUnicodeN.

* Use std::exit.

* Add protection to memory on Linux.

* Convert majority of dependencies to submodules. (#48)

* Convert majority of dependencies to submodules.

* Don't compile header-only libraries.

* Fix a few incorrect data types.

* Fix config directory.

* Unicode fixes & sizeof asserts.

* Change the exit function to not call static destructors.

* Fix files picker.

* Add RelWithDebInfo preset for Linux.

* Implement OS Restart on Linux. (#50)

---------

Co-authored-by: Dario <dariosamo@gmail.com>

* Update PowerRecomp.

* Add Env Var detection for VCPKG_ROOT, add DLC detection.

* Use error code version on DLC directory iterator.

* Set D3D12MA::ALLOCATOR_FLAG_DONT_PREFER_SMALL_BUFFERS_COMMITTED flag.

* Linux flatpak. (#51)

* Add flatpak support.

* Add game install directory override for flatpak.

* Flatpak'ing.

* Flatpak it some more.

* We flat it, we pak it.

* Flatpak'd.

* The Marvelous Misadventures of Flatpak.

* Attempt to change logic of NFD and show error.

* Flattenpakken.

* Use game install directory instead of current path.

* Attempt to fix line endings.

* Update io.github.hedge_dev.unleashedrecomp.json

* Fix system time query implementation.

* Add Present Wait to Vulkan to improve frame pacing and reduce latency. (#53)

* Add present wait support to Vulkan.

* Default to triple buffering if presentWait is supported.

* Bracey fellas.

* Update paths.h

* SDL2 audio (again). (#52)

* Implement SDL2 audio (again).

* Call timeBeginPeriod/timeEndPeriod.

* Replace miniaudio with SDL mixer.

* Queue audio samples in a separate thread.

* Enable CMake option override policy & fix compilation error.

* Fix compilation error on Linux.

* Fix but also trim shared strings.

* Wayland support. (#55)

* Make channel index a global variable in embedded player.

* Fix SDL Audio selection for OGG on Flatpak.

* Minor installer wizard fixes.

* Fix compilation error.

* Yield in model consumer and pipeline compiler threads.

* Special case Sleep(0) to yield on Linux.

* Add App Id hint.

* Correct implementation for auto reset events. (#57)

---------

Co-authored-by: Dario <dariosamo@gmail.com>
Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2024-12-21 00:44:05 +03:00