diff options
-rw-r--r-- | src/common/common_paths.h | 2 | ||||
-rw-r--r-- | src/common/file_util.cpp | 16 | ||||
-rw-r--r-- | src/common/file_util.h | 1 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.cpp | 4 |
4 files changed, 20 insertions, 3 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index a5342a610..37304d236 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -19,7 +19,7 @@ #define EMU_DATA_DIR USER_DIR #else #ifdef _WIN32 -#define EMU_DATA_DIR "Citra Emulator" +#define EMU_DATA_DIR "Citra" #else #define EMU_DATA_DIR "citra-emu" #endif diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 407ed047a..413a8e7e5 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -26,6 +26,9 @@ #define stat _stat64 #define fstat _fstat64 #define fileno _fileno +// Windows version, at least Vista is required to obtain AppData Path +#define WINVER 0x0600 +#define _WIN32_WINNT 0x0600 #else #ifdef __APPLE__ #include <sys/param.h> @@ -594,6 +597,15 @@ std::string& GetExeDirectory() { } return exe_path; } + +std::string AppDataRoamingDirectory() { + PWSTR pw_local_path = nullptr; + // Only supported by Windows Vista or later + SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pw_local_path); + std::string local_path = Common::UTF16ToUTF8(pw_local_path); + CoTaskMemFree(pw_local_path); + return local_path; +} #else /** * @return The user’s home directory on POSIX systems @@ -671,6 +683,10 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new if (paths[D_USER_IDX].empty()) { #ifdef _WIN32 paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; + if (!FileUtil::IsDirectory(paths[D_USER_IDX])) { + paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP; + } + paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; #else diff --git a/src/common/file_util.h b/src/common/file_util.h index 204b06f14..ac58607c5 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -154,6 +154,7 @@ std::string GetBundleDirectory(); #ifdef _WIN32 std::string& GetExeDirectory(); +std::string AppDataRoamingDirectory(); #endif size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename); diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 2595defdf..ca8a94ee9 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -131,9 +131,9 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64)); void ARM_Dynarmic::ExecuteInstructions(int num_instructions) { MICROPROFILE_SCOPE(ARM_Jit); - jit->Run(static_cast<unsigned>(num_instructions)); + unsigned ticks_executed = jit->Run(static_cast<unsigned>(num_instructions)); - AddTicks(num_instructions); + AddTicks(ticks_executed); } void ARM_Dynarmic::SaveContext(Core::ThreadContext& ctx) { |