mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2026-01-01 12:15:44 +01:00
Revert "Merge branch 'master' into 'dev'"
This reverts merge request !17
This commit is contained in:
parent
fdadc50fff
commit
cdbdf63ebe
2887 changed files with 18295 additions and 18366 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2021 suyu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -56,10 +56,10 @@ namespace fs = std::filesystem;
|
|||
|
||||
/**
|
||||
* The PathManagerImpl is a singleton allowing to manage the mapping of
|
||||
* suyuPath enums to real filesystem paths.
|
||||
* This class provides 2 functions: GetsuyuPathImpl and SetsuyuPathImpl.
|
||||
* These are used by GetsuyuPath and SetsuyuPath respectively to get or modify
|
||||
* the path mapped by the suyuPath enum.
|
||||
* YuzuPath enums to real filesystem paths.
|
||||
* This class provides 2 functions: GetYuzuPathImpl and SetYuzuPathImpl.
|
||||
* These are used by GetYuzuPath and SetYuzuPath respectively to get or modify
|
||||
* the path mapped by the YuzuPath enum.
|
||||
*/
|
||||
class PathManagerImpl {
|
||||
public:
|
||||
|
|
@ -75,62 +75,62 @@ public:
|
|||
PathManagerImpl(PathManagerImpl&&) = delete;
|
||||
PathManagerImpl& operator=(PathManagerImpl&&) = delete;
|
||||
|
||||
[[nodiscard]] const fs::path& GetsuyuPathImpl(suyuPath suyu_path) {
|
||||
return suyu_paths.at(suyu_path);
|
||||
[[nodiscard]] const fs::path& GetYuzuPathImpl(YuzuPath yuzu_path) {
|
||||
return yuzu_paths.at(yuzu_path);
|
||||
}
|
||||
|
||||
void SetsuyuPathImpl(suyuPath suyu_path, const fs::path& new_path) {
|
||||
suyu_paths.insert_or_assign(suyu_path, new_path);
|
||||
void SetYuzuPathImpl(YuzuPath yuzu_path, const fs::path& new_path) {
|
||||
yuzu_paths.insert_or_assign(yuzu_path, new_path);
|
||||
}
|
||||
|
||||
void Reinitialize(fs::path suyu_path = {}) {
|
||||
fs::path suyu_path_cache;
|
||||
fs::path suyu_path_config;
|
||||
void Reinitialize(fs::path yuzu_path = {}) {
|
||||
fs::path yuzu_path_cache;
|
||||
fs::path yuzu_path_config;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef suyu_ENABLE_PORTABLE
|
||||
suyu_path = GetExeDirectory() / PORTABLE_DIR;
|
||||
#ifdef YUZU_ENABLE_PORTABLE
|
||||
yuzu_path = GetExeDirectory() / PORTABLE_DIR;
|
||||
#endif
|
||||
if (!IsDir(suyu_path)) {
|
||||
suyu_path = GetAppDataRoamingDirectory() / suyu_DIR;
|
||||
if (!IsDir(yuzu_path)) {
|
||||
yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
|
||||
}
|
||||
|
||||
suyu_path_cache = suyu_path / CACHE_DIR;
|
||||
suyu_path_config = suyu_path / CONFIG_DIR;
|
||||
yuzu_path_cache = yuzu_path / CACHE_DIR;
|
||||
yuzu_path_config = yuzu_path / CONFIG_DIR;
|
||||
#elif ANDROID
|
||||
ASSERT(!suyu_path.empty());
|
||||
suyu_path_cache = suyu_path / CACHE_DIR;
|
||||
suyu_path_config = suyu_path / CONFIG_DIR;
|
||||
ASSERT(!yuzu_path.empty());
|
||||
yuzu_path_cache = yuzu_path / CACHE_DIR;
|
||||
yuzu_path_config = yuzu_path / CONFIG_DIR;
|
||||
#else
|
||||
#ifdef suyu_ENABLE_PORTABLE
|
||||
suyu_path = GetCurrentDir() / PORTABLE_DIR;
|
||||
#ifdef YUZU_ENABLE_PORTABLE
|
||||
yuzu_path = GetCurrentDir() / PORTABLE_DIR;
|
||||
#endif
|
||||
if (Exists(suyu_path) && IsDir(suyu_path)) {
|
||||
suyu_path_cache = suyu_path / CACHE_DIR;
|
||||
suyu_path_config = suyu_path / CONFIG_DIR;
|
||||
if (Exists(yuzu_path) && IsDir(yuzu_path)) {
|
||||
yuzu_path_cache = yuzu_path / CACHE_DIR;
|
||||
yuzu_path_config = yuzu_path / CONFIG_DIR;
|
||||
} else {
|
||||
suyu_path = GetDataDirectory("XDG_DATA_HOME") / suyu_DIR;
|
||||
suyu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / suyu_DIR;
|
||||
suyu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / suyu_DIR;
|
||||
yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR;
|
||||
yuzu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR;
|
||||
yuzu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR;
|
||||
}
|
||||
#endif
|
||||
|
||||
GeneratesuyuPath(suyuPath::suyuDir, suyu_path);
|
||||
GeneratesuyuPath(suyuPath::AmiiboDir, suyu_path / AMIIBO_DIR);
|
||||
GeneratesuyuPath(suyuPath::CacheDir, suyu_path_cache);
|
||||
GeneratesuyuPath(suyuPath::ConfigDir, suyu_path_config);
|
||||
GeneratesuyuPath(suyuPath::CrashDumpsDir, suyu_path / CRASH_DUMPS_DIR);
|
||||
GeneratesuyuPath(suyuPath::DumpDir, suyu_path / DUMP_DIR);
|
||||
GeneratesuyuPath(suyuPath::KeysDir, suyu_path / KEYS_DIR);
|
||||
GeneratesuyuPath(suyuPath::LoadDir, suyu_path / LOAD_DIR);
|
||||
GeneratesuyuPath(suyuPath::LogDir, suyu_path / LOG_DIR);
|
||||
GeneratesuyuPath(suyuPath::NANDDir, suyu_path / NAND_DIR);
|
||||
GeneratesuyuPath(suyuPath::PlayTimeDir, suyu_path / PLAY_TIME_DIR);
|
||||
GeneratesuyuPath(suyuPath::ScreenshotsDir, suyu_path / SCREENSHOTS_DIR);
|
||||
GeneratesuyuPath(suyuPath::SDMCDir, suyu_path / SDMC_DIR);
|
||||
GeneratesuyuPath(suyuPath::ShaderDir, suyu_path / SHADER_DIR);
|
||||
GeneratesuyuPath(suyuPath::TASDir, suyu_path / TAS_DIR);
|
||||
GeneratesuyuPath(suyuPath::IconsDir, suyu_path / ICONS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
|
||||
GenerateYuzuPath(YuzuPath::AmiiboDir, yuzu_path / AMIIBO_DIR);
|
||||
GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path_cache);
|
||||
GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path_config);
|
||||
GenerateYuzuPath(YuzuPath::CrashDumpsDir, yuzu_path / CRASH_DUMPS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR);
|
||||
GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR);
|
||||
GenerateYuzuPath(YuzuPath::LogDir, yuzu_path / LOG_DIR);
|
||||
GenerateYuzuPath(YuzuPath::NANDDir, yuzu_path / NAND_DIR);
|
||||
GenerateYuzuPath(YuzuPath::PlayTimeDir, yuzu_path / PLAY_TIME_DIR);
|
||||
GenerateYuzuPath(YuzuPath::ScreenshotsDir, yuzu_path / SCREENSHOTS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::SDMCDir, yuzu_path / SDMC_DIR);
|
||||
GenerateYuzuPath(YuzuPath::ShaderDir, yuzu_path / SHADER_DIR);
|
||||
GenerateYuzuPath(YuzuPath::TASDir, yuzu_path / TAS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::IconsDir, yuzu_path / ICONS_DIR);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -140,13 +140,13 @@ private:
|
|||
|
||||
~PathManagerImpl() = default;
|
||||
|
||||
void GeneratesuyuPath(suyuPath suyu_path, const fs::path& new_path) {
|
||||
void GenerateYuzuPath(YuzuPath yuzu_path, const fs::path& new_path) {
|
||||
void(FS::CreateDir(new_path));
|
||||
|
||||
SetsuyuPathImpl(suyu_path, new_path);
|
||||
SetYuzuPathImpl(yuzu_path, new_path);
|
||||
}
|
||||
|
||||
std::unordered_map<suyuPath, fs::path> suyu_paths;
|
||||
std::unordered_map<YuzuPath, fs::path> yuzu_paths;
|
||||
};
|
||||
|
||||
bool ValidatePath(const fs::path& path) {
|
||||
|
|
@ -230,22 +230,22 @@ void SetAppDirectory(const std::string& app_directory) {
|
|||
PathManagerImpl::GetInstance().Reinitialize(app_directory);
|
||||
}
|
||||
|
||||
const fs::path& GetsuyuPath(suyuPath suyu_path) {
|
||||
return PathManagerImpl::GetInstance().GetsuyuPathImpl(suyu_path);
|
||||
const fs::path& GetYuzuPath(YuzuPath yuzu_path) {
|
||||
return PathManagerImpl::GetInstance().GetYuzuPathImpl(yuzu_path);
|
||||
}
|
||||
|
||||
std::string GetsuyuPathString(suyuPath suyu_path) {
|
||||
return PathToUTF8String(GetsuyuPath(suyu_path));
|
||||
std::string GetYuzuPathString(YuzuPath yuzu_path) {
|
||||
return PathToUTF8String(GetYuzuPath(yuzu_path));
|
||||
}
|
||||
|
||||
void SetsuyuPath(suyuPath suyu_path, const fs::path& new_path) {
|
||||
void SetYuzuPath(YuzuPath yuzu_path, const fs::path& new_path) {
|
||||
if (!FS::IsDir(new_path)) {
|
||||
LOG_ERROR(Common_Filesystem, "Filesystem object at new_path={} is not a directory",
|
||||
PathToUTF8String(new_path));
|
||||
return;
|
||||
}
|
||||
|
||||
PathManagerImpl::GetInstance().SetsuyuPathImpl(suyu_path, new_path);
|
||||
PathManagerImpl::GetInstance().SetYuzuPathImpl(yuzu_path, new_path);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue