diff options
author | bunnei <bunneidev@gmail.com> | 2014-10-08 01:44:13 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-10-08 01:44:13 +0200 |
commit | a171000cbec1dbae4e5c0c34ea1d7ef1b4313164 (patch) | |
tree | a6bc766749aabd4eb8df276749fe51db49ee7030 /src/common | |
parent | Merge pull request #129 from linkmauve/master (diff) | |
parent | Added configuration file system. (diff) | |
download | yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.tar yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.tar.gz yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.tar.bz2 yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.tar.lz yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.tar.xz yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.tar.zst yuzu-a171000cbec1dbae4e5c0c34ea1d7ef1b4313164.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/common_paths.h | 44 | ||||
-rw-r--r-- | src/common/emu_window.h | 10 | ||||
-rw-r--r-- | src/common/file_util.cpp | 72 | ||||
-rw-r--r-- | src/common/file_util.h | 14 | ||||
-rw-r--r-- | src/common/log.h | 1 | ||||
-rw-r--r-- | src/common/log_manager.cpp | 1 |
6 files changed, 73 insertions, 69 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index 7cd5b1f35..ae08d082a 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -7,25 +7,25 @@ // Make sure we pick up USER_DIR if set in config.h #include "common/common.h" -// Directory seperators, do we need this? +// Directory separators, do we need this? #define DIR_SEP "/" #define DIR_SEP_CHR '/' #ifndef MAX_PATH -#define MAX_PATH 260 +#define MAX_PATH 260 #endif // The user data dir #define ROOT_DIR "." #ifdef _WIN32 #define USERDATA_DIR "user" - #define EMU_DATA_DIR "emu" + #define EMU_DATA_DIR "Citra Emulator" #else #define USERDATA_DIR "user" #ifdef USER_DIR #define EMU_DATA_DIR USER_DIR #else - #define EMU_DATA_DIR ".emu" + #define EMU_DATA_DIR ".citra-emu" #endif #endif @@ -48,30 +48,30 @@ #define JAP_DIR "JAP" // Subdirs in the User dir returned by GetUserPath(D_USER_IDX) -#define CONFIG_DIR "config" -#define GAMECONFIG_DIR "game_config" -#define MAPS_DIR "maps" -#define CACHE_DIR "cache" +#define CONFIG_DIR "config" +#define GAMECONFIG_DIR "game_config" +#define MAPS_DIR "maps" +#define CACHE_DIR "cache" #define SDMC_DIR "sdmc" -#define SHADERCACHE_DIR "shader_cache" -#define STATESAVES_DIR "state_saves" -#define SCREENSHOTS_DIR "screenShots" -#define DUMP_DIR "dump" -#define DUMP_TEXTURES_DIR "textures" -#define DUMP_FRAMES_DIR "frames" -#define DUMP_AUDIO_DIR "audio" -#define LOGS_DIR "logs" -#define SHADERS_DIR "shaders" -#define SYSCONF_DIR "sysconf" +#define SHADERCACHE_DIR "shader_cache" +#define STATESAVES_DIR "state_saves" +#define SCREENSHOTS_DIR "screenShots" +#define DUMP_DIR "dump" +#define DUMP_TEXTURES_DIR "textures" +#define DUMP_FRAMES_DIR "frames" +#define DUMP_AUDIO_DIR "audio" +#define LOGS_DIR "logs" +#define SHADERS_DIR "shaders" +#define SYSCONF_DIR "sysconf" // Filenames // Files in the directory returned by GetUserPath(D_CONFIG_IDX) #define EMU_CONFIG "emu.ini" -#define DEBUGGER_CONFIG "debugger.ini" -#define LOGGER_CONFIG "logger.ini" +#define DEBUGGER_CONFIG "debugger.ini" +#define LOGGER_CONFIG "logger.ini" // Files in the directory returned by GetUserPath(D_LOGS_IDX) -#define MAIN_LOG "emu.log" +#define MAIN_LOG "emu.log" // Files in the directory returned by GetUserPath(D_SYSCONF_IDX) -#define SYSCONF "SYSCONF" +#define SYSCONF "SYSCONF" diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 23f178fdf..34cecb40b 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -16,7 +16,7 @@ class EmuWindow public: /// Data structure to store an emuwindow configuration - struct Config{ + struct WindowConfig { bool fullscreen; int res_width; int res_height; @@ -34,17 +34,19 @@ public: /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread virtual void DoneCurrent() = 0; + virtual void ReloadSetKeymaps() = 0; + /// Signals a key press action to the HID module static void KeyPressed(KeyMap::HostDeviceKey key); /// Signals a key release action to the HID module static void KeyReleased(KeyMap::HostDeviceKey key); - Config GetConfig() const { + WindowConfig GetConfig() const { return m_config; } - void SetConfig(const Config& val) { + void SetConfig(const WindowConfig& val) { m_config = val; } @@ -86,6 +88,6 @@ protected: int m_client_area_height; ///< Current client height, should be set by window impl. private: - Config m_config; ///< Internal configuration + WindowConfig m_config; ///< Internal configuration }; diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 5fd155222..78a642599 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -648,7 +648,7 @@ std::string GetSysDirectory() return sysDir; } -// Returns a string with a Dolphin data dir or file in the user's home +// Returns a string with a Citra data dir or file in the user's home // directory. To be used in "multi-user" mode (that is, installed). const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath) { @@ -668,22 +668,22 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new getenv("PWD") : "") + DIR_SEP EMU_DATA_DIR DIR_SEP; #endif - paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; - paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; - paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; - paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; + paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; + paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; + paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; + paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; - paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; + paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; - paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; - paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; - paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; - paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; - paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; - paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; - paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; + paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; + paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; + paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; + paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; + paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; + paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; + paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; } @@ -702,44 +702,44 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new switch (DirIDX) { case D_ROOT_IDX: - paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; - paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP; - paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF; + paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; + paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP; + paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF; break; case D_USER_IDX: - paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; - paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; - paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; - paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; - paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; + paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; + paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; + paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; + paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; + paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; - paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; + paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; - paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; - paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; - paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; - paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; - paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; + paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; + paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; + paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; + paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; + paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR DIR_SEP; - paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; - paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; - paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; + paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; + paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; + paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; break; case D_CONFIG_IDX: - paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; - paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; - paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; + paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; + paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; + paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; break; case D_DUMP_IDX: - paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; - paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; - paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; + paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; + paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; + paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; break; case D_LOGS_IDX: diff --git a/src/common/file_util.h b/src/common/file_util.h index 288734cad..173ce6623 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -48,7 +48,7 @@ enum { namespace FileUtil { -// FileSystem tree node/ +// FileSystem tree node/ struct FSTEntry { bool isDirectory; @@ -86,13 +86,13 @@ bool Delete(const std::string &filename); // Deletes a directory filename, returns true on success bool DeleteDir(const std::string &filename); -// renames file srcFilename to destFilename, returns true on success +// renames file srcFilename to destFilename, returns true on success bool Rename(const std::string &srcFilename, const std::string &destFilename); -// copies file srcFilename to destFilename, returns true on success +// copies file srcFilename to destFilename, returns true on success bool Copy(const std::string &srcFilename, const std::string &destFilename); -// creates an empty file filename, returns true on success +// creates an empty file filename, returns true on success bool CreateEmptyFile(const std::string &filename); // Scans the directory tree gets, starting from _Directory and adds the @@ -111,7 +111,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path); // Set the current directory to given directory bool SetCurrentDir(const std::string &directory); -// Returns a pointer to a string with a Dolphin data dir in the user's home +// Returns a pointer to a string with a Citra data dir in the user's home // directory. To be used in "multi-user" mode (that is, installed). const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath=""); @@ -153,10 +153,10 @@ public: IOFile(const std::string& filename, const char openmode[]); ~IOFile(); - + IOFile(IOFile&& other); IOFile& operator=(IOFile&& other); - + void Swap(IOFile& other); bool Open(const std::string& filename, const char openmode[]); diff --git a/src/common/log.h b/src/common/log.h index 291534c67..bfd73f8a5 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -28,6 +28,7 @@ enum LOG_TYPE { COMMANDPROCESSOR, COMMON, CONSOLE, + CONFIG, DISCIO, FILEMON, DSPHLE, diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp index 28b72fa20..4d590d98f 100644 --- a/src/common/log_manager.cpp +++ b/src/common/log_manager.cpp @@ -30,6 +30,7 @@ LogManager::LogManager() m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); + m_Log[LogTypes::CONFIG] = new LogContainer("CONFIG", "Configuration"); m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); |