early-access version 1708

This commit is contained in:
pineappleEA 2021-05-25 22:52:37 +02:00
parent 3f35accecf
commit bada4c739c
7 changed files with 25 additions and 71 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 1707. This is the source code for early-access 1708.
## Legal Notice ## Legal Notice

View File

@ -37,7 +37,6 @@ void OpenFileStream(FileStream& file_stream, const std::filesystem::path& path,
} }
#ifdef _WIN32 #ifdef _WIN32
template <typename FileStream, typename Path> template <typename FileStream, typename Path>
void OpenFileStream(FileStream& file_stream, const Path& path, std::ios_base::openmode open_mode) { void OpenFileStream(FileStream& file_stream, const Path& path, std::ios_base::openmode open_mode) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -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); file_stream.open(std::filesystem::path{path}, open_mode);
} }
} }
#endif #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); [[nodiscard]] std::string ReadStringFromFile(const std::filesystem::path& path, FileType type);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] std::string ReadStringFromFile(const Path& path, FileType type) { [[nodiscard]] std::string ReadStringFromFile(const Path& path, FileType type) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -70,7 +67,6 @@ template <typename Path>
return ReadStringFromFile(std::filesystem::path{path}, type); return ReadStringFromFile(std::filesystem::path{path}, type);
} }
} }
#endif #endif
/** /**
@ -87,7 +83,6 @@ template <typename Path>
std::string_view string); std::string_view string);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] size_t WriteStringToFile(const Path& path, FileType type, std::string_view string) { [[nodiscard]] size_t WriteStringToFile(const Path& path, FileType type, std::string_view string) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -96,7 +91,6 @@ template <typename Path>
return WriteStringToFile(std::filesystem::path{path}, type, string); return WriteStringToFile(std::filesystem::path{path}, type, string);
} }
} }
#endif #endif
/** /**
@ -113,7 +107,6 @@ template <typename Path>
std::string_view string); std::string_view string);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] size_t AppendStringToFile(const Path& path, FileType type, std::string_view string) { [[nodiscard]] size_t AppendStringToFile(const Path& path, FileType type, std::string_view string) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -122,7 +115,6 @@ template <typename Path>
return AppendStringToFile(std::filesystem::path{path}, type, string); return AppendStringToFile(std::filesystem::path{path}, type, string);
} }
} }
#endif #endif
class IOFile final : NonCopyable { class IOFile final : NonCopyable {
@ -191,7 +183,6 @@ public:
FileShareFlag flag = FileShareFlag::ShareReadOnly); FileShareFlag flag = FileShareFlag::ShareReadOnly);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] void Open(const Path& path, FileAccessMode mode, [[nodiscard]] void Open(const Path& path, FileAccessMode mode,
FileType type = FileType::BinaryFile, FileType type = FileType::BinaryFile,
@ -203,7 +194,6 @@ public:
Open(std::filesystem::path{path}, mode, type, flag); Open(std::filesystem::path{path}, mode, type, flag);
} }
} }
#endif #endif
/// Closes the file if it is opened. /// Closes the file if it is opened.

View File

@ -33,7 +33,6 @@ class IOFile;
[[nodiscard]] bool NewFile(const std::filesystem::path& path, u64 size = 0); [[nodiscard]] bool NewFile(const std::filesystem::path& path, u64 size = 0);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool NewFile(const Path& path, u64 size = 0) { [[nodiscard]] bool NewFile(const Path& path, u64 size = 0) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -42,7 +41,6 @@ template <typename Path>
return NewFile(std::filesystem::path{path}, size); return NewFile(std::filesystem::path{path}, size);
} }
} }
#endif #endif
/** /**
@ -60,7 +58,6 @@ template <typename Path>
[[nodiscard]] bool RemoveFile(const std::filesystem::path& path); [[nodiscard]] bool RemoveFile(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool RemoveFile(const Path& path) { [[nodiscard]] bool RemoveFile(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -69,7 +66,6 @@ template <typename Path>
return RemoveFile(std::filesystem::path{path}); return RemoveFile(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -91,7 +87,6 @@ template <typename Path>
const std::filesystem::path& new_path); const std::filesystem::path& new_path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path1, typename Path2> template <typename Path1, typename Path2>
[[nodiscard]] bool RenameFile(const Path1& old_path, const Path2& new_path) { [[nodiscard]] bool RenameFile(const Path1& old_path, const Path2& new_path) {
using ValueType1 = typename Path1::value_type; using ValueType1 = typename Path1::value_type;
@ -106,7 +101,6 @@ template <typename Path1, typename Path2>
return RenameFile(std::filesystem::path{old_path}, std::filesystem::path{new_path}); return RenameFile(std::filesystem::path{old_path}, std::filesystem::path{new_path});
} }
} }
#endif #endif
/** /**
@ -132,7 +126,6 @@ template <typename Path1, typename Path2>
FileShareFlag flag = FileShareFlag::ShareReadOnly); FileShareFlag flag = FileShareFlag::ShareReadOnly);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] std::shared_ptr<IOFile> FileOpen(const Path& path, FileAccessMode mode, [[nodiscard]] std::shared_ptr<IOFile> FileOpen(const Path& path, FileAccessMode mode,
FileType type = FileType::BinaryFile, FileType type = FileType::BinaryFile,
@ -143,7 +136,6 @@ template <typename Path>
return FileOpen(std::filesystem::path{path}, mode, type, flag); return FileOpen(std::filesystem::path{path}, mode, type, flag);
} }
} }
#endif #endif
// Directory Operations // Directory Operations
@ -166,7 +158,6 @@ template <typename Path>
[[nodiscard]] bool CreateDir(const std::filesystem::path& path); [[nodiscard]] bool CreateDir(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool CreateDir(const Path& path) { [[nodiscard]] bool CreateDir(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -175,7 +166,6 @@ template <typename Path>
return CreateDir(std::filesystem::path{path}); return CreateDir(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -196,7 +186,6 @@ template <typename Path>
[[nodiscard]] bool CreateDirs(const std::filesystem::path& path); [[nodiscard]] bool CreateDirs(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool CreateDirs(const Path& path) { [[nodiscard]] bool CreateDirs(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -205,7 +194,6 @@ template <typename Path>
return CreateDirs(std::filesystem::path{path}); return CreateDirs(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -219,7 +207,6 @@ template <typename Path>
[[nodiscard]] bool CreateParentDir(const std::filesystem::path& path); [[nodiscard]] bool CreateParentDir(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool CreateParentDir(const Path& path) { [[nodiscard]] bool CreateParentDir(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -228,7 +215,6 @@ template <typename Path>
return CreateParentDir(std::filesystem::path{path}); return CreateParentDir(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -242,7 +228,6 @@ template <typename Path>
[[nodiscard]] bool CreateParentDirs(const std::filesystem::path& path); [[nodiscard]] bool CreateParentDirs(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool CreateParentDirs(const Path& path) { [[nodiscard]] bool CreateParentDirs(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -251,7 +236,6 @@ template <typename Path>
return CreateParentDirs(std::filesystem::path{path}); return CreateParentDirs(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -270,7 +254,6 @@ template <typename Path>
[[nodiscard]] bool RemoveDir(const std::filesystem::path& path); [[nodiscard]] bool RemoveDir(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool RemoveDir(const Path& path) { [[nodiscard]] bool RemoveDir(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -279,7 +262,6 @@ template <typename Path>
return RemoveDir(std::filesystem::path{path}); return RemoveDir(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -297,7 +279,6 @@ template <typename Path>
[[nodiscard]] bool RemoveDirRecursively(const std::filesystem::path& path); [[nodiscard]] bool RemoveDirRecursively(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool RemoveDirRecursively(const Path& path) { [[nodiscard]] bool RemoveDirRecursively(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -306,7 +287,6 @@ template <typename Path>
return RemoveDirRecursively(std::filesystem::path{path}); return RemoveDirRecursively(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -324,7 +304,6 @@ template <typename Path>
[[nodiscard]] bool RemoveDirContentsRecursively(const std::filesystem::path& path); [[nodiscard]] bool RemoveDirContentsRecursively(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool RemoveDirContentsRecursively(const Path& path) { [[nodiscard]] bool RemoveDirContentsRecursively(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -333,7 +312,6 @@ template <typename Path>
return RemoveDirContentsRecursively(std::filesystem::path{path}); return RemoveDirContentsRecursively(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -355,7 +333,6 @@ template <typename Path>
const std::filesystem::path& new_path); const std::filesystem::path& new_path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path1, typename Path2> template <typename Path1, typename Path2>
[[nodiscard]] bool RenameDir(const Path1& old_path, const Path2& new_path) { [[nodiscard]] bool RenameDir(const Path1& old_path, const Path2& new_path) {
using ValueType1 = typename Path1::value_type; using ValueType1 = typename Path1::value_type;
@ -370,7 +347,6 @@ template <typename Path1, typename Path2>
return RenameDir(std::filesystem::path{old_path}, std::filesystem::path{new_path}); return RenameDir(std::filesystem::path{old_path}, std::filesystem::path{new_path});
} }
} }
#endif #endif
/** /**
@ -393,7 +369,6 @@ void IterateDirEntries(const std::filesystem::path& path, const DirEntryCallable
DirEntryFilter filter = DirEntryFilter::All); DirEntryFilter filter = DirEntryFilter::All);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
void IterateDirEntries(const Path& path, const DirEntryCallable& callback, void IterateDirEntries(const Path& path, const DirEntryCallable& callback,
DirEntryFilter filter = DirEntryFilter::All) { DirEntryFilter filter = DirEntryFilter::All) {
@ -403,7 +378,6 @@ void IterateDirEntries(const Path& path, const DirEntryCallable& callback,
IterateDirEntries(std::filesystem::path{path}, callback, filter); IterateDirEntries(std::filesystem::path{path}, callback, filter);
} }
} }
#endif #endif
/** /**
@ -427,7 +401,6 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
DirEntryFilter filter = DirEntryFilter::All); DirEntryFilter filter = DirEntryFilter::All);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& callback, void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& callback,
DirEntryFilter filter = DirEntryFilter::All) { DirEntryFilter filter = DirEntryFilter::All) {
@ -437,7 +410,6 @@ void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& call
IterateDirEntriesRecursively(std::filesystem::path{path}, callback, filter); IterateDirEntriesRecursively(std::filesystem::path{path}, callback, filter);
} }
} }
#endif #endif
// Generic Filesystem Operations // Generic Filesystem Operations
@ -452,7 +424,6 @@ void IterateDirEntriesRecursively(const Path& path, const DirEntryCallable& call
[[nodiscard]] bool Exists(const std::filesystem::path& path); [[nodiscard]] bool Exists(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool Exists(const Path& path) { [[nodiscard]] bool Exists(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -461,7 +432,6 @@ template <typename Path>
return Exists(std::filesystem::path{path}); return Exists(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -474,7 +444,6 @@ template <typename Path>
[[nodiscard]] bool IsFile(const std::filesystem::path& path); [[nodiscard]] bool IsFile(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool IsFile(const Path& path) { [[nodiscard]] bool IsFile(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -483,7 +452,6 @@ template <typename Path>
return IsFile(std::filesystem::path{path}); return IsFile(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -496,7 +464,6 @@ template <typename Path>
[[nodiscard]] bool IsDir(const std::filesystem::path& path); [[nodiscard]] bool IsDir(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool IsDir(const Path& path) { [[nodiscard]] bool IsDir(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -505,7 +472,6 @@ template <typename Path>
return IsDir(std::filesystem::path{path}); return IsDir(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -523,7 +489,6 @@ template <typename Path>
[[nodiscard]] bool SetCurrentDir(const std::filesystem::path& path); [[nodiscard]] bool SetCurrentDir(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool SetCurrentDir(const Path& path) { [[nodiscard]] bool SetCurrentDir(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -532,7 +497,6 @@ template <typename Path>
return SetCurrentDir(std::filesystem::path{path}); return SetCurrentDir(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -545,7 +509,6 @@ template <typename Path>
[[nodiscard]] std::filesystem::file_type GetEntryType(const std::filesystem::path& path); [[nodiscard]] std::filesystem::file_type GetEntryType(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] std::filesystem::file_type GetEntryType(const Path& path) { [[nodiscard]] std::filesystem::file_type GetEntryType(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -554,7 +517,6 @@ template <typename Path>
return GetEntryType(std::filesystem::path{path}); return GetEntryType(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -567,7 +529,6 @@ template <typename Path>
[[nodiscard]] u64 GetSize(const std::filesystem::path& path); [[nodiscard]] u64 GetSize(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] u64 GetSize(const Path& path) { [[nodiscard]] u64 GetSize(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -576,7 +537,6 @@ template <typename Path>
return GetSize(std::filesystem::path{path}); return GetSize(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -589,7 +549,6 @@ template <typename Path>
[[nodiscard]] u64 GetFreeSpaceSize(const std::filesystem::path& path); [[nodiscard]] u64 GetFreeSpaceSize(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] u64 GetFreeSpaceSize(const Path& path) { [[nodiscard]] u64 GetFreeSpaceSize(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -598,7 +557,6 @@ template <typename Path>
return GetFreeSpaceSize(std::filesystem::path{path}); return GetFreeSpaceSize(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -611,7 +569,6 @@ template <typename Path>
[[nodiscard]] u64 GetTotalSpaceSize(const std::filesystem::path& path); [[nodiscard]] u64 GetTotalSpaceSize(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] u64 GetTotalSpaceSize(const Path& path) { [[nodiscard]] u64 GetTotalSpaceSize(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -620,7 +577,6 @@ template <typename Path>
return GetTotalSpaceSize(std::filesystem::path{path}); return GetTotalSpaceSize(std::filesystem::path{path});
} }
} }
#endif #endif
} // namespace Common::FS } // namespace Common::FS

View File

@ -48,7 +48,6 @@ enum class YuzuPath {
[[nodiscard]] bool ValidatePath(const std::filesystem::path& path); [[nodiscard]] bool ValidatePath(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] bool ValidatePath(const Path& path) { [[nodiscard]] bool ValidatePath(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -57,7 +56,6 @@ template <typename Path>
return ValidatePath(std::filesystem::path{path}); return ValidatePath(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -77,7 +75,6 @@ template <typename Path>
const std::filesystem::path& second); const std::filesystem::path& second);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path1, typename Path2> template <typename Path1, typename Path2>
[[nodiscard]] std::filesystem::path ConcatPath(const Path1& first, const Path2& second) { [[nodiscard]] std::filesystem::path ConcatPath(const Path1& first, const Path2& second) {
using ValueType1 = typename Path1::value_type; using ValueType1 = typename Path1::value_type;
@ -92,7 +89,6 @@ template <typename Path1, typename Path2>
return ConcatPath(std::filesystem::path{first}, std::filesystem::path{second}); return ConcatPath(std::filesystem::path{first}, std::filesystem::path{second});
} }
} }
#endif #endif
/** /**
@ -111,7 +107,6 @@ template <typename Path1, typename Path2>
const std::filesystem::path& offset); const std::filesystem::path& offset);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path1, typename Path2> template <typename Path1, typename Path2>
[[nodiscard]] std::filesystem::path ConcatPathSafe(const Path1& base, const Path2& offset) { [[nodiscard]] std::filesystem::path ConcatPathSafe(const Path1& base, const Path2& offset) {
using ValueType1 = typename Path1::value_type; using ValueType1 = typename Path1::value_type;
@ -126,7 +121,6 @@ template <typename Path1, typename Path2>
return ConcatPathSafe(std::filesystem::path{base}, std::filesystem::path{offset}); return ConcatPathSafe(std::filesystem::path{base}, std::filesystem::path{offset});
} }
} }
#endif #endif
/** /**
@ -141,7 +135,6 @@ template <typename Path1, typename Path2>
const std::filesystem::path& path); const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path1, typename Path2> template <typename Path1, typename Path2>
[[nodiscard]] bool IsPathSandboxed(const Path1& base, const Path2& path) { [[nodiscard]] bool IsPathSandboxed(const Path1& base, const Path2& path) {
using ValueType1 = typename Path1::value_type; using ValueType1 = typename Path1::value_type;
@ -156,7 +149,6 @@ template <typename Path1, typename Path2>
return IsPathSandboxed(std::filesystem::path{base}, std::filesystem::path{path}); return IsPathSandboxed(std::filesystem::path{base}, std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -187,7 +179,6 @@ template <typename Path1, typename Path2>
[[nodiscard]] std::filesystem::path RemoveTrailingSeparators(const std::filesystem::path& path); [[nodiscard]] std::filesystem::path RemoveTrailingSeparators(const std::filesystem::path& path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] std::filesystem::path RemoveTrailingSeparators(const Path& path) { [[nodiscard]] std::filesystem::path RemoveTrailingSeparators(const Path& path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -196,7 +187,6 @@ template <typename Path>
return RemoveTrailingSeparators(std::filesystem::path{path}); return RemoveTrailingSeparators(std::filesystem::path{path});
} }
} }
#endif #endif
/** /**
@ -227,7 +217,6 @@ template <typename Path>
void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path); void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path);
#ifdef _WIN32 #ifdef _WIN32
template <typename Path> template <typename Path>
[[nodiscard]] void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { [[nodiscard]] void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) {
if constexpr (IsChar<typename Path::value_type>) { if constexpr (IsChar<typename Path::value_type>) {
@ -236,7 +225,6 @@ template <typename Path>
SetYuzuPath(yuzu_path, std::filesystem::path{new_path}); SetYuzuPath(yuzu_path, std::filesystem::path{new_path});
} }
} }
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View File

@ -514,6 +514,13 @@ void Config::ReadControlValues() {
ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat(); ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat();
ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), true); 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"), ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"),
true); true);
ReadSettingGlobal(Settings::values.enable_accurate_vibrations, ReadSettingGlobal(Settings::values.enable_accurate_vibrations,

View File

@ -38,6 +38,7 @@ void ControllerDialog::refreshConfiguration() {
widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
widget->SetConnectedStatus(players[player].connected); widget->SetConnectedStatus(players[player].connected);
widget->SetControllerType(players[player].controller_type); widget->SetControllerType(players[player].controller_type);
widget->repaint();
} }
QAction* ControllerDialog::toggleViewAction() { QAction* ControllerDialog::toggleViewAction() {

View File

@ -763,10 +763,22 @@ void GMainWindow::InitializeWidgets() {
dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
dock_status_button->setFocusPolicy(Qt::NoFocus); dock_status_button->setFocusPolicy(Qt::NoFocus);
connect(dock_status_button, &QPushButton::clicked, [&] { connect(dock_status_button, &QPushButton::clicked, [&] {
Settings::values.use_docked_mode.SetValue(!Settings::values.use_docked_mode.GetValue()); const bool is_docked = Settings::values.use_docked_mode.GetValue();
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); auto& controller_type = Settings::values.players.GetValue()[0].controller_type;
OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(),
Settings::values.use_docked_mode.GetValue()); 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->setText(tr("DOCK"));
dock_status_button->setCheckable(true); dock_status_button->setCheckable(true);