summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/common_paths.h1
-rw-r--r--src/common/file_util.cpp14
-rw-r--r--src/common/file_util.h3
-rw-r--r--src/common/logging/backend.cpp2
-rw-r--r--src/common/logging/log.h2
5 files changed, 22 insertions, 0 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 6799a357a..df2ce80b1 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -32,6 +32,7 @@
32#define SDMC_DIR "sdmc" 32#define SDMC_DIR "sdmc"
33#define NAND_DIR "nand" 33#define NAND_DIR "nand"
34#define SYSDATA_DIR "sysdata" 34#define SYSDATA_DIR "sysdata"
35#define KEYS_DIR "keys"
35#define LOG_DIR "log" 36#define LOG_DIR "log"
36 37
37// Filenames 38// Filenames
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index b8dd92b65..7aeda737f 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -706,6 +706,7 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) {
706 paths.emplace(UserPath::SDMCDir, user_path + SDMC_DIR DIR_SEP); 706 paths.emplace(UserPath::SDMCDir, user_path + SDMC_DIR DIR_SEP);
707 paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); 707 paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP);
708 paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); 708 paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP);
709 paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP);
709 // TODO: Put the logs in a better location for each OS 710 // TODO: Put the logs in a better location for each OS
710 paths.emplace(UserPath::LogDir, user_path + LOG_DIR DIR_SEP); 711 paths.emplace(UserPath::LogDir, user_path + LOG_DIR DIR_SEP);
711 } 712 }
@@ -736,6 +737,19 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) {
736 return paths[path]; 737 return paths[path];
737} 738}
738 739
740std::string GetHactoolConfigurationPath() {
741#ifdef _WIN32
742 PWSTR pw_local_path = nullptr;
743 if (SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &pw_local_path) != S_OK)
744 return "";
745 std::string local_path = Common::UTF16ToUTF8(pw_local_path);
746 CoTaskMemFree(pw_local_path);
747 return local_path + "\\.switch";
748#else
749 return GetHomeDirectory() + "/.switch";
750#endif
751}
752
739size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) { 753size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) {
740 return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size()); 754 return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
741} 755}
diff --git a/src/common/file_util.h b/src/common/file_util.h
index bc9272d89..28697d527 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -23,6 +23,7 @@ namespace FileUtil {
23enum class UserPath { 23enum class UserPath {
24 CacheDir, 24 CacheDir,
25 ConfigDir, 25 ConfigDir,
26 KeysDir,
26 LogDir, 27 LogDir,
27 NANDDir, 28 NANDDir,
28 RootDir, 29 RootDir,
@@ -125,6 +126,8 @@ bool SetCurrentDir(const std::string& directory);
125// directory. To be used in "multi-user" mode (that is, installed). 126// directory. To be used in "multi-user" mode (that is, installed).
126const std::string& GetUserPath(UserPath path, const std::string& new_path = ""); 127const std::string& GetUserPath(UserPath path, const std::string& new_path = "");
127 128
129std::string GetHactoolConfigurationPath();
130
128// Returns the path to where the sys file are 131// Returns the path to where the sys file are
129std::string GetSysDirectory(); 132std::string GetSysDirectory();
130 133
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index c6a21d993..816414e8d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -168,6 +168,7 @@ void FileBackend::Write(const Entry& entry) {
168 SUB(Service, AM) \ 168 SUB(Service, AM) \
169 SUB(Service, AOC) \ 169 SUB(Service, AOC) \
170 SUB(Service, APM) \ 170 SUB(Service, APM) \
171 SUB(Service, ARP) \
171 SUB(Service, BCAT) \ 172 SUB(Service, BCAT) \
172 SUB(Service, BPC) \ 173 SUB(Service, BPC) \
173 SUB(Service, BTM) \ 174 SUB(Service, BTM) \
@@ -217,6 +218,7 @@ void FileBackend::Write(const Entry& entry) {
217 CLS(Input) \ 218 CLS(Input) \
218 CLS(Network) \ 219 CLS(Network) \
219 CLS(Loader) \ 220 CLS(Loader) \
221 CLS(Crypto) \
220 CLS(WebService) 222 CLS(WebService)
221 223
222// GetClassName is a macro defined by Windows.h, grrr... 224// GetClassName is a macro defined by Windows.h, grrr...
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 3d6a161a5..7ab5277ea 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -54,6 +54,7 @@ enum class Class : ClassType {
54 Service_AM, ///< The AM (Applet manager) service 54 Service_AM, ///< The AM (Applet manager) service
55 Service_AOC, ///< The AOC (AddOn Content) service 55 Service_AOC, ///< The AOC (AddOn Content) service
56 Service_APM, ///< The APM (Performance) service 56 Service_APM, ///< The APM (Performance) service
57 Service_ARP, ///< The ARP service
57 Service_Audio, ///< The Audio (Audio control) service 58 Service_Audio, ///< The Audio (Audio control) service
58 Service_BCAT, ///< The BCAT service 59 Service_BCAT, ///< The BCAT service
59 Service_BPC, ///< The BPC service 60 Service_BPC, ///< The BPC service
@@ -102,6 +103,7 @@ enum class Class : ClassType {
102 Audio_DSP, ///< The HLE implementation of the DSP 103 Audio_DSP, ///< The HLE implementation of the DSP
103 Audio_Sink, ///< Emulator audio output backend 104 Audio_Sink, ///< Emulator audio output backend
104 Loader, ///< ROM loader 105 Loader, ///< ROM loader
106 Crypto, ///< Cryptographic engine/functions
105 Input, ///< Input emulation 107 Input, ///< Input emulation
106 Network, ///< Network emulation 108 Network, ///< Network emulation
107 WebService, ///< Interface to yuzu Web Services 109 WebService, ///< Interface to yuzu Web Services