diff options
Diffstat (limited to 'src')
28 files changed, 116 insertions, 98 deletions
diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp index 357cf5855..9f8671982 100644 --- a/src/common/fs/fs_util.cpp +++ b/src/common/fs/fs_util.cpp | |||
| @@ -20,6 +20,10 @@ std::string ToUTF8String(std::u8string_view u8_string) { | |||
| 20 | return std::string{u8_string.begin(), u8_string.end()}; | 20 | return std::string{u8_string.begin(), u8_string.end()}; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | std::string BufferToUTF8String(std::span<const u8> buffer) { | ||
| 24 | return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})}; | ||
| 25 | } | ||
| 26 | |||
| 23 | std::string PathToUTF8String(const std::filesystem::path& path) { | 27 | std::string PathToUTF8String(const std::filesystem::path& path) { |
| 24 | return ToUTF8String(path.u8string()); | 28 | return ToUTF8String(path.u8string()); |
| 25 | } | 29 | } |
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h index ec9950ee7..1ec82eb35 100644 --- a/src/common/fs/fs_util.h +++ b/src/common/fs/fs_util.h | |||
| @@ -47,6 +47,17 @@ concept IsChar = std::same_as<T, char>; | |||
| 47 | [[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); | 47 | [[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); |
| 48 | 48 | ||
| 49 | /** | 49 | /** |
| 50 | * Converts a buffer of bytes to a UTF8-encoded std::string. | ||
| 51 | * This converts from the start of the buffer until the first encountered null-terminator. | ||
| 52 | * If no null-terminator is found, this converts the entire buffer instead. | ||
| 53 | * | ||
| 54 | * @param buffer Buffer of bytes | ||
| 55 | * | ||
| 56 | * @returns UTF-8 encoded std::string. | ||
| 57 | */ | ||
| 58 | [[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer); | ||
| 59 | |||
| 60 | /** | ||
| 50 | * Converts a filesystem path to a UTF-8 encoded std::string. | 61 | * Converts a filesystem path to a UTF-8 encoded std::string. |
| 51 | * | 62 | * |
| 52 | * @param path Filesystem path | 63 | * @param path Filesystem path |
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 2a5a7596c..6661244cf 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <windows.h> | 6 | #include <windows.h> |
| 7 | #include "common/dynamic_library.h" | 7 | #include "common/dynamic_library.h" |
| 8 | 8 | ||
| 9 | #elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv | 9 | #elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv |
| 10 | 10 | ||
| 11 | #ifndef _GNU_SOURCE | 11 | #ifndef _GNU_SOURCE |
| 12 | #define _GNU_SOURCE | 12 | #define _GNU_SOURCE |
| @@ -343,7 +343,7 @@ private: | |||
| 343 | std::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset | 343 | std::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset |
| 344 | }; | 344 | }; |
| 345 | 345 | ||
| 346 | #elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv | 346 | #elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv |
| 347 | 347 | ||
| 348 | class HostMemory::Impl { | 348 | class HostMemory::Impl { |
| 349 | public: | 349 | public: |
| @@ -357,7 +357,12 @@ public: | |||
| 357 | }); | 357 | }); |
| 358 | 358 | ||
| 359 | // Backing memory initialization | 359 | // Backing memory initialization |
| 360 | #if defined(__FreeBSD__) && __FreeBSD__ < 13 | ||
| 361 | // XXX Drop after FreeBSD 12.* reaches EOL on 2024-06-30 | ||
| 362 | fd = shm_open(SHM_ANON, O_RDWR, 0600); | ||
| 363 | #else | ||
| 360 | fd = memfd_create("HostMemory", 0); | 364 | fd = memfd_create("HostMemory", 0); |
| 365 | #endif | ||
| 361 | if (fd == -1) { | 366 | if (fd == -1) { |
| 362 | LOG_CRITICAL(HW_Memory, "memfd_create failed: {}", strerror(errno)); | 367 | LOG_CRITICAL(HW_Memory, "memfd_create failed: {}", strerror(errno)); |
| 363 | throw std::bad_alloc{}; | 368 | throw std::bad_alloc{}; |
diff --git a/src/common/settings.h b/src/common/settings.h index d8730f515..cfc1ab46f 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -42,6 +42,11 @@ enum class CPUAccuracy : u32 { | |||
| 42 | Unsafe = 2, | 42 | Unsafe = 2, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | enum class FullscreenMode : u32 { | ||
| 46 | Borderless = 0, | ||
| 47 | Exclusive = 1, | ||
| 48 | }; | ||
| 49 | |||
| 45 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | 50 | /** The BasicSetting class is a simple resource manager. It defines a label and default value |
| 46 | * alongside the actual value of the setting for simpler and less-error prone use with frontend | 51 | * alongside the actual value of the setting for simpler and less-error prone use with frontend |
| 47 | * configurations. Setting a default value and label is required, though subclasses may deviate from | 52 | * configurations. Setting a default value and label is required, though subclasses may deviate from |
| @@ -322,11 +327,11 @@ struct Values { | |||
| 322 | Setting<u16> resolution_factor{1, "resolution_factor"}; | 327 | Setting<u16> resolution_factor{1, "resolution_factor"}; |
| 323 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 328 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 324 | // Default to exclusive fullscreen on these platforms for now. | 329 | // Default to exclusive fullscreen on these platforms for now. |
| 325 | Setting<int> fullscreen_mode{ | 330 | Setting<FullscreenMode> fullscreen_mode{ |
| 326 | #ifdef _WIN32 | 331 | #ifdef _WIN32 |
| 327 | 0, | 332 | FullscreenMode::Borderless, |
| 328 | #else | 333 | #else |
| 329 | 1, | 334 | FullscreenMode::Exclusive, |
| 330 | #endif | 335 | #endif |
| 331 | "fullscreen_mode"}; | 336 | "fullscreen_mode"}; |
| 332 | Setting<int> aspect_ratio{0, "aspect_ratio"}; | 337 | Setting<int> aspect_ratio{0, "aspect_ratio"}; |
diff --git a/src/common/uuid.cpp b/src/common/uuid.cpp index 26db03fba..18303a1e3 100644 --- a/src/common/uuid.cpp +++ b/src/common/uuid.cpp | |||
| @@ -18,7 +18,7 @@ UUID UUID::Generate() { | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | std::string UUID::Format() const { | 20 | std::string UUID::Format() const { |
| 21 | return fmt::format("0x{:016X}{:016X}", uuid[1], uuid[0]); | 21 | return fmt::format("{:016x}{:016x}", uuid[1], uuid[0]); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::string UUID::FormatSwitch() const { | 24 | std::string UUID::FormatSwitch() const { |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 2e969f2a8..882fc1492 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -292,7 +292,7 @@ public: | |||
| 292 | 292 | ||
| 293 | protected: | 293 | protected: |
| 294 | void Get(Kernel::HLERequestContext& ctx) { | 294 | void Get(Kernel::HLERequestContext& ctx) { |
| 295 | LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); | 295 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); |
| 296 | ProfileBase profile_base{}; | 296 | ProfileBase profile_base{}; |
| 297 | ProfileData data{}; | 297 | ProfileData data{}; |
| 298 | if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { | 298 | if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { |
| @@ -301,7 +301,7 @@ protected: | |||
| 301 | rb.Push(ResultSuccess); | 301 | rb.Push(ResultSuccess); |
| 302 | rb.PushRaw(profile_base); | 302 | rb.PushRaw(profile_base); |
| 303 | } else { | 303 | } else { |
| 304 | LOG_ERROR(Service_ACC, "Failed to get profile base and data for user={}", | 304 | LOG_ERROR(Service_ACC, "Failed to get profile base and data for user=0x{}", |
| 305 | user_id.Format()); | 305 | user_id.Format()); |
| 306 | IPC::ResponseBuilder rb{ctx, 2}; | 306 | IPC::ResponseBuilder rb{ctx, 2}; |
| 307 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code | 307 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code |
| @@ -309,14 +309,14 @@ protected: | |||
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | void GetBase(Kernel::HLERequestContext& ctx) { | 311 | void GetBase(Kernel::HLERequestContext& ctx) { |
| 312 | LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); | 312 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); |
| 313 | ProfileBase profile_base{}; | 313 | ProfileBase profile_base{}; |
| 314 | if (profile_manager.GetProfileBase(user_id, profile_base)) { | 314 | if (profile_manager.GetProfileBase(user_id, profile_base)) { |
| 315 | IPC::ResponseBuilder rb{ctx, 16}; | 315 | IPC::ResponseBuilder rb{ctx, 16}; |
| 316 | rb.Push(ResultSuccess); | 316 | rb.Push(ResultSuccess); |
| 317 | rb.PushRaw(profile_base); | 317 | rb.PushRaw(profile_base); |
| 318 | } else { | 318 | } else { |
| 319 | LOG_ERROR(Service_ACC, "Failed to get profile base for user={}", user_id.Format()); | 319 | LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.Format()); |
| 320 | IPC::ResponseBuilder rb{ctx, 2}; | 320 | IPC::ResponseBuilder rb{ctx, 2}; |
| 321 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code | 321 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code |
| 322 | } | 322 | } |
| @@ -372,7 +372,7 @@ protected: | |||
| 372 | 372 | ||
| 373 | const auto user_data = ctx.ReadBuffer(); | 373 | const auto user_data = ctx.ReadBuffer(); |
| 374 | 374 | ||
| 375 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid={}", | 375 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", |
| 376 | Common::StringFromFixedZeroTerminatedBuffer( | 376 | Common::StringFromFixedZeroTerminatedBuffer( |
| 377 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), | 377 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), |
| 378 | base.timestamp, base.user_uuid.Format()); | 378 | base.timestamp, base.user_uuid.Format()); |
| @@ -405,7 +405,7 @@ protected: | |||
| 405 | const auto user_data = ctx.ReadBuffer(); | 405 | const auto user_data = ctx.ReadBuffer(); |
| 406 | const auto image_data = ctx.ReadBuffer(1); | 406 | const auto image_data = ctx.ReadBuffer(1); |
| 407 | 407 | ||
| 408 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid={}", | 408 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", |
| 409 | Common::StringFromFixedZeroTerminatedBuffer( | 409 | Common::StringFromFixedZeroTerminatedBuffer( |
| 410 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), | 410 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), |
| 411 | base.timestamp, base.user_uuid.Format()); | 411 | base.timestamp, base.user_uuid.Format()); |
| @@ -662,7 +662,7 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { | |||
| 662 | void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { | 662 | void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { |
| 663 | IPC::RequestParser rp{ctx}; | 663 | IPC::RequestParser rp{ctx}; |
| 664 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); | 664 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); |
| 665 | LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); | 665 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); |
| 666 | 666 | ||
| 667 | IPC::ResponseBuilder rb{ctx, 3}; | 667 | IPC::ResponseBuilder rb{ctx, 3}; |
| 668 | rb.Push(ResultSuccess); | 668 | rb.Push(ResultSuccess); |
| @@ -693,7 +693,7 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { | |||
| 693 | void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { | 693 | void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { |
| 694 | IPC::RequestParser rp{ctx}; | 694 | IPC::RequestParser rp{ctx}; |
| 695 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); | 695 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); |
| 696 | LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); | 696 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); |
| 697 | 697 | ||
| 698 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 698 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 699 | rb.Push(ResultSuccess); | 699 | rb.Push(ResultSuccess); |
| @@ -802,7 +802,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { | |||
| 802 | IPC::RequestParser rp{ctx}; | 802 | IPC::RequestParser rp{ctx}; |
| 803 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); | 803 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); |
| 804 | 804 | ||
| 805 | LOG_DEBUG(Service_ACC, "called, user_id={}", user_id.Format()); | 805 | LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.Format()); |
| 806 | 806 | ||
| 807 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 807 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 808 | rb.Push(ResultSuccess); | 808 | rb.Push(ResultSuccess); |
| @@ -844,7 +844,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont | |||
| 844 | IPC::RequestParser rp{ctx}; | 844 | IPC::RequestParser rp{ctx}; |
| 845 | const auto uuid = rp.PopRaw<Common::UUID>(); | 845 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 846 | 846 | ||
| 847 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}", uuid.Format()); | 847 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.Format()); |
| 848 | 848 | ||
| 849 | // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable | 849 | // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable |
| 850 | // way of confirming things like the TID, we're going to assume a non zero value for the time | 850 | // way of confirming things like the TID, we're going to assume a non zero value for the time |
| @@ -858,7 +858,7 @@ void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& | |||
| 858 | const auto uuid = rp.PopRaw<Common::UUID>(); | 858 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 859 | const auto tid = rp.Pop<u64_le>(); | 859 | const auto tid = rp.Pop<u64_le>(); |
| 860 | 860 | ||
| 861 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}, tid={:016X}", uuid.Format(), tid); | 861 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.Format(), tid); |
| 862 | StoreSaveDataThumbnail(ctx, uuid, tid); | 862 | StoreSaveDataThumbnail(ctx, uuid, tid); |
| 863 | } | 863 | } |
| 864 | 864 | ||
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index a3c939c0c..b58c152ce 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -158,7 +158,7 @@ private: | |||
| 158 | const auto local_play = rp.Pop<bool>(); | 158 | const auto local_play = rp.Pop<bool>(); |
| 159 | const auto uuid = rp.PopRaw<Common::UUID>(); | 159 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 160 | 160 | ||
| 161 | LOG_WARNING(Service_Friend, "(STUBBED) called local_play={} uuid={}", local_play, | 161 | LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play, |
| 162 | uuid.Format()); | 162 | uuid.Format()); |
| 163 | 163 | ||
| 164 | IPC::ResponseBuilder rb{ctx, 2}; | 164 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -171,7 +171,7 @@ private: | |||
| 171 | const auto uuid = rp.PopRaw<Common::UUID>(); | 171 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 172 | [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); | 172 | [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); |
| 173 | const auto pid = rp.Pop<u64>(); | 173 | const auto pid = rp.Pop<u64>(); |
| 174 | LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset, | 174 | LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset, |
| 175 | uuid.Format(), pid); | 175 | uuid.Format(), pid); |
| 176 | 176 | ||
| 177 | IPC::ResponseBuilder rb{ctx, 3}; | 177 | IPC::ResponseBuilder rb{ctx, 3}; |
| @@ -289,7 +289,7 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx | |||
| 289 | IPC::RequestParser rp{ctx}; | 289 | IPC::RequestParser rp{ctx}; |
| 290 | auto uuid = rp.PopRaw<Common::UUID>(); | 290 | auto uuid = rp.PopRaw<Common::UUID>(); |
| 291 | 291 | ||
| 292 | LOG_DEBUG(Service_Friend, "called, uuid={}", uuid.Format()); | 292 | LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.Format()); |
| 293 | 293 | ||
| 294 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 294 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 295 | rb.Push(ResultSuccess); | 295 | rb.Push(ResultSuccess); |
diff --git a/src/shader_recompiler/exception.h b/src/shader_recompiler/exception.h index 337e7f0c8..277be8541 100644 --- a/src/shader_recompiler/exception.h +++ b/src/shader_recompiler/exception.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <stdexcept> | 7 | #include <exception> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <string_view> | 9 | #include <string_view> |
| 10 | #include <utility> | 10 | #include <utility> |
| @@ -17,7 +17,7 @@ class Exception : public std::exception { | |||
| 17 | public: | 17 | public: |
| 18 | explicit Exception(std::string message) noexcept : err_message{std::move(message)} {} | 18 | explicit Exception(std::string message) noexcept : err_message{std::move(message)} {} |
| 19 | 19 | ||
| 20 | const char* what() const noexcept override { | 20 | [[nodiscard]] const char* what() const noexcept override { |
| 21 | return err_message.c_str(); | 21 | return err_message.c_str(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| @@ -36,21 +36,21 @@ private: | |||
| 36 | class LogicError : public Exception { | 36 | class LogicError : public Exception { |
| 37 | public: | 37 | public: |
| 38 | template <typename... Args> | 38 | template <typename... Args> |
| 39 | LogicError(const char* message, Args&&... args) | 39 | explicit LogicError(const char* message, Args&&... args) |
| 40 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} | 40 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | class RuntimeError : public Exception { | 43 | class RuntimeError : public Exception { |
| 44 | public: | 44 | public: |
| 45 | template <typename... Args> | 45 | template <typename... Args> |
| 46 | RuntimeError(const char* message, Args&&... args) | 46 | explicit RuntimeError(const char* message, Args&&... args) |
| 47 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} | 47 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | class NotImplementedException : public Exception { | 50 | class NotImplementedException : public Exception { |
| 51 | public: | 51 | public: |
| 52 | template <typename... Args> | 52 | template <typename... Args> |
| 53 | NotImplementedException(const char* message, Args&&... args) | 53 | explicit NotImplementedException(const char* message, Args&&... args) |
| 54 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} { | 54 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} { |
| 55 | Append(" is not implemented"); | 55 | Append(" is not implemented"); |
| 56 | } | 56 | } |
| @@ -59,7 +59,7 @@ public: | |||
| 59 | class InvalidArgument : public Exception { | 59 | class InvalidArgument : public Exception { |
| 60 | public: | 60 | public: |
| 61 | template <typename... Args> | 61 | template <typename... Args> |
| 62 | InvalidArgument(const char* message, Args&&... args) | 62 | explicit InvalidArgument(const char* message, Args&&... args) |
| 63 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} | 63 | : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
diff --git a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp index 5ead930f1..f69e1c9cc 100644 --- a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp +++ b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp | |||
| @@ -111,6 +111,8 @@ void VisitUsages(Info& info, IR::Inst& inst) { | |||
| 111 | case IR::Opcode::ConvertF16U16: | 111 | case IR::Opcode::ConvertF16U16: |
| 112 | case IR::Opcode::ConvertF16U32: | 112 | case IR::Opcode::ConvertF16U32: |
| 113 | case IR::Opcode::ConvertF16U64: | 113 | case IR::Opcode::ConvertF16U64: |
| 114 | case IR::Opcode::ConvertF16F32: | ||
| 115 | case IR::Opcode::ConvertF32F16: | ||
| 114 | case IR::Opcode::FPAbs16: | 116 | case IR::Opcode::FPAbs16: |
| 115 | case IR::Opcode::FPAdd16: | 117 | case IR::Opcode::FPAdd16: |
| 116 | case IR::Opcode::FPCeil16: | 118 | case IR::Opcode::FPCeil16: |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 24c858104..3b43554f9 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -817,7 +817,6 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 817 | const std::size_t size = interval.upper() - interval.lower(); | 817 | const std::size_t size = interval.upper() - interval.lower(); |
| 818 | const VAddr cpu_addr = interval.lower(); | 818 | const VAddr cpu_addr = interval.lower(); |
| 819 | ForEachBufferInRange(cpu_addr, size, [&](BufferId buffer_id, Buffer& buffer) { | 819 | ForEachBufferInRange(cpu_addr, size, [&](BufferId buffer_id, Buffer& buffer) { |
| 820 | boost::container::small_vector<BufferCopy, 1> copies; | ||
| 821 | buffer.ForEachDownloadRangeAndClear( | 820 | buffer.ForEachDownloadRangeAndClear( |
| 822 | cpu_addr, size, [&](u64 range_offset, u64 range_size) { | 821 | cpu_addr, size, [&](u64 range_offset, u64 range_size) { |
| 823 | const VAddr buffer_addr = buffer.CpuAddr(); | 822 | const VAddr buffer_addr = buffer.CpuAddr(); |
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h index a4170ffff..d76c5ed56 100644 --- a/src/video_core/engines/fermi_2d.h +++ b/src/video_core/engines/fermi_2d.h | |||
| @@ -299,7 +299,7 @@ public: | |||
| 299 | }; | 299 | }; |
| 300 | 300 | ||
| 301 | private: | 301 | private: |
| 302 | VideoCore::RasterizerInterface* rasterizer; | 302 | VideoCore::RasterizerInterface* rasterizer = nullptr; |
| 303 | 303 | ||
| 304 | /// Performs the copy from the source surface to the destination surface as configured in the | 304 | /// Performs the copy from the source surface to the destination surface as configured in the |
| 305 | /// registers. | 305 | /// registers. |
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index d3329b0f8..9e457ae16 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -227,7 +227,7 @@ private: | |||
| 227 | Core::System& system; | 227 | Core::System& system; |
| 228 | 228 | ||
| 229 | MemoryManager& memory_manager; | 229 | MemoryManager& memory_manager; |
| 230 | VideoCore::RasterizerInterface* rasterizer; | 230 | VideoCore::RasterizerInterface* rasterizer = nullptr; |
| 231 | 231 | ||
| 232 | std::vector<u8> read_buffer; | 232 | std::vector<u8> read_buffer; |
| 233 | std::vector<u8> write_buffer; | 233 | std::vector<u8> write_buffer; |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 8d6cc074c..1f4dda17e 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -441,7 +441,6 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 441 | 441 | ||
| 442 | std::array<const Shader::Info*, Maxwell::MaxShaderStage> infos{}; | 442 | std::array<const Shader::Info*, Maxwell::MaxShaderStage> infos{}; |
| 443 | 443 | ||
| 444 | OGLProgram source_program; | ||
| 445 | std::array<std::string, 5> sources; | 444 | std::array<std::string, 5> sources; |
| 446 | std::array<std::vector<u32>, 5> sources_spirv; | 445 | std::array<std::vector<u32>, 5> sources_spirv; |
| 447 | Shader::Backend::Bindings binding; | 446 | Shader::Backend::Bindings binding; |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 73157a15d..561cf5e11 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp | |||
| @@ -258,10 +258,9 @@ std::pair<VkBuffer, VkDeviceSize> Uint8Pass::Assemble(u32 num_vertices, VkBuffer | |||
| 258 | update_descriptor_queue.AddBuffer(src_buffer, src_offset, num_vertices); | 258 | update_descriptor_queue.AddBuffer(src_buffer, src_offset, num_vertices); |
| 259 | update_descriptor_queue.AddBuffer(staging.buffer, staging.offset, staging_size); | 259 | update_descriptor_queue.AddBuffer(staging.buffer, staging.offset, staging_size); |
| 260 | const void* const descriptor_data{update_descriptor_queue.UpdateData()}; | 260 | const void* const descriptor_data{update_descriptor_queue.UpdateData()}; |
| 261 | const VkBuffer buffer{staging.buffer}; | ||
| 262 | 261 | ||
| 263 | scheduler.RequestOutsideRenderPassOperationContext(); | 262 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 264 | scheduler.Record([this, buffer, descriptor_data, num_vertices](vk::CommandBuffer cmdbuf) { | 263 | scheduler.Record([this, descriptor_data, num_vertices](vk::CommandBuffer cmdbuf) { |
| 265 | static constexpr u32 DISPATCH_SIZE = 1024; | 264 | static constexpr u32 DISPATCH_SIZE = 1024; |
| 266 | static constexpr VkMemoryBarrier WRITE_BARRIER{ | 265 | static constexpr VkMemoryBarrier WRITE_BARRIER{ |
| 267 | .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER, | 266 | .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER, |
| @@ -319,7 +318,7 @@ std::pair<VkBuffer, VkDeviceSize> QuadIndexedPass::Assemble( | |||
| 319 | const void* const descriptor_data{update_descriptor_queue.UpdateData()}; | 318 | const void* const descriptor_data{update_descriptor_queue.UpdateData()}; |
| 320 | 319 | ||
| 321 | scheduler.RequestOutsideRenderPassOperationContext(); | 320 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 322 | scheduler.Record([this, buffer = staging.buffer, descriptor_data, num_tri_vertices, base_vertex, | 321 | scheduler.Record([this, descriptor_data, num_tri_vertices, base_vertex, |
| 323 | index_shift](vk::CommandBuffer cmdbuf) { | 322 | index_shift](vk::CommandBuffer cmdbuf) { |
| 324 | static constexpr u32 DISPATCH_SIZE = 1024; | 323 | static constexpr u32 DISPATCH_SIZE = 1024; |
| 325 | static constexpr VkMemoryBarrier WRITE_BARRIER{ | 324 | static constexpr VkMemoryBarrier WRITE_BARRIER{ |
diff --git a/src/video_core/texture_cache/render_targets.h b/src/video_core/texture_cache/render_targets.h index 9b9544b07..0cb227d69 100644 --- a/src/video_core/texture_cache/render_targets.h +++ b/src/video_core/texture_cache/render_targets.h | |||
| @@ -24,10 +24,10 @@ struct RenderTargets { | |||
| 24 | return std::ranges::any_of(color_buffer_ids, contains) || contains(depth_buffer_id); | 24 | return std::ranges::any_of(color_buffer_ids, contains) || contains(depth_buffer_id); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | std::array<ImageViewId, NUM_RT> color_buffer_ids; | 27 | std::array<ImageViewId, NUM_RT> color_buffer_ids{}; |
| 28 | ImageViewId depth_buffer_id; | 28 | ImageViewId depth_buffer_id{}; |
| 29 | std::array<u8, NUM_RT> draw_buffers{}; | 29 | std::array<u8, NUM_RT> draw_buffers{}; |
| 30 | Extent2D size; | 30 | Extent2D size{}; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | } // namespace VideoCommon | 33 | } // namespace VideoCommon |
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index bbf0fccae..70898004a 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp | |||
| @@ -202,7 +202,7 @@ void SetObjectName(const DeviceDispatch* dld, VkDevice device, T handle, VkObjec | |||
| 202 | const VkDebugUtilsObjectNameInfoEXT name_info{ | 202 | const VkDebugUtilsObjectNameInfoEXT name_info{ |
| 203 | .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, | 203 | .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, |
| 204 | .pNext = nullptr, | 204 | .pNext = nullptr, |
| 205 | .objectType = VK_OBJECT_TYPE_IMAGE, | 205 | .objectType = type, |
| 206 | .objectHandle = reinterpret_cast<u64>(handle), | 206 | .objectHandle = reinterpret_cast<u64>(handle), |
| 207 | .pObjectName = name, | 207 | .pObjectName = name, |
| 208 | }; | 208 | }; |
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index b112dd7b0..652d99570 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp | |||
| @@ -107,6 +107,7 @@ void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url, | |||
| 107 | is_local = true; | 107 | is_local = true; |
| 108 | 108 | ||
| 109 | LoadExtractedFonts(); | 109 | LoadExtractedFonts(); |
| 110 | FocusFirstLinkElement(); | ||
| 110 | SetUserAgent(UserAgent::WebApplet); | 111 | SetUserAgent(UserAgent::WebApplet); |
| 111 | SetFinished(false); | 112 | SetFinished(false); |
| 112 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); | 113 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); |
| @@ -121,6 +122,7 @@ void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url, | |||
| 121 | const std::string& additional_args) { | 122 | const std::string& additional_args) { |
| 122 | is_local = false; | 123 | is_local = false; |
| 123 | 124 | ||
| 125 | FocusFirstLinkElement(); | ||
| 124 | SetUserAgent(UserAgent::WebApplet); | 126 | SetUserAgent(UserAgent::WebApplet); |
| 125 | SetFinished(false); | 127 | SetFinished(false); |
| 126 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); | 128 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); |
| @@ -208,7 +210,7 @@ void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() { | |||
| 208 | if (input_interpreter->IsButtonPressedOnce(button)) { | 210 | if (input_interpreter->IsButtonPressedOnce(button)) { |
| 209 | page()->runJavaScript( | 211 | page()->runJavaScript( |
| 210 | QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast<u8>(button)), | 212 | QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast<u8>(button)), |
| 211 | [&](const QVariant& variant) { | 213 | [this, button](const QVariant& variant) { |
| 212 | if (variant.toBool()) { | 214 | if (variant.toBool()) { |
| 213 | switch (button) { | 215 | switch (button) { |
| 214 | case HIDButton::A: | 216 | case HIDButton::A: |
| @@ -364,6 +366,17 @@ void QtNXWebEngineView::LoadExtractedFonts() { | |||
| 364 | Qt::QueuedConnection); | 366 | Qt::QueuedConnection); |
| 365 | } | 367 | } |
| 366 | 368 | ||
| 369 | void QtNXWebEngineView::FocusFirstLinkElement() { | ||
| 370 | QWebEngineScript focus_link_element; | ||
| 371 | |||
| 372 | focus_link_element.setName(QStringLiteral("focus_link_element.js")); | ||
| 373 | focus_link_element.setSourceCode(QString::fromStdString(FOCUS_LINK_ELEMENT_SCRIPT)); | ||
| 374 | focus_link_element.setWorldId(QWebEngineScript::MainWorld); | ||
| 375 | focus_link_element.setInjectionPoint(QWebEngineScript::Deferred); | ||
| 376 | focus_link_element.setRunsOnSubFrames(true); | ||
| 377 | default_profile->scripts()->insert(focus_link_element); | ||
| 378 | } | ||
| 379 | |||
| 367 | #endif | 380 | #endif |
| 368 | 381 | ||
| 369 | QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { | 382 | QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { |
diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 7ad07409f..7e9f703fc 100644 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h | |||
| @@ -161,6 +161,9 @@ private: | |||
| 161 | /// Loads the extracted fonts using JavaScript. | 161 | /// Loads the extracted fonts using JavaScript. |
| 162 | void LoadExtractedFonts(); | 162 | void LoadExtractedFonts(); |
| 163 | 163 | ||
| 164 | /// Brings focus to the first available link element. | ||
| 165 | void FocusFirstLinkElement(); | ||
| 166 | |||
| 164 | InputCommon::InputSubsystem* input_subsystem; | 167 | InputCommon::InputSubsystem* input_subsystem; |
| 165 | 168 | ||
| 166 | std::unique_ptr<UrlRequestInterceptor> url_interceptor; | 169 | std::unique_ptr<UrlRequestInterceptor> url_interceptor; |
diff --git a/src/yuzu/applets/qt_web_browser_scripts.h b/src/yuzu/applets/qt_web_browser_scripts.h index 992837a85..c4ba8d40f 100644 --- a/src/yuzu/applets/qt_web_browser_scripts.h +++ b/src/yuzu/applets/qt_web_browser_scripts.h | |||
| @@ -73,6 +73,12 @@ constexpr char LOAD_NX_FONT[] = R"( | |||
| 73 | })(); | 73 | })(); |
| 74 | )"; | 74 | )"; |
| 75 | 75 | ||
| 76 | constexpr char FOCUS_LINK_ELEMENT_SCRIPT[] = R"( | ||
| 77 | if (document.getElementsByTagName("a").length > 0) { | ||
| 78 | document.getElementsByTagName("a")[0].focus(); | ||
| 79 | } | ||
| 80 | )"; | ||
| 81 | |||
| 76 | constexpr char GAMEPAD_SCRIPT[] = R"( | 82 | constexpr char GAMEPAD_SCRIPT[] = R"( |
| 77 | window.addEventListener("gamepadconnected", function(e) { | 83 | window.addEventListener("gamepadconnected", function(e) { |
| 78 | console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.", | 84 | console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.", |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 72027e773..ecd5dfac1 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -1332,7 +1332,10 @@ void Config::SaveRendererValues() { | |||
| 1332 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), | 1332 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), |
| 1333 | Settings::values.renderer_backend.UsingGlobal()); | 1333 | Settings::values.renderer_backend.UsingGlobal()); |
| 1334 | WriteGlobalSetting(Settings::values.vulkan_device); | 1334 | WriteGlobalSetting(Settings::values.vulkan_device); |
| 1335 | WriteGlobalSetting(Settings::values.fullscreen_mode); | 1335 | WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), |
| 1336 | static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)), | ||
| 1337 | static_cast<u32>(Settings::values.fullscreen_mode.GetDefault()), | ||
| 1338 | Settings::values.fullscreen_mode.UsingGlobal()); | ||
| 1336 | WriteGlobalSetting(Settings::values.aspect_ratio); | 1339 | WriteGlobalSetting(Settings::values.aspect_ratio); |
| 1337 | WriteGlobalSetting(Settings::values.max_anisotropy); | 1340 | WriteGlobalSetting(Settings::values.max_anisotropy); |
| 1338 | WriteGlobalSetting(Settings::values.use_speed_limit); | 1341 | WriteGlobalSetting(Settings::values.use_speed_limit); |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 4bbb9f1cd..c1d7feb9f 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -181,5 +181,6 @@ private: | |||
| 181 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT | 181 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT |
| 182 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); | 182 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); |
| 183 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); | 183 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); |
| 184 | Q_DECLARE_METATYPE(Settings::FullscreenMode); | ||
| 184 | Q_DECLARE_METATYPE(Settings::RendererBackend); | 185 | Q_DECLARE_METATYPE(Settings::RendererBackend); |
| 185 | Q_DECLARE_METATYPE(Settings::ShaderBackend); | 186 | Q_DECLARE_METATYPE(Settings::ShaderBackend); |
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 096e42e94..251aab912 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -25,20 +25,6 @@ void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, | |||
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting, | ||
| 29 | const QComboBox* combobox) { | ||
| 30 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { | ||
| 31 | setting->SetValue(combobox->currentIndex()); | ||
| 32 | } else if (!Settings::IsConfiguringGlobal()) { | ||
| 33 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 34 | setting->SetGlobal(true); | ||
| 35 | } else { | ||
| 36 | setting->SetGlobal(false); | ||
| 37 | setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, | 28 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, |
| 43 | const Settings::Setting<bool>* setting) { | 29 | const Settings::Setting<bool>* setting) { |
| 44 | if (setting->UsingGlobal()) { | 30 | if (setting->UsingGlobal()) { |
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 1e0ef01ca..5423dbc92 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -28,7 +28,20 @@ enum class CheckState { | |||
| 28 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting | 28 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting |
| 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, | 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, |
| 30 | const CheckState& tracker); | 30 | const CheckState& tracker); |
| 31 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); | 31 | template <typename Type> |
| 32 | void ApplyPerGameSetting(Settings::Setting<Type>* setting, const QComboBox* combobox) { | ||
| 33 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { | ||
| 34 | setting->SetValue(static_cast<Type>(combobox->currentIndex())); | ||
| 35 | } else if (!Settings::IsConfiguringGlobal()) { | ||
| 36 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 37 | setting->SetGlobal(true); | ||
| 38 | } else { | ||
| 39 | setting->SetGlobal(false); | ||
| 40 | setting->SetValue(static_cast<Type>(combobox->currentIndex() - | ||
| 41 | ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 32 | 45 | ||
| 33 | // Sets a Qt UI element given a Settings::Setting | 46 | // Sets a Qt UI element given a Settings::Setting |
| 34 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); | 47 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); |
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 8d7171487..784b6484e 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp | |||
| @@ -65,6 +65,7 @@ void ConfigureCpu::UpdateGroup(int index) { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void ConfigureCpu::ApplyConfiguration() { | 67 | void ConfigureCpu::ApplyConfiguration() { |
| 68 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpu_accuracy, ui->accuracy); | ||
| 68 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_unfuse_fma, | 69 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_unfuse_fma, |
| 69 | ui->cpuopt_unsafe_unfuse_fma, | 70 | ui->cpuopt_unsafe_unfuse_fma, |
| 70 | cpuopt_unsafe_unfuse_fma); | 71 | cpuopt_unsafe_unfuse_fma); |
| @@ -80,22 +81,6 @@ void ConfigureCpu::ApplyConfiguration() { | |||
| 80 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_fastmem_check, | 81 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_fastmem_check, |
| 81 | ui->cpuopt_unsafe_fastmem_check, | 82 | ui->cpuopt_unsafe_fastmem_check, |
| 82 | cpuopt_unsafe_fastmem_check); | 83 | cpuopt_unsafe_fastmem_check); |
| 83 | |||
| 84 | if (Settings::IsConfiguringGlobal()) { | ||
| 85 | // Guard if during game and set to game-specific value | ||
| 86 | if (Settings::values.cpu_accuracy.UsingGlobal()) { | ||
| 87 | Settings::values.cpu_accuracy.SetValue( | ||
| 88 | static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex())); | ||
| 89 | } | ||
| 90 | } else { | ||
| 91 | if (ui->accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 92 | Settings::values.cpu_accuracy.SetGlobal(true); | ||
| 93 | } else { | ||
| 94 | Settings::values.cpu_accuracy.SetGlobal(false); | ||
| 95 | Settings::values.cpu_accuracy.SetValue(static_cast<Settings::CPUAccuracy>( | ||
| 96 | ui->accuracy->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | } | 84 | } |
| 100 | 85 | ||
| 101 | void ConfigureCpu::changeEvent(QEvent* event) { | 86 | void ConfigureCpu::changeEvent(QEvent* event) { |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 1bc477c96..37e896258 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -98,7 +98,8 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 98 | 98 | ||
| 99 | if (Settings::IsConfiguringGlobal()) { | 99 | if (Settings::IsConfiguringGlobal()) { |
| 100 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); | 100 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); |
| 101 | ui->fullscreen_mode_combobox->setCurrentIndex(Settings::values.fullscreen_mode.GetValue()); | 101 | ui->fullscreen_mode_combobox->setCurrentIndex( |
| 102 | static_cast<int>(Settings::values.fullscreen_mode.GetValue())); | ||
| 102 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); | 103 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); |
| 103 | } else { | 104 | } else { |
| 104 | ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); | 105 | ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); |
| @@ -310,8 +311,9 @@ void ConfigureGraphics::SetupPerGameUI() { | |||
| 310 | 311 | ||
| 311 | ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, | 312 | ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, |
| 312 | Settings::values.aspect_ratio.GetValue(true)); | 313 | Settings::values.aspect_ratio.GetValue(true)); |
| 313 | ConfigurationShared::SetColoredComboBox(ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, | 314 | ConfigurationShared::SetColoredComboBox( |
| 314 | Settings::values.fullscreen_mode.GetValue(true)); | 315 | ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, |
| 316 | static_cast<int>(Settings::values.fullscreen_mode.GetValue(true))); | ||
| 315 | ConfigurationShared::InsertGlobalItem( | 317 | ConfigurationShared::InsertGlobalItem( |
| 316 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); | 318 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); |
| 317 | } | 319 | } |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 38276feb1..a31b8e192 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -48,11 +48,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | void ConfigureGraphicsAdvanced::ApplyConfiguration() { | 50 | void ConfigureGraphicsAdvanced::ApplyConfiguration() { |
| 51 | // Subtract 2 if configuring per-game (separator and "use global configuration" take 2 slots) | 51 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.gpu_accuracy, ui->gpu_accuracy); |
| 52 | const auto gpu_accuracy = static_cast<Settings::GPUAccuracy>( | ||
| 53 | ui->gpu_accuracy->currentIndex() - | ||
| 54 | ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 55 | |||
| 56 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | 52 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, |
| 57 | ui->anisotropic_filtering_combobox); | 53 | ui->anisotropic_filtering_combobox); |
| 58 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); | 54 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); |
| @@ -63,20 +59,6 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { | |||
| 63 | use_caches_gc); | 59 | use_caches_gc); |
| 64 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, | 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, |
| 65 | ui->use_fast_gpu_time, use_fast_gpu_time); | 61 | ui->use_fast_gpu_time, use_fast_gpu_time); |
| 66 | |||
| 67 | if (Settings::IsConfiguringGlobal()) { | ||
| 68 | // Must guard in case of a during-game configuration when set to be game-specific. | ||
| 69 | if (Settings::values.gpu_accuracy.UsingGlobal()) { | ||
| 70 | Settings::values.gpu_accuracy.SetValue(gpu_accuracy); | ||
| 71 | } | ||
| 72 | } else { | ||
| 73 | if (ui->gpu_accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 74 | Settings::values.gpu_accuracy.SetGlobal(true); | ||
| 75 | } else { | ||
| 76 | Settings::values.gpu_accuracy.SetGlobal(false); | ||
| 77 | Settings::values.gpu_accuracy.SetValue(gpu_accuracy); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | 62 | } |
| 81 | 63 | ||
| 82 | void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) { | 64 | void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e172d2ff4..9544f0fb0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2513,7 +2513,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2513 | ui.menubar->hide(); | 2513 | ui.menubar->hide(); |
| 2514 | statusBar()->hide(); | 2514 | statusBar()->hide(); |
| 2515 | 2515 | ||
| 2516 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2516 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2517 | showFullScreen(); | 2517 | showFullScreen(); |
| 2518 | return; | 2518 | return; |
| 2519 | } | 2519 | } |
| @@ -2528,7 +2528,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2528 | } else { | 2528 | } else { |
| 2529 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); | 2529 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); |
| 2530 | 2530 | ||
| 2531 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2531 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2532 | render_window->showFullScreen(); | 2532 | render_window->showFullScreen(); |
| 2533 | return; | 2533 | return; |
| 2534 | } | 2534 | } |
| @@ -2545,7 +2545,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2545 | 2545 | ||
| 2546 | void GMainWindow::HideFullscreen() { | 2546 | void GMainWindow::HideFullscreen() { |
| 2547 | if (ui.action_Single_Window_Mode->isChecked()) { | 2547 | if (ui.action_Single_Window_Mode->isChecked()) { |
| 2548 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2548 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2549 | showNormal(); | 2549 | showNormal(); |
| 2550 | restoreGeometry(UISettings::values.geometry); | 2550 | restoreGeometry(UISettings::values.geometry); |
| 2551 | } else { | 2551 | } else { |
| @@ -2559,7 +2559,7 @@ void GMainWindow::HideFullscreen() { | |||
| 2559 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); | 2559 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); |
| 2560 | ui.menubar->show(); | 2560 | ui.menubar->show(); |
| 2561 | } else { | 2561 | } else { |
| 2562 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2562 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2563 | render_window->showNormal(); | 2563 | render_window->showNormal(); |
| 2564 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); | 2564 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); |
| 2565 | } else { | 2565 | } else { |
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 353e51ea7..ea3e0ada4 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | |||
| @@ -124,7 +124,7 @@ void EmuWindow_SDL2::OnResize() { | |||
| 124 | 124 | ||
| 125 | void EmuWindow_SDL2::Fullscreen() { | 125 | void EmuWindow_SDL2::Fullscreen() { |
| 126 | switch (Settings::values.fullscreen_mode.GetValue()) { | 126 | switch (Settings::values.fullscreen_mode.GetValue()) { |
| 127 | case 1: // Exclusive fullscreen | 127 | case Settings::FullscreenMode::Exclusive: |
| 128 | // Set window size to render size before entering fullscreen -- SDL does not resize to | 128 | // Set window size to render size before entering fullscreen -- SDL does not resize to |
| 129 | // display dimensions in this mode. | 129 | // display dimensions in this mode. |
| 130 | // TODO: Multiply the window size by resolution_factor (for both docked modes) | 130 | // TODO: Multiply the window size by resolution_factor (for both docked modes) |
| @@ -140,7 +140,7 @@ void EmuWindow_SDL2::Fullscreen() { | |||
| 140 | LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); | 140 | LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); |
| 141 | LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); | 141 | LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); |
| 142 | [[fallthrough]]; | 142 | [[fallthrough]]; |
| 143 | case 0: // Borderless window | 143 | case Settings::FullscreenMode::Borderless: |
| 144 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { | 144 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { |
| 145 | return; | 145 | return; |
| 146 | } | 146 | } |