Commit graph

1468 commits

Author SHA1 Message Date
bunnei
0eacc362dd
Merge pull request #7272 from behunin/the-courteous-logger
Logging: Impl refactor
2021-11-13 00:03:54 -08:00
Morph
a41e9e93dd common: Implement a subset of P0323 (std::expected)
This implementation is based on and is a subset of the proposed implementation of std::expected
https://github.com/TartanLlama/expected/blob/master/include/tl/expected.hpp
2021-11-02 15:20:35 -04:00
Levi Behunin
d6b5f64484 Refactor Logging Impl
Loop on stop_token and remove final_entry in Entry.
Move Backend thread out of Impl Constructor to its own function.
Add Start function for backend thread.
Use stop token in PopWait and check if entry filename is nullptr before logging.
2021-11-01 18:36:27 -06:00
ameerj
1841f63a40 common/alignment: Fix VS2022 compilation
VS2022 seems to introduce an optimization when moving vectors to check for equality of the element values. AlignmentAllocator needed to overload the equality operator to fix compilation of its usage in vector moving.
2021-10-20 01:22:00 -04:00
ameerj
ef811c6425 settings: Remove std::chrono usage
Alleviates the dependency on chrono for all files that include settings.h
2021-10-17 00:37:49 -04:00
Morph
0d6057b2fa string_util: Make use of std::string_view and add bounds checking
Makes use of std::string_view in StringFromFixedZeroTerminatedBuffer and add bounds checking
2021-10-14 14:09:34 -04:00
Morph
3ffff78a27 string_util: Prevent out of bounds access in u16string_view buffer 2021-10-14 14:09:34 -04:00
Creak
0b8a7ca213
common/fs/path_util: Slightly refactor PathManagerImpl's constructor
This moves all GenerateYuzuPath calls outside of the platofrm-specific #ifdefs, replacing them with assignments to paths.
2021-10-11 21:56:25 -04:00
bunnei
5b2fa8dd41
Merge pull request #7115 from ameerj/log-compile
common/logging: Reduce dependent header include overhead
2021-10-05 10:05:46 -07:00
bunnei
3a33519598
Merge pull request #7102 from Morph1984/remove-boxcat
Remove Boxcat BCAT backend
2021-10-01 18:41:41 -07:00
ameerj
579f4ea4bd common/logging: Reduce scope of fmt include 2021-10-01 20:48:49 -04:00
ameerj
5daf3abe65 common/logging: Move Log::Entry declaration to a separate header
This reduces the load of requiring to include std::chrono in all files which include log.h
2021-10-01 20:48:49 -04:00
Andrew Strelsky
3fc7aceea7
Fixed invalid iterator usage 2021-09-29 06:58:48 -04:00
Morph
8af9f3216e settings: Remove BCAT settings 2021-09-29 01:24:21 -04:00
ameerj
73666fb262 general: Update style to clang-format-12 2021-09-24 15:52:05 -04:00
Lioncash
40314cc586 common/uuid: Add validity checking functions to interface
Given we have a function to invalidate, we should also have ones to
query the validity. Also makes the code more straightforward to read.
2021-09-22 17:59:00 -04:00
bunnei
a9c3619d26
Merge pull request #7019 from ameerj/videocore-jthread
videocore: Use std::jthread for worker threads
2021-09-18 20:37:40 -07:00
german77
33a1d790e8 input_common/tas: Document the main class 2021-09-18 23:22:48 +02:00
german77
e6c4bf52f0 input_common/tas: Add swap controller 2021-09-18 23:22:42 +02:00
MonsterDruide1
f078b15565 input_common/tas: Fallback to simple update 2021-09-18 23:22:30 +02:00
german77
c01a872c8e config: Move TAS options to it's own menu 2021-09-18 23:22:30 +02:00
MonsterDruide1
4297d2fea2 core: Hacky TAS syncing & load pausing
To keep the TAS inputs synced to the game speed even through lag spikes and loading zones, deeper access is required.

First, the `TAS::UpdateThread` has to be executed exactly once per frame. This is done by connecting it to the service method the game calls to pass parameters to the GPU: `Service::VI::QueueBuffer`.

Second, the loading time of new subareas and/or kingdoms (SMO) can vary. To counteract that, the `CPU_BOOST_MODE` can be detected: In the `APM`-interface, the call to enabling/disabling the boost mode can be caught and forwarded to the TASing system, which can pause the script execution if neccessary and enabled in the settings.
2021-09-18 23:22:20 +02:00
MonsterDruide1
f25d6ebc45 settings: File selector & other settings
First of all, TASing requires a script to play back. The user can select the parent directory at `System -> Filesystem`, next to an option to pause TAS during loads: This requires a "hacky" setup deeper in the code and will be added in the last commit.

Also, Hotkeys are being introduced: CTRL+F5 for playback start/stop, CTRL+F6 for re-reading the script and CTRL+F7 for recording a new script.
2021-09-18 23:22:11 +02:00
MonsterDruide1
b42c3ce21d input_common/tas: Base playback & recording system
The base playback system supports up to 8 controllers (specified by `PLAYER_NUMBER` in `tas_input.h`), which all change their inputs simulataneously when `TAS::UpdateThread` is called.

The recording system uses the controller debugger to read the state of the first controller and forwards that data to the TASing system for recording. Currently, this process sadly is not frame-perfect and pixel-accurate.

Co-authored-by: Naii-the-Baf <sfabian200@gmail.com>
Co-authored-by: Narr-the-Reg <juangerman-13@hotmail.com>
2021-09-18 23:22:00 +02:00
bunnei
35f46fc079
Merge pull request #7020 from Moonlacer/remove_audio_stretching
Remove audio stretching
2021-09-18 11:18:24 -07:00
bunnei
6d7801deb7
Merge pull request #6950 from german77/multiplay
input_common: Add advanced setting for 8 player support
2021-09-17 17:25:51 -07:00
Moonlacer
09ab819040 fix_accidental_deletion 2021-09-15 19:59:10 -05:00
Moonlacer
44135b011f remove-audio-stretching-setting 2021-09-15 19:52:43 -05:00
ameerj
c2ddda2f51 threadsafe_queue: Add std::stop_token overload to PopWait
Useful for jthreads which make use of the threadsafe queues.
2021-09-15 20:49:07 -04:00
Morph
3512cae623 common_funcs: Add enum flag bitwise shift operator overloads
This adds bitwise shift operator overloads (<<, >>, <<=, >>=) in the macro DECLARE_ENUM_FLAG_OPERATORS(type)
2021-09-13 16:01:20 -04:00
Morph
eb1e3f19bb common_funcs: Replace <algorithm> with <iterator> 2021-09-11 17:19:14 -04:00
Morph
290afc00d3 common: Move error handling to error.cpp/h
This allows us to avoid implicitly including <string> every time common_funcs.h is included.
2021-09-11 17:19:14 -04:00
Fernando S
be4e192903
Merge pull request #6846 from ameerj/nvdec-gpu-decode
nvdec: Add GPU video decoding for all capable drivers and platforms
2021-09-11 23:11:32 +02:00
german77
5798537ce4 input_common: Enable steam controllers and 8 player support 2021-09-10 00:58:12 -05:00
german77
c57e0b3b24 common/logging: Add missing include 2021-09-01 19:13:33 -05:00
bunnei
956171f024
Merge pull request #6897 from FernandoS27/pineapple-does-not-belong-in-pizza
Project <tentative title>: Rework Garbage Collection.
2021-08-31 09:11:21 -07:00
Fernando Sahmkow
ff48f06fb9 Garbage Collection: Adress Feedback. 2021-08-29 18:19:53 +02:00
Morph
7d2265b6a8
Merge pull request #6927 from german77/ngct
ngct: Stub NGCT:U service
2021-08-28 23:03:29 -04:00
Fernando Sahmkow
ba82bb359b Garbage Collection: enable as default, eliminate option. 2021-08-28 17:55:37 +02:00
Fernando Sahmkow
d540d284b5 VideoCore: Rework Garbage Collection. 2021-08-28 17:54:12 +02:00
german77
f134a5e56c ngct: Stub NGCT:U service 2021-08-27 14:15:34 -05:00
Morph
790a09bc93
Revert "logging: Display backtrace on crash" 2021-08-27 04:01:22 -04:00
bunnei
d10d480642
Merge pull request #6870 from yzct12345/trace-back-stack-back-stack-back
logging: Display backtrace on crash
2021-08-26 17:41:14 -07:00
ameerj
84b4ac5729 logging: Fix log filter during initialization
The log filter was being ignored on initialization due to the logging instance being initialized before the config instance, so the log filter was set to its default value.

This fixes that oversight, along with using descriptive exceptions instead of abort() calls.
2021-08-24 01:32:38 -04:00
bunnei
f65f8b9097
Merge pull request #6869 from yzct12345/shiny-logs-in-the-fireplace
logging: Simplify and make thread-safe
2021-08-22 20:40:18 -07:00
Morph
c4a1d3cbf4 settings: Amend language_index maximum setting range
The maximum is now 17 with the addition of Brazilian Portuguese
2021-08-21 09:43:15 -04:00
bunnei
455e28790a
Merge pull request #6877 from MerryMage/dyn-ignore-asserts
dynarmic: Update and enable DYNARMIC_IGNORE_ASSERTS
2021-08-19 15:53:14 -07:00
ameerj
cd016d3cb5 configure_graphics: Add GPU nvdec decoding as an option
Some system configurations may see visual regressions or lower performance using GPU decoding compared to CPU decoding. This setting provides the option for users to specify their decoding preference.

Co-Authored-By: yzct12345 <87620833+yzct12345@users.noreply.github.com>
2021-08-16 14:40:53 -04:00
Fernando S
521e6ac174
Merge pull request #6863 from spholz/fix-lan-play
Fix LAN Play
2021-08-16 17:10:00 +02:00
Merry
1770503185 xbyak: Update include path 2021-08-15 19:26:38 +01:00
yzct12345
0ba521e634
threadsafe_queue: Fix deadlock
This fixes a lost wakeup in SPSCQueue. If the reader is in just the right position, the writer's notification will be lost and this will be a problem if the writer then does something to wait on the reader.

This was discovered to affect my upcoming stacktrace PR. I don't think any performance decrease will be noticeable because an uncontended mutex is smart enough to skip the syscall. This PR might also resolve some rare deadlocks but I don't know of any examples.
2021-08-13 19:22:51 +00:00
yzct12345
81ed54d13e
logging: Display backtrace on crash
This implements backtraces so we don't have to tell users how to use gdb anymore.

This prints a backtrace after abort or segfault is detected. It also fixes the log getting cut off with the last line containing only a bracket. This change lets us know what caused a crash not just what happened the few seconds before it.

I only know how to add support for Linux with GCC. Also this doesn't work outside of C/C++ such as in dynarmic or certain parts of graphics drivers. The good thing is that it'll try and just crash again but the stack frames are still there so the core dump will work just like before.
2021-08-13 18:58:35 +00:00
yzct12345
001675dced
logging: Simplify and make thread-safe
This simplifies the logging system.

This also fixes some lost messages on startup.

The simplification is simple. I removed unused functions and moved most things in the .h to the .cpp. I replaced the unnecessary linked list with its contents laid out as three member variables. Anything that went through the linked list now directly accesses the backends. Generic functions are replaced with those for each specific use case and there aren't many. This change increases coupling but we gain back more KISS and encapsulation.

With those changes it was easy to make it thread-safe. I just removed the mutex and turned a boolean atomic. I was planning to use this thread-safety in my next PR about stacktraces. It was actually async-signal-safety at first but I ended up using a different approach. Anyway getting rid of the linked list is important for that because have the list of backends constantly changing complicates things.
2021-08-13 18:39:45 +00:00
spholz
78a8249593
Merge branch 'yuzu-emu:master' into fix-lan-play 2021-08-12 22:27:17 +02:00
spholz
1e98e73828 configuration: add option to select network interface
This commit renames the "Services" tab to "Network" and adds a combobox that allows the user to select the network interface that yuzu should use. This new setting is now used to get the local IP address in Network::GetHostIPv4Address. This prevents yuzu from selecting the wrong network interface and thus using the wrong IP address. The return type of Network::GetHostIPv4Adress has also been changed.
2021-08-12 21:32:53 +02:00
lat9nq
5be2d6fd28 settings: Fix MSVC issues
According to https://stackoverflow.com/questions/469508, we run into a
MSVC bug (since VS 2005) when using diamond inheritance for
RangedSetting.

This explicitly implements those functions in RangedSetting. GetValue is
implemented as just calling the inherited version. The explicit
converson operator is reimplemented. I opted for this over ignoring the
warning with a pragma since this specifies the inherited behavior, and I
have now less faith in MSVC to pick the right one.

In addition, we mark destructors as virtual to silence what I believe is
a fair MSVC compilation error.
2021-08-11 17:12:14 -04:00
bunnei
e6b80c2cf8
Merge pull request #6776 from lat9nq/ranged-settings
settings: Implement settings ranges
2021-08-10 21:19:01 -07:00
bunnei
63325cafbe
Merge pull request #6827 from Morph1984/uuid-hash
common: uuid: Add hash function for UUID
2021-08-07 17:18:46 -07:00
bunnei
42d8e08f78
Merge pull request #6822 from yzct12345/clion-assert
assert: Avoid empty macros
2021-08-05 22:29:45 -07:00
Morph
d20c5ac720 common: uuid: Add hash function for UUID
Used when UUID is a key in an unordered_map. The hash is produced by XORing the high and low 64-bits of the UUID together.
2021-08-06 00:41:55 -04:00
bunnei
e1a92db519
Merge pull request #6813 from Morph1984/hex-string-to-uuid
common: uuid: Add hex string to UUID constructor
2021-08-05 13:29:11 -07:00
yzct12345
7e846be376
assert: Verify formatting 2021-08-05 17:46:22 +00:00
yzct12345
346149dcf9
assert: Avoid empty macros 2021-08-05 17:21:56 +00:00
Morph
7b39215c8a hex_util: Fix incorrect array size in AsArray
Although this isn't used, this is a potential bug as HexStringToArray will perform an out-of-bounds read.
2021-08-04 22:16:29 -04:00
Morph
705f111058 common: uuid: Add hex string to UUID constructor
This allows for easily converting a hex string into a Common::UUID, which is backed by a 128 bit unsigned integer.
2021-08-04 10:45:41 -04:00
lat9nq
3862511a9a settings: Use std::clamp where possible
Addresses PR review

Co-authored-by: PixelyIon <pixelyion@protonmail.com>
2021-07-31 17:20:12 -04:00
lat9nq
e9cf08c241 settings: Remove unnecessary std::move usages
Addresses review feedback.

Co-authored-by: Mai M. <mathew1800@gmail.com>
2021-07-30 18:44:50 -04:00
bunnei
7530594602
Merge pull request #6759 from ReinUsesLisp/pipeline-statistics
renderer_vulkan: Add setting to log pipeline statistics
2021-07-30 11:18:52 -07:00
lat9nq
7737bdfd1a settings: Fix function virtualization
Fixes a theoretical scenario where a Setting is using the BasicSetting's
GetValue function. In practice this probably only happens on yuzu-cmd,
where there is no need for a Setting's additional features. Need to fix
regardless.
2021-07-30 13:33:35 -04:00
lat9nq
a1f19b61f8 settings: Implement setting ranges
Clamps the setting's values against the specified minimum and maximum
values.
2021-07-30 13:33:21 -04:00
bunnei
5acf020389
Merge pull request #6742 from Morph1984/uuid
common: uuid: Return a lower-case hex string in Format
2021-07-29 09:37:15 -07:00
bunnei
f771d92e44
Merge pull request #6758 from jbeich/fastmem
host_memory: enable fastmem on FreeBSD
2021-07-28 13:01:54 -07:00
bunnei
d05e6003f0
Merge pull request #6700 from lat9nq/fullscreen-enum
general: Implement FullscreenMode enumeration
2021-07-28 11:36:42 -07:00
ReinUsesLisp
3b006f4fe2 renderer_vulkan: Add setting to log pipeline statistics
Use VK_KHR_pipeline_executable_properties when enabled and available to
log statistics about the pipeline cache in a game.

For example, this is on Turing GPUs when generating a pipeline cache
from Super Smash Bros. Ultimate:

Average pipeline statistics
==========================================
Code size:       6433.167
Register count:    32.939

More advanced results could be presented, at the moment it's just an
average of all 3D and compute pipelines.
2021-07-27 21:29:24 -03:00
Jan Beich
353be2306c host_memory: Add workaround for FreeBSD 12
src/common/host_memory.cpp:360:14: error: use of undeclared identifier
      'memfd_create'
        fd = memfd_create("HostMemory", 0);
             ^
2021-07-27 20:15:23 +00:00
Jan Beich
c4cd82fa7c host_memory: Enable Linux implementation on FreeBSD
HW.Memory <Critical> common/host_memory.cpp:HostMemory:492: Fastmem unavailable, falling back to VirtualBuffer for memory allocation
2021-07-27 20:09:43 +00:00
Morph
f5f04cce01 common: fs: fs_util: Add BufferToUTF8String
Allows for direct conversion to std::string without having to convert std::u8string to std::string
2021-07-27 00:02:22 -04:00
Morph
b9b48aee7d common: uuid: Return a lower-case hex string in Format 2021-07-26 23:54:59 -04:00
bunnei
d6c799494c
Merge pull request #6696 from ameerj/speed-limit-rename
general: Rename "Frame Limit" references to "Speed Limit"
2021-07-26 18:51:00 -07:00
bunnei
c09557acd8
Merge pull request #6697 from ameerj/fps-cap
config, nvflinger: Add FPS cap setting
2021-07-25 16:23:44 -07:00
lat9nq
09d6cc9943
Merge branch 'master' into fullscreen-enum 2021-07-25 15:31:33 -04:00
bunnei
98b26b6e12
Merge pull request #6585 from ameerj/hades
Shader Decompiler Rewrite
2021-07-25 11:39:04 -07:00
ameerj
9dfbc9bdce general: Rename "Frame Limit" references to "Speed Limit"
This setting is best referred to as a speed limit, as it involves the limits of all timing based aspects of the emulator, not only framerate.
This allows us to differentiate it from the fps unlocker setting.
2021-07-23 22:10:01 -04:00
ameerj
2c6e274b39 config, nvflinger: Add FPS cap setting
Allows finer tuning of the FPS limit.
2021-07-23 22:04:36 -04:00
lat9nq
b11c81cc13 general: Implement FullscreenMode enumeration
Prevents us from using an unclear 0 or 1 to describe the fullscreen
mode.
2021-07-23 10:14:37 -04:00
lat9nq
eb61824ea5 common: Publically link to pthreads
Common requires pthreads but does not refer to it when linking to other
modules. Fix this by linking to Threads where necessary.
2021-07-23 09:47:52 -04:00
ReinUsesLisp
4a82450c81 cmake: Remove shader cache version 2021-07-22 21:51:40 -04:00
lat9nq
1152d66ddd general: Add setting shader_backend
GLASM is getting good enough that we can move it out of advanced
graphics settings. This removes the setting `use_assembly_shaders`,
opting for a enum class `shader_backend`. This comes with the benefits
that it is extensible for additional shader backends besides GLSL and
GLASM, and this will work better with a QComboBox.

Qt removes the related assembly shader setting from the Advanced
Graphics section and places it as a new QComboBox in the API Settings
group. This will replace the Vulkan device selector when OpenGL is
selected.

Additionally, mark all of the custom anisotropic filtering settings as
"WILL BREAK THINGS", as that is the case with a select few games.
2021-07-22 21:51:39 -04:00
ReinUsesLisp
61cd7dd301 shader: Add logging 2021-07-22 21:51:35 -04:00
lat9nq
373f75d944 shader: Add shader loop safety check settings
Also add a setting for enable Nsight Aftermath.
2021-07-22 21:51:35 -04:00
lat9nq
0bb85f6a75 shader_recompiler,video_core: Cleanup some GCC and Clang errors
Mostly fixing unused *, implicit conversion, braced scalar init,
fpermissive, and some others.

Some Clang errors likely remain in video_core, and std::ranges is still
a pertinent issue in shader_recompiler

shader_recompiler: cmake: Force bracket depth to 1024 on Clang
Increases the maximum fold expression depth

thread_worker: Include condition_variable

Don't use list initializers in control flow

Co-authored-by: ReinUsesLisp <reinuseslisp@airmail.cc>
2021-07-22 21:51:26 -04:00
ReinUsesLisp
c67d64365a shader: Remove old shader management 2021-07-22 21:51:22 -04:00
ameerj
75059c46d6 thread_worker: Fix compile time error
state is unused in the branch where with_state is false
2021-07-22 21:51:21 -04:00
Chloe Marcec
75e9d3b992 uuid: Directly compare UUID instead of checking per element
We can now update this for C++20
2021-07-21 02:36:57 +10:00
german77
14d5202da6 input_common: Fix mouse panning behaivour 2021-07-16 18:57:29 -05:00
bunnei
3cd3230295
Merge pull request #6579 from ameerj/float-settings
settings: Eliminate usage of float-point setting values
2021-07-15 18:03:11 -04:00
Morph
1bfe950acb
Merge pull request #6576 from ameerj/unlock-fps-setting
settings: Disable FPS unlimit setting between title launches
2021-07-11 13:59:06 -04:00
ameerj
58219d1f36 settings: Disable FPS unlimit setting between title launches
Some titles crash if the FPS limit is disabled when launching. This change ensures that titles launch with the limit in-place to avoid issues.
In order to simplify the change, the UI toggle was removed as it will always be overridden at launch to be disabled.
The setting can still be toggled during gameplay with the hotkey, and indicated by the fps label in the status bar.
2021-07-10 15:11:17 -04:00
Fernando S
7dca756f30
Merge pull request #6573 from lat9nq/cpu-settings-cleanup-2
core,common,yuzu qt: Add CPU accuracy option 'Auto'
2021-07-09 21:45:45 +02:00
ameerj
0ed1077763 configure_input: Use u8 for mouse sensitivity 2021-07-08 23:24:31 -04:00