diff options
Diffstat (limited to 'src')
46 files changed, 266 insertions, 233 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index 43b79bd6d..1bcb897b5 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp | |||
| @@ -82,32 +82,35 @@ public: | |||
| 82 | 82 | ||
| 83 | private: | 83 | private: |
| 84 | PathManagerImpl() { | 84 | PathManagerImpl() { |
| 85 | fs::path yuzu_path; | ||
| 86 | fs::path yuzu_path_cache; | ||
| 87 | fs::path yuzu_path_config; | ||
| 88 | |||
| 85 | #ifdef _WIN32 | 89 | #ifdef _WIN32 |
| 86 | auto yuzu_path = GetExeDirectory() / PORTABLE_DIR; | 90 | yuzu_path = GetExeDirectory() / PORTABLE_DIR; |
| 87 | 91 | ||
| 88 | if (!IsDir(yuzu_path)) { | 92 | if (!IsDir(yuzu_path)) { |
| 89 | yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; | 93 | yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; |
| 90 | } | 94 | } |
| 91 | 95 | ||
| 92 | GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); | 96 | yuzu_path_cache = yuzu_path / CACHE_DIR; |
| 93 | GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR); | 97 | yuzu_path_config = yuzu_path / CONFIG_DIR; |
| 94 | GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR); | ||
| 95 | #else | 98 | #else |
| 96 | auto yuzu_path = GetCurrentDir() / PORTABLE_DIR; | 99 | yuzu_path = GetCurrentDir() / PORTABLE_DIR; |
| 97 | 100 | ||
| 98 | if (Exists(yuzu_path) && IsDir(yuzu_path)) { | 101 | if (Exists(yuzu_path) && IsDir(yuzu_path)) { |
| 99 | GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); | 102 | yuzu_path_cache = yuzu_path / CACHE_DIR; |
| 100 | GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR); | 103 | yuzu_path_config = yuzu_path / CONFIG_DIR; |
| 101 | GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR); | ||
| 102 | } else { | 104 | } else { |
| 103 | yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR; | 105 | yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR; |
| 104 | 106 | yuzu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR; | |
| 105 | GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); | 107 | yuzu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR; |
| 106 | GenerateYuzuPath(YuzuPath::CacheDir, GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR); | ||
| 107 | GenerateYuzuPath(YuzuPath::ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR); | ||
| 108 | } | 108 | } |
| 109 | #endif | 109 | #endif |
| 110 | 110 | ||
| 111 | GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); | ||
| 112 | GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path_cache); | ||
| 113 | GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path_config); | ||
| 111 | GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR); | 114 | GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR); |
| 112 | GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR); | 115 | GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR); |
| 113 | GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR); | 116 | GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR); |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index ceff2532d..cf204f570 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -4,17 +4,14 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <cstring> | 7 | #include <cstring> |
| 9 | #include <memory> | 8 | #include <memory> |
| 10 | #include <tuple> | ||
| 11 | #include <type_traits> | 9 | #include <type_traits> |
| 12 | #include <utility> | 10 | #include <utility> |
| 13 | #include "common/assert.h" | 11 | #include "common/assert.h" |
| 14 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 15 | #include "core/hle/ipc.h" | 13 | #include "core/hle/ipc.h" |
| 16 | #include "core/hle/kernel/hle_ipc.h" | 14 | #include "core/hle/kernel/hle_ipc.h" |
| 17 | #include "core/hle/kernel/k_client_port.h" | ||
| 18 | #include "core/hle/kernel/k_process.h" | 15 | #include "core/hle/kernel/k_process.h" |
| 19 | #include "core/hle/kernel/k_resource_limit.h" | 16 | #include "core/hle/kernel/k_resource_limit.h" |
| 20 | #include "core/hle/kernel/k_session.h" | 17 | #include "core/hle/kernel/k_session.h" |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index ca68fc325..cee96dd9b 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 16 | #include "core/hle/ipc_helpers.h" | 16 | #include "core/hle/ipc_helpers.h" |
| 17 | #include "core/hle/kernel/hle_ipc.h" | 17 | #include "core/hle/kernel/hle_ipc.h" |
| 18 | #include "core/hle/kernel/k_auto_object.h" | ||
| 18 | #include "core/hle/kernel/k_handle_table.h" | 19 | #include "core/hle/kernel/k_handle_table.h" |
| 19 | #include "core/hle/kernel/k_process.h" | 20 | #include "core/hle/kernel/k_process.h" |
| 20 | #include "core/hle/kernel/k_readable_event.h" | 21 | #include "core/hle/kernel/k_readable_event.h" |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index a61870f8b..55e6fb9f7 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #include "common/concepts.h" | 17 | #include "common/concepts.h" |
| 18 | #include "common/swap.h" | 18 | #include "common/swap.h" |
| 19 | #include "core/hle/ipc.h" | 19 | #include "core/hle/ipc.h" |
| 20 | #include "core/hle/kernel/k_auto_object.h" | ||
| 21 | #include "core/hle/kernel/svc_common.h" | 20 | #include "core/hle/kernel/svc_common.h" |
| 22 | 21 | ||
| 23 | union ResultCode; | 22 | union ResultCode; |
| @@ -38,6 +37,7 @@ namespace Kernel { | |||
| 38 | 37 | ||
| 39 | class Domain; | 38 | class Domain; |
| 40 | class HLERequestContext; | 39 | class HLERequestContext; |
| 40 | class KAutoObject; | ||
| 41 | class KernelCore; | 41 | class KernelCore; |
| 42 | class KHandleTable; | 42 | class KHandleTable; |
| 43 | class KProcess; | 43 | class KProcess; |
diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h index adb207349..f89f65649 100644 --- a/src/core/hle/service/am/applet_ae.h +++ b/src/core/hle/service/am/applet_ae.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include "core/hle/kernel/hle_ipc.h" | 8 | |
| 9 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 10 | 10 | ||
| 11 | namespace Service { | 11 | namespace Service { |
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h index 6c1aa255a..64b874ead 100644 --- a/src/core/hle/service/am/applet_oe.h +++ b/src/core/hle/service/am/applet_oe.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include "core/hle/kernel/hle_ipc.h" | 8 | |
| 9 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 10 | 10 | ||
| 11 | namespace Service { | 11 | namespace Service { |
diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp index 35f194961..927eeefff 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.cpp +++ b/src/core/hle/service/am/applets/applet_web_browser.cpp | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include "core/hle/service/am/applets/applet_web_browser.h" | 24 | #include "core/hle/service/am/applets/applet_web_browser.h" |
| 25 | #include "core/hle/service/filesystem/filesystem.h" | 25 | #include "core/hle/service/filesystem/filesystem.h" |
| 26 | #include "core/hle/service/ns/pl_u.h" | 26 | #include "core/hle/service/ns/pl_u.h" |
| 27 | #include "core/loader/loader.h" | ||
| 27 | 28 | ||
| 28 | namespace Service::AM::Applets { | 29 | namespace Service::AM::Applets { |
| 29 | 30 | ||
| @@ -122,6 +123,15 @@ FileSys::VirtualFile GetOfflineRomFS(Core::System& system, u64 title_id, | |||
| 122 | const auto nca = system.GetContentProvider().GetEntry(title_id, nca_type); | 123 | const auto nca = system.GetContentProvider().GetEntry(title_id, nca_type); |
| 123 | 124 | ||
| 124 | if (nca == nullptr) { | 125 | if (nca == nullptr) { |
| 126 | if (nca_type == FileSys::ContentRecordType::HtmlDocument) { | ||
| 127 | LOG_WARNING(Service_AM, "Falling back to AppLoader to get the RomFS."); | ||
| 128 | FileSys::VirtualFile romfs; | ||
| 129 | system.GetAppLoader().ReadManualRomFS(romfs); | ||
| 130 | if (romfs != nullptr) { | ||
| 131 | return romfs; | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 125 | LOG_ERROR(Service_AM, | 135 | LOG_ERROR(Service_AM, |
| 126 | "NCA of type={} with title_id={:016X} is not found in the ContentProvider!", | 136 | "NCA of type={} with title_id={:016X} is not found in the ContentProvider!", |
| 127 | nca_type, title_id); | 137 | nca_type, title_id); |
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 840d1d883..34cc659ed 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/kernel/hle_ipc.h" | ||
| 9 | #include "core/hle/kernel/k_event.h" | 8 | #include "core/hle/kernel/k_event.h" |
| 10 | #include "core/hle/service/audio/audin_u.h" | 9 | #include "core/hle/service/audio/audin_u.h" |
| 11 | 10 | ||
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index beb387745..81adbfe09 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #include "common/swap.h" | 13 | #include "common/swap.h" |
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/hle/ipc_helpers.h" | 15 | #include "core/hle/ipc_helpers.h" |
| 16 | #include "core/hle/kernel/hle_ipc.h" | ||
| 17 | #include "core/hle/kernel/k_event.h" | 16 | #include "core/hle/kernel/k_event.h" |
| 18 | #include "core/hle/kernel/kernel.h" | 17 | #include "core/hle/kernel/kernel.h" |
| 19 | #include "core/hle/service/audio/audout_u.h" | 18 | #include "core/hle/service/audio/audout_u.h" |
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 1f69d39cc..cdb2a9521 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include "common/string_util.h" | 15 | #include "common/string_util.h" |
| 16 | #include "core/core.h" | 16 | #include "core/core.h" |
| 17 | #include "core/hle/ipc_helpers.h" | 17 | #include "core/hle/ipc_helpers.h" |
| 18 | #include "core/hle/kernel/hle_ipc.h" | ||
| 19 | #include "core/hle/kernel/k_event.h" | 18 | #include "core/hle/kernel/k_event.h" |
| 20 | #include "core/hle/kernel/kernel.h" | 19 | #include "core/hle/kernel/kernel.h" |
| 21 | #include "core/hle/service/audio/audren_u.h" | 20 | #include "core/hle/service/audio/audren_u.h" |
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 33a6dbbb6..7da1f2969 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #include "common/assert.h" | 13 | #include "common/assert.h" |
| 14 | #include "common/logging/log.h" | 14 | #include "common/logging/log.h" |
| 15 | #include "core/hle/ipc_helpers.h" | 15 | #include "core/hle/ipc_helpers.h" |
| 16 | #include "core/hle/kernel/hle_ipc.h" | ||
| 17 | #include "core/hle/service/audio/hwopus.h" | 16 | #include "core/hle/service/audio/hwopus.h" |
| 18 | 17 | ||
| 19 | namespace Service::Audio { | 18 | namespace Service::Audio { |
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index ecd3bd22a..088a1a18a 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/kernel/hle_ipc.h" | ||
| 9 | #include "core/hle/kernel/k_event.h" | 8 | #include "core/hle/kernel/k_event.h" |
| 10 | #include "core/hle/kernel/kernel.h" | 9 | #include "core/hle/kernel/kernel.h" |
| 11 | #include "core/hle/service/btdrv/btdrv.h" | 10 | #include "core/hle/service/btdrv/btdrv.h" |
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 780a99c2d..7aabacc19 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| 10 | #include "core/hle/kernel/hle_ipc.h" | ||
| 11 | #include "core/hle/kernel/k_event.h" | 10 | #include "core/hle/kernel/k_event.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/kernel.h" |
| 13 | #include "core/hle/service/btm/btm.h" | 12 | #include "core/hle/service/btm/btm.h" |
diff --git a/src/core/hle/service/caps/caps.h b/src/core/hle/service/caps/caps.h index 3c4290c88..b18adcb9d 100644 --- a/src/core/hle/service/caps/caps.h +++ b/src/core/hle/service/caps/caps.h | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "common/common_funcs.h" |
| 8 | #include "common/common_types.h" | ||
| 8 | 9 | ||
| 9 | namespace Core { | 10 | namespace Core { |
| 10 | class System; | 11 | class System; |
diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp index 25c6c0194..d7a638f96 100644 --- a/src/core/hle/service/fgm/fgm.cpp +++ b/src/core/hle/service/fgm/fgm.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | 6 | ||
| 7 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/kernel/hle_ipc.h" | ||
| 9 | #include "core/hle/service/fgm/fgm.h" | 8 | #include "core/hle/service/fgm/fgm.h" |
| 10 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 11 | #include "core/hle/service/sm/sm.h" | 10 | #include "core/hle/service/sm/sm.h" |
diff --git a/src/core/hle/service/filesystem/fsp_ldr.cpp b/src/core/hle/service/filesystem/fsp_ldr.cpp index 1f6c17ba5..f112ae9d0 100644 --- a/src/core/hle/service/filesystem/fsp_ldr.cpp +++ b/src/core/hle/service/filesystem/fsp_ldr.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/service/filesystem/fsp_ldr.h" | 5 | #include "core/hle/service/filesystem/fsp_ldr.h" |
| 6 | #include "core/hle/service/service.h" | ||
| 7 | 6 | ||
| 8 | namespace Service::FileSystem { | 7 | namespace Service::FileSystem { |
| 9 | 8 | ||
diff --git a/src/core/hle/service/filesystem/fsp_pr.cpp b/src/core/hle/service/filesystem/fsp_pr.cpp index 00e4d1662..9b7f7d861 100644 --- a/src/core/hle/service/filesystem/fsp_pr.cpp +++ b/src/core/hle/service/filesystem/fsp_pr.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/service/filesystem/fsp_pr.h" | 5 | #include "core/hle/service/filesystem/fsp_pr.h" |
| 6 | #include "core/hle/service/service.h" | ||
| 7 | 6 | ||
| 8 | namespace Service::FileSystem { | 7 | namespace Service::FileSystem { |
| 9 | 8 | ||
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 5a3b54cc1..70cd63c6b 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp | |||
| @@ -8,13 +8,11 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/file_sys/control_metadata.h" | 9 | #include "core/file_sys/control_metadata.h" |
| 10 | #include "core/hle/ipc_helpers.h" | 10 | #include "core/hle/ipc_helpers.h" |
| 11 | #include "core/hle/kernel/hle_ipc.h" | ||
| 12 | #include "core/hle/kernel/k_process.h" | 11 | #include "core/hle/kernel/k_process.h" |
| 13 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/kernel.h" |
| 14 | #include "core/hle/service/glue/arp.h" | 13 | #include "core/hle/service/glue/arp.h" |
| 15 | #include "core/hle/service/glue/errors.h" | 14 | #include "core/hle/service/glue/errors.h" |
| 16 | #include "core/hle/service/glue/glue_manager.h" | 15 | #include "core/hle/service/glue/glue_manager.h" |
| 17 | #include "core/hle/service/service.h" | ||
| 18 | 16 | ||
| 19 | namespace Service::Glue { | 17 | namespace Service::Glue { |
| 20 | 18 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 8c363142c..043320d50 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -8,12 +8,9 @@ | |||
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/core_timing.h" | 10 | #include "core/core_timing.h" |
| 11 | #include "core/core_timing_util.h" | ||
| 12 | #include "core/frontend/emu_window.h" | 11 | #include "core/frontend/emu_window.h" |
| 13 | #include "core/frontend/input.h" | 12 | #include "core/frontend/input.h" |
| 14 | #include "core/hardware_properties.h" | ||
| 15 | #include "core/hle/ipc_helpers.h" | 13 | #include "core/hle/ipc_helpers.h" |
| 16 | #include "core/hle/kernel/k_client_port.h" | ||
| 17 | #include "core/hle/kernel/k_readable_event.h" | 14 | #include "core/hle/kernel/k_readable_event.h" |
| 18 | #include "core/hle/kernel/k_shared_memory.h" | 15 | #include "core/hle/kernel/k_shared_memory.h" |
| 19 | #include "core/hle/kernel/k_transfer_memory.h" | 16 | #include "core/hle/kernel/k_transfer_memory.h" |
| @@ -23,7 +20,6 @@ | |||
| 23 | #include "core/hle/service/hid/hid.h" | 20 | #include "core/hle/service/hid/hid.h" |
| 24 | #include "core/hle/service/hid/irs.h" | 21 | #include "core/hle/service/hid/irs.h" |
| 25 | #include "core/hle/service/hid/xcd.h" | 22 | #include "core/hle/service/hid/xcd.h" |
| 26 | #include "core/hle/service/service.h" | ||
| 27 | #include "core/memory.h" | 23 | #include "core/memory.h" |
| 28 | 24 | ||
| 29 | #include "core/hle/service/hid/controllers/console_sixaxis.h" | 25 | #include "core/hle/service/hid/controllers/console_sixaxis.h" |
diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index 37ff37277..5c8ae029c 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| 10 | #include "core/hle/kernel/hle_ipc.h" | ||
| 11 | #include "core/hle/service/lbl/lbl.h" | 10 | #include "core/hle/service/lbl/lbl.h" |
| 12 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 13 | #include "core/hle/service/sm/sm.h" | 12 | #include "core/hle/service/sm/sm.h" |
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index 9d863486a..0b907824d 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 9 | #include "core/hle/kernel/hle_ipc.h" | ||
| 10 | #include "core/hle/service/mii/mii.h" | 9 | #include "core/hle/service/mii/mii.h" |
| 11 | #include "core/hle/service/mii/mii_manager.h" | 10 | #include "core/hle/service/mii/mii_manager.h" |
| 12 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index b014ea826..f77037842 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| 10 | #include "core/hle/kernel/hle_ipc.h" | ||
| 11 | #include "core/hle/service/nfc/nfc.h" | 10 | #include "core/hle/service/nfc/nfc.h" |
| 12 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 13 | #include "core/hle/service/sm/sm.h" | 12 | #include "core/hle/service/sm/sm.h" |
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 8ce1f3296..931b48f72 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #include "core/file_sys/patch_manager.h" | 9 | #include "core/file_sys/patch_manager.h" |
| 10 | #include "core/file_sys/vfs.h" | 10 | #include "core/file_sys/vfs.h" |
| 11 | #include "core/hle/ipc_helpers.h" | 11 | #include "core/hle/ipc_helpers.h" |
| 12 | #include "core/hle/kernel/hle_ipc.h" | ||
| 13 | #include "core/hle/service/ns/errors.h" | 12 | #include "core/hle/service/ns/errors.h" |
| 14 | #include "core/hle/service/ns/language.h" | 13 | #include "core/hle/service/ns/language.h" |
| 15 | #include "core/hle/service/ns/ns.h" | 14 | #include "core/hle/service/ns/ns.h" |
diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 3bbe1bfe2..39a8031a5 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/ipc_helpers.h" | 5 | #include "core/hle/ipc_helpers.h" |
| 6 | #include "core/hle/kernel/hle_ipc.h" | ||
| 7 | #include "core/hle/service/olsc/olsc.h" | 6 | #include "core/hle/service/olsc/olsc.h" |
| 8 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 9 | #include "core/hle/service/sm/sm.h" | 8 | #include "core/hle/service/sm/sm.h" |
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 8299c6b68..286578b17 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include "core/file_sys/errors.h" | 7 | #include "core/file_sys/errors.h" |
| 8 | #include "core/file_sys/system_archive/system_version.h" | 8 | #include "core/file_sys/system_archive/system_version.h" |
| 9 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| 10 | #include "core/hle/kernel/k_client_port.h" | ||
| 11 | #include "core/hle/service/filesystem/filesystem.h" | 10 | #include "core/hle/service/filesystem/filesystem.h" |
| 12 | #include "core/hle/service/set/set_sys.h" | 11 | #include "core/hle/service/set/set_sys.h" |
| 13 | 12 | ||
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index d68beef5c..a387e50df 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h | |||
| @@ -5,11 +5,9 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string_view> | ||
| 9 | #include <vector> | 8 | #include <vector> |
| 10 | 9 | ||
| 11 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/hle_ipc.h" | ||
| 13 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 14 | #include "core/hle/service/sockets/sockets.h" | 12 | #include "core/hle/service/sockets/sockets.h" |
| 15 | 13 | ||
diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h index faa6b7d0d..5d3b4dc2d 100644 --- a/src/core/hle/service/sockets/sfdnsres.h +++ b/src/core/hle/service/sockets/sfdnsres.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/kernel/hle_ipc.h" | ||
| 8 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 9 | 8 | ||
| 10 | namespace Core { | 9 | namespace Core { |
diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index 5a65ed2a9..02dbbae40 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h | |||
| @@ -4,13 +4,17 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_funcs.h" | ||
| 7 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 8 | #include "core/hle/service/service.h" | ||
| 9 | 9 | ||
| 10 | namespace Core { | 10 | namespace Core { |
| 11 | class System; | 11 | class System; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | namespace Service::SM { | ||
| 15 | class ServiceManager; | ||
| 16 | } | ||
| 17 | |||
| 14 | namespace Service::Sockets { | 18 | namespace Service::Sockets { |
| 15 | 19 | ||
| 16 | enum class Errno : u32 { | 20 | enum class Errno : u32 { |
diff --git a/src/core/hle/service/spl/spl_module.cpp b/src/core/hle/service/spl/spl_module.cpp index 918633af5..ed4c06260 100644 --- a/src/core/hle/service/spl/spl_module.cpp +++ b/src/core/hle/service/spl/spl_module.cpp | |||
| @@ -3,10 +3,8 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <chrono> | ||
| 7 | #include <cstdlib> | 6 | #include <cstdlib> |
| 8 | #include <ctime> | 7 | #include <ctime> |
| 9 | #include <functional> | ||
| 10 | #include <vector> | 8 | #include <vector> |
| 11 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 12 | #include "common/settings.h" | 10 | #include "common/settings.h" |
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 921f4d776..a81a595ea 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/ipc_helpers.h" | 5 | #include "core/hle/ipc_helpers.h" |
| 6 | #include "core/hle/kernel/hle_ipc.h" | ||
| 7 | #include "core/hle/service/service.h" | 6 | #include "core/hle/service/service.h" |
| 8 | #include "core/hle/service/sm/sm.h" | 7 | #include "core/hle/service/sm/sm.h" |
| 9 | #include "core/hle/service/ssl/ssl.h" | 8 | #include "core/hle/service/ssl/ssl.h" |
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 8fdd5076f..d84a111c2 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -8,11 +8,11 @@ | |||
| 8 | #include "core/core_timing_util.h" | 8 | #include "core/core_timing_util.h" |
| 9 | #include "core/hardware_properties.h" | 9 | #include "core/hardware_properties.h" |
| 10 | #include "core/hle/ipc_helpers.h" | 10 | #include "core/hle/ipc_helpers.h" |
| 11 | #include "core/hle/kernel/k_client_port.h" | ||
| 12 | #include "core/hle/kernel/k_scheduler.h" | 11 | #include "core/hle/kernel/k_scheduler.h" |
| 13 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/kernel.h" |
| 14 | #include "core/hle/service/time/time.h" | 13 | #include "core/hle/service/time/time.h" |
| 15 | #include "core/hle/service/time/time_interface.h" | 14 | #include "core/hle/service/time/time_interface.h" |
| 15 | #include "core/hle/service/time/time_manager.h" | ||
| 16 | #include "core/hle/service/time/time_sharedmemory.h" | 16 | #include "core/hle/service/time/time_sharedmemory.h" |
| 17 | #include "core/hle/service/time/time_zone_service.h" | 17 | #include "core/hle/service/time/time_zone_service.h" |
| 18 | 18 | ||
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index ce9c479c6..30e2cd369 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | #include "core/hle/service/time/clock_types.h" | 8 | #include "core/hle/service/time/clock_types.h" |
| 9 | #include "core/hle/service/time/time_manager.h" | ||
| 10 | 9 | ||
| 11 | namespace Core { | 10 | namespace Core { |
| 12 | class System; | 11 | class System; |
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index 2ee103b37..502dfbb4a 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 9 | #include "core/hle/kernel/hle_ipc.h" | ||
| 10 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 11 | #include "core/hle/service/sm/sm.h" | 10 | #include "core/hle/service/sm/sm.h" |
| 12 | #include "core/hle/service/usb/usb.h" | 11 | #include "core/hle/service/usb/usb.h" |
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h index eec531d54..2fd7f8e61 100644 --- a/src/core/hle/service/vi/vi.h +++ b/src/core/hle/service/vi/vi.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 8 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 9 | 8 | ||
| 10 | namespace Core { | 9 | namespace Core { |
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index ab6211b29..ecb00d428 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp | |||
| @@ -170,7 +170,8 @@ public: | |||
| 170 | float GetAxis(int axis, float range, float offset) const { | 170 | float GetAxis(int axis, float range, float offset) const { |
| 171 | std::lock_guard lock{mutex}; | 171 | std::lock_guard lock{mutex}; |
| 172 | const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f; | 172 | const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f; |
| 173 | return (value + offset) / range; | 173 | const float offset_scale = (value + offset) > 0.0f ? 1.0f + offset : 1.0f - offset; |
| 174 | return (value + offset) / range / offset_scale; | ||
| 174 | } | 175 | } |
| 175 | 176 | ||
| 176 | bool RumblePlay(u16 amp_low, u16 amp_high) { | 177 | bool RumblePlay(u16 amp_low, u16 amp_high) { |
| @@ -789,8 +790,8 @@ public: | |||
| 789 | const std::string invert_y_value = params.Get("invert_y", "+"); | 790 | const std::string invert_y_value = params.Get("invert_y", "+"); |
| 790 | const bool invert_x = invert_x_value == "-"; | 791 | const bool invert_x = invert_x_value == "-"; |
| 791 | const bool invert_y = invert_y_value == "-"; | 792 | const bool invert_y = invert_y_value == "-"; |
| 792 | const float offset_x = params.Get("offset_x", 0.0f); | 793 | const float offset_x = std::clamp(params.Get("offset_x", 0.0f), -0.99f, 0.99f); |
| 793 | const float offset_y = params.Get("offset_y", 0.0f); | 794 | const float offset_y = std::clamp(params.Get("offset_y", 0.0f), -0.99f, 0.99f); |
| 794 | auto joystick = state.GetSDLJoystickByGUID(guid, port); | 795 | auto joystick = state.GetSDLJoystickByGUID(guid, port); |
| 795 | 796 | ||
| 796 | // This is necessary so accessing GetAxis with axis_x and axis_y won't crash | 797 | // This is necessary so accessing GetAxis with axis_x and axis_y won't crash |
diff --git a/src/video_core/command_classes/codecs/h264.cpp b/src/video_core/command_classes/codecs/h264.cpp index 51ee14c13..5519c4705 100644 --- a/src/video_core/command_classes/codecs/h264.cpp +++ b/src/video_core/command_classes/codecs/h264.cpp | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | 20 | ||
| 21 | #include <array> | 21 | #include <array> |
| 22 | #include <bit> | 22 | #include <bit> |
| 23 | |||
| 24 | #include "common/settings.h" | ||
| 23 | #include "video_core/command_classes/codecs/h264.h" | 25 | #include "video_core/command_classes/codecs/h264.h" |
| 24 | #include "video_core/gpu.h" | 26 | #include "video_core/gpu.h" |
| 25 | #include "video_core/memory_manager.h" | 27 | #include "video_core/memory_manager.h" |
| @@ -96,7 +98,10 @@ const std::vector<u8>& H264::ComposeFrameHeader(const NvdecCommon::NvdecRegister | |||
| 96 | (context.h264_parameter_set.frame_mbs_only_flag ? 1 : 2); | 98 | (context.h264_parameter_set.frame_mbs_only_flag ? 1 : 2); |
| 97 | 99 | ||
| 98 | // TODO (ameerj): Where do we get this number, it seems to be particular for each stream | 100 | // TODO (ameerj): Where do we get this number, it seems to be particular for each stream |
| 99 | writer.WriteUe(6); // Max number of reference frames | 101 | const auto nvdec_decoding = Settings::values.nvdec_emulation.GetValue(); |
| 102 | const bool uses_gpu_decoding = nvdec_decoding == Settings::NvdecEmulation::GPU; | ||
| 103 | const u32 max_num_ref_frames = uses_gpu_decoding ? 6u : 16u; | ||
| 104 | writer.WriteUe(max_num_ref_frames); | ||
| 100 | writer.WriteBit(false); | 105 | writer.WriteBit(false); |
| 101 | writer.WriteUe(context.h264_parameter_set.pic_width_in_mbs - 1); | 106 | writer.WriteUe(context.h264_parameter_set.pic_width_in_mbs - 1); |
| 102 | writer.WriteUe(pic_height - 1); | 107 | writer.WriteUe(pic_height - 1); |
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp index 0ee07f398..051616124 100644 --- a/src/video_core/command_classes/vic.cpp +++ b/src/video_core/command_classes/vic.cpp | |||
| @@ -16,6 +16,7 @@ extern "C" { | |||
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #include "common/assert.h" | 18 | #include "common/assert.h" |
| 19 | #include "common/bit_field.h" | ||
| 19 | #include "common/logging/log.h" | 20 | #include "common/logging/log.h" |
| 20 | 21 | ||
| 21 | #include "video_core/command_classes/nvdec.h" | 22 | #include "video_core/command_classes/nvdec.h" |
| @@ -26,6 +27,25 @@ extern "C" { | |||
| 26 | #include "video_core/textures/decoders.h" | 27 | #include "video_core/textures/decoders.h" |
| 27 | 28 | ||
| 28 | namespace Tegra { | 29 | namespace Tegra { |
| 30 | namespace { | ||
| 31 | enum class VideoPixelFormat : u64_le { | ||
| 32 | RGBA8 = 0x1f, | ||
| 33 | BGRA8 = 0x20, | ||
| 34 | RGBX8 = 0x23, | ||
| 35 | YUV420 = 0x44, | ||
| 36 | }; | ||
| 37 | } // Anonymous namespace | ||
| 38 | |||
| 39 | union VicConfig { | ||
| 40 | u64_le raw{}; | ||
| 41 | BitField<0, 7, VideoPixelFormat> pixel_format; | ||
| 42 | BitField<7, 2, u64_le> chroma_loc_horiz; | ||
| 43 | BitField<9, 2, u64_le> chroma_loc_vert; | ||
| 44 | BitField<11, 4, u64_le> block_linear_kind; | ||
| 45 | BitField<15, 4, u64_le> block_linear_height_log2; | ||
| 46 | BitField<32, 14, u64_le> surface_width_minus1; | ||
| 47 | BitField<46, 14, u64_le> surface_height_minus1; | ||
| 48 | }; | ||
| 29 | 49 | ||
| 30 | Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_) | 50 | Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_) |
| 31 | : gpu(gpu_), | 51 | : gpu(gpu_), |
| @@ -65,134 +85,155 @@ void Vic::Execute() { | |||
| 65 | if (!frame) { | 85 | if (!frame) { |
| 66 | return; | 86 | return; |
| 67 | } | 87 | } |
| 68 | const auto pixel_format = static_cast<VideoPixelFormat>(config.pixel_format.Value()); | 88 | const u64 surface_width = config.surface_width_minus1 + 1; |
| 69 | switch (pixel_format) { | 89 | const u64 surface_height = config.surface_height_minus1 + 1; |
| 90 | if (static_cast<u64>(frame->width) != surface_width || | ||
| 91 | static_cast<u64>(frame->height) != surface_height) { | ||
| 92 | // TODO: Properly support multiple video streams with differing frame dimensions | ||
| 93 | LOG_WARNING(Service_NVDRV, "Frame dimensions {}x{} don't match surface dimensions {}x{}", | ||
| 94 | frame->width, frame->height, surface_width, surface_height); | ||
| 95 | } | ||
| 96 | switch (config.pixel_format) { | ||
| 97 | case VideoPixelFormat::RGBA8: | ||
| 70 | case VideoPixelFormat::BGRA8: | 98 | case VideoPixelFormat::BGRA8: |
| 71 | case VideoPixelFormat::RGBA8: { | 99 | case VideoPixelFormat::RGBX8: |
| 72 | LOG_TRACE(Service_NVDRV, "Writing RGB Frame"); | 100 | WriteRGBFrame(frame, config); |
| 101 | break; | ||
| 102 | case VideoPixelFormat::YUV420: | ||
| 103 | WriteYUVFrame(frame, config); | ||
| 104 | break; | ||
| 105 | default: | ||
| 106 | UNIMPLEMENTED_MSG("Unknown video pixel format {:X}", config.pixel_format.Value()); | ||
| 107 | break; | ||
| 108 | } | ||
| 109 | } | ||
| 73 | 110 | ||
| 74 | if (scaler_ctx == nullptr || frame->width != scaler_width || | 111 | void Vic::WriteRGBFrame(const AVFrame* frame, const VicConfig& config) { |
| 75 | frame->height != scaler_height) { | 112 | LOG_TRACE(Service_NVDRV, "Writing RGB Frame"); |
| 76 | const AVPixelFormat target_format = | 113 | |
| 77 | (pixel_format == VideoPixelFormat::RGBA8) ? AV_PIX_FMT_RGBA : AV_PIX_FMT_BGRA; | 114 | if (!scaler_ctx || frame->width != scaler_width || frame->height != scaler_height) { |
| 115 | const AVPixelFormat target_format = [pixel_format = config.pixel_format]() { | ||
| 116 | switch (pixel_format) { | ||
| 117 | case VideoPixelFormat::RGBA8: | ||
| 118 | return AV_PIX_FMT_RGBA; | ||
| 119 | case VideoPixelFormat::BGRA8: | ||
| 120 | return AV_PIX_FMT_BGRA; | ||
| 121 | case VideoPixelFormat::RGBX8: | ||
| 122 | return AV_PIX_FMT_RGB0; | ||
| 123 | default: | ||
| 124 | return AV_PIX_FMT_RGBA; | ||
| 125 | } | ||
| 126 | }(); | ||
| 127 | |||
| 128 | sws_freeContext(scaler_ctx); | ||
| 129 | // Frames are decoded into either YUV420 or NV12 formats. Convert to desired RGB format | ||
| 130 | scaler_ctx = sws_getContext(frame->width, frame->height, | ||
| 131 | static_cast<AVPixelFormat>(frame->format), frame->width, | ||
| 132 | frame->height, target_format, 0, nullptr, nullptr, nullptr); | ||
| 133 | scaler_width = frame->width; | ||
| 134 | scaler_height = frame->height; | ||
| 135 | converted_frame_buffer.reset(); | ||
| 136 | } | ||
| 137 | if (!converted_frame_buffer) { | ||
| 138 | const size_t frame_size = frame->width * frame->height * 4; | ||
| 139 | converted_frame_buffer = AVMallocPtr{static_cast<u8*>(av_malloc(frame_size)), av_free}; | ||
| 140 | } | ||
| 141 | const std::array<int, 4> converted_stride{frame->width * 4, frame->height * 4, 0, 0}; | ||
| 142 | u8* const converted_frame_buf_addr{converted_frame_buffer.get()}; | ||
| 143 | sws_scale(scaler_ctx, frame->data, frame->linesize, 0, frame->height, &converted_frame_buf_addr, | ||
| 144 | converted_stride.data()); | ||
| 145 | |||
| 146 | // Use the minimum of surface/frame dimensions to avoid buffer overflow. | ||
| 147 | const u32 surface_width = static_cast<u32>(config.surface_width_minus1) + 1; | ||
| 148 | const u32 surface_height = static_cast<u32>(config.surface_height_minus1) + 1; | ||
| 149 | const u32 width = std::min(surface_width, static_cast<u32>(frame->width)); | ||
| 150 | const u32 height = std::min(surface_height, static_cast<u32>(frame->height)); | ||
| 151 | const u32 blk_kind = static_cast<u32>(config.block_linear_kind); | ||
| 152 | if (blk_kind != 0) { | ||
| 153 | // swizzle pitch linear to block linear | ||
| 154 | const u32 block_height = static_cast<u32>(config.block_linear_height_log2); | ||
| 155 | const auto size = Texture::CalculateSize(true, 4, width, height, 1, block_height, 0); | ||
| 156 | luma_buffer.resize(size); | ||
| 157 | Texture::SwizzleSubrect(width, height, width * 4, width, 4, luma_buffer.data(), | ||
| 158 | converted_frame_buf_addr, block_height, 0, 0); | ||
| 159 | |||
| 160 | gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), size); | ||
| 161 | } else { | ||
| 162 | // send pitch linear frame | ||
| 163 | const size_t linear_size = width * height * 4; | ||
| 164 | gpu.MemoryManager().WriteBlock(output_surface_luma_address, converted_frame_buf_addr, | ||
| 165 | linear_size); | ||
| 166 | } | ||
| 167 | } | ||
| 78 | 168 | ||
| 79 | sws_freeContext(scaler_ctx); | 169 | void Vic::WriteYUVFrame(const AVFrame* frame, const VicConfig& config) { |
| 80 | scaler_ctx = nullptr; | 170 | LOG_TRACE(Service_NVDRV, "Writing YUV420 Frame"); |
| 81 | 171 | ||
| 82 | // Frames are decoded into either YUV420 or NV12 formats. Convert to desired format | 172 | const std::size_t surface_width = config.surface_width_minus1 + 1; |
| 83 | scaler_ctx = sws_getContext(frame->width, frame->height, | 173 | const std::size_t surface_height = config.surface_height_minus1 + 1; |
| 84 | static_cast<AVPixelFormat>(frame->format), frame->width, | 174 | const std::size_t aligned_width = (surface_width + 0xff) & ~0xffUL; |
| 85 | frame->height, target_format, 0, nullptr, nullptr, nullptr); | 175 | // Use the minimum of surface/frame dimensions to avoid buffer overflow. |
| 176 | const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width)); | ||
| 177 | const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height)); | ||
| 86 | 178 | ||
| 87 | scaler_width = frame->width; | 179 | const auto stride = static_cast<size_t>(frame->linesize[0]); |
| 88 | scaler_height = frame->height; | 180 | |
| 89 | } | 181 | luma_buffer.resize(aligned_width * surface_height); |
| 90 | // Get Converted frame | 182 | chroma_buffer.resize(aligned_width * surface_height / 2); |
| 91 | const u32 width = static_cast<u32>(frame->width); | 183 | |
| 92 | const u32 height = static_cast<u32>(frame->height); | 184 | // Populate luma buffer |
| 93 | const std::size_t linear_size = width * height * 4; | 185 | const u8* luma_src = frame->data[0]; |
| 94 | 186 | for (std::size_t y = 0; y < frame_height; ++y) { | |
| 95 | // Only allocate frame_buffer once per stream, as the size is not expected to change | 187 | const std::size_t src = y * stride; |
| 96 | if (!converted_frame_buffer) { | 188 | const std::size_t dst = y * aligned_width; |
| 97 | converted_frame_buffer = AVMallocPtr{static_cast<u8*>(av_malloc(linear_size)), av_free}; | 189 | for (std::size_t x = 0; x < frame_width; ++x) { |
| 190 | luma_buffer[dst + x] = luma_src[src + x]; | ||
| 98 | } | 191 | } |
| 99 | const std::array<int, 4> converted_stride{frame->width * 4, frame->height * 4, 0, 0}; | 192 | } |
| 100 | u8* const converted_frame_buf_addr{converted_frame_buffer.get()}; | 193 | gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), |
| 101 | 194 | luma_buffer.size()); | |
| 102 | sws_scale(scaler_ctx, frame->data, frame->linesize, 0, frame->height, | 195 | |
| 103 | &converted_frame_buf_addr, converted_stride.data()); | 196 | // Chroma |
| 104 | 197 | const std::size_t half_height = frame_height / 2; | |
| 105 | const u32 blk_kind = static_cast<u32>(config.block_linear_kind); | 198 | const auto half_stride = static_cast<size_t>(frame->linesize[1]); |
| 106 | if (blk_kind != 0) { | 199 | |
| 107 | // swizzle pitch linear to block linear | 200 | switch (frame->format) { |
| 108 | const u32 block_height = static_cast<u32>(config.block_linear_height_log2); | 201 | case AV_PIX_FMT_YUV420P: { |
| 109 | const auto size = | 202 | // Frame from FFmpeg software |
| 110 | Tegra::Texture::CalculateSize(true, 4, width, height, 1, block_height, 0); | 203 | // Populate chroma buffer from both channels with interleaving. |
| 111 | luma_buffer.resize(size); | 204 | const std::size_t half_width = frame_width / 2; |
| 112 | Tegra::Texture::SwizzleSubrect(width, height, width * 4, width, 4, luma_buffer.data(), | 205 | const u8* chroma_b_src = frame->data[1]; |
| 113 | converted_frame_buffer.get(), block_height, 0, 0); | 206 | const u8* chroma_r_src = frame->data[2]; |
| 114 | 207 | for (std::size_t y = 0; y < half_height; ++y) { | |
| 115 | gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), size); | 208 | const std::size_t src = y * half_stride; |
| 116 | } else { | 209 | const std::size_t dst = y * aligned_width; |
| 117 | // send pitch linear frame | 210 | |
| 118 | gpu.MemoryManager().WriteBlock(output_surface_luma_address, converted_frame_buf_addr, | 211 | for (std::size_t x = 0; x < half_width; ++x) { |
| 119 | linear_size); | 212 | chroma_buffer[dst + x * 2] = chroma_b_src[src + x]; |
| 213 | chroma_buffer[dst + x * 2 + 1] = chroma_r_src[src + x]; | ||
| 214 | } | ||
| 120 | } | 215 | } |
| 121 | break; | 216 | break; |
| 122 | } | 217 | } |
| 123 | case VideoPixelFormat::Yuv420: { | 218 | case AV_PIX_FMT_NV12: { |
| 124 | LOG_TRACE(Service_NVDRV, "Writing YUV420 Frame"); | 219 | // Frame from VA-API hardware |
| 125 | 220 | // This is already interleaved so just copy | |
| 126 | const std::size_t surface_width = config.surface_width_minus1 + 1; | 221 | const u8* chroma_src = frame->data[1]; |
| 127 | const std::size_t surface_height = config.surface_height_minus1 + 1; | 222 | for (std::size_t y = 0; y < half_height; ++y) { |
| 128 | const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width)); | ||
| 129 | const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height)); | ||
| 130 | const std::size_t aligned_width = (surface_width + 0xff) & ~0xffUL; | ||
| 131 | |||
| 132 | const auto stride = static_cast<size_t>(frame->linesize[0]); | ||
| 133 | |||
| 134 | luma_buffer.resize(aligned_width * surface_height); | ||
| 135 | chroma_buffer.resize(aligned_width * surface_height / 2); | ||
| 136 | |||
| 137 | // Populate luma buffer | ||
| 138 | const u8* luma_src = frame->data[0]; | ||
| 139 | for (std::size_t y = 0; y < frame_height; ++y) { | ||
| 140 | const std::size_t src = y * stride; | 223 | const std::size_t src = y * stride; |
| 141 | const std::size_t dst = y * aligned_width; | 224 | const std::size_t dst = y * aligned_width; |
| 142 | for (std::size_t x = 0; x < frame_width; ++x) { | 225 | for (std::size_t x = 0; x < frame_width; ++x) { |
| 143 | luma_buffer[dst + x] = luma_src[src + x]; | 226 | chroma_buffer[dst + x] = chroma_src[src + x]; |
| 144 | } | ||
| 145 | } | ||
| 146 | gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), | ||
| 147 | luma_buffer.size()); | ||
| 148 | |||
| 149 | // Chroma | ||
| 150 | const std::size_t half_height = frame_height / 2; | ||
| 151 | const auto half_stride = static_cast<size_t>(frame->linesize[1]); | ||
| 152 | |||
| 153 | switch (frame->format) { | ||
| 154 | case AV_PIX_FMT_YUV420P: { | ||
| 155 | // Frame from FFmpeg software | ||
| 156 | // Populate chroma buffer from both channels with interleaving. | ||
| 157 | const std::size_t half_width = frame_width / 2; | ||
| 158 | const u8* chroma_b_src = frame->data[1]; | ||
| 159 | const u8* chroma_r_src = frame->data[2]; | ||
| 160 | for (std::size_t y = 0; y < half_height; ++y) { | ||
| 161 | const std::size_t src = y * half_stride; | ||
| 162 | const std::size_t dst = y * aligned_width; | ||
| 163 | |||
| 164 | for (std::size_t x = 0; x < half_width; ++x) { | ||
| 165 | chroma_buffer[dst + x * 2] = chroma_b_src[src + x]; | ||
| 166 | chroma_buffer[dst + x * 2 + 1] = chroma_r_src[src + x]; | ||
| 167 | } | ||
| 168 | } | 227 | } |
| 169 | break; | ||
| 170 | } | ||
| 171 | case AV_PIX_FMT_NV12: { | ||
| 172 | // Frame from VA-API hardware | ||
| 173 | // This is already interleaved so just copy | ||
| 174 | const u8* chroma_src = frame->data[1]; | ||
| 175 | for (std::size_t y = 0; y < half_height; ++y) { | ||
| 176 | const std::size_t src = y * stride; | ||
| 177 | const std::size_t dst = y * aligned_width; | ||
| 178 | for (std::size_t x = 0; x < frame_width; ++x) { | ||
| 179 | chroma_buffer[dst + x] = chroma_src[src + x]; | ||
| 180 | } | ||
| 181 | } | ||
| 182 | break; | ||
| 183 | } | ||
| 184 | default: | ||
| 185 | UNREACHABLE(); | ||
| 186 | break; | ||
| 187 | } | 228 | } |
| 188 | gpu.MemoryManager().WriteBlock(output_surface_chroma_address, chroma_buffer.data(), | ||
| 189 | chroma_buffer.size()); | ||
| 190 | break; | 229 | break; |
| 191 | } | 230 | } |
| 192 | default: | 231 | default: |
| 193 | UNIMPLEMENTED_MSG("Unknown video pixel format {}", config.pixel_format.Value()); | 232 | UNREACHABLE(); |
| 194 | break; | 233 | break; |
| 195 | } | 234 | } |
| 235 | gpu.MemoryManager().WriteBlock(output_surface_chroma_address, chroma_buffer.data(), | ||
| 236 | chroma_buffer.size()); | ||
| 196 | } | 237 | } |
| 197 | 238 | ||
| 198 | } // namespace Tegra | 239 | } // namespace Tegra |
diff --git a/src/video_core/command_classes/vic.h b/src/video_core/command_classes/vic.h index 74246e08c..6d4cdfd57 100644 --- a/src/video_core/command_classes/vic.h +++ b/src/video_core/command_classes/vic.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include "common/bit_field.h" | ||
| 10 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 11 | 10 | ||
| 12 | struct SwsContext; | 11 | struct SwsContext; |
| @@ -14,6 +13,7 @@ struct SwsContext; | |||
| 14 | namespace Tegra { | 13 | namespace Tegra { |
| 15 | class GPU; | 14 | class GPU; |
| 16 | class Nvdec; | 15 | class Nvdec; |
| 16 | union VicConfig; | ||
| 17 | 17 | ||
| 18 | class Vic { | 18 | class Vic { |
| 19 | public: | 19 | public: |
| @@ -27,6 +27,7 @@ public: | |||
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | explicit Vic(GPU& gpu, std::shared_ptr<Nvdec> nvdec_processor); | 29 | explicit Vic(GPU& gpu, std::shared_ptr<Nvdec> nvdec_processor); |
| 30 | |||
| 30 | ~Vic(); | 31 | ~Vic(); |
| 31 | 32 | ||
| 32 | /// Write to the device state. | 33 | /// Write to the device state. |
| @@ -35,22 +36,9 @@ public: | |||
| 35 | private: | 36 | private: |
| 36 | void Execute(); | 37 | void Execute(); |
| 37 | 38 | ||
| 38 | enum class VideoPixelFormat : u64_le { | 39 | void WriteRGBFrame(const AVFrame* frame, const VicConfig& config); |
| 39 | RGBA8 = 0x1f, | ||
| 40 | BGRA8 = 0x20, | ||
| 41 | Yuv420 = 0x44, | ||
| 42 | }; | ||
| 43 | 40 | ||
| 44 | union VicConfig { | 41 | void WriteYUVFrame(const AVFrame* frame, const VicConfig& config); |
| 45 | u64_le raw{}; | ||
| 46 | BitField<0, 7, u64_le> pixel_format; | ||
| 47 | BitField<7, 2, u64_le> chroma_loc_horiz; | ||
| 48 | BitField<9, 2, u64_le> chroma_loc_vert; | ||
| 49 | BitField<11, 4, u64_le> block_linear_kind; | ||
| 50 | BitField<15, 4, u64_le> block_linear_height_log2; | ||
| 51 | BitField<32, 14, u64_le> surface_width_minus1; | ||
| 52 | BitField<46, 14, u64_le> surface_height_minus1; | ||
| 53 | }; | ||
| 54 | 42 | ||
| 55 | GPU& gpu; | 43 | GPU& gpu; |
| 56 | std::shared_ptr<Tegra::Nvdec> nvdec_processor; | 44 | std::shared_ptr<Tegra::Nvdec> nvdec_processor; |
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index da328d904..f31f86339 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp | |||
| @@ -1837,7 +1837,7 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) { | |||
| 1837 | const float led_size = 5.0f; | 1837 | const float led_size = 5.0f; |
| 1838 | const QPointF led_position = sideview_center + QPointF(0, -36); | 1838 | const QPointF led_position = sideview_center + QPointF(0, -36); |
| 1839 | int led_count = 0; | 1839 | int led_count = 0; |
| 1840 | for (const auto color : led_color) { | 1840 | for (const auto& color : led_color) { |
| 1841 | p.setBrush(color); | 1841 | p.setBrush(color); |
| 1842 | DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size); | 1842 | DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size); |
| 1843 | } | 1843 | } |
| @@ -1933,7 +1933,7 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) { | |||
| 1933 | const float led_size = 5.0f; | 1933 | const float led_size = 5.0f; |
| 1934 | const QPointF led_position = sideview_center + QPointF(0, -36); | 1934 | const QPointF led_position = sideview_center + QPointF(0, -36); |
| 1935 | int led_count = 0; | 1935 | int led_count = 0; |
| 1936 | for (const auto color : led_color) { | 1936 | for (const auto& color : led_color) { |
| 1937 | p.setBrush(color); | 1937 | p.setBrush(color); |
| 1938 | DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size); | 1938 | DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size); |
| 1939 | } | 1939 | } |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index a405e05ca..33eb059a3 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| 13 | #include "common/settings.h" | 13 | #include "common/settings.h" |
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/hle/service/time/time.h" | 15 | #include "core/hle/service/time/time_manager.h" |
| 16 | #include "ui_configure_system.h" | 16 | #include "ui_configure_system.h" |
| 17 | #include "yuzu/configuration/configuration_shared.h" | 17 | #include "yuzu/configuration/configuration_shared.h" |
| 18 | #include "yuzu/configuration/configure_system.h" | 18 | #include "yuzu/configuration/configure_system.h" |
diff --git a/src/yuzu/configuration/configure_tas.ui b/src/yuzu/configuration/configure_tas.ui index 3972f9083..6caa19031 100644 --- a/src/yuzu/configuration/configure_tas.ui +++ b/src/yuzu/configuration/configure_tas.ui | |||
| @@ -2,14 +2,6 @@ | |||
| 2 | <ui version="4.0"> | 2 | <ui version="4.0"> |
| 3 | <class>ConfigureTas</class> | 3 | <class>ConfigureTas</class> |
| 4 | <widget class="QDialog" name="ConfigureTas"> | 4 | <widget class="QDialog" name="ConfigureTas"> |
| 5 | <property name="geometry"> | ||
| 6 | <rect> | ||
| 7 | <x>0</x> | ||
| 8 | <y>0</y> | ||
| 9 | <width>337</width> | ||
| 10 | <height>316</height> | ||
| 11 | </rect> | ||
| 12 | </property> | ||
| 13 | <layout class="QVBoxLayout" name="verticalLayout_1"> | 5 | <layout class="QVBoxLayout" name="verticalLayout_1"> |
| 14 | <item> | 6 | <item> |
| 15 | <layout class="QHBoxLayout" name="horizontalLayout_1"> | 7 | <layout class="QHBoxLayout" name="horizontalLayout_1"> |
diff --git a/src/yuzu/debugger/profiler.cpp b/src/yuzu/debugger/profiler.cpp index 7a6f84d96..33110685a 100644 --- a/src/yuzu/debugger/profiler.cpp +++ b/src/yuzu/debugger/profiler.cpp | |||
| @@ -143,24 +143,28 @@ void MicroProfileWidget::hideEvent(QHideEvent* ev) { | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | void MicroProfileWidget::mouseMoveEvent(QMouseEvent* ev) { | 145 | void MicroProfileWidget::mouseMoveEvent(QMouseEvent* ev) { |
| 146 | MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, 0); | 146 | const auto mouse_position = ev->pos(); |
| 147 | MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0); | ||
| 147 | ev->accept(); | 148 | ev->accept(); |
| 148 | } | 149 | } |
| 149 | 150 | ||
| 150 | void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) { | 151 | void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) { |
| 151 | MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, 0); | 152 | const auto mouse_position = ev->pos(); |
| 153 | MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0); | ||
| 152 | MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); | 154 | MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); |
| 153 | ev->accept(); | 155 | ev->accept(); |
| 154 | } | 156 | } |
| 155 | 157 | ||
| 156 | void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) { | 158 | void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) { |
| 157 | MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, 0); | 159 | const auto mouse_position = ev->pos(); |
| 160 | MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0); | ||
| 158 | MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); | 161 | MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); |
| 159 | ev->accept(); | 162 | ev->accept(); |
| 160 | } | 163 | } |
| 161 | 164 | ||
| 162 | void MicroProfileWidget::wheelEvent(QWheelEvent* ev) { | 165 | void MicroProfileWidget::wheelEvent(QWheelEvent* ev) { |
| 163 | MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, | 166 | const auto wheel_position = ev->position().toPoint(); |
| 167 | MicroProfileMousePosition(wheel_position.x() / x_scale, wheel_position.y() / y_scale, | ||
| 164 | ev->angleDelta().y() / 120); | 168 | ev->angleDelta().y() / 120); |
| 165 | ev->accept(); | 169 | ev->accept(); |
| 166 | } | 170 | } |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 99c91a6a8..6bd0f9ee9 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -159,8 +159,7 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} { | |||
| 159 | * @return true if the haystack contains all words of userinput | 159 | * @return true if the haystack contains all words of userinput |
| 160 | */ | 160 | */ |
| 161 | static bool ContainsAllWords(const QString& haystack, const QString& userinput) { | 161 | static bool ContainsAllWords(const QString& haystack, const QString& userinput) { |
| 162 | const QStringList userinput_split = | 162 | const QStringList userinput_split = userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts); |
| 163 | userinput.split(QLatin1Char{' '}, QString::SplitBehavior::SkipEmptyParts); | ||
| 164 | 163 | ||
| 165 | return std::all_of(userinput_split.begin(), userinput_split.end(), | 164 | return std::all_of(userinput_split.begin(), userinput_split.end(), |
| 166 | [&haystack](const QString& s) { return haystack.contains(s); }); | 165 | [&haystack](const QString& s) { return haystack.contains(s); }); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 8140e659b..9f80a245c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1172,10 +1172,16 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 1172 | &GMainWindow::OnDisplayTitleBars); | 1172 | &GMainWindow::OnDisplayTitleBars); |
| 1173 | connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); | 1173 | connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); |
| 1174 | connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); | 1174 | connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); |
| 1175 | |||
| 1175 | connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this, | 1176 | connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this, |
| 1176 | &GMainWindow::ResetWindowSize720); | 1177 | &GMainWindow::ResetWindowSize720); |
| 1178 | connect(ui.action_Reset_Window_Size_900, &QAction::triggered, this, | ||
| 1179 | &GMainWindow::ResetWindowSize900); | ||
| 1177 | connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this, | 1180 | connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this, |
| 1178 | &GMainWindow::ResetWindowSize1080); | 1181 | &GMainWindow::ResetWindowSize1080); |
| 1182 | ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_720); | ||
| 1183 | ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_900); | ||
| 1184 | ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_1080); | ||
| 1179 | 1185 | ||
| 1180 | // Fullscreen | 1186 | // Fullscreen |
| 1181 | connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); | 1187 | connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); |
| @@ -2611,32 +2617,29 @@ void GMainWindow::ToggleWindowMode() { | |||
| 2611 | } | 2617 | } |
| 2612 | } | 2618 | } |
| 2613 | 2619 | ||
| 2614 | void GMainWindow::ResetWindowSize720() { | 2620 | void GMainWindow::ResetWindowSize(u32 width, u32 height) { |
| 2615 | const auto aspect_ratio = Layout::EmulationAspectRatio( | 2621 | const auto aspect_ratio = Layout::EmulationAspectRatio( |
| 2616 | static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), | 2622 | static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), |
| 2617 | static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width); | 2623 | static_cast<float>(height) / width); |
| 2618 | if (!ui.action_Single_Window_Mode->isChecked()) { | 2624 | if (!ui.action_Single_Window_Mode->isChecked()) { |
| 2619 | render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio, | 2625 | render_window->resize(height / aspect_ratio, height); |
| 2620 | Layout::ScreenUndocked::Height); | ||
| 2621 | } else { | 2626 | } else { |
| 2622 | resize(Layout::ScreenUndocked::Height / aspect_ratio, | 2627 | const bool show_status_bar = ui.action_Show_Status_Bar->isChecked(); |
| 2623 | Layout::ScreenUndocked::Height + menuBar()->height() + | 2628 | const auto status_bar_height = show_status_bar ? statusBar()->height() : 0; |
| 2624 | (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0)); | 2629 | resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height); |
| 2625 | } | 2630 | } |
| 2626 | } | 2631 | } |
| 2627 | 2632 | ||
| 2633 | void GMainWindow::ResetWindowSize720() { | ||
| 2634 | ResetWindowSize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height); | ||
| 2635 | } | ||
| 2636 | |||
| 2637 | void GMainWindow::ResetWindowSize900() { | ||
| 2638 | ResetWindowSize(1600U, 900U); | ||
| 2639 | } | ||
| 2640 | |||
| 2628 | void GMainWindow::ResetWindowSize1080() { | 2641 | void GMainWindow::ResetWindowSize1080() { |
| 2629 | const auto aspect_ratio = Layout::EmulationAspectRatio( | 2642 | ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height); |
| 2630 | static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), | ||
| 2631 | static_cast<float>(Layout::ScreenDocked::Height) / Layout::ScreenDocked::Width); | ||
| 2632 | if (!ui.action_Single_Window_Mode->isChecked()) { | ||
| 2633 | render_window->resize(Layout::ScreenDocked::Height / aspect_ratio, | ||
| 2634 | Layout::ScreenDocked::Height); | ||
| 2635 | } else { | ||
| 2636 | resize(Layout::ScreenDocked::Height / aspect_ratio, | ||
| 2637 | Layout::ScreenDocked::Height + menuBar()->height() + | ||
| 2638 | (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0)); | ||
| 2639 | } | ||
| 2640 | } | 2643 | } |
| 2641 | 2644 | ||
| 2642 | void GMainWindow::OnConfigure() { | 2645 | void GMainWindow::OnConfigure() { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 6ef4e4d4e..e31b3d06b 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -272,7 +272,9 @@ private slots: | |||
| 272 | void ShowFullscreen(); | 272 | void ShowFullscreen(); |
| 273 | void HideFullscreen(); | 273 | void HideFullscreen(); |
| 274 | void ToggleWindowMode(); | 274 | void ToggleWindowMode(); |
| 275 | void ResetWindowSize(u32 width, u32 height); | ||
| 275 | void ResetWindowSize720(); | 276 | void ResetWindowSize720(); |
| 277 | void ResetWindowSize900(); | ||
| 276 | void ResetWindowSize1080(); | 278 | void ResetWindowSize1080(); |
| 277 | void OnCaptureScreenshot(); | 279 | void OnCaptureScreenshot(); |
| 278 | void OnCoreError(Core::System::ResultStatus, std::string); | 280 | void OnCoreError(Core::System::ResultStatus, std::string); |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 653c010d8..a62e39a06 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -78,6 +78,35 @@ | |||
| 78 | <property name="title"> | 78 | <property name="title"> |
| 79 | <string>&View</string> | 79 | <string>&View</string> |
| 80 | </property> | 80 | </property> |
| 81 | <widget class="QMenu" name="menu_Reset_Window_Size"> | ||
| 82 | <property name="title"> | ||
| 83 | <string>&Reset Window Size</string> | ||
| 84 | </property> | ||
| 85 | </widget> | ||
| 86 | <action name="action_Reset_Window_Size_720"> | ||
| 87 | <property name="text"> | ||
| 88 | <string>Reset Window Size to &720p</string> | ||
| 89 | </property> | ||
| 90 | <property name="iconText"> | ||
| 91 | <string>Reset Window Size to 720p</string> | ||
| 92 | </property> | ||
| 93 | </action> | ||
| 94 | <action name="action_Reset_Window_Size_900"> | ||
| 95 | <property name="text"> | ||
| 96 | <string>Reset Window Size to &900p</string> | ||
| 97 | </property> | ||
| 98 | <property name="iconText"> | ||
| 99 | <string>Reset Window Size to 900p</string> | ||
| 100 | </property> | ||
| 101 | </action> | ||
| 102 | <action name="action_Reset_Window_Size_1080"> | ||
| 103 | <property name="text"> | ||
| 104 | <string>Reset Window Size to &1080p</string> | ||
| 105 | </property> | ||
| 106 | <property name="iconText"> | ||
| 107 | <string>Reset Window Size to 1080p</string> | ||
| 108 | </property> | ||
| 109 | </action> | ||
| 81 | <widget class="QMenu" name="menu_View_Debugging"> | 110 | <widget class="QMenu" name="menu_View_Debugging"> |
| 82 | <property name="title"> | 111 | <property name="title"> |
| 83 | <string>&Debugging</string> | 112 | <string>&Debugging</string> |
| @@ -88,9 +117,8 @@ | |||
| 88 | <addaction name="action_Display_Dock_Widget_Headers"/> | 117 | <addaction name="action_Display_Dock_Widget_Headers"/> |
| 89 | <addaction name="action_Show_Filter_Bar"/> | 118 | <addaction name="action_Show_Filter_Bar"/> |
| 90 | <addaction name="action_Show_Status_Bar"/> | 119 | <addaction name="action_Show_Status_Bar"/> |
| 91 | <addaction name="action_Reset_Window_Size_720"/> | ||
| 92 | <addaction name="action_Reset_Window_Size_1080"/> | ||
| 93 | <addaction name="separator"/> | 120 | <addaction name="separator"/> |
| 121 | <addaction name="menu_Reset_Window_Size"/> | ||
| 94 | <addaction name="menu_View_Debugging"/> | 122 | <addaction name="menu_View_Debugging"/> |
| 95 | </widget> | 123 | </widget> |
| 96 | <widget class="QMenu" name="menu_Tools"> | 124 | <widget class="QMenu" name="menu_Tools"> |
| @@ -216,22 +244,6 @@ | |||
| 216 | <string>Show Status Bar</string> | 244 | <string>Show Status Bar</string> |
| 217 | </property> | 245 | </property> |
| 218 | </action> | 246 | </action> |
| 219 | <action name="action_Reset_Window_Size_720"> | ||
| 220 | <property name="text"> | ||
| 221 | <string>Reset Window Size to &720p</string> | ||
| 222 | </property> | ||
| 223 | <property name="iconText"> | ||
| 224 | <string>Reset Window Size to 720p</string> | ||
| 225 | </property> | ||
| 226 | </action> | ||
| 227 | <action name="action_Reset_Window_Size_1080"> | ||
| 228 | <property name="text"> | ||
| 229 | <string>Reset Window Size to &1080p</string> | ||
| 230 | </property> | ||
| 231 | <property name="iconText"> | ||
| 232 | <string>Reset Window Size to 1080p</string> | ||
| 233 | </property> | ||
| 234 | </action> | ||
| 235 | <action name="action_Fullscreen"> | 247 | <action name="action_Fullscreen"> |
| 236 | <property name="checkable"> | 248 | <property name="checkable"> |
| 237 | <bool>true</bool> | 249 | <bool>true</bool> |