Compare commits
493 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3ebfd2481 | |||
| e8a025b4f8 | |||
| f82efe9f65 | |||
| e5c2ec223a | |||
| dbcdb3523b | |||
| 1e398e6c36 | |||
| 55d740fffa | |||
| f6c5507873 | |||
| de7c92d7c4 | |||
| f35c14fb73 | |||
| c1a8a508bc | |||
| 9d4a2de72b | |||
| 5693434b8a | |||
| 47c5c37bed | |||
| a540d248f3 | |||
| bbb6b58aa4 | |||
| 736a31e4ff | |||
| 6060685609 | |||
| 5b85925469 | |||
| 033aa264cf | |||
| 9087fe10e9 | |||
| 6e54615b16 | |||
| c4bfbc6d25 | |||
| e9069dfe76 | |||
| 2be751100b | |||
| ac531aa15f | |||
| 29c7176f55 | |||
| 122435e080 | |||
| 856838f7ce | |||
| 9c739f1506 | |||
| 075d73f076 | |||
| 021e503cc8 | |||
| 1805de0301 | |||
| 9367769fe7 | |||
| a22c5a3880 | |||
| cd0ded7771 | |||
| 351079a4ba | |||
| 62bcb99ba8 | |||
| 13e4ceb990 | |||
| bb94beed15 | |||
| 6e10a0c130 | |||
| e42b4a16b6 | |||
| 182221b9ff | |||
| 2643ea80df | |||
| f94186d3c3 | |||
| bf08bc3c0f | |||
| 871e7cacf6 | |||
| 2fe922aae5 | |||
| ceb65c259a | |||
| 67fd1df762 | |||
| b7f60e9123 | |||
| 3ec027400e | |||
| 42e1db4b0e | |||
| 1968cc7b10 | |||
| a386003b64 | |||
| b3691fc33c | |||
| 7944f271dc | |||
| 5890b96ce5 | |||
| 1f14b58315 | |||
| 3f048770d3 | |||
| cb1487d774 | |||
| 8a214e5530 | |||
| 15ec8d3e44 | |||
| a4362765a6 | |||
| e1838f51a3 | |||
| 97bd6d6418 | |||
| 40f3e2fbf1 | |||
| b70a205a96 | |||
| 3d8eca92f9 | |||
| d6d60f7104 | |||
| bdb7c11d8e | |||
| 8f605b542c | |||
| 2688fb1aa2 | |||
| d100de27ee | |||
| cf023aa8ec | |||
| 7eb17f3aa5 | |||
| 8014dd8259 | |||
| 2df19ef0fd | |||
| 016c6feb49 | |||
| 36c302fa32 | |||
| 6f90dff293 | |||
| ab0c0a469c | |||
| 92da86290c | |||
| 0f4f18265f | |||
| c6cac2ffaa | |||
| 5792a72c29 | |||
| e58090c9c7 | |||
| ed98afdebc | |||
| e46074a2e3 | |||
| 0c5bdc7241 | |||
| cb49c3b64c | |||
| 35862b21d6 | |||
| 4366a21eae | |||
| 1166ca3a57 | |||
| 6fed48b3a4 | |||
| f36b5dfd18 | |||
| 91695a453b | |||
| 55c77dd25b | |||
| 6ed6e6e18e | |||
| 725aacb4bc | |||
| 3547248ec2 | |||
| 82188b2f79 | |||
| 5467d39bc3 | |||
| 27ff00acb1 | |||
| f1b770a8f0 | |||
| 9c9b4616c3 | |||
| e7b6389e44 | |||
| a13fd5f7cc | |||
| 9b771bcb8f | |||
| 94151097b9 | |||
| ca6bf06ef7 | |||
| f017335fef | |||
| f764223f93 | |||
| 46e835f2d6 | |||
| bb2e407772 | |||
| 0a6bd8b236 | |||
| 432d754d7d | |||
| 740c349820 | |||
| 8df3aed2f1 | |||
| 16939b1a6e | |||
| 60d54d911e | |||
| e2b81ae5fe | |||
| b095a0242d | |||
| 2506594c50 | |||
| 7d5683c63c | |||
| 055ee84024 | |||
| ae59ffc56c | |||
| 1c13c74295 | |||
| a71498d163 | |||
| a661c547d8 | |||
| 737e1ca101 | |||
| 87a9be8dec | |||
| ffeb5cdd8d | |||
| 3ba95402fd | |||
| 8dd3baa562 | |||
| daf7936095 | |||
| 627022bef9 | |||
| f3fcc15ad5 | |||
| 35e7f36a39 | |||
| d82cad3fb3 | |||
| cd2981ee12 | |||
| 0c0f5b7ccc | |||
| a546ecbb12 | |||
| 952b271092 | |||
| a090a380be | |||
| cbd79df233 | |||
| c6c11c1553 | |||
| 2528cf7c54 | |||
| 6b973c5986 | |||
| 40f062f749 | |||
| 29a56496bf | |||
| 41a103c0fc | |||
| 66ed1c1872 | |||
| 6f0929df82 | |||
| d1dd54cbfa | |||
| 8f43b05d6b | |||
| f902cc2a2b | |||
| 451b1bba26 | |||
| 494cc992eb | |||
| f603dc9763 | |||
| 4df49631de | |||
| e1c74cea10 | |||
| f7292c776b | |||
| 2007d0e4a0 | |||
| f403d27941 | |||
| 1d7abac84b | |||
| 50791cb974 | |||
| 2ad9acf795 | |||
| 47938541c2 | |||
| 1f079d9566 | |||
| 3f4315e4c6 | |||
| d6f565e5da | |||
| 7ec66db22c | |||
| 2feb40f14d | |||
| 2cd9e1ecb6 | |||
| b566c98258 | |||
| 689f9a75a7 | |||
| b143ce8134 | |||
| 1b5c87ab6a | |||
| 2afaa7aed7 | |||
| fe57f39676 | |||
| 4bc5469f52 | |||
| f8d31d1ae1 | |||
| fff6155bc3 | |||
| 80480fe3f7 | |||
| ed4553806a | |||
| f2d3212de9 | |||
| a16c261131 | |||
| 58d1c7c77a | |||
| 56c9730a16 | |||
| e3a2ca96bd | |||
| 3fbee093b2 | |||
| cb092af3f0 | |||
| 2f15876524 | |||
| 9a7c172f76 | |||
| 5e16fe4579 | |||
| e4dc73f61e | |||
| 9bf19b04f6 | |||
| 47cd0586ee | |||
| 2311fa7c84 | |||
| 00d76fc5f5 | |||
| a3fa64fcc4 | |||
| e29ced29fa | |||
| 7e76c1642c | |||
| fca72beb2d | |||
| eb7c2314f6 | |||
| 4da4ecb1ff | |||
| 3346de365a | |||
| d600183583 | |||
| 0f1ff5f34e | |||
| d0e6eafe23 | |||
| 74d203fbe3 | |||
| 7ffc42c397 | |||
| 4e14b64bfc | |||
| 0cfeb2e8d7 | |||
| 79e32127b3 | |||
| 799579c8d2 | |||
| 3e7af5fbd7 | |||
| 34d0d94df0 | |||
| 55a33342cc | |||
| 70a97fb5c7 | |||
| e3fb9b5e00 | |||
| e0895a8581 | |||
| 07694609fb | |||
| 307371e01d | |||
| 00800d5289 | |||
| 60c4032b68 | |||
| 101c0df79c | |||
| e37e1d24f9 | |||
| c0e5ecc399 | |||
| 54b4c84ab6 | |||
| 4f77275cd5 | |||
| 47b80da906 | |||
| baf4d1c22e | |||
| add4f82c33 | |||
| abb785f269 | |||
| 8908663f12 | |||
| 82b78cde73 | |||
| fe91066f46 | |||
| 780240e697 | |||
| 25c4ae6e11 | |||
| 6aaa8acff9 | |||
| 455a736250 | |||
| 0afb9631b5 | |||
| bbdfe1fab1 | |||
| ff386e794b | |||
| a9623d5f55 | |||
| d2ae39bf4b | |||
| 756f013d8a | |||
| 9c94faaa2b | |||
| 6775a6ee02 | |||
| 1ab052952d | |||
| b2772bcb0d | |||
| ff4fbaf152 | |||
| 986336b0d8 | |||
| 2ddecb9631 | |||
| 0730dc6c44 | |||
| 083d913eab | |||
| ff2089fdf5 | |||
| b000af0054 | |||
| fbf0a9c976 | |||
| 11edba4974 | |||
| 8e84381038 | |||
| e446f368d7 | |||
| 668eb5b8da | |||
| 8bdc51b620 | |||
| 9efd95cda5 | |||
| 9c96d40586 | |||
| 40efd2ab56 | |||
| c68b4bee2c | |||
| cdc846677c | |||
| 981bc8aa1c | |||
| e1bce50d8b | |||
| 27c33ab73f | |||
| d2cfe25b07 | |||
| 530fe24768 | |||
| 237934b736 | |||
| ea5dd02db9 | |||
| fbbf532d42 | |||
| c2c7386dfd | |||
| 2fbadc7e1f | |||
| 0661f5ccd1 | |||
| 3b30f5d823 | |||
| d8fc3f403b | |||
| 8da1a4ea22 | |||
| 8802646730 | |||
| 1476ffd865 | |||
| 568d523746 | |||
| 7017f04ee8 | |||
| 4b508655a4 | |||
| 49f6deecb8 | |||
| f09d192aac | |||
| 9971cd1d55 | |||
| c4f5615c6b | |||
| 50a59487eb | |||
| 950db851ea | |||
| 09da9da6fb | |||
| 6892a0942f | |||
| f38ae8e953 | |||
| cfb9672093 | |||
| 462c430c8b | |||
| 5a2dff87bf | |||
| 7a8a7545f2 | |||
| abe2ad7aac | |||
| 877e8991c7 | |||
| 032e5b983c | |||
| 41d99aa89d | |||
| ac3927074b | |||
| c41a4baf06 | |||
| 6adaa0d5e2 | |||
| fb49ec19c1 | |||
| 197d756560 | |||
| 8c56481249 | |||
| 6ff4bf9b1c | |||
| dba86ee007 | |||
| 407dc917f1 | |||
| 15d573194c | |||
| f28ca5361f | |||
| 306840a580 | |||
| 3d4c113037 | |||
| 230d118252 | |||
| b9b1318bea | |||
| 43d909949e | |||
| 00d401d639 | |||
| 0e7e98e24e | |||
| 0eb3fa05e5 | |||
| 889454f9bf | |||
| 8bcaa8c2e4 | |||
| c95baf92ce | |||
| a7651168dd | |||
| 075a3d1172 | |||
| 6d76a54d37 | |||
| a04061e6ae | |||
| 7187732454 | |||
| 5031f5b8b0 | |||
| da83afdeaf | |||
| 026fe2e4f4 | |||
| 0c7149d222 | |||
| 11ffbee5ae | |||
| 05f26e1337 | |||
| 4c678cfbc8 | |||
| 8870fae674 | |||
| 8348c41eab | |||
| 638044820d | |||
| 1f952f6ac9 | |||
| 96b8a3ecac | |||
| c352381ce9 | |||
| 9775a73d1a | |||
| 088c434d65 | |||
| 9863db9db4 | |||
| 6bfb4c8f71 | |||
| ac6cbb7134 | |||
| 641783df8f | |||
| c0b9e93b77 | |||
| 9368e17a92 | |||
| 91fd4e30f2 | |||
| 57f1d8ef8d | |||
| d1b53c8d82 | |||
| 7322c99e5f | |||
| 467adc1acd | |||
| 0483dfae1a | |||
| 8d1f5bfbd2 | |||
| fdf90c6d75 | |||
| 097c25b164 | |||
| d24ab14126 | |||
| 54c359d1e3 | |||
| 3f261f22c9 | |||
| 600f325d87 | |||
| 44f10c8dee | |||
| 4e42ba54e5 | |||
| d155167ea2 | |||
| e090a1c6bd | |||
| e8af3f29d2 | |||
| 49643d8134 | |||
| 92c89312fc | |||
| e0bd27b674 | |||
| 103380134f | |||
| 021af4fd00 | |||
| c8ad039612 | |||
| 8d5cde6eff | |||
| ec4e2d1fab | |||
| b5c0c1e163 | |||
| 03137086db | |||
| 4562f7af9a | |||
| f3f57f90fe | |||
| b5d61f214d | |||
| 3cf88a4d6c | |||
| 67560296c6 | |||
| d72d753b1a | |||
| a3ffea6a64 | |||
| b014fdacdb | |||
| 1073346c7f | |||
| 3053a62375 | |||
| d718eab351 | |||
| c27a626b5b | |||
| 6f9918552c | |||
| dcd13a7566 | |||
| 757aafa582 | |||
| 1776448df2 | |||
| 9a9e5844d3 | |||
| 64dcb40db1 | |||
| ba4213d956 | |||
| d45ac00d48 | |||
| 484641003c | |||
| a7792e5ff8 | |||
| 268942c8fe | |||
| 6b9cc0ed23 | |||
| 1d0fe75e7c | |||
| 6d61430311 | |||
| b210174087 | |||
| e6349fcd3b | |||
| f7e6bda5cd | |||
| 31f0fa1065 | |||
| 3bd29fb66b | |||
| 859fb469b8 | |||
| c161e3f433 | |||
| 8a501ff30b | |||
| 97704b8da9 | |||
| 1f57ae6949 | |||
| f01540da6c | |||
| 54711df739 | |||
| 644ee0043e | |||
| fdae95efaa | |||
| 8a3411b417 | |||
| 376a414f5b | |||
| 026eaddbee | |||
| 3453beb1e0 | |||
| 194cf0b497 | |||
| bff1453282 | |||
| 7e353082ac | |||
| 7fffdf83b7 | |||
| 1ed49f92dd | |||
| bd09c82521 | |||
| ce8f4da638 | |||
| a7fb80e612 | |||
| 44518b225c | |||
| 1f98634371 | |||
| b4b3454d9b | |||
| 104cb6aa0a | |||
| 99d763888f | |||
| ec6ee04c64 | |||
| 97f7f7bad5 | |||
| c4ba088a5d | |||
| 96bd7ea42d | |||
| 367e89f984 | |||
| 9f9b64cda2 | |||
| 4165ac0680 | |||
| 62711fec02 | |||
| 0746a2084e | |||
| 809148e1a5 | |||
| 65be230fdd | |||
| 4a1aa98598 | |||
| 97f7a560f3 | |||
| da11c40849 | |||
| 6efd335eda | |||
| 1346b14bef | |||
| 304d6e9870 | |||
| 57fd8b1f45 | |||
| 7b8a5413ad | |||
| b44527a259 | |||
| 0245c5dc49 | |||
| a78a475815 | |||
| 22432668be | |||
| 50575c317e | |||
| 5f2cbf53d7 | |||
| c38bb96a2c | |||
| 71ca956d5c | |||
| 2b4ba90329 | |||
| ff11fdb07e | |||
| 26c1edf2f0 | |||
| c50a930bbb | |||
| 60688bf0d5 | |||
| 2ce5bb9bd6 | |||
| 833afb7ce3 | |||
| 290ec3eb2f | |||
| d5bfc36e90 | |||
| 5eeadde3c8 | |||
| cfd69e2e58 | |||
| 5e4ea04a64 | |||
| 39ca7b2928 | |||
| 975186ad4d | |||
| de4e5db330 | |||
| ca8a804a3c | |||
| 739a81055f | |||
| 673accd630 | |||
| db2785082b | |||
| 9477181d09 | |||
| 2bf9602e83 | |||
| 72e5552409 | |||
| 87749d217e | |||
| 6e0a33089b | |||
| a936972614 | |||
| 23151ff498 |
@@ -22,6 +22,7 @@ cmake .. \
|
||||
-DUSE_DISCORD_PRESENCE=ON \
|
||||
-DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
|
||||
-DYUZU_USE_BUNDLED_FFMPEG=ON \
|
||||
-DYUZU_ENABLE_LTO=ON \
|
||||
-GNinja
|
||||
|
||||
ninja
|
||||
|
||||
@@ -40,7 +40,7 @@ def parse_imports(file_name):
|
||||
|
||||
def parse_imports_recursive(file_name, path_list=[]):
|
||||
q = queue.Queue() # create a FIFO queue
|
||||
# file_name can be a string or a list for the convience
|
||||
# file_name can be a string or a list for the convenience
|
||||
if isinstance(file_name, str):
|
||||
q.put(file_name)
|
||||
elif isinstance(file_name, list):
|
||||
|
||||
@@ -9,7 +9,7 @@ parameters:
|
||||
steps:
|
||||
- script: choco install vulkan-sdk
|
||||
displayName: 'Install vulkan-sdk'
|
||||
- script: refreshenv && mkdir build && cd build && cmake -E env CXXFLAGS="/Gw /GA /Gr /Ob2" cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_CRASH_DUMPS=ON .. && cd ..
|
||||
- script: refreshenv && mkdir build && cd build && cmake -E env CXXFLAGS="/Gw /GA /Gr /Ob2" cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DYUZU_ENABLE_LTO=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_CRASH_DUMPS=ON .. && cd ..
|
||||
displayName: 'Configure CMake'
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
; SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
; SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[codespell]
|
||||
skip = ./.git,./build,./dist,./Doxyfile,./externals,./LICENSES
|
||||
ignore-words-list = aci,allright,ba,deques,froms,hda,inout,lod,masia,nam,nax,nd,pullrequests,pullrequest,te,transfered,unstall,uscaled,zink
|
||||
@@ -0,0 +1,17 @@
|
||||
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# GitHub Action to automate the identification of common misspellings in text files.
|
||||
# https://github.com/codespell-project/actions-codespell
|
||||
# https://github.com/codespell-project/codespell
|
||||
name: codespell
|
||||
on: pull_request
|
||||
permissions: {}
|
||||
jobs:
|
||||
codespell:
|
||||
name: Check for spelling errors
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: codespell-project/actions-codespell@master
|
||||
@@ -13,9 +13,6 @@
|
||||
[submodule "dynarmic"]
|
||||
path = externals/dynarmic
|
||||
url = https://github.com/MerryMage/dynarmic.git
|
||||
[submodule "libressl"]
|
||||
path = externals/libressl
|
||||
url = https://github.com/citra-emu/ext-libressl-portable.git
|
||||
[submodule "libusb"]
|
||||
path = externals/libusb/libusb
|
||||
url = https://github.com/libusb/libusb.git
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
path_classifiers:
|
||||
library: "externals"
|
||||
extraction:
|
||||
cpp:
|
||||
prepare:
|
||||
packages:
|
||||
- "libsdl2-dev"
|
||||
- "qtmultimedia5-dev"
|
||||
- "libtbb-dev"
|
||||
- "libjack-jackd2-dev"
|
||||
+15
-34
@@ -56,6 +56,8 @@ option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
|
||||
|
||||
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON)
|
||||
|
||||
option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF)
|
||||
|
||||
if (YUZU_USE_BUNDLED_VCPKG)
|
||||
@@ -65,6 +67,9 @@ if (YUZU_USE_BUNDLED_VCPKG)
|
||||
if (YUZU_CRASH_DUMPS)
|
||||
list(APPEND VCPKG_MANIFEST_FEATURES "dbghelp")
|
||||
endif()
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
list(APPEND VCPKG_MANIFEST_FEATURES "web-service")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/externals/vcpkg/scripts/buildsystems/vcpkg.cmake)
|
||||
elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "")
|
||||
@@ -205,10 +210,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||
# =======================================================================
|
||||
|
||||
# Enforce the search mode of non-required packages for better and shorter failure messages
|
||||
find_package(Boost 1.79.0 REQUIRED context)
|
||||
find_package(enet 1.3 MODULE)
|
||||
find_package(fmt 9 REQUIRED)
|
||||
find_package(inih MODULE)
|
||||
find_package(LLVM MODULE)
|
||||
find_package(inih 52 MODULE COMPONENTS INIReader)
|
||||
find_package(LLVM MODULE COMPONENTS Demangle)
|
||||
find_package(lz4 REQUIRED)
|
||||
find_package(nlohmann_json 3.8 REQUIRED)
|
||||
find_package(Opus 1.3 MODULE)
|
||||
@@ -216,7 +222,7 @@ find_package(ZLIB 1.2 REQUIRED)
|
||||
find_package(zstd 1.5 REQUIRED)
|
||||
|
||||
if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS)
|
||||
find_package(Vulkan 1.3.238 REQUIRED)
|
||||
find_package(Vulkan 1.3.246 REQUIRED)
|
||||
endif()
|
||||
|
||||
if (ENABLE_LIBUSB)
|
||||
@@ -241,26 +247,13 @@ endif()
|
||||
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
find_package(cpp-jwt 1.4 CONFIG)
|
||||
find_package(httplib 0.12 MODULE)
|
||||
find_package(httplib 0.12 MODULE COMPONENTS OpenSSL)
|
||||
endif()
|
||||
|
||||
if (YUZU_TESTS)
|
||||
find_package(Catch2 3.0.1 REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Boost 1.73.0 COMPONENTS context)
|
||||
if (Boost_FOUND)
|
||||
set(Boost_LIBRARIES Boost::boost)
|
||||
# Conditionally add Boost::context only if the found Boost package provides it
|
||||
# The old version is missing Boost::context, so we want to avoid adding in that case
|
||||
# The new version requires adding Boost::context to prevent linking issues
|
||||
if (TARGET Boost::context)
|
||||
list(APPEND Boost_LIBRARIES Boost::context)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Boost 1.73.0 or newer not found")
|
||||
endif()
|
||||
|
||||
# boost:asio has functions that require AcceptEx et al
|
||||
if (MINGW)
|
||||
find_library(MSWSOCK_LIBRARY mswsock REQUIRED)
|
||||
@@ -351,12 +344,12 @@ if(ENABLE_QT)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(QT_DEP_GLU QUIET glu>=9.0.0)
|
||||
if (NOT QT_DEP_GLU_FOUND)
|
||||
message(FATAL_ERROR "Qt bundled pacakge dependency `glu` not found. \
|
||||
message(FATAL_ERROR "Qt bundled package dependency `glu` not found. \
|
||||
Perhaps `libglu1-mesa-dev` needs to be installed?")
|
||||
endif()
|
||||
pkg_check_modules(QT_DEP_MESA QUIET dri>=20.0.8)
|
||||
if (NOT QT_DEP_MESA_FOUND)
|
||||
message(FATAL_ERROR "Qt bundled pacakge dependency `dri` not found. \
|
||||
message(FATAL_ERROR "Qt bundled package dependency `dri` not found. \
|
||||
Perhaps `mesa-common-dev` needs to be installed?")
|
||||
endif()
|
||||
|
||||
@@ -457,14 +450,6 @@ if (ENABLE_SDL2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Reexport some targets that are named differently when using the upstream CmakeConfig
|
||||
# In order to ALIAS targets to a new name, they first need to be IMPORTED_GLOBAL
|
||||
# Dynarmic checks for target `boost` and so we want to make sure it can find it through our system instead of using their external
|
||||
if (TARGET Boost::boost)
|
||||
set_target_properties(Boost::boost PROPERTIES IMPORTED_GLOBAL TRUE)
|
||||
add_library(boost ALIAS Boost::boost)
|
||||
endif()
|
||||
|
||||
# List of all FFmpeg components required
|
||||
set(FFmpeg_COMPONENTS
|
||||
avcodec
|
||||
@@ -492,8 +477,8 @@ if (APPLE)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||
elseif (WIN32)
|
||||
# WSAPoll and SHGetKnownFolderPath (AppData/Roaming) didn't exist before WinNT 6.x (Vista)
|
||||
add_definitions(-D_WIN32_WINNT=0x0600 -DWINVER=0x0600)
|
||||
# Target Windows 10
|
||||
add_definitions(-D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00)
|
||||
set(PLATFORM_LIBRARIES winmm ws2_32 iphlpapi)
|
||||
if (MINGW)
|
||||
# PSAPI is the Process Status API
|
||||
@@ -580,11 +565,7 @@ function(create_target_directory_groups target_name)
|
||||
endfunction()
|
||||
|
||||
# Prevent boost from linking against libs when building
|
||||
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY
|
||||
-DBOOST_SYSTEM_NO_LIB
|
||||
-DBOOST_DATE_TIME_NO_LIB
|
||||
-DBOOST_REGEX_NO_LIB
|
||||
)
|
||||
target_link_libraries(Boost::headers INTERFACE Boost::disable_autolinking)
|
||||
# Adjustments for MSVC + Ninja
|
||||
if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
add_compile_options(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# FFmpeg_LIBRARIES: aggregate all the paths to the libraries
|
||||
# FFmpeg_FOUND: True if all components have been found
|
||||
#
|
||||
# This module defines the following targets, which are prefered over variables:
|
||||
# This module defines the following targets, which are preferred over variables:
|
||||
#
|
||||
# FFmpeg::<component>: Target to use <component> directly, with include path,
|
||||
# library and dependencies set up. If you are using a static build, you are
|
||||
|
||||
@@ -2,15 +2,25 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
find_package(LLVM QUIET CONFIG)
|
||||
find_package(LLVM QUIET COMPONENTS CONFIG)
|
||||
if (LLVM_FOUND)
|
||||
separate_arguments(LLVM_DEFINITIONS)
|
||||
if (LLVMDemangle IN_LIST LLVM_AVAILABLE_LIBS)
|
||||
set(LLVM_Demangle_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LLVM CONFIG_MODE)
|
||||
find_package_handle_standard_args(LLVM HANDLE_COMPONENTS CONFIG_MODE)
|
||||
|
||||
if (LLVM_FOUND AND NOT TARGET LLVM::Demangle)
|
||||
if (LLVM_FOUND AND LLVM_Demangle_FOUND AND NOT TARGET LLVM::Demangle)
|
||||
add_library(LLVM::Demangle INTERFACE IMPORTED)
|
||||
llvm_map_components_to_libnames(LLVM_LIBRARIES demangle)
|
||||
target_compile_definitions(LLVM::Demangle INTERFACE ${LLVM_DEFINITIONS})
|
||||
target_include_directories(LLVM::Demangle INTERFACE ${LLVM_INCLUDE_DIRS})
|
||||
# prefer shared LLVM: https://github.com/llvm/llvm-project/issues/34593
|
||||
# but use ugly hack because llvm_config doesn't support interface library
|
||||
add_library(_dummy_lib SHARED EXCLUDE_FROM_ALL src/yuzu/main.cpp)
|
||||
llvm_config(_dummy_lib USE_SHARED demangle)
|
||||
get_target_property(LLVM_LIBRARIES _dummy_lib LINK_LIBRARIES)
|
||||
target_link_libraries(LLVM::Demangle INTERFACE ${LLVM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
@@ -6,13 +6,23 @@ include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(httplib QUIET CONFIG)
|
||||
if (httplib_CONSIDERED_CONFIGS)
|
||||
find_package_handle_standard_args(httplib CONFIG_MODE)
|
||||
find_package_handle_standard_args(httplib HANDLE_COMPONENTS CONFIG_MODE)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(HTTPLIB QUIET IMPORTED_TARGET cpp-httplib)
|
||||
if ("-DCPPHTTPLIB_OPENSSL_SUPPORT" IN_LIST HTTPLIB_CFLAGS_OTHER)
|
||||
set(httplib_OpenSSL_FOUND TRUE)
|
||||
endif()
|
||||
if ("-DCPPHTTPLIB_ZLIB_SUPPORT" IN_LIST HTTPLIB_CFLAGS_OTHER)
|
||||
set(httplib_ZLIB_FOUND TRUE)
|
||||
endif()
|
||||
if ("-DCPPHTTPLIB_BROTLI_SUPPORT" IN_LIST HTTPLIB_CFLAGS_OTHER)
|
||||
set(httplib_Brotli_FOUND TRUE)
|
||||
endif()
|
||||
find_package_handle_standard_args(httplib
|
||||
REQUIRED_VARS HTTPLIB_INCLUDEDIR
|
||||
VERSION_VAR HTTPLIB_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,14 +3,25 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(INIREADER QUIET IMPORTED_TARGET INIReader)
|
||||
pkg_search_module(INIH QUIET IMPORTED_TARGET inih)
|
||||
if (INIReader IN_LIST inih_FIND_COMPONENTS)
|
||||
pkg_search_module(INIREADER QUIET IMPORTED_TARGET INIReader)
|
||||
if (INIREADER_FOUND)
|
||||
set(inih_INIReader_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(inih
|
||||
REQUIRED_VARS INIREADER_LINK_LIBRARIES
|
||||
VERSION_VAR INIREADER_VERSION
|
||||
REQUIRED_VARS INIH_LINK_LIBRARIES
|
||||
VERSION_VAR INIH_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
)
|
||||
|
||||
if (inih_FOUND AND NOT TARGET inih::INIReader)
|
||||
if (inih_FOUND AND NOT TARGET inih::inih)
|
||||
add_library(inih::inih ALIAS PkgConfig::INIH)
|
||||
endif()
|
||||
|
||||
if (inih_FOUND AND inih_INIReader_FOUND AND NOT TARGET inih::INIReader)
|
||||
add_library(inih::INIReader ALIAS PkgConfig::INIREADER)
|
||||
endif()
|
||||
|
||||
@@ -83,5 +83,3 @@ If you wish to support us a different way, please join our [Discord](https://dis
|
||||
## License
|
||||
|
||||
yuzu is licensed under the GPLv3 (or any later version). Refer to the [LICENSE.txt](https://github.com/yuzu-emu/yuzu/blob/master/LICENSE.txt) file.
|
||||
|
||||
The [Skyline-Emulator Team](https://github.com/skyline-emu/skyline) may choose to use the code from these contributors under the GPL-3.0-or-later OR MPL-2.0: [FernandoS27](https://github.com/FernandoS27), [lioncash](https://github.com/lioncash), [bunnei](https://github.com/bunnei), [ReinUsesLisp](https://github.com/ReinUsesLisp), [Morph1984](https://github.com/Morph1984), [ogniK5377](https://github.com/ogniK5377), [german77](https://github.com/german77), [ameerj](https://github.com/ameerj), [Kelebek1](https://github.com/Kelebek1) and [lat9nq](https://github.com/lat9nq)
|
||||
|
||||
Vendored
+543
-493
File diff suppressed because it is too large
Load Diff
Vendored
+543
-493
File diff suppressed because it is too large
Load Diff
Vendored
+542
-492
File diff suppressed because it is too large
Load Diff
Vendored
+545
-495
File diff suppressed because it is too large
Load Diff
Vendored
+543
-493
File diff suppressed because it is too large
Load Diff
Vendored
+561
-511
File diff suppressed because it is too large
Load Diff
Vendored
+594
-544
File diff suppressed because it is too large
Load Diff
Vendored
+541
-491
File diff suppressed because it is too large
Load Diff
Vendored
+586
-536
File diff suppressed because it is too large
Load Diff
Vendored
+628
-574
File diff suppressed because it is too large
Load Diff
Vendored
+544
-494
File diff suppressed because it is too large
Load Diff
Vendored
+543
-493
File diff suppressed because it is too large
Load Diff
Vendored
+1544
-1452
File diff suppressed because it is too large
Load Diff
Vendored
+544
-494
File diff suppressed because it is too large
Load Diff
Vendored
+764
-708
File diff suppressed because it is too large
Load Diff
Vendored
+765
-709
File diff suppressed because it is too large
Load Diff
Vendored
+673
-580
File diff suppressed because it is too large
Load Diff
Vendored
+576
-526
File diff suppressed because it is too large
Load Diff
Vendored
+544
-494
File diff suppressed because it is too large
Load Diff
Vendored
+579
-523
File diff suppressed because it is too large
Load Diff
Vendored
+548
-498
File diff suppressed because it is too large
Load Diff
Vendored
+544
-494
File diff suppressed because it is too large
Load Diff
Vendored
-6
@@ -36,12 +36,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
||||
<application>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
<trustInfo
|
||||
|
||||
Vendored
+6
-31
@@ -102,41 +102,16 @@ add_subdirectory(sirit EXCLUDE_FROM_ALL)
|
||||
|
||||
# httplib
|
||||
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
|
||||
if (NOT WIN32)
|
||||
find_package(OpenSSL 1.1)
|
||||
if (OPENSSL_FOUND)
|
||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32 OR NOT OPENSSL_FOUND)
|
||||
# LibreSSL
|
||||
set(LIBRESSL_SKIP_INSTALL ON)
|
||||
set(OPENSSLDIR "/etc/ssl/")
|
||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||
target_include_directories(ssl INTERFACE ./libressl/include)
|
||||
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
||||
get_directory_property(OPENSSL_LIBRARIES
|
||||
DIRECTORY libressl
|
||||
DEFINITION OPENSSL_LIBS)
|
||||
endif()
|
||||
|
||||
add_library(httplib INTERFACE)
|
||||
target_include_directories(httplib INTERFACE ./cpp-httplib)
|
||||
target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
||||
if (WIN32)
|
||||
target_link_libraries(httplib INTERFACE crypt32 cryptui ws2_32)
|
||||
endif()
|
||||
add_library(httplib::httplib ALIAS httplib)
|
||||
set(HTTPLIB_REQUIRE_OPENSSL ON)
|
||||
add_subdirectory(cpp-httplib EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
# cpp-jwt
|
||||
if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt)
|
||||
add_library(cpp-jwt INTERFACE)
|
||||
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
|
||||
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
|
||||
add_library(cpp-jwt::cpp-jwt ALIAS cpp-jwt)
|
||||
set(CPP_JWT_BUILD_EXAMPLES OFF)
|
||||
set(CPP_JWT_BUILD_TESTS OFF)
|
||||
set(CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF)
|
||||
add_subdirectory(cpp-jwt EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
# Opus
|
||||
|
||||
Vendored
+1
-1
Submodule externals/Vulkan-Headers updated: 00671c64ba...63af1cf1ee
Vendored
+1
-1
Submodule externals/cubeb updated: 75d9d125ee...48689ae7a7
Vendored
+1
-1
Submodule externals/dynarmic updated: 165621a872...7da378033a
Vendored
-1
Submodule externals/libressl deleted from 8929f818fd
Vendored
+1
-1
Submodule externals/vcpkg updated: 9b22b40c6c...a7b6122f6b
+15
-1
@@ -83,7 +83,7 @@ if (MSVC)
|
||||
)
|
||||
|
||||
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
|
||||
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cachable format
|
||||
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
|
||||
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
|
||||
add_compile_options(/Z7)
|
||||
else()
|
||||
@@ -113,6 +113,9 @@ else()
|
||||
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wno-braced-scalar-init>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wno-unused-private-field>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Werror=shadow-uncaptured-local>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Werror=implicit-fallthrough>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Werror=type-limits>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-braced-scalar-init>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-unused-private-field>
|
||||
)
|
||||
@@ -126,6 +129,17 @@ else()
|
||||
add_compile_options("-stdlib=libc++")
|
||||
endif()
|
||||
|
||||
# GCC bugs
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# These diagnostics would be great if they worked, but are just completely broken
|
||||
# and produce bogus errors on external libraries like fmt.
|
||||
add_compile_options(
|
||||
-Wno-array-bounds
|
||||
-Wno-stringop-overread
|
||||
-Wno-stringop-overflow
|
||||
)
|
||||
endif()
|
||||
|
||||
# Set file offset size to 64 bits.
|
||||
#
|
||||
# On modern Unixes, this is typically already the case. The lone exception is
|
||||
|
||||
@@ -20,7 +20,7 @@ Manager::Manager(Core::System& system_) : system{system_} {
|
||||
Result Manager::AcquireSessionId(size_t& session_id) {
|
||||
if (num_free_sessions == 0) {
|
||||
LOG_ERROR(Service_Audio, "All 4 AudioIn sessions are in use, cannot create any more");
|
||||
return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
|
||||
return Service::Audio::ResultOutOfSessions;
|
||||
}
|
||||
session_id = session_ids[next_session_id];
|
||||
next_session_id = (next_session_id + 1) % MaxInSessions;
|
||||
|
||||
@@ -19,7 +19,7 @@ void AudioManager::Shutdown() {
|
||||
|
||||
Result AudioManager::SetOutManager(BufferEventFunc buffer_func) {
|
||||
if (!running) {
|
||||
return Service::Audio::ERR_OPERATION_FAILED;
|
||||
return Service::Audio::ResultOperationFailed;
|
||||
}
|
||||
|
||||
std::scoped_lock l{lock};
|
||||
@@ -35,7 +35,7 @@ Result AudioManager::SetOutManager(BufferEventFunc buffer_func) {
|
||||
|
||||
Result AudioManager::SetInManager(BufferEventFunc buffer_func) {
|
||||
if (!running) {
|
||||
return Service::Audio::ERR_OPERATION_FAILED;
|
||||
return Service::Audio::ResultOperationFailed;
|
||||
}
|
||||
|
||||
std::scoped_lock l{lock};
|
||||
|
||||
@@ -19,7 +19,7 @@ Manager::Manager(Core::System& system_) : system{system_} {
|
||||
Result Manager::AcquireSessionId(size_t& session_id) {
|
||||
if (num_free_sessions == 0) {
|
||||
LOG_ERROR(Service_Audio, "All 12 Audio Out sessions are in use, cannot create any more");
|
||||
return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
|
||||
return Service::Audio::ResultOutOfSessions;
|
||||
}
|
||||
session_id = session_ids[next_session_id];
|
||||
next_session_id = (next_session_id + 1) % MaxOutSessions;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
* Get a list of audio out device names.
|
||||
*
|
||||
* @oaram names - Output container to write names to.
|
||||
* @param names - Output container to write names to.
|
||||
* @return Number of names written.
|
||||
*/
|
||||
u32 GetAudioOutDeviceNames(
|
||||
|
||||
@@ -28,7 +28,7 @@ SystemManager& Manager::GetSystemManager() {
|
||||
Result Manager::GetWorkBufferSize(const AudioRendererParameterInternal& params,
|
||||
u64& out_count) const {
|
||||
if (!CheckValidRevision(params.revision)) {
|
||||
return Service::Audio::ERR_INVALID_REVISION;
|
||||
return Service::Audio::ResultInvalidRevision;
|
||||
}
|
||||
|
||||
out_count = System::GetWorkBufferSize(params);
|
||||
|
||||
@@ -16,7 +16,7 @@ struct AudioBuffer {
|
||||
s64 played_timestamp;
|
||||
/// Game memory address for these samples.
|
||||
VAddr samples;
|
||||
/// Unqiue identifier for this buffer.
|
||||
/// Unique identifier for this buffer.
|
||||
u64 tag;
|
||||
/// Size of the samples buffer.
|
||||
u64 size;
|
||||
|
||||
@@ -93,7 +93,7 @@ void DeviceSession::AppendBuffers(std::span<const AudioBuffer> buffers) const {
|
||||
stream->AppendBuffer(new_buffer, samples);
|
||||
} else {
|
||||
std::vector<s16> samples(buffer.size / sizeof(s16));
|
||||
system.Memory().ReadBlockUnsafe(buffer.samples, samples.data(), buffer.size);
|
||||
system.ApplicationMemory().ReadBlockUnsafe(buffer.samples, samples.data(), buffer.size);
|
||||
stream->AppendBuffer(new_buffer, samples);
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void DeviceSession::AppendBuffers(std::span<const AudioBuffer> buffers) const {
|
||||
void DeviceSession::ReleaseBuffer(const AudioBuffer& buffer) const {
|
||||
if (type == Sink::StreamType::In) {
|
||||
auto samples{stream->ReleaseBuffer(buffer.size / sizeof(s16))};
|
||||
system.Memory().WriteBlockUnsafe(buffer.samples, samples.data(), buffer.size);
|
||||
system.ApplicationMemory().WriteBlockUnsafe(buffer.samples, samples.data(), buffer.size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,8 +121,7 @@ u64 DeviceSession::GetPlayedSampleCount() const {
|
||||
}
|
||||
|
||||
std::optional<std::chrono::nanoseconds> DeviceSession::ThreadFunc() {
|
||||
// Add 5ms of samples at a 48K sample rate.
|
||||
played_sample_count += 48'000 * INCREMENT_TIME / 1s;
|
||||
played_sample_count = stream->GetExpectedPlayedSampleCount();
|
||||
if (type == Sink::StreamType::Out) {
|
||||
system.AudioCore().GetAudioManager().SetEvent(Event::Type::AudioOutManager, true);
|
||||
} else {
|
||||
|
||||
@@ -46,7 +46,7 @@ Result In::AppendBuffer(const AudioInBuffer& buffer, u64 tag) {
|
||||
if (system.AppendBuffer(buffer, tag)) {
|
||||
return ResultSuccess;
|
||||
}
|
||||
return Service::Audio::ERR_BUFFER_COUNT_EXCEEDED;
|
||||
return Service::Audio::ResultBufferCountReached;
|
||||
}
|
||||
|
||||
void In::ReleaseAndRegisterBuffers() {
|
||||
|
||||
@@ -45,11 +45,11 @@ Result System::IsConfigValid(const std::string_view device_name,
|
||||
const AudioInParameter& in_params) const {
|
||||
if ((device_name.size() > 0) &&
|
||||
(device_name != GetDefaultDeviceName() && device_name != GetDefaultUacDeviceName())) {
|
||||
return Service::Audio::ERR_INVALID_DEVICE_NAME;
|
||||
return Service::Audio::ResultNotFound;
|
||||
}
|
||||
|
||||
if (in_params.sample_rate != TargetSampleRate && in_params.sample_rate > 0) {
|
||||
return Service::Audio::ERR_INVALID_SAMPLE_RATE;
|
||||
return Service::Audio::ResultInvalidSampleRate;
|
||||
}
|
||||
|
||||
return ResultSuccess;
|
||||
@@ -80,7 +80,7 @@ Result System::Initialize(std::string device_name, const AudioInParameter& in_pa
|
||||
|
||||
Result System::Start() {
|
||||
if (state != State::Stopped) {
|
||||
return Service::Audio::ERR_OPERATION_FAILED;
|
||||
return Service::Audio::ResultOperationFailed;
|
||||
}
|
||||
|
||||
session->Initialize(name, sample_format, channel_count, session_id, handle,
|
||||
|
||||
@@ -46,7 +46,7 @@ Result Out::AppendBuffer(const AudioOutBuffer& buffer, const u64 tag) {
|
||||
if (system.AppendBuffer(buffer, tag)) {
|
||||
return ResultSuccess;
|
||||
}
|
||||
return Service::Audio::ERR_BUFFER_COUNT_EXCEEDED;
|
||||
return Service::Audio::ResultBufferCountReached;
|
||||
}
|
||||
|
||||
void Out::ReleaseAndRegisterBuffers() {
|
||||
|
||||
@@ -33,11 +33,11 @@ std::string_view System::GetDefaultOutputDeviceName() const {
|
||||
Result System::IsConfigValid(std::string_view device_name,
|
||||
const AudioOutParameter& in_params) const {
|
||||
if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) {
|
||||
return Service::Audio::ERR_INVALID_DEVICE_NAME;
|
||||
return Service::Audio::ResultNotFound;
|
||||
}
|
||||
|
||||
if (in_params.sample_rate != TargetSampleRate && in_params.sample_rate > 0) {
|
||||
return Service::Audio::ERR_INVALID_SAMPLE_RATE;
|
||||
return Service::Audio::ResultInvalidSampleRate;
|
||||
}
|
||||
|
||||
if (in_params.channel_count == 0 || in_params.channel_count == 2 ||
|
||||
@@ -45,7 +45,7 @@ Result System::IsConfigValid(std::string_view device_name,
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
return Service::Audio::ERR_INVALID_CHANNEL_COUNT;
|
||||
return Service::Audio::ResultInvalidChannelCount;
|
||||
}
|
||||
|
||||
Result System::Initialize(std::string device_name, const AudioOutParameter& in_params, u32 handle_,
|
||||
@@ -80,7 +80,7 @@ size_t System::GetSessionId() const {
|
||||
|
||||
Result System::Start() {
|
||||
if (state != State::Stopped) {
|
||||
return Service::Audio::ERR_OPERATION_FAILED;
|
||||
return Service::Audio::ResultOperationFailed;
|
||||
}
|
||||
|
||||
session->Initialize(name, sample_format, channel_count, session_id, handle,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace AudioCore::AudioRenderer::ADSP {
|
||||
|
||||
ADSP::ADSP(Core::System& system_, Sink::Sink& sink_)
|
||||
: system{system_}, memory{system.Memory()}, sink{sink_} {}
|
||||
: system{system_}, memory{system.ApplicationMemory()}, sink{sink_} {}
|
||||
|
||||
ADSP::~ADSP() {
|
||||
ClearCommandBuffers();
|
||||
|
||||
@@ -135,7 +135,7 @@ void AudioRenderer::ThreadFunc() {
|
||||
static constexpr char name[]{"AudioRenderer"};
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
|
||||
if (mailbox->ADSPWaitMessage() != RenderMessage::AudioRenderer_InitializeOK) {
|
||||
LOG_ERROR(Service_Audio,
|
||||
"ADSP Audio Renderer -- Failed to receive initialize message from host!");
|
||||
@@ -165,7 +165,7 @@ void AudioRenderer::ThreadFunc() {
|
||||
// Check this buffer is valid, as it may not be used.
|
||||
if (command_buffer.buffer != 0) {
|
||||
// If there are no remaining commands (from the previous list),
|
||||
// this is a new command list, initalize it.
|
||||
// this is a new command list, initialize it.
|
||||
if (command_buffer.remaining_command_count == 0) {
|
||||
command_list_processor.Initialize(system, command_buffer.buffer,
|
||||
command_buffer.size, streams[index]);
|
||||
@@ -189,6 +189,8 @@ void AudioRenderer::ThreadFunc() {
|
||||
max_time = std::min(command_buffer.time_limit, max_time);
|
||||
command_list_processor.SetProcessTimeMax(max_time);
|
||||
|
||||
streams[index]->WaitFreeSpace();
|
||||
|
||||
// Process the command list
|
||||
{
|
||||
MICROPROFILE_SCOPE(Audio_Renderer);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "audio_core/renderer/adsp/command_buffer.h"
|
||||
#include "audio_core/renderer/adsp/command_list_processor.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/polyfill_thread.h"
|
||||
#include "common/reader_writer_queue.h"
|
||||
#include "common/thread.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AudioCore::AudioRenderer::ADSP {
|
||||
void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size,
|
||||
Sink::SinkStream* stream_) {
|
||||
system = &system_;
|
||||
memory = &system->Memory();
|
||||
memory = &system->ApplicationMemory();
|
||||
stream = stream_;
|
||||
header = reinterpret_cast<CommandListHeader*>(buffer);
|
||||
commands = reinterpret_cast<u8*>(buffer + sizeof(CommandListHeader));
|
||||
|
||||
@@ -22,7 +22,7 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params,
|
||||
if (!manager.AddSystem(system)) {
|
||||
LOG_ERROR(Service_Audio,
|
||||
"Both Audio Render sessions are in use, cannot create any more");
|
||||
return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
|
||||
return Service::Audio::ResultOutOfSessions;
|
||||
}
|
||||
system_registered = true;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
/**
|
||||
* Check if a variadic command buffer is supported.
|
||||
* As of Rev 5 with the added optional performance metric logging, the command
|
||||
* buffer can be a variable size, so take that into account for calcualting its size.
|
||||
* buffer can be a variable size, so take that into account for calculating its size.
|
||||
*
|
||||
* @return True if supported, otherwise false.
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ Result InfoUpdater::UpdateVoiceChannelResources(VoiceContext& voice_context) {
|
||||
LOG_ERROR(Service_Audio,
|
||||
"Consumed an incorrect voice resource size, header size={}, consumed={}",
|
||||
in_header->voice_resources_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += consumed_input_size;
|
||||
@@ -123,7 +123,7 @@ Result InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
||||
if (consumed_input_size != in_header->voices_size) {
|
||||
LOG_ERROR(Service_Audio, "Consumed an incorrect voices size, header size={}, consumed={}",
|
||||
in_header->voices_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
out_header->voices_size = consumed_output_size;
|
||||
@@ -184,7 +184,7 @@ Result InfoUpdater::UpdateEffectsVersion1(EffectContext& effect_context, const b
|
||||
if (consumed_input_size != in_header->effects_size) {
|
||||
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
|
||||
in_header->effects_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
out_header->effects_size = consumed_output_size;
|
||||
@@ -239,7 +239,7 @@ Result InfoUpdater::UpdateEffectsVersion2(EffectContext& effect_context, const b
|
||||
if (consumed_input_size != in_header->effects_size) {
|
||||
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
|
||||
in_header->effects_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
out_header->effects_size = consumed_output_size;
|
||||
@@ -267,7 +267,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||
}
|
||||
|
||||
if (mix_buffer_count == 0) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
std::span<const MixInfo::InParameter> in_params{
|
||||
@@ -281,13 +281,13 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||
total_buffer_count += params.buffer_count;
|
||||
if (params.dest_mix_id > static_cast<s32>(mix_context.GetCount()) &&
|
||||
params.dest_mix_id != UnusedMixId && params.mix_id != FinalMixId) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (total_buffer_count > mix_buffer_count) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
bool mix_dirty{false};
|
||||
@@ -317,7 +317,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||
if (mix_dirty) {
|
||||
if (behaviour.IsSplitterSupported() && splitter_context.UsingSplitter()) {
|
||||
if (!mix_context.TSortInfo(splitter_context)) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
} else {
|
||||
mix_context.SortInfo();
|
||||
@@ -327,7 +327,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
||||
if (consumed_input_size != in_header->mix_size) {
|
||||
LOG_ERROR(Service_Audio, "Consumed an incorrect mixes size, header size={}, consumed={}",
|
||||
in_header->mix_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += mix_count * sizeof(MixInfo::InParameter);
|
||||
@@ -384,7 +384,7 @@ Result InfoUpdater::UpdateSinks(SinkContext& sink_context, std::span<MemoryPoolI
|
||||
if (consumed_input_size != in_header->sinks_size) {
|
||||
LOG_ERROR(Service_Audio, "Consumed an incorrect sinks size, header size={}, consumed={}",
|
||||
in_header->sinks_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += consumed_input_size;
|
||||
@@ -411,7 +411,7 @@ Result InfoUpdater::UpdateMemoryPools(std::span<MemoryPoolInfo> memory_pools,
|
||||
state != MemoryPoolInfo::ResultState::MapFailed &&
|
||||
state != MemoryPoolInfo::ResultState::InUse) {
|
||||
LOG_WARNING(Service_Audio, "Invalid ResultState from updating memory pools");
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ Result InfoUpdater::UpdateMemoryPools(std::span<MemoryPoolInfo> memory_pools,
|
||||
LOG_ERROR(Service_Audio,
|
||||
"Consumed an incorrect memory pool size, header size={}, consumed={}",
|
||||
in_header->memory_pool_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += consumed_input_size;
|
||||
@@ -453,7 +453,7 @@ Result InfoUpdater::UpdatePerformanceBuffer(std::span<u8> performance_output,
|
||||
LOG_ERROR(Service_Audio,
|
||||
"Consumed an incorrect performance size, header size={}, consumed={}",
|
||||
in_header->performance_buffer_size, consumed_input_size);
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += consumed_input_size;
|
||||
@@ -467,18 +467,18 @@ Result InfoUpdater::UpdateBehaviorInfo(BehaviorInfo& behaviour_) {
|
||||
const auto in_params{reinterpret_cast<const BehaviorInfo::InParameter*>(input)};
|
||||
|
||||
if (!CheckValidRevision(in_params->revision)) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
if (in_params->revision != behaviour_.GetUserRevision()) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
behaviour_.ClearError();
|
||||
behaviour_.UpdateFlags(in_params->flags);
|
||||
|
||||
if (in_header->behaviour_size != sizeof(BehaviorInfo::InParameter)) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += sizeof(BehaviorInfo::InParameter);
|
||||
@@ -500,7 +500,7 @@ Result InfoUpdater::UpdateErrorInfo(const BehaviorInfo& behaviour_) {
|
||||
Result InfoUpdater::UpdateSplitterInfo(SplitterContext& splitter_context) {
|
||||
u32 consumed_size{0};
|
||||
if (!splitter_context.Update(input, consumed_size)) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
||||
input += consumed_size;
|
||||
@@ -529,9 +529,9 @@ Result InfoUpdater::UpdateRendererInfo(const u64 elapsed_frames) {
|
||||
|
||||
Result InfoUpdater::CheckConsumedSize() {
|
||||
if (CpuAddr(input) - CpuAddr(input_origin.data()) != expected_input_size) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
} else if (CpuAddr(output) - CpuAddr(output_origin.data()) != expected_output_size) {
|
||||
return Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,8 @@ static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, Rever
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> pre_delay_sample{
|
||||
state.pre_delay_line.Read() * Common::FixedPoint<50, 14>::from_base(params.late_gain)};
|
||||
state.pre_delay_line.TapOut(state.pre_delay_time) *
|
||||
Common::FixedPoint<50, 14>::from_base(params.late_gain)};
|
||||
|
||||
std::array<Common::FixedPoint<50, 14>, ReverbInfo::MaxDelayLines> mix_matrix{
|
||||
state.prev_feedback_output[2] + state.prev_feedback_output[1] + pre_delay_sample,
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
/**
|
||||
* Get this effect's parameter data.
|
||||
*
|
||||
* @return Pointer to the parametter, must be cast to the correct type.
|
||||
* @return Pointer to the parameter, must be cast to the correct type.
|
||||
*/
|
||||
u8* GetParameter() {
|
||||
return parameter.data();
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
/**
|
||||
* Get this effect's parameter data.
|
||||
*
|
||||
* @return Pointer to the parametter, must be cast to the correct type.
|
||||
* @return Pointer to the parameter, must be cast to the correct type.
|
||||
*/
|
||||
u8* GetStateBuffer() {
|
||||
return state.data();
|
||||
|
||||
@@ -104,7 +104,8 @@ public:
|
||||
}
|
||||
|
||||
void Write(const Common::FixedPoint<50, 14> sample) {
|
||||
*(input++) = sample;
|
||||
*input = sample;
|
||||
input++;
|
||||
if (input >= buffer_end) {
|
||||
input = buffer.data();
|
||||
}
|
||||
|
||||
@@ -79,12 +79,10 @@ public:
|
||||
return;
|
||||
}
|
||||
sample_count = delay_time;
|
||||
input = &buffer[(output - buffer.data() + sample_count) % (sample_count_max + 1)];
|
||||
input = &buffer[0];
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> Tick(const Common::FixedPoint<50, 14> sample) {
|
||||
Write(sample);
|
||||
|
||||
auto out_sample{Read()};
|
||||
|
||||
output++;
|
||||
@@ -92,6 +90,7 @@ public:
|
||||
output = buffer.data();
|
||||
}
|
||||
|
||||
Write(sample);
|
||||
return out_sample;
|
||||
}
|
||||
|
||||
@@ -100,7 +99,8 @@ public:
|
||||
}
|
||||
|
||||
void Write(const Common::FixedPoint<50, 14> sample) {
|
||||
*(input++) = sample;
|
||||
*input = sample;
|
||||
input++;
|
||||
if (input >= buffer_end) {
|
||||
input = buffer.data();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
enum class State {
|
||||
Invalid,
|
||||
Aquired,
|
||||
Acquired,
|
||||
RequestDetach,
|
||||
Detached,
|
||||
RequestAttach,
|
||||
|
||||
@@ -92,7 +92,7 @@ bool PoolMapper::TryAttachBuffer(BehaviorInfo::ErrorInfo& error_info, AddressInf
|
||||
address_info.Setup(address, size);
|
||||
|
||||
if (!FillDspAddr(address_info)) {
|
||||
error_info.error_code = Service::Audio::ERR_POOL_MAPPING_FAILED;
|
||||
error_info.error_code = Service::Audio::ResultInvalidAddressInfo;
|
||||
error_info.address = address;
|
||||
return force_map;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
* Splitter sort, traverse the splitter node graph and sort the sorted mixes from results.
|
||||
*
|
||||
* @param splitter_context - Splitter context for the sort.
|
||||
* @return True if the sort was successful, othewise false.
|
||||
* @return True if the sort was successful, otherwise false.
|
||||
*/
|
||||
bool TSortInfo(const SplitterContext& splitter_context);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ struct PerformanceDetailVersion1 {
|
||||
/* 0x0D */ PerformanceEntryType entry_type;
|
||||
};
|
||||
static_assert(sizeof(PerformanceDetailVersion1) == 0x10,
|
||||
"PerformanceDetailVersion1 has the worng size!");
|
||||
"PerformanceDetailVersion1 has the wrong size!");
|
||||
|
||||
struct PerformanceDetailVersion2 {
|
||||
/* 0x00 */ u32 node_id;
|
||||
@@ -45,6 +45,6 @@ struct PerformanceDetailVersion2 {
|
||||
/* 0x14 */ char unk14[0x4];
|
||||
};
|
||||
static_assert(sizeof(PerformanceDetailVersion2) == 0x18,
|
||||
"PerformanceDetailVersion2 has the worng size!");
|
||||
"PerformanceDetailVersion2 has the wrong size!");
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -22,7 +22,7 @@ struct PerformanceEntryVersion1 {
|
||||
/* 0x0C */ PerformanceEntryType entry_type;
|
||||
};
|
||||
static_assert(sizeof(PerformanceEntryVersion1) == 0x10,
|
||||
"PerformanceEntryVersion1 has the worng size!");
|
||||
"PerformanceEntryVersion1 has the wrong size!");
|
||||
|
||||
struct PerformanceEntryVersion2 {
|
||||
/* 0x00 */ u32 node_id;
|
||||
@@ -32,6 +32,6 @@ struct PerformanceEntryVersion2 {
|
||||
/* 0x0D */ char unk0D[0xB];
|
||||
};
|
||||
static_assert(sizeof(PerformanceEntryVersion2) == 0x18,
|
||||
"PerformanceEntryVersion2 has the worng size!");
|
||||
"PerformanceEntryVersion2 has the wrong size!");
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -16,7 +16,7 @@ struct PerformanceFrameHeaderVersion1 {
|
||||
/* 0x14 */ u32 frame_index;
|
||||
};
|
||||
static_assert(sizeof(PerformanceFrameHeaderVersion1) == 0x18,
|
||||
"PerformanceFrameHeaderVersion1 has the worng size!");
|
||||
"PerformanceFrameHeaderVersion1 has the wrong size!");
|
||||
|
||||
struct PerformanceFrameHeaderVersion2 {
|
||||
/* 0x00 */ u32 magic; // "PERF"
|
||||
@@ -31,6 +31,6 @@ struct PerformanceFrameHeaderVersion2 {
|
||||
/* 0x25 */ char unk25[0xB];
|
||||
};
|
||||
static_assert(sizeof(PerformanceFrameHeaderVersion2) == 0x30,
|
||||
"PerformanceFrameHeaderVersion2 has the worng size!");
|
||||
"PerformanceFrameHeaderVersion2 has the wrong size!");
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/**
|
||||
* Get the total number of splitter destinations.
|
||||
*
|
||||
* @return Number of destiantions.
|
||||
* @return Number of destinations.
|
||||
*/
|
||||
u32 GetDataCount() const;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
/**
|
||||
* Update this destination.
|
||||
*
|
||||
* @param params - Inpout parameters to update the destination.
|
||||
* @param params - Input parameters to update the destination.
|
||||
*/
|
||||
void Update(const InParameter& params);
|
||||
|
||||
@@ -126,9 +126,9 @@ private:
|
||||
std::array<f32, MaxMixBuffers> prev_mix_volumes{0.0f};
|
||||
/// Next destination in the mix chain
|
||||
SplitterDestinationData* next{};
|
||||
/// Is this destiantion in use?
|
||||
/// Is this destination in use?
|
||||
bool in_use{};
|
||||
/// Does this destiantion need its volumes updated?
|
||||
/// Does this destination need its volumes updated?
|
||||
bool need_update{};
|
||||
};
|
||||
|
||||
|
||||
@@ -49,14 +49,14 @@ public:
|
||||
/**
|
||||
* Get the number of destinations in this splitter.
|
||||
*
|
||||
* @return The number of destiantions.
|
||||
* @return The number of destinations.
|
||||
*/
|
||||
u32 GetDestinationCount() const;
|
||||
|
||||
/**
|
||||
* Set the number of destinations in this splitter.
|
||||
*
|
||||
* @param count - The new number of destiantions.
|
||||
* @param count - The new number of destinations.
|
||||
*/
|
||||
void SetDestinationCount(u32 count);
|
||||
|
||||
|
||||
@@ -101,15 +101,15 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
|
||||
u32 process_handle_, u64 applet_resource_user_id_, s32 session_id_) {
|
||||
if (!CheckValidRevision(params.revision)) {
|
||||
return Service::Audio::ERR_INVALID_REVISION;
|
||||
return Service::Audio::ResultInvalidRevision;
|
||||
}
|
||||
|
||||
if (GetWorkBufferSize(params) > transfer_memory_size) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
if (process_handle_ == 0) {
|
||||
return Service::Audio::ERR_INVALID_PROCESS_HANDLE;
|
||||
return Service::Audio::ResultInvalidHandle;
|
||||
}
|
||||
|
||||
behavior.SetUserLibRevision(params.revision);
|
||||
@@ -127,8 +127,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
render_device = params.rendering_device;
|
||||
execution_mode = params.execution_mode;
|
||||
|
||||
core.Memory().ZeroBlock(*core.ApplicationProcess(), transfer_memory->GetSourceAddress(),
|
||||
transfer_memory_size);
|
||||
core.ApplicationMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size);
|
||||
|
||||
// Note: We're not actually using the transfer memory because it's a pain to code for.
|
||||
// Allocate the memory normally instead and hope the game doesn't try to read anything back
|
||||
@@ -143,19 +142,19 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
samples_workbuffer =
|
||||
allocator.Allocate<s32>((voice_channels + mix_buffer_count) * sample_count, 0x10);
|
||||
if (samples_workbuffer.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
auto upsampler_workbuffer{allocator.Allocate<s32>(
|
||||
(voice_channels + mix_buffer_count) * TargetSampleCount * upsampler_count, 0x10)};
|
||||
if (upsampler_workbuffer.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
depop_buffer =
|
||||
allocator.Allocate<s32>(Common::AlignUp(static_cast<u32>(mix_buffer_count), 0x40), 0x40);
|
||||
if (depop_buffer.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
// invalidate samples_workbuffer DSP cache
|
||||
@@ -166,12 +165,12 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
}
|
||||
|
||||
if (voice_infos.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
auto sorted_voice_infos{allocator.Allocate<VoiceInfo*>(params.voices, 0x10)};
|
||||
if (sorted_voice_infos.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
std::memset(sorted_voice_infos.data(), 0, sorted_voice_infos.size_bytes());
|
||||
@@ -183,12 +182,12 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
}
|
||||
|
||||
if (voice_channel_resources.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
auto voice_cpu_states{allocator.Allocate<VoiceState>(params.voices, 0x10)};
|
||||
if (voice_cpu_states.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
for (auto& voice_state : voice_cpu_states) {
|
||||
@@ -198,7 +197,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
auto mix_infos{allocator.Allocate<MixInfo>(params.sub_mixes + 1, 0x10)};
|
||||
|
||||
if (mix_infos.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
u32 effect_process_order_count{0};
|
||||
@@ -208,7 +207,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
effect_process_order_count = params.effects * (params.sub_mixes + 1);
|
||||
effect_process_order_buffer = allocator.Allocate<s32>(effect_process_order_count, 0x10);
|
||||
if (effect_process_order_buffer.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +221,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
|
||||
auto sorted_mix_infos{allocator.Allocate<MixInfo*>(params.sub_mixes + 1, 0x10)};
|
||||
if (sorted_mix_infos.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
std::memset(sorted_mix_infos.data(), 0, sorted_mix_infos.size_bytes());
|
||||
@@ -235,7 +234,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
auto edge_matrix_workbuffer{allocator.Allocate<u8>(edge_matrix_size, 1)};
|
||||
|
||||
if (node_states_workbuffer.empty() || edge_matrix_workbuffer.size() == 0) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
mix_context.Initialize(sorted_mix_infos, mix_infos, params.sub_mixes + 1,
|
||||
@@ -250,7 +249,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
|
||||
upsampler_manager = allocator.Allocate<UpsamplerManager>(1, 0x10).data();
|
||||
if (upsampler_manager == nullptr) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
memory_pool_workbuffer = allocator.Allocate<MemoryPoolInfo>(memory_pool_count, 0x10);
|
||||
@@ -259,18 +258,18 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
}
|
||||
|
||||
if (memory_pool_workbuffer.empty() && memory_pool_count > 0) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
if (!splitter_context.Initialize(behavior, params, allocator)) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
std::span<EffectResultState> effect_result_states_cpu{};
|
||||
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
|
||||
effect_result_states_cpu = allocator.Allocate<EffectResultState>(params.effects, 0x10);
|
||||
if (effect_result_states_cpu.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
std::memset(effect_result_states_cpu.data(), 0, effect_result_states_cpu.size_bytes());
|
||||
}
|
||||
@@ -289,7 +288,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
upsampler_workbuffer);
|
||||
|
||||
if (upsampler_infos.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
auto effect_infos{allocator.Allocate<EffectInfoBase>(params.effects, 0x40)};
|
||||
@@ -298,14 +297,14 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
}
|
||||
|
||||
if (effect_infos.empty() && params.effects > 0) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
std::span<EffectResultState> effect_result_states_dsp{};
|
||||
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
|
||||
effect_result_states_dsp = allocator.Allocate<EffectResultState>(params.effects, 0x40);
|
||||
if (effect_result_states_dsp.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
std::memset(effect_result_states_dsp.data(), 0, effect_result_states_dsp.size_bytes());
|
||||
}
|
||||
@@ -319,14 +318,14 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
}
|
||||
|
||||
if (sinks.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
sink_context.Initialize(sinks, params.sinks);
|
||||
|
||||
auto voice_dsp_states{allocator.Allocate<VoiceState>(params.voices, 0x40)};
|
||||
if (voice_dsp_states.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
for (auto& voice_state : voice_dsp_states) {
|
||||
@@ -344,7 +343,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
0xC};
|
||||
performance_workbuffer = allocator.Allocate<u8>(perf_workbuffer_size, 0x40);
|
||||
if (performance_workbuffer.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
std::memset(performance_workbuffer.data(), 0, performance_workbuffer.size_bytes());
|
||||
performance_manager.Initialize(performance_workbuffer, performance_workbuffer.size_bytes(),
|
||||
@@ -360,7 +359,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
|
||||
command_workbuffer_size = allocator.GetRemainingSize();
|
||||
command_workbuffer = allocator.Allocate<u8>(command_workbuffer_size, 0x40);
|
||||
if (command_workbuffer.empty()) {
|
||||
return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
|
||||
return Service::Audio::ResultInsufficientBuffer;
|
||||
}
|
||||
|
||||
command_buffer_size = 0;
|
||||
@@ -437,10 +436,7 @@ void System::Stop() {
|
||||
}
|
||||
|
||||
if (execution_mode == ExecutionMode::Auto) {
|
||||
// Should wait for the system to terminate here, but core timing (should have) already
|
||||
// stopped, so this isn't needed. Find a way to make this definite.
|
||||
|
||||
// terminate_event.Wait();
|
||||
terminate_event.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
ExecutionMode GetExecutionMode() const;
|
||||
|
||||
/**
|
||||
* Get the rendering deivce for this system.
|
||||
* Get the rendering device for this system.
|
||||
* This is unused.
|
||||
*
|
||||
* @return Rendering device for this system.
|
||||
@@ -241,7 +241,7 @@ private:
|
||||
std::span<u8> command_workbuffer{};
|
||||
/// Size of command workbuffer
|
||||
u64 command_workbuffer_size{};
|
||||
/// Numebr of commands in the workbuffer
|
||||
/// Number of commands in the workbuffer
|
||||
u64 command_buffer_size{};
|
||||
/// Manager for upsamplers
|
||||
UpsamplerManager* upsampler_manager{};
|
||||
|
||||
@@ -15,14 +15,9 @@ MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager",
|
||||
MP_RGB(60, 19, 97));
|
||||
|
||||
namespace AudioCore::AudioRenderer {
|
||||
constexpr std::chrono::nanoseconds RENDER_TIME{5'000'000UL};
|
||||
|
||||
SystemManager::SystemManager(Core::System& core_)
|
||||
: core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()},
|
||||
thread_event{Core::Timing::CreateEvent(
|
||||
"AudioRendererSystemManager", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds) {
|
||||
return ThreadFunc2(time);
|
||||
})} {}
|
||||
: core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {}
|
||||
|
||||
SystemManager::~SystemManager() {
|
||||
Stop();
|
||||
@@ -33,8 +28,6 @@ bool SystemManager::InitializeUnsafe() {
|
||||
if (adsp.Start()) {
|
||||
active = true;
|
||||
thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(); });
|
||||
core.CoreTiming().ScheduleLoopingEvent(std::chrono::nanoseconds(0), RENDER_TIME,
|
||||
thread_event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +38,6 @@ void SystemManager::Stop() {
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
core.CoreTiming().UnscheduleEvent(thread_event, {});
|
||||
active = false;
|
||||
update.store(true);
|
||||
update.notify_all();
|
||||
@@ -111,16 +103,7 @@ void SystemManager::ThreadFunc() {
|
||||
|
||||
adsp.Signal();
|
||||
adsp.Wait();
|
||||
|
||||
update.wait(false);
|
||||
update.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<std::chrono::nanoseconds> SystemManager::ThreadFunc2(s64 time) {
|
||||
update.store(true);
|
||||
update.notify_all();
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
/**
|
||||
* Initialize the system manager, called when any system is registered.
|
||||
*
|
||||
* @return True if sucessfully initialized, otherwise false.
|
||||
* @return True if successfully initialized, otherwise false.
|
||||
*/
|
||||
bool InitializeUnsafe();
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
* The manager does not own the system, so do not free it without calling Remove.
|
||||
*
|
||||
* @param system - The system to add.
|
||||
* @return True if succesfully added, otherwise false.
|
||||
* @return True if successfully added, otherwise false.
|
||||
*/
|
||||
bool Add(System& system);
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
* Remove an audio render system from the manager.
|
||||
*
|
||||
* @param system - The system to remove.
|
||||
* @return True if succesfully removed, otherwise false.
|
||||
* @return True if successfully removed, otherwise false.
|
||||
*/
|
||||
bool Remove(System& system);
|
||||
|
||||
@@ -68,11 +68,6 @@ private:
|
||||
*/
|
||||
void ThreadFunc();
|
||||
|
||||
/**
|
||||
* Signalling core timing thread to run ThreadFunc.
|
||||
*/
|
||||
std::optional<std::chrono::nanoseconds> ThreadFunc2(s64 time);
|
||||
|
||||
enum class StreamState {
|
||||
Filling,
|
||||
Steady,
|
||||
@@ -95,8 +90,6 @@ private:
|
||||
ADSP::ADSP& adsp;
|
||||
/// AudioRenderer mailbox for communication
|
||||
ADSP::AudioRenderer_Mailbox* mailbox{};
|
||||
/// Core timing event to signal main thread
|
||||
std::shared_ptr<Core::Timing::EventType> thread_event;
|
||||
/// Atomic for main thread to wait on
|
||||
std::atomic<bool> update{};
|
||||
};
|
||||
|
||||
@@ -181,7 +181,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
||||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
||||
LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!");
|
||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||
error_info[0].address = wave_buffer_internal.address;
|
||||
return;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
||||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
||||
LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!");
|
||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||
error_info[0].address = wave_buffer_internal.address;
|
||||
return;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||
if (start > static_cast<s64>(wave_buffer_internal.size) ||
|
||||
end > static_cast<s64>(wave_buffer_internal.size)) {
|
||||
LOG_ERROR(Service_Audio, "Invalid ADPCM start/end wavebuffer sizes!");
|
||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||
error_info[0].address = wave_buffer_internal.address;
|
||||
return;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
||||
|
||||
if (wave_buffer_internal.start_offset < 0 || wave_buffer_internal.end_offset < 0) {
|
||||
LOG_ERROR(Service_Audio, "Invalid input start/end wavebuffer sizes!");
|
||||
error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
|
||||
error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
|
||||
error_info[0].address = wave_buffer_internal.address;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
void Initialize();
|
||||
|
||||
/**
|
||||
* Does this voice ned an update?
|
||||
* Does this voice need an update?
|
||||
*
|
||||
* @param params - Input parameters to check matching.
|
||||
*
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
*
|
||||
* @param error_info - Output array of errors.
|
||||
* @param wave_buffer - The wavebuffer to be updated.
|
||||
* @param wave_buffer_internal - Input parametters to be used for the update.
|
||||
* @param wave_buffer_internal - Input parameters to be used for the update.
|
||||
* @param sample_format - Sample format of the wavebuffer.
|
||||
* @param valid - Is this wavebuffer valid?
|
||||
* @param pool_mapper - Used to map the wavebuffers.
|
||||
|
||||
@@ -101,8 +101,6 @@ public:
|
||||
~CubebSinkStream() override {
|
||||
LOG_DEBUG(Service_Audio, "Destructing cubeb stream {}", name);
|
||||
|
||||
Unstall();
|
||||
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
@@ -143,8 +141,6 @@ public:
|
||||
* Stop the sink stream.
|
||||
*/
|
||||
void Stop() override {
|
||||
Unstall();
|
||||
|
||||
if (!ctx || paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "audio_core/common/common.h"
|
||||
#include "audio_core/sink/sdl2_sink.h"
|
||||
@@ -10,16 +11,6 @@
|
||||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
|
||||
// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
#include <SDL.h>
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
namespace AudioCore::Sink {
|
||||
/**
|
||||
* SDL sink stream, responsible for sinking samples to hardware.
|
||||
@@ -88,7 +79,6 @@ public:
|
||||
* Finalize the sink stream.
|
||||
*/
|
||||
void Finalize() override {
|
||||
Unstall();
|
||||
if (device == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +106,6 @@ public:
|
||||
* Stop the sink stream.
|
||||
*/
|
||||
void Stop() override {
|
||||
Unstall();
|
||||
if (device == 0 || paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "common/fixed_point.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/core_timing_util.h"
|
||||
|
||||
namespace AudioCore::Sink {
|
||||
|
||||
@@ -149,10 +151,6 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n
|
||||
return;
|
||||
}
|
||||
|
||||
if (queued_buffers > max_queue_size) {
|
||||
Stall();
|
||||
}
|
||||
|
||||
while (frames_written < num_frames) {
|
||||
// If the playing buffer has been consumed or has no frames, we need a new one
|
||||
if (playing_buffer.consumed || playing_buffer.frames == 0) {
|
||||
@@ -187,10 +185,6 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n
|
||||
}
|
||||
|
||||
std::memcpy(&last_frame[0], &input_buffer[(frames_written - 1) * frame_size], frame_size_bytes);
|
||||
|
||||
if (queued_buffers <= max_queue_size) {
|
||||
Unstall();
|
||||
}
|
||||
}
|
||||
|
||||
void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::size_t num_frames) {
|
||||
@@ -198,10 +192,15 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
||||
const std::size_t frame_size = num_channels;
|
||||
const std::size_t frame_size_bytes = frame_size * sizeof(s16);
|
||||
size_t frames_written{0};
|
||||
size_t actual_frames_written{0};
|
||||
|
||||
// If we're paused or going to shut down, we don't want to consume buffers as coretiming is
|
||||
// paused and we'll desync, so just play silence.
|
||||
if (system.IsPaused() || system.IsShuttingDown()) {
|
||||
if (system.IsShuttingDown()) {
|
||||
release_cv.notify_one();
|
||||
}
|
||||
|
||||
static constexpr std::array<s16, 6> silence{};
|
||||
for (size_t i = frames_written; i < num_frames; i++) {
|
||||
std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
|
||||
@@ -209,20 +208,6 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
||||
return;
|
||||
}
|
||||
|
||||
// Due to many frames being queued up with nvdec (5 frames or so?), a lot of buffers also get
|
||||
// queued up (30+) but not all at once, which causes constant stalling here, so just let the
|
||||
// video play out without attempting to stall.
|
||||
// Can hopefully remove this later with a more complete NVDEC implementation.
|
||||
const auto nvdec_active{system.AudioCore().IsNVDECActive()};
|
||||
|
||||
// Core timing cannot be paused in single-core mode, so Stall ends up being called over and over
|
||||
// and never recovers to a normal state, so just skip attempting to sync things on single-core.
|
||||
if (system.IsMulticore() && !nvdec_active && queued_buffers > max_queue_size) {
|
||||
Stall();
|
||||
} else if (system.IsMulticore() && queued_buffers <= max_queue_size) {
|
||||
Unstall();
|
||||
}
|
||||
|
||||
while (frames_written < num_frames) {
|
||||
// If the playing buffer has been consumed or has no frames, we need a new one
|
||||
if (playing_buffer.consumed || playing_buffer.frames == 0) {
|
||||
@@ -237,6 +222,10 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
||||
}
|
||||
// Successfully dequeued a new buffer.
|
||||
queued_buffers--;
|
||||
|
||||
{ std::unique_lock lk{release_mutex}; }
|
||||
|
||||
release_cv.notify_one();
|
||||
}
|
||||
|
||||
// Get the minimum frames available between the currently playing buffer, and the
|
||||
@@ -248,6 +237,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
||||
frames_available * frame_size);
|
||||
|
||||
frames_written += frames_available;
|
||||
actual_frames_written += frames_available;
|
||||
playing_buffer.frames_played += frames_available;
|
||||
|
||||
// If that's all the frames in the current buffer, add its samples and mark it as
|
||||
@@ -260,26 +250,29 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
||||
std::memcpy(&last_frame[0], &output_buffer[(frames_written - 1) * frame_size],
|
||||
frame_size_bytes);
|
||||
|
||||
if (system.IsMulticore() && queued_buffers <= max_queue_size) {
|
||||
Unstall();
|
||||
{
|
||||
std::scoped_lock lk{sample_count_lock};
|
||||
last_sample_count_update_time = system.CoreTiming().GetGlobalTimeNs();
|
||||
min_played_sample_count = max_played_sample_count;
|
||||
max_played_sample_count += actual_frames_written;
|
||||
}
|
||||
}
|
||||
|
||||
void SinkStream::Stall() {
|
||||
std::scoped_lock lk{stall_guard};
|
||||
if (stalled_lock) {
|
||||
return;
|
||||
}
|
||||
stalled_lock = system.StallApplication();
|
||||
u64 SinkStream::GetExpectedPlayedSampleCount() {
|
||||
std::scoped_lock lk{sample_count_lock};
|
||||
auto cur_time{system.CoreTiming().GetGlobalTimeNs()};
|
||||
auto time_delta{cur_time - last_sample_count_update_time};
|
||||
auto exp_played_sample_count{min_played_sample_count +
|
||||
(TargetSampleRate * time_delta) / std::chrono::seconds{1}};
|
||||
|
||||
// Add 15ms of latency in sample reporting to allow for some leeway in scheduler timings
|
||||
return std::min<u64>(exp_played_sample_count, max_played_sample_count) + TargetSampleCount * 3;
|
||||
}
|
||||
|
||||
void SinkStream::Unstall() {
|
||||
std::scoped_lock lk{stall_guard};
|
||||
if (!stalled_lock) {
|
||||
return;
|
||||
}
|
||||
system.UnstallApplication();
|
||||
stalled_lock.unlock();
|
||||
void SinkStream::WaitFreeSpace() {
|
||||
std::unique_lock lk{release_mutex};
|
||||
release_cv.wait(
|
||||
lk, [this]() { return queued_buffers < max_queue_size || system.IsShuttingDown(); });
|
||||
}
|
||||
|
||||
} // namespace AudioCore::Sink
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <span>
|
||||
@@ -14,6 +15,7 @@
|
||||
#include "common/common_types.h"
|
||||
#include "common/reader_writer_queue.h"
|
||||
#include "common/ring_buffer.h"
|
||||
#include "common/thread.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
@@ -53,9 +55,7 @@ struct SinkBuffer {
|
||||
class SinkStream {
|
||||
public:
|
||||
explicit SinkStream(Core::System& system_, StreamType type_) : system{system_}, type{type_} {}
|
||||
virtual ~SinkStream() {
|
||||
Unstall();
|
||||
}
|
||||
virtual ~SinkStream() {}
|
||||
|
||||
/**
|
||||
* Finalize the sink stream.
|
||||
@@ -201,14 +201,16 @@ public:
|
||||
void ProcessAudioOutAndRender(std::span<s16> output_buffer, std::size_t num_frames);
|
||||
|
||||
/**
|
||||
* Stall core processes if the audio thread falls too far behind.
|
||||
* Get the total number of samples expected to have been played by this stream.
|
||||
*
|
||||
* @return The number of samples.
|
||||
*/
|
||||
void Stall();
|
||||
u64 GetExpectedPlayedSampleCount();
|
||||
|
||||
/**
|
||||
* Unstall core processes.
|
||||
* Waits for free space in the sample ring buffer
|
||||
*/
|
||||
void Unstall();
|
||||
void WaitFreeSpace();
|
||||
|
||||
protected:
|
||||
/// Core system
|
||||
@@ -237,12 +239,21 @@ private:
|
||||
std::atomic<u32> queued_buffers{};
|
||||
/// The ring size for audio out buffers (usually 4, rarely 2 or 8)
|
||||
u32 max_queue_size{};
|
||||
/// Locks access to sample count tracking info
|
||||
std::mutex sample_count_lock;
|
||||
/// Minimum number of total samples that have been played since the last callback
|
||||
u64 min_played_sample_count{};
|
||||
/// Maximum number of total samples that can be played since the last callback
|
||||
u64 max_played_sample_count{};
|
||||
/// The time the two above tracking variables were last written to
|
||||
std::chrono::nanoseconds last_sample_count_update_time{};
|
||||
/// Set by the audio render/in/out system which uses this stream
|
||||
f32 system_volume{1.0f};
|
||||
/// Set via IAudioDevice service calls
|
||||
f32 device_volume{1.0f};
|
||||
std::mutex stall_guard;
|
||||
std::unique_lock<std::mutex> stalled_lock;
|
||||
/// Signalled when ring buffer entries are consumed
|
||||
std::condition_variable release_cv;
|
||||
std::mutex release_mutex;
|
||||
};
|
||||
|
||||
using SinkStreamPtr = std::unique_ptr<SinkStream>;
|
||||
|
||||
@@ -38,6 +38,7 @@ add_library(common STATIC
|
||||
common_precompiled_headers.h
|
||||
common_types.h
|
||||
concepts.h
|
||||
container_hash.h
|
||||
demangle.cpp
|
||||
demangle.h
|
||||
div_ceil.h
|
||||
@@ -91,6 +92,7 @@ add_library(common STATIC
|
||||
multi_level_page_table.h
|
||||
nvidia_flags.cpp
|
||||
nvidia_flags.h
|
||||
overflow.h
|
||||
page_table.cpp
|
||||
page_table.h
|
||||
param_package.cpp
|
||||
@@ -113,6 +115,8 @@ add_library(common STATIC
|
||||
socket_types.h
|
||||
spin_lock.cpp
|
||||
spin_lock.h
|
||||
steady_clock.cpp
|
||||
steady_clock.h
|
||||
stream.cpp
|
||||
stream.h
|
||||
string_util.cpp
|
||||
@@ -129,6 +133,7 @@ add_library(common STATIC
|
||||
time_zone.h
|
||||
tiny_mt.h
|
||||
tree.h
|
||||
typed_address.h
|
||||
uint128.h
|
||||
unique_function.h
|
||||
uuid.cpp
|
||||
@@ -142,11 +147,21 @@ add_library(common STATIC
|
||||
zstd_compression.h
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
target_sources(common PRIVATE
|
||||
windows/timer_resolution.cpp
|
||||
windows/timer_resolution.h
|
||||
)
|
||||
target_link_libraries(common PRIVATE ntdll)
|
||||
endif()
|
||||
|
||||
if(ARCHITECTURE_x86_64)
|
||||
target_sources(common
|
||||
PRIVATE
|
||||
x64/cpu_detect.cpp
|
||||
x64/cpu_detect.h
|
||||
x64/cpu_wait.cpp
|
||||
x64/cpu_wait.h
|
||||
x64/native_clock.cpp
|
||||
x64/native_clock.h
|
||||
x64/xbyak_abi.h
|
||||
@@ -176,7 +191,7 @@ endif()
|
||||
|
||||
create_target_directory_groups(common)
|
||||
|
||||
target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
|
||||
target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile Threads::Threads)
|
||||
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
|
||||
|
||||
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||
|
||||
@@ -72,7 +72,7 @@ MAP_MEMBER(void)::MapLocked(VaType virt, PaType phys, VaType size, ExtraBlockInf
|
||||
}
|
||||
}()};
|
||||
|
||||
if (block_end_predecessor->virt >= virt) {
|
||||
if (block_end_predecessor != blocks.begin() && block_end_predecessor->virt >= virt) {
|
||||
// If this block's start would be overlapped by the map then reuse it as a tail
|
||||
// block
|
||||
block_end_predecessor->virt = virt_end;
|
||||
@@ -336,7 +336,7 @@ ALLOC_MEMBER(VaType)::Allocate(VaType size) {
|
||||
ASSERT_MSG(false, "Unexpected allocator state!");
|
||||
}
|
||||
|
||||
auto search_predecessor{this->blocks.begin()};
|
||||
auto search_predecessor{std::next(this->blocks.begin())};
|
||||
auto search_successor{std::next(search_predecessor)};
|
||||
|
||||
while (search_successor != this->blocks.end() &&
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
* @param description The room description
|
||||
* @param port The port of the room
|
||||
* @param net_version The version of the libNetwork that gets used
|
||||
* @param has_password True if the room is passowrd protected
|
||||
* @param has_password True if the room is password protected
|
||||
* @param preferred_game The preferred game of the room
|
||||
* @param preferred_game_id The title id of the preferred game
|
||||
*/
|
||||
|
||||
+11
-9
@@ -3,19 +3,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
#include <version>
|
||||
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
#include <bit>
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
|
||||
template <typename To, typename From>
|
||||
[[nodiscard]] std::enable_if_t<sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> &&
|
||||
std::is_trivially_copyable_v<To>,
|
||||
To>
|
||||
BitCast(const From& src) noexcept {
|
||||
To dst;
|
||||
std::memcpy(&dst, &src, sizeof(To));
|
||||
return dst;
|
||||
constexpr inline To BitCast(const From& from) {
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
return std::bit_cast<To>(from);
|
||||
#else
|
||||
return __builtin_bit_cast(To, from);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
||||
@@ -1,158 +1,249 @@
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2020 Erik Rigtorp <erik@rigtorp.se>
|
||||
// SPDX-License-Identifier: MIT
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <bit>
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <cstddef>
|
||||
#include <mutex>
|
||||
#include <new>
|
||||
#include <stop_token>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "common/polyfill_thread.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
#if defined(__cpp_lib_hardware_interference_size)
|
||||
constexpr size_t hardware_interference_size = std::hardware_destructive_interference_size;
|
||||
#else
|
||||
constexpr size_t hardware_interference_size = 64;
|
||||
#endif
|
||||
namespace detail {
|
||||
constexpr size_t DefaultCapacity = 0x1000;
|
||||
} // namespace detail
|
||||
|
||||
template <typename T, size_t Capacity = detail::DefaultCapacity>
|
||||
class SPSCQueue {
|
||||
static_assert((Capacity & (Capacity - 1)) == 0, "Capacity must be a power of two.");
|
||||
|
||||
template <typename T, size_t capacity = 0x400>
|
||||
class MPSCQueue {
|
||||
public:
|
||||
explicit MPSCQueue() : allocator{std::allocator<Slot<T>>()} {
|
||||
// Allocate one extra slot to prevent false sharing on the last slot
|
||||
slots = allocator.allocate(capacity + 1);
|
||||
// Allocators are not required to honor alignment for over-aligned types
|
||||
// (see http://eel.is/c++draft/allocator.requirements#10) so we verify
|
||||
// alignment here
|
||||
if (reinterpret_cast<uintptr_t>(slots) % alignof(Slot<T>) != 0) {
|
||||
allocator.deallocate(slots, capacity + 1);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
for (size_t i = 0; i < capacity; ++i) {
|
||||
std::construct_at(&slots[i]);
|
||||
}
|
||||
static_assert(std::has_single_bit(capacity), "capacity must be an integer power of 2");
|
||||
static_assert(alignof(Slot<T>) == hardware_interference_size,
|
||||
"Slot must be aligned to cache line boundary to prevent false sharing");
|
||||
static_assert(sizeof(Slot<T>) % hardware_interference_size == 0,
|
||||
"Slot size must be a multiple of cache line size to prevent "
|
||||
"false sharing between adjacent slots");
|
||||
static_assert(sizeof(MPSCQueue) % hardware_interference_size == 0,
|
||||
"Queue size must be a multiple of cache line size to "
|
||||
"prevent false sharing between adjacent queues");
|
||||
template <typename... Args>
|
||||
bool TryEmplace(Args&&... args) {
|
||||
return Emplace<PushMode::Try>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
~MPSCQueue() noexcept {
|
||||
for (size_t i = 0; i < capacity; ++i) {
|
||||
std::destroy_at(&slots[i]);
|
||||
}
|
||||
allocator.deallocate(slots, capacity + 1);
|
||||
template <typename... Args>
|
||||
void EmplaceWait(Args&&... args) {
|
||||
Emplace<PushMode::Wait>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// The queue must be both non-copyable and non-movable
|
||||
MPSCQueue(const MPSCQueue&) = delete;
|
||||
MPSCQueue& operator=(const MPSCQueue&) = delete;
|
||||
|
||||
MPSCQueue(MPSCQueue&&) = delete;
|
||||
MPSCQueue& operator=(MPSCQueue&&) = delete;
|
||||
|
||||
void Push(const T& v) noexcept {
|
||||
static_assert(std::is_nothrow_copy_constructible_v<T>,
|
||||
"T must be nothrow copy constructible");
|
||||
emplace(v);
|
||||
bool TryPop(T& t) {
|
||||
return Pop<PopMode::Try>(t);
|
||||
}
|
||||
|
||||
template <typename P, typename = std::enable_if_t<std::is_nothrow_constructible_v<T, P&&>>>
|
||||
void Push(P&& v) noexcept {
|
||||
emplace(std::forward<P>(v));
|
||||
void PopWait(T& t) {
|
||||
Pop<PopMode::Wait>(t);
|
||||
}
|
||||
|
||||
void Pop(T& v, std::stop_token stop) noexcept {
|
||||
auto const tail = tail_.fetch_add(1);
|
||||
auto& slot = slots[idx(tail)];
|
||||
if (!slot.turn.test()) {
|
||||
std::unique_lock lock{cv_mutex};
|
||||
cv.wait(lock, stop, [&slot] { return slot.turn.test(); });
|
||||
}
|
||||
v = slot.move();
|
||||
slot.destroy();
|
||||
slot.turn.clear();
|
||||
slot.turn.notify_one();
|
||||
void PopWait(T& t, std::stop_token stop_token) {
|
||||
Pop<PopMode::WaitWithStopToken>(t, stop_token);
|
||||
}
|
||||
|
||||
T PopWait() {
|
||||
T t;
|
||||
Pop<PopMode::Wait>(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
T PopWait(std::stop_token stop_token) {
|
||||
T t;
|
||||
Pop<PopMode::WaitWithStopToken>(t, stop_token);
|
||||
return t;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename U = T>
|
||||
struct Slot {
|
||||
~Slot() noexcept {
|
||||
if (turn.test()) {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void construct(Args&&... args) noexcept {
|
||||
static_assert(std::is_nothrow_constructible_v<U, Args&&...>,
|
||||
"T must be nothrow constructible with Args&&...");
|
||||
std::construct_at(reinterpret_cast<U*>(&storage), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
void destroy() noexcept {
|
||||
static_assert(std::is_nothrow_destructible_v<U>, "T must be nothrow destructible");
|
||||
std::destroy_at(reinterpret_cast<U*>(&storage));
|
||||
}
|
||||
|
||||
U&& move() noexcept {
|
||||
return reinterpret_cast<U&&>(storage);
|
||||
}
|
||||
|
||||
// Align to avoid false sharing between adjacent slots
|
||||
alignas(hardware_interference_size) std::atomic_flag turn{};
|
||||
struct aligned_store {
|
||||
struct type {
|
||||
alignas(U) unsigned char data[sizeof(U)];
|
||||
};
|
||||
};
|
||||
typename aligned_store::type storage;
|
||||
enum class PushMode {
|
||||
Try,
|
||||
Wait,
|
||||
Count,
|
||||
};
|
||||
|
||||
enum class PopMode {
|
||||
Try,
|
||||
Wait,
|
||||
WaitWithStopToken,
|
||||
Count,
|
||||
};
|
||||
|
||||
template <PushMode Mode, typename... Args>
|
||||
bool Emplace(Args&&... args) {
|
||||
const size_t write_index = m_write_index.load(std::memory_order::relaxed);
|
||||
|
||||
if constexpr (Mode == PushMode::Try) {
|
||||
// Check if we have free slots to write to.
|
||||
if ((write_index - m_read_index.load(std::memory_order::acquire)) == Capacity) {
|
||||
return false;
|
||||
}
|
||||
} else if constexpr (Mode == PushMode::Wait) {
|
||||
// Wait until we have free slots to write to.
|
||||
std::unique_lock lock{producer_cv_mutex};
|
||||
producer_cv.wait(lock, [this, write_index] {
|
||||
return (write_index - m_read_index.load(std::memory_order::acquire)) < Capacity;
|
||||
});
|
||||
} else {
|
||||
static_assert(Mode < PushMode::Count, "Invalid PushMode.");
|
||||
}
|
||||
|
||||
// Determine the position to write to.
|
||||
const size_t pos = write_index % Capacity;
|
||||
|
||||
// Emplace into the queue.
|
||||
std::construct_at(std::addressof(m_data[pos]), std::forward<Args>(args)...);
|
||||
|
||||
// Increment the write index.
|
||||
++m_write_index;
|
||||
|
||||
// Notify the consumer that we have pushed into the queue.
|
||||
std::scoped_lock lock{consumer_cv_mutex};
|
||||
consumer_cv.notify_one();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <PopMode Mode>
|
||||
bool Pop(T& t, [[maybe_unused]] std::stop_token stop_token = {}) {
|
||||
const size_t read_index = m_read_index.load(std::memory_order::relaxed);
|
||||
|
||||
if constexpr (Mode == PopMode::Try) {
|
||||
// Check if the queue is empty.
|
||||
if (read_index == m_write_index.load(std::memory_order::acquire)) {
|
||||
return false;
|
||||
}
|
||||
} else if constexpr (Mode == PopMode::Wait) {
|
||||
// Wait until the queue is not empty.
|
||||
std::unique_lock lock{consumer_cv_mutex};
|
||||
consumer_cv.wait(lock, [this, read_index] {
|
||||
return read_index != m_write_index.load(std::memory_order::acquire);
|
||||
});
|
||||
} else if constexpr (Mode == PopMode::WaitWithStopToken) {
|
||||
// Wait until the queue is not empty.
|
||||
std::unique_lock lock{consumer_cv_mutex};
|
||||
Common::CondvarWait(consumer_cv, lock, stop_token, [this, read_index] {
|
||||
return read_index != m_write_index.load(std::memory_order::acquire);
|
||||
});
|
||||
if (stop_token.stop_requested()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
static_assert(Mode < PopMode::Count, "Invalid PopMode.");
|
||||
}
|
||||
|
||||
// Determine the position to read from.
|
||||
const size_t pos = read_index % Capacity;
|
||||
|
||||
// Pop the data off the queue, moving it.
|
||||
t = std::move(m_data[pos]);
|
||||
|
||||
// Increment the read index.
|
||||
++m_read_index;
|
||||
|
||||
// Notify the producer that we have popped off the queue.
|
||||
std::scoped_lock lock{producer_cv_mutex};
|
||||
producer_cv.notify_one();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
alignas(128) std::atomic_size_t m_read_index{0};
|
||||
alignas(128) std::atomic_size_t m_write_index{0};
|
||||
|
||||
std::array<T, Capacity> m_data;
|
||||
|
||||
std::condition_variable_any producer_cv;
|
||||
std::mutex producer_cv_mutex;
|
||||
std::condition_variable_any consumer_cv;
|
||||
std::mutex consumer_cv_mutex;
|
||||
};
|
||||
|
||||
template <typename T, size_t Capacity = detail::DefaultCapacity>
|
||||
class MPSCQueue {
|
||||
public:
|
||||
template <typename... Args>
|
||||
void emplace(Args&&... args) noexcept {
|
||||
static_assert(std::is_nothrow_constructible_v<T, Args&&...>,
|
||||
"T must be nothrow constructible with Args&&...");
|
||||
auto const head = head_.fetch_add(1);
|
||||
auto& slot = slots[idx(head)];
|
||||
slot.turn.wait(true);
|
||||
slot.construct(std::forward<Args>(args)...);
|
||||
slot.turn.test_and_set();
|
||||
cv.notify_one();
|
||||
bool TryEmplace(Args&&... args) {
|
||||
std::scoped_lock lock{write_mutex};
|
||||
return spsc_queue.TryEmplace(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
constexpr size_t idx(size_t i) const noexcept {
|
||||
return i & mask;
|
||||
template <typename... Args>
|
||||
void EmplaceWait(Args&&... args) {
|
||||
std::scoped_lock lock{write_mutex};
|
||||
spsc_queue.EmplaceWait(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
static constexpr size_t mask = capacity - 1;
|
||||
bool TryPop(T& t) {
|
||||
return spsc_queue.TryPop(t);
|
||||
}
|
||||
|
||||
// Align to avoid false sharing between head_ and tail_
|
||||
alignas(hardware_interference_size) std::atomic<size_t> head_{0};
|
||||
alignas(hardware_interference_size) std::atomic<size_t> tail_{0};
|
||||
void PopWait(T& t) {
|
||||
spsc_queue.PopWait(t);
|
||||
}
|
||||
|
||||
std::mutex cv_mutex;
|
||||
std::condition_variable_any cv;
|
||||
void PopWait(T& t, std::stop_token stop_token) {
|
||||
spsc_queue.PopWait(t, stop_token);
|
||||
}
|
||||
|
||||
Slot<T>* slots;
|
||||
[[no_unique_address]] std::allocator<Slot<T>> allocator;
|
||||
T PopWait() {
|
||||
return spsc_queue.PopWait();
|
||||
}
|
||||
|
||||
static_assert(std::is_nothrow_copy_assignable_v<T> || std::is_nothrow_move_assignable_v<T>,
|
||||
"T must be nothrow copy or move assignable");
|
||||
T PopWait(std::stop_token stop_token) {
|
||||
return spsc_queue.PopWait(stop_token);
|
||||
}
|
||||
|
||||
static_assert(std::is_nothrow_destructible_v<T>, "T must be nothrow destructible");
|
||||
private:
|
||||
SPSCQueue<T, Capacity> spsc_queue;
|
||||
std::mutex write_mutex;
|
||||
};
|
||||
|
||||
template <typename T, size_t Capacity = detail::DefaultCapacity>
|
||||
class MPMCQueue {
|
||||
public:
|
||||
template <typename... Args>
|
||||
bool TryEmplace(Args&&... args) {
|
||||
std::scoped_lock lock{write_mutex};
|
||||
return spsc_queue.TryEmplace(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void EmplaceWait(Args&&... args) {
|
||||
std::scoped_lock lock{write_mutex};
|
||||
spsc_queue.EmplaceWait(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
bool TryPop(T& t) {
|
||||
std::scoped_lock lock{read_mutex};
|
||||
return spsc_queue.TryPop(t);
|
||||
}
|
||||
|
||||
void PopWait(T& t) {
|
||||
std::scoped_lock lock{read_mutex};
|
||||
spsc_queue.PopWait(t);
|
||||
}
|
||||
|
||||
void PopWait(T& t, std::stop_token stop_token) {
|
||||
std::scoped_lock lock{read_mutex};
|
||||
spsc_queue.PopWait(t, stop_token);
|
||||
}
|
||||
|
||||
T PopWait() {
|
||||
std::scoped_lock lock{read_mutex};
|
||||
return spsc_queue.PopWait();
|
||||
}
|
||||
|
||||
T PopWait(std::stop_token stop_token) {
|
||||
std::scoped_lock lock{read_mutex};
|
||||
return spsc_queue.PopWait(stop_token);
|
||||
}
|
||||
|
||||
private:
|
||||
SPSCQueue<T, Capacity> spsc_queue;
|
||||
std::mutex write_mutex;
|
||||
std::mutex read_mutex;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
// SPDX-FileCopyrightText: 2005-2014 Daniel James
|
||||
// SPDX-FileCopyrightText: 2016 Austin Appleby
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <array>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace Common {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
requires std::is_unsigned_v<T>
|
||||
inline std::size_t HashValue(T val) {
|
||||
const unsigned int size_t_bits = std::numeric_limits<std::size_t>::digits;
|
||||
const unsigned int length =
|
||||
(std::numeric_limits<T>::digits - 1) / static_cast<unsigned int>(size_t_bits);
|
||||
|
||||
std::size_t seed = 0;
|
||||
|
||||
for (unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) {
|
||||
seed ^= static_cast<size_t>(val >> i) + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
seed ^= static_cast<size_t>(val) + (seed << 6) + (seed >> 2);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <size_t Bits>
|
||||
struct HashCombineImpl {
|
||||
template <typename T>
|
||||
static inline T fn(T seed, T value) {
|
||||
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct HashCombineImpl<64> {
|
||||
static inline std::uint64_t fn(std::uint64_t h, std::uint64_t k) {
|
||||
const std::uint64_t m = (std::uint64_t(0xc6a4a793) << 32) + 0x5bd1e995;
|
||||
const int r = 47;
|
||||
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
|
||||
h ^= k;
|
||||
h *= m;
|
||||
|
||||
// Completely arbitrary number, to prevent 0's
|
||||
// from hashing to 0.
|
||||
h += 0xe6546b64;
|
||||
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
inline void HashCombine(std::size_t& seed, const T& v) {
|
||||
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, detail::HashValue(v));
|
||||
}
|
||||
|
||||
template <typename It>
|
||||
inline std::size_t HashRange(It first, It last) {
|
||||
std::size_t seed = 0;
|
||||
|
||||
for (; first != last; ++first) {
|
||||
HashCombine<typename std::iterator_traits<It>::value_type>(seed, *first);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <typename T, size_t Size>
|
||||
std::size_t HashValue(const std::array<T, Size>& v) {
|
||||
return HashRange(v.cbegin(), v.cend());
|
||||
}
|
||||
|
||||
template <typename T, typename Allocator>
|
||||
std::size_t HashValue(const std::vector<T, Allocator>& v) {
|
||||
return HashRange(v.cbegin(), v.cend());
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
@@ -90,7 +90,7 @@ Fiber::~Fiber() {
|
||||
}
|
||||
|
||||
void Fiber::Exit() {
|
||||
ASSERT_MSG(impl->is_thread_fiber, "Exitting non main thread fiber");
|
||||
ASSERT_MSG(impl->is_thread_fiber, "Exiting non main thread fiber");
|
||||
if (!impl->is_thread_fiber) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class FixedPoint;
|
||||
namespace detail {
|
||||
|
||||
// helper templates to make magic with types :)
|
||||
// these allow us to determine resonable types from
|
||||
// these allow us to determine reasonable types from
|
||||
// a desired size, they also let us infer the next largest type
|
||||
// from a type which is nice for the division op
|
||||
template <size_t T>
|
||||
|
||||
@@ -322,7 +322,7 @@ private:
|
||||
}
|
||||
|
||||
/// Return true when a given memory region is a "nieche" and the placeholders don't have to be
|
||||
/// splitted.
|
||||
/// split.
|
||||
bool IsNiechePlaceholder(size_t virtual_offset, size_t length) const {
|
||||
const auto it = placeholders.upper_bound({virtual_offset, virtual_offset + length});
|
||||
if (it != placeholders.end() && it->lower() == virtual_offset + length) {
|
||||
@@ -484,7 +484,7 @@ class HostMemory::Impl {
|
||||
public:
|
||||
explicit Impl(size_t /*backing_size */, size_t /* virtual_size */) {
|
||||
// This is just a place holder.
|
||||
// Please implement fastmem in a propper way on your platform.
|
||||
// Please implement fastmem in a proper way on your platform.
|
||||
throw std::bad_alloc{};
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace Common::Input {
|
||||
|
||||
// Type of data that is expected to recieve or send
|
||||
// Type of data that is expected to receive or send
|
||||
enum class InputType {
|
||||
None,
|
||||
Battery,
|
||||
@@ -46,7 +46,7 @@ enum class PollingMode {
|
||||
// Constant polling of buttons, analogs and motion data
|
||||
Active,
|
||||
// Only update on button change, digital analogs
|
||||
Pasive,
|
||||
Passive,
|
||||
// Enable near field communication polling
|
||||
NFC,
|
||||
// Enable infrared camera polling
|
||||
@@ -103,7 +103,7 @@ enum class VibrationAmplificationType {
|
||||
struct AnalogProperties {
|
||||
// Anything below this value will be detected as zero
|
||||
float deadzone{};
|
||||
// Anyting above this values will be detected as one
|
||||
// Anything above this values will be detected as one
|
||||
float range{1.0f};
|
||||
// Minimum value to be detected as active
|
||||
float threshold{0.5f};
|
||||
@@ -111,6 +111,8 @@ struct AnalogProperties {
|
||||
float offset{};
|
||||
// Invert direction of the sensor data
|
||||
bool inverted{};
|
||||
// Invert the state if it's converted to a button
|
||||
bool inverted_button{};
|
||||
// Press once to activate, press again to release
|
||||
bool toggle{};
|
||||
};
|
||||
@@ -209,7 +211,7 @@ struct LedStatus {
|
||||
bool led_4{};
|
||||
};
|
||||
|
||||
// Raw data fom camera
|
||||
// Raw data from camera
|
||||
struct CameraStatus {
|
||||
CameraFormat format{CameraFormat::None};
|
||||
std::vector<u8> data{};
|
||||
@@ -428,7 +430,7 @@ inline void UnregisterOutputFactory(const std::string& name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an input device from given paramters.
|
||||
* Create an input device from given parameters.
|
||||
* @tparam InputDeviceType the type of input devices to create
|
||||
* @param params a serialized ParamPackage string that contains all parameters for creating the
|
||||
* device
|
||||
|
||||
@@ -0,0 +1,631 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/parent_of_member.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
// Forward declare implementation class for Node.
|
||||
namespace impl {
|
||||
|
||||
class IntrusiveListImpl;
|
||||
|
||||
}
|
||||
|
||||
class IntrusiveListNode {
|
||||
YUZU_NON_COPYABLE(IntrusiveListNode);
|
||||
|
||||
private:
|
||||
friend class impl::IntrusiveListImpl;
|
||||
|
||||
IntrusiveListNode* m_prev;
|
||||
IntrusiveListNode* m_next;
|
||||
|
||||
public:
|
||||
constexpr IntrusiveListNode() : m_prev(this), m_next(this) {}
|
||||
|
||||
constexpr bool IsLinked() const {
|
||||
return m_next != this;
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr void LinkPrev(IntrusiveListNode* node) {
|
||||
// We can't link an already linked node.
|
||||
ASSERT(!node->IsLinked());
|
||||
this->SplicePrev(node, node);
|
||||
}
|
||||
|
||||
constexpr void SplicePrev(IntrusiveListNode* first, IntrusiveListNode* last) {
|
||||
// Splice a range into the list.
|
||||
auto last_prev = last->m_prev;
|
||||
first->m_prev = m_prev;
|
||||
last_prev->m_next = this;
|
||||
m_prev->m_next = first;
|
||||
m_prev = last_prev;
|
||||
}
|
||||
|
||||
constexpr void LinkNext(IntrusiveListNode* node) {
|
||||
// We can't link an already linked node.
|
||||
ASSERT(!node->IsLinked());
|
||||
return this->SpliceNext(node, node);
|
||||
}
|
||||
|
||||
constexpr void SpliceNext(IntrusiveListNode* first, IntrusiveListNode* last) {
|
||||
// Splice a range into the list.
|
||||
auto last_prev = last->m_prev;
|
||||
first->m_prev = this;
|
||||
last_prev->m_next = m_next;
|
||||
m_next->m_prev = last_prev;
|
||||
m_next = first;
|
||||
}
|
||||
|
||||
constexpr void Unlink() {
|
||||
this->Unlink(m_next);
|
||||
}
|
||||
|
||||
constexpr void Unlink(IntrusiveListNode* last) {
|
||||
// Unlink a node from a next node.
|
||||
auto last_prev = last->m_prev;
|
||||
m_prev->m_next = last;
|
||||
last->m_prev = m_prev;
|
||||
last_prev->m_next = this;
|
||||
m_prev = last_prev;
|
||||
}
|
||||
|
||||
constexpr IntrusiveListNode* GetPrev() {
|
||||
return m_prev;
|
||||
}
|
||||
|
||||
constexpr const IntrusiveListNode* GetPrev() const {
|
||||
return m_prev;
|
||||
}
|
||||
|
||||
constexpr IntrusiveListNode* GetNext() {
|
||||
return m_next;
|
||||
}
|
||||
|
||||
constexpr const IntrusiveListNode* GetNext() const {
|
||||
return m_next;
|
||||
}
|
||||
};
|
||||
// DEPRECATED: static_assert(std::is_literal_type<IntrusiveListNode>::value);
|
||||
|
||||
namespace impl {
|
||||
|
||||
class IntrusiveListImpl {
|
||||
YUZU_NON_COPYABLE(IntrusiveListImpl);
|
||||
|
||||
private:
|
||||
IntrusiveListNode m_root_node;
|
||||
|
||||
public:
|
||||
template <bool Const>
|
||||
class Iterator;
|
||||
|
||||
using value_type = IntrusiveListNode;
|
||||
using size_type = size_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = value_type*;
|
||||
using const_pointer = const value_type*;
|
||||
using reference = value_type&;
|
||||
using const_reference = const value_type&;
|
||||
using iterator = Iterator<false>;
|
||||
using const_iterator = Iterator<true>;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
template <bool Const>
|
||||
class Iterator {
|
||||
public:
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = typename IntrusiveListImpl::value_type;
|
||||
using difference_type = typename IntrusiveListImpl::difference_type;
|
||||
using pointer =
|
||||
std::conditional_t<Const, IntrusiveListImpl::const_pointer, IntrusiveListImpl::pointer>;
|
||||
using reference = std::conditional_t<Const, IntrusiveListImpl::const_reference,
|
||||
IntrusiveListImpl::reference>;
|
||||
|
||||
private:
|
||||
pointer m_node;
|
||||
|
||||
public:
|
||||
constexpr explicit Iterator(pointer n) : m_node(n) {}
|
||||
|
||||
constexpr bool operator==(const Iterator& rhs) const {
|
||||
return m_node == rhs.m_node;
|
||||
}
|
||||
|
||||
constexpr pointer operator->() const {
|
||||
return m_node;
|
||||
}
|
||||
|
||||
constexpr reference operator*() const {
|
||||
return *m_node;
|
||||
}
|
||||
|
||||
constexpr Iterator& operator++() {
|
||||
m_node = m_node->m_next;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Iterator& operator--() {
|
||||
m_node = m_node->m_prev;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Iterator operator++(int) {
|
||||
const Iterator it{*this};
|
||||
++(*this);
|
||||
return it;
|
||||
}
|
||||
|
||||
constexpr Iterator operator--(int) {
|
||||
const Iterator it{*this};
|
||||
--(*this);
|
||||
return it;
|
||||
}
|
||||
|
||||
constexpr operator Iterator<true>() const {
|
||||
return Iterator<true>(m_node);
|
||||
}
|
||||
|
||||
constexpr Iterator<false> GetNonConstIterator() const {
|
||||
return Iterator<false>(const_cast<IntrusiveListImpl::pointer>(m_node));
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
constexpr IntrusiveListImpl() : m_root_node() {}
|
||||
|
||||
// Iterator accessors.
|
||||
constexpr iterator begin() {
|
||||
return iterator(m_root_node.GetNext());
|
||||
}
|
||||
|
||||
constexpr const_iterator begin() const {
|
||||
return const_iterator(m_root_node.GetNext());
|
||||
}
|
||||
|
||||
constexpr iterator end() {
|
||||
return iterator(std::addressof(m_root_node));
|
||||
}
|
||||
|
||||
constexpr const_iterator end() const {
|
||||
return const_iterator(std::addressof(m_root_node));
|
||||
}
|
||||
|
||||
constexpr iterator iterator_to(reference v) {
|
||||
// Only allow iterator_to for values in lists.
|
||||
ASSERT(v.IsLinked());
|
||||
return iterator(std::addressof(v));
|
||||
}
|
||||
|
||||
constexpr const_iterator iterator_to(const_reference v) const {
|
||||
// Only allow iterator_to for values in lists.
|
||||
ASSERT(v.IsLinked());
|
||||
return const_iterator(std::addressof(v));
|
||||
}
|
||||
|
||||
// Content management.
|
||||
constexpr bool empty() const {
|
||||
return !m_root_node.IsLinked();
|
||||
}
|
||||
|
||||
constexpr size_type size() const {
|
||||
return static_cast<size_type>(std::distance(this->begin(), this->end()));
|
||||
}
|
||||
|
||||
constexpr reference back() {
|
||||
return *m_root_node.GetPrev();
|
||||
}
|
||||
|
||||
constexpr const_reference back() const {
|
||||
return *m_root_node.GetPrev();
|
||||
}
|
||||
|
||||
constexpr reference front() {
|
||||
return *m_root_node.GetNext();
|
||||
}
|
||||
|
||||
constexpr const_reference front() const {
|
||||
return *m_root_node.GetNext();
|
||||
}
|
||||
|
||||
constexpr void push_back(reference node) {
|
||||
m_root_node.LinkPrev(std::addressof(node));
|
||||
}
|
||||
|
||||
constexpr void push_front(reference node) {
|
||||
m_root_node.LinkNext(std::addressof(node));
|
||||
}
|
||||
|
||||
constexpr void pop_back() {
|
||||
m_root_node.GetPrev()->Unlink();
|
||||
}
|
||||
|
||||
constexpr void pop_front() {
|
||||
m_root_node.GetNext()->Unlink();
|
||||
}
|
||||
|
||||
constexpr iterator insert(const_iterator pos, reference node) {
|
||||
pos.GetNonConstIterator()->LinkPrev(std::addressof(node));
|
||||
return iterator(std::addressof(node));
|
||||
}
|
||||
|
||||
constexpr void splice(const_iterator pos, IntrusiveListImpl& o) {
|
||||
splice_impl(pos, o.begin(), o.end());
|
||||
}
|
||||
|
||||
constexpr void splice(const_iterator pos, IntrusiveListImpl& o, const_iterator first) {
|
||||
const_iterator last(first);
|
||||
std::advance(last, 1);
|
||||
splice_impl(pos, first, last);
|
||||
}
|
||||
|
||||
constexpr void splice(const_iterator pos, IntrusiveListImpl& o, const_iterator first,
|
||||
const_iterator last) {
|
||||
splice_impl(pos, first, last);
|
||||
}
|
||||
|
||||
constexpr iterator erase(const_iterator pos) {
|
||||
if (pos == this->end()) {
|
||||
return this->end();
|
||||
}
|
||||
iterator it(pos.GetNonConstIterator());
|
||||
(it++)->Unlink();
|
||||
return it;
|
||||
}
|
||||
|
||||
constexpr void clear() {
|
||||
while (!this->empty()) {
|
||||
this->pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr void splice_impl(const_iterator _pos, const_iterator _first, const_iterator _last) {
|
||||
if (_first == _last) {
|
||||
return;
|
||||
}
|
||||
iterator pos(_pos.GetNonConstIterator());
|
||||
iterator first(_first.GetNonConstIterator());
|
||||
iterator last(_last.GetNonConstIterator());
|
||||
first->Unlink(std::addressof(*last));
|
||||
pos->SplicePrev(std::addressof(*first), std::addressof(*first));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
template <class T, class Traits>
|
||||
class IntrusiveList {
|
||||
YUZU_NON_COPYABLE(IntrusiveList);
|
||||
|
||||
private:
|
||||
impl::IntrusiveListImpl m_impl;
|
||||
|
||||
public:
|
||||
template <bool Const>
|
||||
class Iterator;
|
||||
|
||||
using value_type = T;
|
||||
using size_type = size_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = value_type*;
|
||||
using const_pointer = const value_type*;
|
||||
using reference = value_type&;
|
||||
using const_reference = const value_type&;
|
||||
using iterator = Iterator<false>;
|
||||
using const_iterator = Iterator<true>;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
template <bool Const>
|
||||
class Iterator {
|
||||
public:
|
||||
friend class Common::IntrusiveList<T, Traits>;
|
||||
|
||||
using ImplIterator =
|
||||
std::conditional_t<Const, Common::impl::IntrusiveListImpl::const_iterator,
|
||||
Common::impl::IntrusiveListImpl::iterator>;
|
||||
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = typename IntrusiveList::value_type;
|
||||
using difference_type = typename IntrusiveList::difference_type;
|
||||
using pointer =
|
||||
std::conditional_t<Const, IntrusiveList::const_pointer, IntrusiveList::pointer>;
|
||||
using reference =
|
||||
std::conditional_t<Const, IntrusiveList::const_reference, IntrusiveList::reference>;
|
||||
|
||||
private:
|
||||
ImplIterator m_iterator;
|
||||
|
||||
private:
|
||||
constexpr explicit Iterator(ImplIterator it) : m_iterator(it) {}
|
||||
|
||||
constexpr ImplIterator GetImplIterator() const {
|
||||
return m_iterator;
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr bool operator==(const Iterator& rhs) const {
|
||||
return m_iterator == rhs.m_iterator;
|
||||
}
|
||||
|
||||
constexpr pointer operator->() const {
|
||||
return std::addressof(Traits::GetParent(*m_iterator));
|
||||
}
|
||||
|
||||
constexpr reference operator*() const {
|
||||
return Traits::GetParent(*m_iterator);
|
||||
}
|
||||
|
||||
constexpr Iterator& operator++() {
|
||||
++m_iterator;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Iterator& operator--() {
|
||||
--m_iterator;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Iterator operator++(int) {
|
||||
const Iterator it{*this};
|
||||
++m_iterator;
|
||||
return it;
|
||||
}
|
||||
|
||||
constexpr Iterator operator--(int) {
|
||||
const Iterator it{*this};
|
||||
--m_iterator;
|
||||
return it;
|
||||
}
|
||||
|
||||
constexpr operator Iterator<true>() const {
|
||||
return Iterator<true>(m_iterator);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
static constexpr IntrusiveListNode& GetNode(reference ref) {
|
||||
return Traits::GetNode(ref);
|
||||
}
|
||||
|
||||
static constexpr IntrusiveListNode const& GetNode(const_reference ref) {
|
||||
return Traits::GetNode(ref);
|
||||
}
|
||||
|
||||
static constexpr reference GetParent(IntrusiveListNode& node) {
|
||||
return Traits::GetParent(node);
|
||||
}
|
||||
|
||||
static constexpr const_reference GetParent(IntrusiveListNode const& node) {
|
||||
return Traits::GetParent(node);
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr IntrusiveList() : m_impl() {}
|
||||
|
||||
// Iterator accessors.
|
||||
constexpr iterator begin() {
|
||||
return iterator(m_impl.begin());
|
||||
}
|
||||
|
||||
constexpr const_iterator begin() const {
|
||||
return const_iterator(m_impl.begin());
|
||||
}
|
||||
|
||||
constexpr iterator end() {
|
||||
return iterator(m_impl.end());
|
||||
}
|
||||
|
||||
constexpr const_iterator end() const {
|
||||
return const_iterator(m_impl.end());
|
||||
}
|
||||
|
||||
constexpr const_iterator cbegin() const {
|
||||
return this->begin();
|
||||
}
|
||||
|
||||
constexpr const_iterator cend() const {
|
||||
return this->end();
|
||||
}
|
||||
|
||||
constexpr reverse_iterator rbegin() {
|
||||
return reverse_iterator(this->end());
|
||||
}
|
||||
|
||||
constexpr const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(this->end());
|
||||
}
|
||||
|
||||
constexpr reverse_iterator rend() {
|
||||
return reverse_iterator(this->begin());
|
||||
}
|
||||
|
||||
constexpr const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(this->begin());
|
||||
}
|
||||
|
||||
constexpr const_reverse_iterator crbegin() const {
|
||||
return this->rbegin();
|
||||
}
|
||||
|
||||
constexpr const_reverse_iterator crend() const {
|
||||
return this->rend();
|
||||
}
|
||||
|
||||
constexpr iterator iterator_to(reference v) {
|
||||
return iterator(m_impl.iterator_to(GetNode(v)));
|
||||
}
|
||||
|
||||
constexpr const_iterator iterator_to(const_reference v) const {
|
||||
return const_iterator(m_impl.iterator_to(GetNode(v)));
|
||||
}
|
||||
|
||||
// Content management.
|
||||
constexpr bool empty() const {
|
||||
return m_impl.empty();
|
||||
}
|
||||
|
||||
constexpr size_type size() const {
|
||||
return m_impl.size();
|
||||
}
|
||||
|
||||
constexpr reference back() {
|
||||
return GetParent(m_impl.back());
|
||||
}
|
||||
|
||||
constexpr const_reference back() const {
|
||||
return GetParent(m_impl.back());
|
||||
}
|
||||
|
||||
constexpr reference front() {
|
||||
return GetParent(m_impl.front());
|
||||
}
|
||||
|
||||
constexpr const_reference front() const {
|
||||
return GetParent(m_impl.front());
|
||||
}
|
||||
|
||||
constexpr void push_back(reference ref) {
|
||||
m_impl.push_back(GetNode(ref));
|
||||
}
|
||||
|
||||
constexpr void push_front(reference ref) {
|
||||
m_impl.push_front(GetNode(ref));
|
||||
}
|
||||
|
||||
constexpr void pop_back() {
|
||||
m_impl.pop_back();
|
||||
}
|
||||
|
||||
constexpr void pop_front() {
|
||||
m_impl.pop_front();
|
||||
}
|
||||
|
||||
constexpr iterator insert(const_iterator pos, reference ref) {
|
||||
return iterator(m_impl.insert(pos.GetImplIterator(), GetNode(ref)));
|
||||
}
|
||||
|
||||
constexpr void splice(const_iterator pos, IntrusiveList& o) {
|
||||
m_impl.splice(pos.GetImplIterator(), o.m_impl);
|
||||
}
|
||||
|
||||
constexpr void splice(const_iterator pos, IntrusiveList& o, const_iterator first) {
|
||||
m_impl.splice(pos.GetImplIterator(), o.m_impl, first.GetImplIterator());
|
||||
}
|
||||
|
||||
constexpr void splice(const_iterator pos, IntrusiveList& o, const_iterator first,
|
||||
const_iterator last) {
|
||||
m_impl.splice(pos.GetImplIterator(), o.m_impl, first.GetImplIterator(),
|
||||
last.GetImplIterator());
|
||||
}
|
||||
|
||||
constexpr iterator erase(const_iterator pos) {
|
||||
return iterator(m_impl.erase(pos.GetImplIterator()));
|
||||
}
|
||||
|
||||
constexpr void clear() {
|
||||
m_impl.clear();
|
||||
}
|
||||
};
|
||||
|
||||
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
||||
class IntrusiveListMemberTraits;
|
||||
|
||||
template <class Parent, IntrusiveListNode Parent::*Member, class Derived>
|
||||
class IntrusiveListMemberTraits<Member, Derived> {
|
||||
public:
|
||||
using ListType = IntrusiveList<Derived, IntrusiveListMemberTraits>;
|
||||
|
||||
private:
|
||||
friend class IntrusiveList<Derived, IntrusiveListMemberTraits>;
|
||||
|
||||
static constexpr IntrusiveListNode& GetNode(Derived& parent) {
|
||||
return parent.*Member;
|
||||
}
|
||||
|
||||
static constexpr IntrusiveListNode const& GetNode(Derived const& parent) {
|
||||
return parent.*Member;
|
||||
}
|
||||
|
||||
static Derived& GetParent(IntrusiveListNode& node) {
|
||||
return Common::GetParentReference<Member, Derived>(std::addressof(node));
|
||||
}
|
||||
|
||||
static Derived const& GetParent(IntrusiveListNode const& node) {
|
||||
return Common::GetParentReference<Member, Derived>(std::addressof(node));
|
||||
}
|
||||
};
|
||||
|
||||
template <auto T, class Derived = Common::impl::GetParentType<T>>
|
||||
class IntrusiveListMemberTraitsByNonConstexprOffsetOf;
|
||||
|
||||
template <class Parent, IntrusiveListNode Parent::*Member, class Derived>
|
||||
class IntrusiveListMemberTraitsByNonConstexprOffsetOf<Member, Derived> {
|
||||
public:
|
||||
using ListType = IntrusiveList<Derived, IntrusiveListMemberTraitsByNonConstexprOffsetOf>;
|
||||
|
||||
private:
|
||||
friend class IntrusiveList<Derived, IntrusiveListMemberTraitsByNonConstexprOffsetOf>;
|
||||
|
||||
static constexpr IntrusiveListNode& GetNode(Derived& parent) {
|
||||
return parent.*Member;
|
||||
}
|
||||
|
||||
static constexpr IntrusiveListNode const& GetNode(Derived const& parent) {
|
||||
return parent.*Member;
|
||||
}
|
||||
|
||||
static Derived& GetParent(IntrusiveListNode& node) {
|
||||
return *reinterpret_cast<Derived*>(reinterpret_cast<char*>(std::addressof(node)) -
|
||||
GetOffset());
|
||||
}
|
||||
|
||||
static Derived const& GetParent(IntrusiveListNode const& node) {
|
||||
return *reinterpret_cast<const Derived*>(
|
||||
reinterpret_cast<const char*>(std::addressof(node)) - GetOffset());
|
||||
}
|
||||
|
||||
static uintptr_t GetOffset() {
|
||||
return reinterpret_cast<uintptr_t>(std::addressof(reinterpret_cast<Derived*>(0)->*Member));
|
||||
}
|
||||
};
|
||||
|
||||
template <class Derived>
|
||||
class IntrusiveListBaseNode : public IntrusiveListNode {};
|
||||
|
||||
template <class Derived>
|
||||
class IntrusiveListBaseTraits {
|
||||
public:
|
||||
using ListType = IntrusiveList<Derived, IntrusiveListBaseTraits>;
|
||||
|
||||
private:
|
||||
friend class IntrusiveList<Derived, IntrusiveListBaseTraits>;
|
||||
|
||||
static constexpr IntrusiveListNode& GetNode(Derived& parent) {
|
||||
return static_cast<IntrusiveListNode&>(
|
||||
static_cast<IntrusiveListBaseNode<Derived>&>(parent));
|
||||
}
|
||||
|
||||
static constexpr IntrusiveListNode const& GetNode(Derived const& parent) {
|
||||
return static_cast<const IntrusiveListNode&>(
|
||||
static_cast<const IntrusiveListBaseNode<Derived>&>(parent));
|
||||
}
|
||||
|
||||
static constexpr Derived& GetParent(IntrusiveListNode& node) {
|
||||
return static_cast<Derived&>(static_cast<IntrusiveListBaseNode<Derived>&>(node));
|
||||
}
|
||||
|
||||
static constexpr Derived const& GetParent(IntrusiveListNode const& node) {
|
||||
return static_cast<const Derived&>(
|
||||
static_cast<const IntrusiveListBaseNode<Derived>&>(node));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
@@ -96,10 +96,6 @@ public:
|
||||
return m_node == rhs.m_node;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const Iterator& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
constexpr pointer operator->() const {
|
||||
return m_node;
|
||||
}
|
||||
@@ -324,10 +320,6 @@ public:
|
||||
return m_impl == rhs.m_impl;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const Iterator& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
constexpr pointer operator->() const {
|
||||
return Traits::GetParent(std::addressof(*m_impl));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifdef _WIN32
|
||||
#include "common/string_util.h"
|
||||
#endif
|
||||
#include "common/threadsafe_queue.h"
|
||||
#include "common/bounded_threadsafe_queue.h"
|
||||
|
||||
namespace Common::Log {
|
||||
|
||||
@@ -204,11 +204,11 @@ public:
|
||||
|
||||
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
||||
const char* function, std::string&& message) {
|
||||
if (!filter.CheckMessage(log_class, log_level))
|
||||
if (!filter.CheckMessage(log_class, log_level)) {
|
||||
return;
|
||||
const Entry& entry =
|
||||
CreateEntry(log_class, log_level, filename, line_num, function, std::move(message));
|
||||
message_queue.Push(entry);
|
||||
}
|
||||
message_queue.EmplaceWait(
|
||||
CreateEntry(log_class, log_level, filename, line_num, function, std::move(message)));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -225,7 +225,7 @@ private:
|
||||
ForEachBackend([&entry](Backend& backend) { backend.Write(entry); });
|
||||
};
|
||||
while (!stop_token.stop_requested()) {
|
||||
entry = message_queue.PopWait(stop_token);
|
||||
message_queue.PopWait(entry, stop_token);
|
||||
if (entry.filename != nullptr) {
|
||||
write_logs();
|
||||
}
|
||||
@@ -233,7 +233,7 @@ private:
|
||||
// Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a
|
||||
// case where a system is repeatedly spamming logs even on close.
|
||||
int max_logs_to_write = filter.IsDebug() ? INT_MAX : 100;
|
||||
while (max_logs_to_write-- && message_queue.Pop(entry)) {
|
||||
while (max_logs_to_write-- && message_queue.TryPop(entry)) {
|
||||
write_logs();
|
||||
}
|
||||
});
|
||||
@@ -273,7 +273,7 @@ private:
|
||||
ColorConsoleBackend color_console_backend{};
|
||||
FileBackend file_backend;
|
||||
|
||||
MPSCQueue<Entry, true> message_queue{};
|
||||
MPSCQueue<Entry> message_queue{};
|
||||
std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};
|
||||
std::jthread backend_thread;
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
|
||||
SUB(Service, NPNS) \
|
||||
SUB(Service, NS) \
|
||||
SUB(Service, NVDRV) \
|
||||
SUB(Service, NVFlinger) \
|
||||
SUB(Service, Nvnflinger) \
|
||||
SUB(Service, OLSC) \
|
||||
SUB(Service, PCIE) \
|
||||
SUB(Service, PCTL) \
|
||||
|
||||
+101
-101
@@ -29,107 +29,107 @@ enum class Level : u8 {
|
||||
* filter.cpp.
|
||||
*/
|
||||
enum class Class : u8 {
|
||||
Log, ///< Messages about the log system itself
|
||||
Common, ///< Library routines
|
||||
Common_Filesystem, ///< Filesystem interface library
|
||||
Common_Memory, ///< Memory mapping and management functions
|
||||
Core, ///< LLE emulation core
|
||||
Core_ARM, ///< ARM CPU core
|
||||
Core_Timing, ///< CoreTiming functions
|
||||
Config, ///< Emulator configuration (including commandline)
|
||||
Debug, ///< Debugging tools
|
||||
Debug_Emulated, ///< Debug messages from the emulated programs
|
||||
Debug_GPU, ///< GPU debugging tools
|
||||
Debug_Breakpoint, ///< Logging breakpoints and watchpoints
|
||||
Debug_GDBStub, ///< GDB Stub
|
||||
Kernel, ///< The HLE implementation of the CTR kernel
|
||||
Kernel_SVC, ///< Kernel system calls
|
||||
Service, ///< HLE implementation of system services. Each major service
|
||||
///< should have its own subclass.
|
||||
Service_ACC, ///< The ACC (Accounts) service
|
||||
Service_AM, ///< The AM (Applet manager) service
|
||||
Service_AOC, ///< The AOC (AddOn Content) service
|
||||
Service_APM, ///< The APM (Performance) service
|
||||
Service_ARP, ///< The ARP service
|
||||
Service_Audio, ///< The Audio (Audio control) service
|
||||
Service_BCAT, ///< The BCAT service
|
||||
Service_BGTC, ///< The BGTC (Background Task Controller) service
|
||||
Service_BPC, ///< The BPC service
|
||||
Service_BTDRV, ///< The Bluetooth driver service
|
||||
Service_BTM, ///< The BTM service
|
||||
Service_Capture, ///< The capture service
|
||||
Service_ERPT, ///< The error reporting service
|
||||
Service_ETicket, ///< The ETicket service
|
||||
Service_EUPLD, ///< The error upload service
|
||||
Service_Fatal, ///< The Fatal service
|
||||
Service_FGM, ///< The FGM service
|
||||
Service_Friend, ///< The friend service
|
||||
Service_FS, ///< The FS (Filesystem) service
|
||||
Service_GRC, ///< The game recording service
|
||||
Service_HID, ///< The HID (Human interface device) service
|
||||
Service_IRS, ///< The IRS service
|
||||
Service_JIT, ///< The JIT service
|
||||
Service_LBL, ///< The LBL (LCD backlight) service
|
||||
Service_LDN, ///< The LDN (Local domain network) service
|
||||
Service_LDR, ///< The loader service
|
||||
Service_LM, ///< The LM (Logger) service
|
||||
Service_Migration, ///< The migration service
|
||||
Service_Mii, ///< The Mii service
|
||||
Service_MM, ///< The MM (Multimedia) service
|
||||
Service_MNPP, ///< The MNPP service
|
||||
Service_NCM, ///< The NCM service
|
||||
Service_NFC, ///< The NFC (Near-field communication) service
|
||||
Service_NFP, ///< The NFP service
|
||||
Service_NGCT, ///< The NGCT (No Good Content for Terra) service
|
||||
Service_NIFM, ///< The NIFM (Network interface) service
|
||||
Service_NIM, ///< The NIM service
|
||||
Service_NOTIF, ///< The NOTIF (Notification) service
|
||||
Service_NPNS, ///< The NPNS service
|
||||
Service_NS, ///< The NS services
|
||||
Service_NVDRV, ///< The NVDRV (Nvidia driver) service
|
||||
Service_NVFlinger, ///< The NVFlinger service
|
||||
Service_OLSC, ///< The OLSC service
|
||||
Service_PCIE, ///< The PCIe service
|
||||
Service_PCTL, ///< The PCTL (Parental control) service
|
||||
Service_PCV, ///< The PCV service
|
||||
Service_PM, ///< The PM service
|
||||
Service_PREPO, ///< The PREPO (Play report) service
|
||||
Service_PSC, ///< The PSC service
|
||||
Service_PTM, ///< The PTM service
|
||||
Service_SET, ///< The SET (Settings) service
|
||||
Service_SM, ///< The SM (Service manager) service
|
||||
Service_SPL, ///< The SPL service
|
||||
Service_SSL, ///< The SSL service
|
||||
Service_TCAP, ///< The TCAP service.
|
||||
Service_Time, ///< The time service
|
||||
Service_USB, ///< The USB (Universal Serial Bus) service
|
||||
Service_VI, ///< The VI (Video interface) service
|
||||
Service_WLAN, ///< The WLAN (Wireless local area network) service
|
||||
HW, ///< Low-level hardware emulation
|
||||
HW_Memory, ///< Memory-map and address translation
|
||||
HW_LCD, ///< LCD register emulation
|
||||
HW_GPU, ///< GPU control emulation
|
||||
HW_AES, ///< AES engine emulation
|
||||
IPC, ///< IPC interface
|
||||
Frontend, ///< Emulator UI
|
||||
Render, ///< Emulator video output and hardware acceleration
|
||||
Render_Software, ///< Software renderer backend
|
||||
Render_OpenGL, ///< OpenGL backend
|
||||
Render_Vulkan, ///< Vulkan backend
|
||||
Shader, ///< Shader recompiler
|
||||
Shader_SPIRV, ///< Shader SPIR-V code generation
|
||||
Shader_GLASM, ///< Shader GLASM code generation
|
||||
Shader_GLSL, ///< Shader GLSL code generation
|
||||
Audio, ///< Audio emulation
|
||||
Audio_DSP, ///< The HLE implementation of the DSP
|
||||
Audio_Sink, ///< Emulator audio output backend
|
||||
Loader, ///< ROM loader
|
||||
CheatEngine, ///< Memory manipulation and engine VM functions
|
||||
Crypto, ///< Cryptographic engine/functions
|
||||
Input, ///< Input emulation
|
||||
Network, ///< Network emulation
|
||||
WebService, ///< Interface to yuzu Web Services
|
||||
Count ///< Total number of logging classes
|
||||
Log, ///< Messages about the log system itself
|
||||
Common, ///< Library routines
|
||||
Common_Filesystem, ///< Filesystem interface library
|
||||
Common_Memory, ///< Memory mapping and management functions
|
||||
Core, ///< LLE emulation core
|
||||
Core_ARM, ///< ARM CPU core
|
||||
Core_Timing, ///< CoreTiming functions
|
||||
Config, ///< Emulator configuration (including commandline)
|
||||
Debug, ///< Debugging tools
|
||||
Debug_Emulated, ///< Debug messages from the emulated programs
|
||||
Debug_GPU, ///< GPU debugging tools
|
||||
Debug_Breakpoint, ///< Logging breakpoints and watchpoints
|
||||
Debug_GDBStub, ///< GDB Stub
|
||||
Kernel, ///< The HLE implementation of the CTR kernel
|
||||
Kernel_SVC, ///< Kernel system calls
|
||||
Service, ///< HLE implementation of system services. Each major service
|
||||
///< should have its own subclass.
|
||||
Service_ACC, ///< The ACC (Accounts) service
|
||||
Service_AM, ///< The AM (Applet manager) service
|
||||
Service_AOC, ///< The AOC (AddOn Content) service
|
||||
Service_APM, ///< The APM (Performance) service
|
||||
Service_ARP, ///< The ARP service
|
||||
Service_Audio, ///< The Audio (Audio control) service
|
||||
Service_BCAT, ///< The BCAT service
|
||||
Service_BGTC, ///< The BGTC (Background Task Controller) service
|
||||
Service_BPC, ///< The BPC service
|
||||
Service_BTDRV, ///< The Bluetooth driver service
|
||||
Service_BTM, ///< The BTM service
|
||||
Service_Capture, ///< The capture service
|
||||
Service_ERPT, ///< The error reporting service
|
||||
Service_ETicket, ///< The ETicket service
|
||||
Service_EUPLD, ///< The error upload service
|
||||
Service_Fatal, ///< The Fatal service
|
||||
Service_FGM, ///< The FGM service
|
||||
Service_Friend, ///< The friend service
|
||||
Service_FS, ///< The FS (Filesystem) service
|
||||
Service_GRC, ///< The game recording service
|
||||
Service_HID, ///< The HID (Human interface device) service
|
||||
Service_IRS, ///< The IRS service
|
||||
Service_JIT, ///< The JIT service
|
||||
Service_LBL, ///< The LBL (LCD backlight) service
|
||||
Service_LDN, ///< The LDN (Local domain network) service
|
||||
Service_LDR, ///< The loader service
|
||||
Service_LM, ///< The LM (Logger) service
|
||||
Service_Migration, ///< The migration service
|
||||
Service_Mii, ///< The Mii service
|
||||
Service_MM, ///< The MM (Multimedia) service
|
||||
Service_MNPP, ///< The MNPP service
|
||||
Service_NCM, ///< The NCM service
|
||||
Service_NFC, ///< The NFC (Near-field communication) service
|
||||
Service_NFP, ///< The NFP service
|
||||
Service_NGCT, ///< The NGCT (No Good Content for Terra) service
|
||||
Service_NIFM, ///< The NIFM (Network interface) service
|
||||
Service_NIM, ///< The NIM service
|
||||
Service_NOTIF, ///< The NOTIF (Notification) service
|
||||
Service_NPNS, ///< The NPNS service
|
||||
Service_NS, ///< The NS services
|
||||
Service_NVDRV, ///< The NVDRV (Nvidia driver) service
|
||||
Service_Nvnflinger, ///< The Nvnflinger service
|
||||
Service_OLSC, ///< The OLSC service
|
||||
Service_PCIE, ///< The PCIe service
|
||||
Service_PCTL, ///< The PCTL (Parental control) service
|
||||
Service_PCV, ///< The PCV service
|
||||
Service_PM, ///< The PM service
|
||||
Service_PREPO, ///< The PREPO (Play report) service
|
||||
Service_PSC, ///< The PSC service
|
||||
Service_PTM, ///< The PTM service
|
||||
Service_SET, ///< The SET (Settings) service
|
||||
Service_SM, ///< The SM (Service manager) service
|
||||
Service_SPL, ///< The SPL service
|
||||
Service_SSL, ///< The SSL service
|
||||
Service_TCAP, ///< The TCAP service.
|
||||
Service_Time, ///< The time service
|
||||
Service_USB, ///< The USB (Universal Serial Bus) service
|
||||
Service_VI, ///< The VI (Video interface) service
|
||||
Service_WLAN, ///< The WLAN (Wireless local area network) service
|
||||
HW, ///< Low-level hardware emulation
|
||||
HW_Memory, ///< Memory-map and address translation
|
||||
HW_LCD, ///< LCD register emulation
|
||||
HW_GPU, ///< GPU control emulation
|
||||
HW_AES, ///< AES engine emulation
|
||||
IPC, ///< IPC interface
|
||||
Frontend, ///< Emulator UI
|
||||
Render, ///< Emulator video output and hardware acceleration
|
||||
Render_Software, ///< Software renderer backend
|
||||
Render_OpenGL, ///< OpenGL backend
|
||||
Render_Vulkan, ///< Vulkan backend
|
||||
Shader, ///< Shader recompiler
|
||||
Shader_SPIRV, ///< Shader SPIR-V code generation
|
||||
Shader_GLASM, ///< Shader GLASM code generation
|
||||
Shader_GLSL, ///< Shader GLSL code generation
|
||||
Audio, ///< Audio emulation
|
||||
Audio_DSP, ///< The HLE implementation of the DSP
|
||||
Audio_Sink, ///< Emulator audio output backend
|
||||
Loader, ///< ROM loader
|
||||
CheatEngine, ///< Memory manipulation and engine VM functions
|
||||
Crypto, ///< Cryptographic engine/functions
|
||||
Input, ///< Input emulation
|
||||
Network, ///< Network emulation
|
||||
WebService, ///< Interface to yuzu Web Services
|
||||
Count ///< Total number of logging classes
|
||||
};
|
||||
|
||||
} // namespace Common::Log
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include "bit_cast.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
template <typename T>
|
||||
requires(std::is_integral_v<T> && std::is_signed_v<T>)
|
||||
inline T WrappingAdd(T lhs, T rhs) {
|
||||
using U = std::make_unsigned_t<T>;
|
||||
|
||||
U lhs_u = BitCast<U>(lhs);
|
||||
U rhs_u = BitCast<U>(rhs);
|
||||
|
||||
return BitCast<T>(lhs_u + rhs_u);
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user