From bada4c739c95b5f9b252b1afbe1b07579140c524 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Tue, 25 May 2021 22:52:37 +0200 Subject: [PATCH] early-access version 1708 --- README.md | 2 +- src/common/fs/file.h | 10 ------- src/common/fs/fs.h | 44 ------------------------------- src/common/fs/path_util.h | 12 --------- src/yuzu/configuration/config.cpp | 7 +++++ src/yuzu/debugger/controller.cpp | 1 + src/yuzu/main.cpp | 20 +++++++++++--- 7 files changed, 25 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index dbec45e05..7e62d4007 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1707. +This is the source code for early-access 1708. ## Legal Notice diff --git a/src/common/fs/file.h b/src/common/fs/file.h index abdc447f3..209f9664b 100755 --- a/src/common/fs/file.h +++ b/src/common/fs/file.h @@ -37,7 +37,6 @@ void OpenFileStream(FileStream& file_stream, const std::filesystem::path& path, } #ifdef _WIN32 - template void OpenFileStream(FileStream& file_stream, const Path& path, std::ios_base::openmode open_mode) { if constexpr (IsChar) { @@ -46,7 +45,6 @@ void OpenFileStream(FileStream& file_stream, const Path& path, std::ios_base::op file_stream.open(std::filesystem::path{path}, open_mode); } } - #endif /** @@ -61,7 +59,6 @@ void OpenFileStream(FileStream& file_stream, const Path& path, std::ios_base::op [[nodiscard]] std::string ReadStringFromFile(const std::filesystem::path& path, FileType type); #ifdef _WIN32 - template [[nodiscard]] std::string ReadStringFromFile(const Path& path, FileType type) { if constexpr (IsChar) { @@ -70,7 +67,6 @@ template return ReadStringFromFile(std::filesystem::path{path}, type); } } - #endif /** @@ -87,7 +83,6 @@ template std::string_view string); #ifdef _WIN32 - template [[nodiscard]] size_t WriteStringToFile(const Path& path, FileType type, std::string_view string) { if constexpr (IsChar) { @@ -96,7 +91,6 @@ template return WriteStringToFile(std::filesystem::path{path}, type, string); } } - #endif /** @@ -113,7 +107,6 @@ template std::string_view string); #ifdef _WIN32 - template [[nodiscard]] size_t AppendStringToFile(const Path& path, FileType type, std::string_view string) { if constexpr (IsChar) { @@ -122,7 +115,6 @@ template return AppendStringToFile(std::filesystem::path{path}, type, string); } } - #endif class IOFile final : NonCopyable { @@ -191,7 +183,6 @@ public: FileShareFlag flag = FileShareFlag::ShareReadOnly); #ifdef _WIN32 - template [[nodiscard]] void Open(const Path& path, FileAccessMode mode, FileType type = FileType::BinaryFile, @@ -203,7 +194,6 @@ public: Open(std::filesystem::path{path}, mode, type, flag); } } - #endif /// Closes the file if it is opened. diff --git a/src/common/fs/fs.h b/src/common/fs/fs.h index 857410c4e..f6f256349 100755 --- a/src/common/fs/fs.h +++ b/src/common/fs/fs.h @@ -33,7 +33,6 @@ class IOFile; [[nodiscard]] bool NewFile(const std::filesystem::path& path, u64 size = 0); #ifdef _WIN32 - template [[nodiscard]] bool NewFile(const Path& path, u64 size = 0) { if constexpr (IsChar) { @@ -42,7 +41,6 @@ template return NewFile(std::filesystem::path{path}, size); } } - #endif /** @@ -60,7 +58,6 @@ template [[nodiscard]] bool RemoveFile(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool RemoveFile(const Path& path) { if constexpr (IsChar) { @@ -69,7 +66,6 @@ template return RemoveFile(std::filesystem::path{path}); } } - #endif /** @@ -91,7 +87,6 @@ template const std::filesystem::path& new_path); #ifdef _WIN32 - template [[nodiscard]] bool RenameFile(const Path1& old_path, const Path2& new_path) { using ValueType1 = typename Path1::value_type; @@ -106,7 +101,6 @@ template return RenameFile(std::filesystem::path{old_path}, std::filesystem::path{new_path}); } } - #endif /** @@ -132,7 +126,6 @@ template FileShareFlag flag = FileShareFlag::ShareReadOnly); #ifdef _WIN32 - template [[nodiscard]] std::shared_ptr FileOpen(const Path& path, FileAccessMode mode, FileType type = FileType::BinaryFile, @@ -143,7 +136,6 @@ template return FileOpen(std::filesystem::path{path}, mode, type, flag); } } - #endif // Directory Operations @@ -166,7 +158,6 @@ template [[nodiscard]] bool CreateDir(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool CreateDir(const Path& path) { if constexpr (IsChar) { @@ -175,7 +166,6 @@ template return CreateDir(std::filesystem::path{path}); } } - #endif /** @@ -196,7 +186,6 @@ template [[nodiscard]] bool CreateDirs(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool CreateDirs(const Path& path) { if constexpr (IsChar) { @@ -205,7 +194,6 @@ template return CreateDirs(std::filesystem::path{path}); } } - #endif /** @@ -219,7 +207,6 @@ template [[nodiscard]] bool CreateParentDir(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool CreateParentDir(const Path& path) { if constexpr (IsChar) { @@ -228,7 +215,6 @@ template return CreateParentDir(std::filesystem::path{path}); } } - #endif /** @@ -242,7 +228,6 @@ template [[nodiscard]] bool CreateParentDirs(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool CreateParentDirs(const Path& path) { if constexpr (IsChar) { @@ -251,7 +236,6 @@ template return CreateParentDirs(std::filesystem::path{path}); } } - #endif /** @@ -270,7 +254,6 @@ template [[nodiscard]] bool RemoveDir(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool RemoveDir(const Path& path) { if constexpr (IsChar) { @@ -279,7 +262,6 @@ template return RemoveDir(std::filesystem::path{path}); } } - #endif /** @@ -297,7 +279,6 @@ template [[nodiscard]] bool RemoveDirRecursively(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool RemoveDirRecursively(const Path& path) { if constexpr (IsChar) { @@ -306,7 +287,6 @@ template return RemoveDirRecursively(std::filesystem::path{path}); } } - #endif /** @@ -324,7 +304,6 @@ template [[nodiscard]] bool RemoveDirContentsRecursively(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool RemoveDirContentsRecursively(const Path& path) { if constexpr (IsChar) { @@ -333,7 +312,6 @@ template return RemoveDirContentsRecursively(std::filesystem::path{path}); } } - #endif /** @@ -355,7 +333,6 @@ template const std::filesystem::path& new_path); #ifdef _WIN32 - template [[nodiscard]] bool RenameDir(const Path1& old_path, const Path2& new_path) { using ValueType1 = typename Path1::value_type; @@ -370,7 +347,6 @@ template return RenameDir(std::filesystem::path{old_path}, std::filesystem::path{new_path}); } } - #endif /** @@ -393,7 +369,6 @@ void IterateDirEntries(const std::filesystem::path& path, const DirEntryCallable DirEntryFilter filter = DirEntryFilter::All); #ifdef _WIN32 - template void IterateDirEntries(const Path& path, const DirEntryCallable& callback, DirEntryFilter filter = DirEntryFilter::All) { @@ -403,7 +378,6 @@ void IterateDirEntries(const Path& path, const DirEntryCallable& callback, IterateDirEntries(std::filesystem::path{path}, callback, filter); } } - #endif /** @@ -427,7 +401,6 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path, DirEntryFilter filter = DirEntryFilter::All); #ifdef _WIN32 - template void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& callback, DirEntryFilter filter = DirEntryFilter::All) { @@ -437,7 +410,6 @@ void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& call IterateDirEntriesRecursively(std::filesystem::path{path}, callback, filter); } } - #endif // Generic Filesystem Operations @@ -452,7 +424,6 @@ void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& call [[nodiscard]] bool Exists(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool Exists(const Path& path) { if constexpr (IsChar) { @@ -461,7 +432,6 @@ template return Exists(std::filesystem::path{path}); } } - #endif /** @@ -474,7 +444,6 @@ template [[nodiscard]] bool IsFile(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool IsFile(const Path& path) { if constexpr (IsChar) { @@ -483,7 +452,6 @@ template return IsFile(std::filesystem::path{path}); } } - #endif /** @@ -496,7 +464,6 @@ template [[nodiscard]] bool IsDir(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool IsDir(const Path& path) { if constexpr (IsChar) { @@ -505,7 +472,6 @@ template return IsDir(std::filesystem::path{path}); } } - #endif /** @@ -523,7 +489,6 @@ template [[nodiscard]] bool SetCurrentDir(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool SetCurrentDir(const Path& path) { if constexpr (IsChar) { @@ -532,7 +497,6 @@ template return SetCurrentDir(std::filesystem::path{path}); } } - #endif /** @@ -545,7 +509,6 @@ template [[nodiscard]] std::filesystem::file_type GetEntryType(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] std::filesystem::file_type GetEntryType(const Path& path) { if constexpr (IsChar) { @@ -554,7 +517,6 @@ template return GetEntryType(std::filesystem::path{path}); } } - #endif /** @@ -567,7 +529,6 @@ template [[nodiscard]] u64 GetSize(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] u64 GetSize(const Path& path) { if constexpr (IsChar) { @@ -576,7 +537,6 @@ template return GetSize(std::filesystem::path{path}); } } - #endif /** @@ -589,7 +549,6 @@ template [[nodiscard]] u64 GetFreeSpaceSize(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] u64 GetFreeSpaceSize(const Path& path) { if constexpr (IsChar) { @@ -598,7 +557,6 @@ template return GetFreeSpaceSize(std::filesystem::path{path}); } } - #endif /** @@ -611,7 +569,6 @@ template [[nodiscard]] u64 GetTotalSpaceSize(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] u64 GetTotalSpaceSize(const Path& path) { if constexpr (IsChar) { @@ -620,7 +577,6 @@ template return GetTotalSpaceSize(std::filesystem::path{path}); } } - #endif } // namespace Common::FS diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h index 89f46406a..a9fadbceb 100755 --- a/src/common/fs/path_util.h +++ b/src/common/fs/path_util.h @@ -48,7 +48,6 @@ enum class YuzuPath { [[nodiscard]] bool ValidatePath(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool ValidatePath(const Path& path) { if constexpr (IsChar) { @@ -57,7 +56,6 @@ template return ValidatePath(std::filesystem::path{path}); } } - #endif /** @@ -77,7 +75,6 @@ template const std::filesystem::path& second); #ifdef _WIN32 - template [[nodiscard]] std::filesystem::path ConcatPath(const Path1& first, const Path2& second) { using ValueType1 = typename Path1::value_type; @@ -92,7 +89,6 @@ template return ConcatPath(std::filesystem::path{first}, std::filesystem::path{second}); } } - #endif /** @@ -111,7 +107,6 @@ template const std::filesystem::path& offset); #ifdef _WIN32 - template [[nodiscard]] std::filesystem::path ConcatPathSafe(const Path1& base, const Path2& offset) { using ValueType1 = typename Path1::value_type; @@ -126,7 +121,6 @@ template return ConcatPathSafe(std::filesystem::path{base}, std::filesystem::path{offset}); } } - #endif /** @@ -141,7 +135,6 @@ template const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] bool IsPathSandboxed(const Path1& base, const Path2& path) { using ValueType1 = typename Path1::value_type; @@ -156,7 +149,6 @@ template return IsPathSandboxed(std::filesystem::path{base}, std::filesystem::path{path}); } } - #endif /** @@ -187,7 +179,6 @@ template [[nodiscard]] std::filesystem::path RemoveTrailingSeparators(const std::filesystem::path& path); #ifdef _WIN32 - template [[nodiscard]] std::filesystem::path RemoveTrailingSeparators(const Path& path) { if constexpr (IsChar) { @@ -196,7 +187,6 @@ template return RemoveTrailingSeparators(std::filesystem::path{path}); } } - #endif /** @@ -227,7 +217,6 @@ template void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path); #ifdef _WIN32 - template [[nodiscard]] void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { if constexpr (IsChar) { @@ -236,7 +225,6 @@ template SetYuzuPath(yuzu_path, std::filesystem::path{new_path}); } } - #endif #ifdef _WIN32 diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 6c1592a87..eb58bfa5b 100755 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -514,6 +514,13 @@ void Config::ReadControlValues() { ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat(); ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), true); + + // Disable docked mode if handheld is selected + const auto controller_type = Settings::values.players.GetValue()[0].controller_type; + if (controller_type == Settings::ControllerType::Handheld) { + Settings::values.use_docked_mode.SetValue(false); + } + ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), true); ReadSettingGlobal(Settings::values.enable_accurate_vibrations, diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index 7186eac76..d85408ac6 100755 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp @@ -38,6 +38,7 @@ void ControllerDialog::refreshConfiguration() { widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); widget->SetConnectedStatus(players[player].connected); widget->SetControllerType(players[player].controller_type); + widget->repaint(); } QAction* ControllerDialog::toggleViewAction() { diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 00afa6f43..0f0e228b0 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -763,10 +763,22 @@ void GMainWindow::InitializeWidgets() { dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); dock_status_button->setFocusPolicy(Qt::NoFocus); connect(dock_status_button, &QPushButton::clicked, [&] { - Settings::values.use_docked_mode.SetValue(!Settings::values.use_docked_mode.GetValue()); - dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); - OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), - Settings::values.use_docked_mode.GetValue()); + const bool is_docked = Settings::values.use_docked_mode.GetValue(); + auto& controller_type = Settings::values.players.GetValue()[0].controller_type; + + if (!is_docked && controller_type == Settings::ControllerType::Handheld) { + QMessageBox::warning(this, tr("Invalid config detected"), + tr("Handheld controller can't be used on docked mode. Pro " + "controller will be selected.")); + controller_type = Settings::ControllerType::ProController; + ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); + configure_dialog.ApplyConfiguration(); + controller_dialog->refreshConfiguration(); + } + + Settings::values.use_docked_mode.SetValue(!is_docked); + dock_status_button->setChecked(!is_docked); + OnDockedModeChanged(is_docked, !is_docked); }); dock_status_button->setText(tr("DOCK")); dock_status_button->setCheckable(true);