From ba54fac9eb74be6f73e20e2de953cf6f355be57f Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 28 Feb 2011 20:40:15 +0000 Subject: [PATCH] Convert GetUserPath to return a std::string instead of a const char *. This simplifies its usage in most cases. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7265 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/AudioCommon/Src/AudioCommon.cpp | 11 +- .../AudioCommon/Src/AudioCommonConfig.cpp | 6 +- Source/Core/Common/Src/FileUtil.cpp | 163 +++++++++--------- Source/Core/Common/Src/FileUtil.h | 2 +- Source/Core/Common/Src/LogManager.cpp | 2 +- Source/Core/Common/Src/NandPaths.cpp | 9 +- Source/Core/Common/Src/SDCardUtil.cpp | 2 +- Source/Core/Common/Src/SDCardUtil.h | 2 +- Source/Core/Common/Src/SysConf.cpp | 2 +- Source/Core/Core/Src/Boot/Boot.cpp | 4 +- Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp | 15 +- Source/Core/Core/Src/BootManager.cpp | 2 +- Source/Core/Core/Src/ConfigManager.cpp | 8 +- Source/Core/Core/Src/Core.cpp | 4 +- Source/Core/Core/Src/CoreParameter.cpp | 2 +- Source/Core/Core/Src/DSP/disassemble.cpp | 5 +- .../Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp | 2 +- .../Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp | 2 +- Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp | 20 +-- .../Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp | 9 +- .../Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp | 4 +- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 +- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp | 10 +- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 11 +- Source/Core/Core/Src/PatchEngine.cpp | 2 +- Source/Core/Core/Src/PowerPC/PPCTables.cpp | 6 +- Source/Core/Core/Src/PowerPC/Profiler.cpp | 26 +-- Source/Core/Core/Src/State.cpp | 10 +- Source/Core/DiscIO/Src/BannerLoaderWii.cpp | 6 +- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 8 +- Source/Core/DolphinWX/Src/CheatsWindow.cpp | 2 +- Source/Core/DolphinWX/Src/ConfigMain.cpp | 2 +- .../DolphinWX/Src/Debugger/BreakpointDlg.cpp | 2 - .../DolphinWX/Src/Debugger/BreakpointView.h | 1 - .../Src/Debugger/BreakpointWindow.cpp | 28 ++- .../DolphinWX/Src/Debugger/BreakpointWindow.h | 10 +- .../DolphinWX/Src/Debugger/CodeWindow.cpp | 109 ++++-------- .../Core/DolphinWX/Src/Debugger/CodeWindow.h | 5 +- .../Src/Debugger/CodeWindowFunctions.cpp | 36 ++-- .../DolphinWX/Src/Debugger/DebuggerPanel.cpp | 26 +-- .../DolphinWX/Src/Debugger/MemoryCheckDlg.cpp | 7 +- .../DolphinWX/Src/Debugger/MemoryCheckDlg.h | 5 +- .../DolphinWX/Src/Debugger/MemoryWindow.cpp | 6 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 2 +- Source/Core/DolphinWX/Src/GameListCtrl.cpp | 13 +- Source/Core/DolphinWX/Src/Globals.h | 3 - Source/Core/DolphinWX/Src/ISOFile.cpp | 9 +- Source/Core/DolphinWX/Src/ISOProperties.cpp | 2 +- Source/Core/DolphinWX/Src/Main.cpp | 50 +++--- Source/Core/DolphinWX/Src/MemcardManager.cpp | 2 +- .../DolphinWX/Src/MemoryCards/GCMemcard.cpp | 2 +- .../Src/MemoryCards/WiiSaveCrypted.cpp | 4 +- Source/Core/DolphinWX/Src/NetWindow.cpp | 4 +- Source/Core/DolphinWX/Src/PHackSettings.cpp | 2 +- Source/Core/DolphinWX/Src/VideoConfigDiag.cpp | 2 +- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 2 +- Source/Core/InputCommon/Src/InputConfig.cpp | 4 +- Source/Core/VideoCommon/Src/AVIDump.cpp | 4 +- Source/Core/VideoCommon/Src/HiresTextures.cpp | 4 +- .../Src/OpenCL/OCLTextureDecoder.cpp | 16 +- .../Core/VideoCommon/Src/TextureCacheBase.cpp | 12 +- .../VideoCommon/Src/VertexManagerBase.cpp | 8 +- .../Plugin_VideoDX11/Src/PixelShaderCache.cpp | 7 +- .../Src/VertexShaderCache.cpp | 7 +- Source/Plugins/Plugin_VideoDX11/Src/main.cpp | 2 +- .../Plugin_VideoDX9/Src/PixelShaderCache.cpp | 11 +- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 3 +- .../Plugin_VideoDX9/Src/TextureConverter.cpp | 4 +- .../Plugin_VideoDX9/Src/VertexShaderCache.cpp | 7 +- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 2 +- .../Plugin_VideoOGL/Src/PixelShaderCache.cpp | 4 +- .../Plugin_VideoOGL/Src/PostProcessing.cpp | 4 +- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 10 +- .../Plugin_VideoOGL/Src/TextureCache.cpp | 2 +- .../Plugin_VideoOGL/Src/TextureConverter.cpp | 2 +- .../Plugin_VideoOGL/Src/VertexManager.cpp | 9 +- .../Plugin_VideoOGL/Src/VertexShaderCache.cpp | 2 +- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 8 +- .../Plugin_VideoSoftware/Src/DebugUtil.cpp | 26 ++- .../Plugin_VideoSoftware/Src/SWmain.cpp | 2 +- 82 files changed, 408 insertions(+), 449 deletions(-) diff --git a/Source/Core/AudioCommon/Src/AudioCommon.cpp b/Source/Core/AudioCommon/Src/AudioCommon.cpp index 22758c53b4..67d892b557 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommon.cpp @@ -54,12 +54,11 @@ namespace AudioCommon ac_Config.Update(); if (soundStream->Start()) { - if (ac_Config.m_DumpAudio) { - char audio_file_name[255]; - snprintf(audio_file_name, 255, "%saudiodump.wav", File::GetUserPath(D_DUMPAUDIO_IDX)); - File::CreateFullPath(audio_file_name); - mixer->StartLogAudio(audio_file_name); - //soundStream->StartLogAudio(audio_file_name); + if (ac_Config.m_DumpAudio) + { + std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav"; + File::CreateFullPath(audio_file_name.c_str()); + mixer->StartLogAudio(audio_file_name.c_str()); } return soundStream; diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp index b04ae01fd9..1ab4c261e2 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp @@ -28,7 +28,7 @@ SoundStream *soundStream; void AudioCommonConfig::Load() { IniFile file; - file.Load(std::string(File::GetUserPath(F_DSPCONFIG_IDX)).c_str()); + file.Load(File::GetUserPath(F_DSPCONFIG_IDX)); file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true); file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); @@ -51,7 +51,7 @@ void AudioCommonConfig::Load() void AudioCommonConfig::SaveSettings() { IniFile file; - file.Load(std::string(File::GetUserPath(F_DSPCONFIG_IDX)).c_str()); + file.Load(File::GetUserPath(F_DSPCONFIG_IDX)); file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); file.Set("Config", "EnableThrottle", m_EnableThrottle); @@ -61,7 +61,7 @@ void AudioCommonConfig::SaveSettings() file.Set("Config", "Frequency", iFrequency); file.Set("Config", "Volume", m_Volume); - file.Save((std::string(File::GetUserPath(F_DSPCONFIG_IDX)).c_str())); + file.Save(File::GetUserPath(F_DSPCONFIG_IDX)); } // Update according to the values (stream/mixer) diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 45ae2e1c95..73735235f4 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -61,24 +61,26 @@ namespace File // Remove any ending forward slashes from directory paths // Modifies argument. -static char *StripTailDirSlashes(char *fname) +static void StripTailDirSlashes(std::string &fname) { - int len = (int)strlen(fname); - int i = len - 1; - if (len > 1) + if (fname.length() > 1) + { + size_t i = fname.length() - 1; while (fname[i] == DIR_SEP_CHR) fname[i--] = '\0'; - return fname; + } + return; } // Returns true if file filename exists bool Exists(const char *filename) { struct stat64 file_info; - - char *copy = StripTailDirSlashes(__strdup(filename)); - int result = stat64(copy, &file_info); - free(copy); + + std::string copy(filename); + StripTailDirSlashes(copy); + + int result = stat64(copy.c_str(), &file_info); return (result == 0); } @@ -88,10 +90,10 @@ bool IsDirectory(const char *filename) { struct stat64 file_info; - char *copy = StripTailDirSlashes(__strdup(filename)); + std::string copy(filename); + StripTailDirSlashes(copy); - int result = stat64(copy, &file_info); - free(copy); + int result = stat64(copy.c_str(), &file_info); if (result < 0) { WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", @@ -622,84 +624,85 @@ std::string GetSysDirectory() // Returns a pointer to a string with a Dolphin data dir or file in the user's home // directory. To be used in "multi-user" mode (that is, installed). -const char *GetUserPath(int DirIDX) +std::string &GetUserPath(int DirIDX) { - static char UserDir[MAX_PATH] = {0}; - static char GCUserDir[MAX_PATH] = {0}; - static char WiiUserDir[MAX_PATH] = {0}; - static char WiiRootDir[MAX_PATH] = {0}; - static char ConfigDir[MAX_PATH] = {0}; - static char GameConfigDir[MAX_PATH] = {0}; - static char MapsDir[MAX_PATH] = {0}; - static char CacheDir[MAX_PATH] = {0}; - static char ShaderCacheDir[MAX_PATH] = {0}; - static char ShadersDir[MAX_PATH] = {0}; - static char StateSavesDir[MAX_PATH] = {0}; - static char ScreenShotsDir[MAX_PATH] = {0}; - static char OpenCLDir[MAX_PATH] = {0}; - static char HiresTexturesDir[MAX_PATH] = {0}; - static char DumpDir[MAX_PATH] = {0}; - static char DumpFramesDir[MAX_PATH] = {0}; - static char DumpAudioDir[MAX_PATH] = {0}; - static char DumpTexturesDir[MAX_PATH] = {0}; - static char DumpDSPDir[MAX_PATH] = {0}; - static char LogsDir[MAX_PATH] = {0}; - static char MailLogsDir[MAX_PATH] = {0}; - static char WiiSYSCONFDir[MAX_PATH] = {0}; - static char DolphinConfig[MAX_PATH] = {0}; - static char DSPConfig[MAX_PATH] = {0}; - static char DebuggerConfig[MAX_PATH] = {0}; - static char LoggerConfig[MAX_PATH] = {0}; - static char MainLog[MAX_PATH] = {0}; - static char WiiSYSCONF[MAX_PATH] = {0}; - static char RamDump[MAX_PATH] = {0}; - static char ARamDump[MAX_PATH] = {0}; - static char GCSRam[MAX_PATH] = {0}; + static std::string UserDir; + static std::string GCUserDir; + static std::string WiiUserDir; + static std::string WiiRootDir; + static std::string ConfigDir; + static std::string GameConfigDir; + static std::string MapsDir; + static std::string CacheDir; + static std::string ShaderCacheDir; + static std::string ShadersDir; + static std::string StateSavesDir; + static std::string ScreenShotsDir; + static std::string OpenCLDir; + static std::string HiresTexturesDir; + static std::string DumpDir; + static std::string DumpFramesDir; + static std::string DumpAudioDir; + static std::string DumpTexturesDir; + static std::string DumpDSPDir; + static std::string LogsDir; + static std::string MailLogsDir; + static std::string WiiSYSCONFDir; + static std::string DolphinConfig; + static std::string DSPConfig; + static std::string DebuggerConfig; + static std::string LoggerConfig; + static std::string MainLog; + static std::string WiiSYSCONF; + static std::string RamDump; + static std::string ARamDump; + static std::string GCSRam; + static std::string Default; // Set up all paths and files on the first run - if (strlen(UserDir) == 0) + if (UserDir.empty()) { #ifdef _WIN32 // Keep the directory setup the way it was on windows - snprintf(UserDir, sizeof(UserDir), ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP); + UserDir = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; #else if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) - snprintf(UserDir, sizeof(UserDir), ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP); + UserDir = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; else - snprintf(UserDir, sizeof(UserDir), "%s" DIR_SEP DOLPHIN_DATA_DIR DIR_SEP, getenv("HOME")); + UserDir = std::string(getenv("HOME")) + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP; #endif - INFO_LOG(COMMON, "GetUserPath: Setting user directory to %s:", UserDir); + INFO_LOG(COMMON, "GetUserPath: Setting user directory to %s:", UserDir.c_str()); - snprintf(GCUserDir, sizeof(GCUserDir), "%s" GC_USER_DIR DIR_SEP, UserDir); - snprintf(WiiUserDir, sizeof(WiiUserDir), "%s" WII_USER_DIR DIR_SEP, UserDir); - snprintf(WiiRootDir, sizeof(WiiRootDir), "%s" WII_USER_DIR, UserDir); - snprintf(ConfigDir, sizeof(ConfigDir), "%s" CONFIG_DIR DIR_SEP, UserDir); - snprintf(GameConfigDir, sizeof(GameConfigDir), "%s" GAMECONFIG_DIR DIR_SEP, UserDir); - snprintf(MapsDir, sizeof(MapsDir), "%s" MAPS_DIR DIR_SEP, UserDir); - snprintf(CacheDir, sizeof(CacheDir), "%s" CACHE_DIR DIR_SEP, UserDir); - snprintf(ShaderCacheDir, sizeof(ShaderCacheDir), "%s" SHADERCACHE_DIR DIR_SEP, UserDir); - snprintf(ShadersDir, sizeof(ShadersDir), "%s" SHADERS_DIR DIR_SEP, UserDir); - snprintf(StateSavesDir, sizeof(StateSavesDir), "%s" STATESAVES_DIR DIR_SEP, UserDir); - snprintf(ScreenShotsDir, sizeof(ScreenShotsDir), "%s" SCREENSHOTS_DIR DIR_SEP, UserDir); - snprintf(OpenCLDir, sizeof(OpenCLDir), "%s" OPENCL_DIR DIR_SEP, UserDir); - snprintf(HiresTexturesDir, sizeof(HiresTexturesDir), "%s" HIRES_TEXTURES_DIR DIR_SEP, UserDir); - snprintf(DumpDir, sizeof(DumpDir), "%s" DUMP_DIR DIR_SEP, UserDir); - snprintf(DumpFramesDir, sizeof(DumpFramesDir), "%s" DUMP_FRAMES_DIR DIR_SEP, UserDir); - snprintf(DumpAudioDir, sizeof(DumpAudioDir), "%s" DUMP_AUDIO_DIR DIR_SEP, UserDir); - snprintf(DumpTexturesDir, sizeof(DumpTexturesDir), "%s" DUMP_TEXTURES_DIR DIR_SEP, UserDir); - snprintf(DumpDSPDir, sizeof(DumpDSPDir), "%s" DUMP_DSP_DIR DIR_SEP, UserDir); - snprintf(LogsDir, sizeof(LogsDir), "%s" LOGS_DIR DIR_SEP, UserDir); - snprintf(MailLogsDir, sizeof(MailLogsDir), "%s" MAIL_LOGS_DIR DIR_SEP, UserDir); - snprintf(WiiSYSCONFDir, sizeof(WiiSYSCONFDir), "%s" WII_SYSCONF_DIR DIR_SEP, UserDir); - snprintf(DolphinConfig, sizeof(DolphinConfig), "%s" DOLPHIN_CONFIG, ConfigDir); - snprintf(DSPConfig, sizeof(DSPConfig), "%s" DSP_CONFIG, ConfigDir); - snprintf(DebuggerConfig, sizeof(DebuggerConfig), "%s" DEBUGGER_CONFIG, ConfigDir); - snprintf(LoggerConfig, sizeof(LoggerConfig), "%s" LOGGER_CONFIG, ConfigDir); - snprintf(MainLog, sizeof(MainLog), "%s" MAIN_LOG, LogsDir); - snprintf(WiiSYSCONF, sizeof(WiiSYSCONF), "%s" WII_SYSCONF, WiiSYSCONFDir); - snprintf(RamDump, sizeof(RamDump), "%s" RAM_DUMP, DumpDir); - snprintf(ARamDump, sizeof(ARamDump), "%s" ARAM_DUMP, DumpDir); - snprintf(GCSRam, sizeof(GCSRam), "%s" GC_SRAM, GCUserDir); + GCUserDir = UserDir + GC_USER_DIR DIR_SEP; + WiiUserDir = UserDir + WII_USER_DIR DIR_SEP; + WiiRootDir = UserDir + WII_USER_DIR; + ConfigDir = UserDir + CONFIG_DIR DIR_SEP; + GameConfigDir = UserDir + GAMECONFIG_DIR DIR_SEP; + MapsDir = UserDir + MAPS_DIR DIR_SEP; + CacheDir = UserDir + CACHE_DIR DIR_SEP; + ShaderCacheDir = UserDir + SHADERCACHE_DIR DIR_SEP; + ShadersDir = UserDir + SHADERS_DIR DIR_SEP; + StateSavesDir = UserDir + STATESAVES_DIR DIR_SEP; + ScreenShotsDir = UserDir + SCREENSHOTS_DIR DIR_SEP; + OpenCLDir = UserDir + OPENCL_DIR DIR_SEP; + HiresTexturesDir = UserDir + HIRES_TEXTURES_DIR DIR_SEP; + DumpDir = UserDir + DUMP_DIR DIR_SEP; + DumpFramesDir = UserDir + DUMP_FRAMES_DIR DIR_SEP; + DumpAudioDir = UserDir + DUMP_AUDIO_DIR DIR_SEP; + DumpTexturesDir = UserDir + DUMP_TEXTURES_DIR DIR_SEP; + DumpDSPDir = UserDir + DUMP_DSP_DIR DIR_SEP; + LogsDir = UserDir + LOGS_DIR DIR_SEP; + MailLogsDir = UserDir + MAIL_LOGS_DIR DIR_SEP; + WiiSYSCONFDir = UserDir + WII_SYSCONF_DIR DIR_SEP; + DolphinConfig = ConfigDir + DOLPHIN_CONFIG; + DSPConfig = ConfigDir + DSP_CONFIG; + DebuggerConfig = ConfigDir + DEBUGGER_CONFIG; + LoggerConfig = ConfigDir + LOGGER_CONFIG; + MainLog = LogsDir + MAIN_LOG; + WiiSYSCONF = WiiSYSCONFDir + WII_SYSCONF; + RamDump = DumpDir + RAM_DUMP; + ARamDump = DumpDir + ARAM_DUMP; + GCSRam = GCUserDir + GC_SRAM; } switch (DirIDX) { @@ -766,7 +769,7 @@ const char *GetUserPath(int DirIDX) case F_GCSRAM_IDX: return GCSRam; default: - return NULL; + return Default; } } diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index ff9277645f..4a960f19bc 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -127,7 +127,7 @@ bool SetCurrentDir(const char *directory); // Returns a pointer to a string with a Dolphin data dir in the user's home // directory. To be used in "multi-user" mode (that is, installed). -const char *GetUserPath(int DirIDX); +std::string &GetUserPath(int DirIDX); // Returns the path to where the sys file are std::string GetSysDirectory(); diff --git a/Source/Core/Common/Src/LogManager.cpp b/Source/Core/Common/Src/LogManager.cpp index a328887209..6332c1c62b 100644 --- a/Source/Core/Common/Src/LogManager.cpp +++ b/Source/Core/Common/Src/LogManager.cpp @@ -84,7 +84,7 @@ LogManager::LogManager() { m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager"); m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); - m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)); + m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); m_consoleLog = new ConsoleListener(); for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { diff --git a/Source/Core/Common/Src/NandPaths.cpp b/Source/Core/Common/Src/NandPaths.cpp index 6264f0ba55..5249df361b 100644 --- a/Source/Core/Common/Src/NandPaths.cpp +++ b/Source/Core/Common/Src/NandPaths.cpp @@ -26,7 +26,8 @@ namespace Common std::string CreateTicketFileName(u64 _titleID) { char TicketFilename[1024]; - sprintf(TicketFilename, "%sticket/%08x/%08x.tik", File::GetUserPath(D_WIIUSER_IDX), (u32)(_titleID >> 32), (u32)_titleID); + sprintf(TicketFilename, "%sticket/%08x/%08x.tik", + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(_titleID >> 32), (u32)_titleID); return TicketFilename; } @@ -34,7 +35,8 @@ std::string CreateTicketFileName(u64 _titleID) std::string CreateTitleDataPath(u64 _titleID) { char path[1024]; - sprintf(path, "%stitle/%08x/%08x/data", File::GetUserPath(D_WIIUSER_IDX), (u32)(_titleID >> 32), (u32)_titleID); + sprintf(path, "%stitle/%08x/%08x/data", + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(_titleID >> 32), (u32)_titleID); return path; } @@ -42,7 +44,8 @@ std::string CreateTitleDataPath(u64 _titleID) std::string CreateTitleContentPath(u64 _titleID) { char ContentPath[1024]; - sprintf(ContentPath, "%stitle/%08x/%08x/content", File::GetUserPath(D_WIIUSER_IDX), (u32)(_titleID >> 32), (u32)_titleID); + sprintf(ContentPath, "%stitle/%08x/%08x/content", + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(_titleID >> 32), (u32)_titleID); return ContentPath; } diff --git a/Source/Core/Common/Src/SDCardUtil.cpp b/Source/Core/Common/Src/SDCardUtil.cpp index 27cfd5b170..4002a51b99 100644 --- a/Source/Core/Common/Src/SDCardUtil.cpp +++ b/Source/Core/Common/Src/SDCardUtil.cpp @@ -186,7 +186,7 @@ static int write_empty(FILE* file, u64 count) return 0; } -bool SDCardCreate(u64 disk_size /*in MB*/, char* filename) +bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename) { int sectors_per_fat; int sectors_per_disk; diff --git a/Source/Core/Common/Src/SDCardUtil.h b/Source/Core/Common/Src/SDCardUtil.h index 6d0077f825..96456bd282 100644 --- a/Source/Core/Common/Src/SDCardUtil.h +++ b/Source/Core/Common/Src/SDCardUtil.h @@ -17,4 +17,4 @@ #include "Common.h" -bool SDCardCreate(u64 disk_size /*in MB*/, char* filename); +bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename); diff --git a/Source/Core/Common/Src/SysConf.cpp b/Source/Core/Common/Src/SysConf.cpp index a1993fc4a3..9c7cd6bad7 100644 --- a/Source/Core/Common/Src/SysConf.cpp +++ b/Source/Core/Common/Src/SysConf.cpp @@ -21,7 +21,7 @@ SysConf::SysConf() : m_IsValid(false) { - if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX))) + if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX).c_str())) m_IsValid = true; } diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index 3c9ae40473..f469cd632c 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -94,7 +94,7 @@ std::string CBoot::GenerateMapFilename() u64 TitleID = Loader.GetTitleID(); char tmpBuffer[32]; sprintf(tmpBuffer, "%08x_%08x", (u32)(TitleID >> 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF ); - return std::string(File::GetUserPath(D_MAPS_IDX)) + std::string(tmpBuffer) + ".map"; + return File::GetUserPath(D_MAPS_IDX) + std::string(tmpBuffer) + ".map"; } break; } @@ -103,7 +103,7 @@ std::string CBoot::GenerateMapFilename() case SCoreStartupParameter::BOOT_DOL: return _StartupPara.m_strFilename.substr(0, _StartupPara.m_strFilename.size()-4) + ".map"; default: - return std::string(File::GetUserPath(D_MAPS_IDX)) + _StartupPara.GetUniqueID() + ".map"; + return File::GetUserPath(D_MAPS_IDX) + _StartupPara.GetUniqueID() + ".map"; } return std::string("unknown map"); diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp index f123425dbc..08bf7f1092 100644 --- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp @@ -46,9 +46,10 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename) char Path[260+1]; u64 TitleID = ContentLoader.GetTitleID(); char* pTitleID = (char*)&TitleID; - sprintf(Path, "%stitle/%02x%02x%02x%02x/%02x%02x%02x%02x/data/nocopy/", File::GetUserPath(D_WIIUSER_IDX), - (u8)pTitleID[7], (u8)pTitleID[6], (u8)pTitleID[5], (u8)pTitleID[4], - (u8)pTitleID[3], (u8)pTitleID[2], (u8)pTitleID[1], (u8)pTitleID[0]); + sprintf(Path, "%stitle/%02x%02x%02x%02x/%02x%02x%02x%02x/data/nocopy/", + File::GetUserPath(D_WIIUSER_IDX).c_str(), + (u8)pTitleID[7], (u8)pTitleID[6], (u8)pTitleID[5], (u8)pTitleID[4], + (u8)pTitleID[3], (u8)pTitleID[2], (u8)pTitleID[1], (u8)pTitleID[0]); File::CreateFullPath(Path); // setup wii mem @@ -100,7 +101,8 @@ bool CBoot::Install_WiiWAD(const char* _pFilename) //copy WAD's tmd header and contents to content directory char ContentPath[260+1]; - sprintf(ContentPath, "%stitle/%08x/%08x/content/", File::GetUserPath(D_WIIUSER_IDX), TitleID_HI, TitleID_LO); + sprintf(ContentPath, "%stitle/%08x/%08x/content/", + File::GetUserPath(D_WIIUSER_IDX).c_str(), TitleID_HI, TitleID_LO); File::CreateFullPath(ContentPath); std::string TMDFileName(ContentPath); @@ -155,11 +157,12 @@ bool CBoot::Install_WiiWAD(const char* _pFilename) //Extract and copy WAD's ticket to ticket directory char TicketPath[260+1]; - sprintf(TicketPath, "%sticket/%08x/", File::GetUserPath(D_WIIUSER_IDX), TitleID_HI); + sprintf(TicketPath, "%sticket/%08x/", File::GetUserPath(D_WIIUSER_IDX).c_str(), TitleID_HI); File::CreateFullPath(TicketPath); char TicketFileName[260+1]; - sprintf(TicketFileName, "%sticket/%08x/%08x.tik", File::GetUserPath(D_WIIUSER_IDX), TitleID_HI, TitleID_LO); + sprintf(TicketFileName, "%sticket/%08x/%08x.tik", + File::GetUserPath(D_WIIUSER_IDX).c_str(), TitleID_HI, TitleID_LO); FILE* pTicketFile = fopen(TicketFileName, "wb"); if (pTicketFile == NULL) { diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index e857ad82ca..21c5b16390 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -84,7 +84,7 @@ bool BootCore(const std::string& _rFilename) // Load game specific settings IniFile game_ini; std::string unique_id = StartUp.GetUniqueID(); - StartUp.m_strGameIni = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + unique_id + ".ini"; + StartUp.m_strGameIni = File::GetUserPath(D_GAMECONFIG_IDX) + unique_id + ".ini"; if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str())) { config_cache.valid = true; diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 4228946239..7c6c14e325 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -124,7 +124,7 @@ SConfig::~SConfig() void SConfig::SaveSettings() { - NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX)); + NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff @@ -239,7 +239,7 @@ void SConfig::SaveSettings() void SConfig::LoadSettings() { - INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX)); + INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); @@ -372,14 +372,14 @@ void SConfig::LoadSettingsWii() { IniFile ini; //Wiimote configs - ini.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str()); + ini.Load((File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini")); for (int i = 0; i < 4; i++) { char SectionName[32]; sprintf(SectionName, "Wiimote%i", i + 1); ini.Get(SectionName, "AutoReconnectRealWiimote", &m_WiiAutoReconnect[i], false); } - ini.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "wiimote.ini").c_str()); + ini.Load((File::GetUserPath(D_CONFIG_IDX) + "wiimote.ini")); ini.Get("Real", "Unpair", &m_WiiAutoUnpair, false); } diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 6f8b0a38df..5fa4565b77 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -497,11 +497,11 @@ static inline std::string GenerateScreenshotName() int index = 1; std::string tempname, name; std::string gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID(); - tempname = std::string(File::GetUserPath(D_SCREENSHOTS_IDX)) + gameId + DIR_SEP_CHR; + tempname = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR; if (!File::CreateFullPath(tempname.c_str())) { //fallback to old-style screenshots, without folder. - tempname = std::string(File::GetUserPath(D_SCREENSHOTS_IDX)); + tempname = File::GetUserPath(D_SCREENSHOTS_IDX); } //append gameId, tempname only contains the folder here. tempname += gameId; diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 986476815f..64b5b283c8 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -327,7 +327,7 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri { // Use default memcard path if there is no user defined name std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB; - memcardPath = std::string(File::GetUserPath(D_GCUSER_IDX)) + defaultFilename + ext; + memcardPath = File::GetUserPath(D_GCUSER_IDX) + defaultFilename + ext; } else { diff --git a/Source/Core/Core/Src/DSP/disassemble.cpp b/Source/Core/Core/Src/DSP/disassemble.cpp index 331f65be64..5020922b0f 100644 --- a/Source/Core/Core/Src/DSP/disassemble.cpp +++ b/Source/Core/Core/Src/DSP/disassemble.cpp @@ -49,9 +49,8 @@ DSPDisassembler::DSPDisassembler(const AssemblerSettings &settings) DSPDisassembler::~DSPDisassembler() { // Some old code for logging unknown ops. - char filename[MAX_PATH]; - sprintf(filename, "%sUnkOps.txt", File::GetUserPath(D_DUMPDSP_IDX)); - FILE *uo = fopen(filename, "w"); + std::string filename = File::GetUserPath(D_DUMPDSP_IDX) + "UnkOps.txt"; + FILE *uo = fopen(filename.c_str(), "w"); if (!uo) return; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp index 09ca95552b..f1ac57b0f1 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp @@ -100,7 +100,7 @@ void CUCode_Rom::BootUCode() #if defined(_DEBUG) || defined(DEBUGFAST) char binFile[MAX_PATH]; - sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX), ector_crc); + sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); FILE* pFile = fopen(binFile, "wb"); if (pFile) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp index 34f8e107ca..86f38d440d 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp @@ -146,7 +146,7 @@ void IUCode::PrepareBootUCode(u32 mail) #if defined(_DEBUG) || defined(DEBUGFAST) char binFile[MAX_PATH]; - sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX), ector_crc); + sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), ector_crc); FILE* pFile = fopen(binFile, "wb"); if (pFile) diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp index fa1e2d4b38..6735049a09 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp @@ -106,20 +106,14 @@ void DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread) m_bDSPThread = bDSPThread; m_InitMixer = false; bool bCanWork = true; - char irom_file[MAX_PATH]; - char coef_file[MAX_PATH]; + std::string irom_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_IROM; + std::string coef_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_COEF; - snprintf(irom_file, MAX_PATH, "%s%s", - File::GetSysDirectory().c_str(), GC_SYS_DIR DIR_SEP DSP_IROM); - if (!File::Exists(irom_file)) - snprintf(irom_file, MAX_PATH, "%s%s", - File::GetUserPath(D_GCUSER_IDX), DIR_SEP DSP_IROM); - snprintf(coef_file, MAX_PATH, "%s%s", - File::GetSysDirectory().c_str(), GC_SYS_DIR DIR_SEP DSP_COEF); - if (!File::Exists(coef_file)) - snprintf(coef_file, MAX_PATH, "%s%s", - File::GetUserPath(D_GCUSER_IDX), DIR_SEP DSP_COEF); - bCanWork = DSPCore_Init(irom_file, coef_file, AudioCommon::UseJIT()); + if (!File::Exists(irom_file.c_str())) + irom_file = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP DSP_IROM; + if (!File::Exists(coef_file.c_str())) + coef_file = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP DSP_COEF; + bCanWork = DSPCore_Init(irom_file.c_str(), coef_file.c_str(), AudioCommon::UseJIT()); g_dsp.cpu_ram = Memory::GetPointer(0); DSPCore_Reset(); diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp index ddead22d43..7847569480 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp @@ -32,8 +32,8 @@ bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc) { char binFile[MAX_PATH]; char txtFile[MAX_PATH]; - sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX), crc); - sprintf(txtFile, "%sDSP_UC_%08X.txt", File::GetUserPath(D_DUMPDSP_IDX), crc); + sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc); + sprintf(txtFile, "%sDSP_UC_%08X.txt", File::GetUserPath(D_DUMPDSP_IDX).c_str(), crc); FILE* pFile = fopen(binFile, "wb"); if (pFile) @@ -70,9 +70,8 @@ bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc) // TODO make this useful :p bool DumpCWCode(u32 _Address, u32 _Length) { - char filename[256]; - sprintf(filename, "%sDSP_UCode.bin", File::GetUserPath(D_DUMPDSP_IDX)); - FILE* pFile = fopen(filename, "wb"); + std::string filename = File::GetUserPath(D_DUMPDSP_IDX) + "DSP_UCode.bin"; + FILE* pFile = fopen(filename.c_str(), "wb"); if (pFile != NULL) { diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index 4cd69d268d..65435f4c6c 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -294,7 +294,7 @@ void Wiimote::WriteData(const wm_write_data* const wd) { // writing the whole mii block each write :/ std::ofstream file; - file.open( (std::string(File::GetUserPath(D_WIIUSER_IDX)) + "mii.bin").c_str(), std::ios::binary | std::ios::out); + file.open((File::GetUserPath(D_WIIUSER_IDX) + "mii.bin").c_str(), std::ios::binary | std::ios::out); file.write((char*)m_eeprom + 0x0FCA, 0x02f0); file.close(); } @@ -427,7 +427,7 @@ void Wiimote::ReadData(const wm_read_data* const rd) { // reading the whole mii block :/ std::ifstream file; - file.open((std::string(File::GetUserPath(D_WIIUSER_IDX)) + "mii.bin").c_str(), std::ios::binary | std::ios::in); + file.open((File::GetUserPath(D_WIIUSER_IDX) + "mii.bin").c_str(), std::ios::binary | std::ios::in); file.read((char*)m_eeprom + 0x0FCA, 0x02f0); file.close(); } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 9a2060e14f..479e4e0a33 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -346,7 +346,7 @@ static int ConnectWiimotes(Wiimote** wm) void LoadSettings() { - std::string ini_filename = (std::string(File::GetUserPath(D_CONFIG_IDX)) + WIIMOTE_INI_NAME ".ini" ); + std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini"; IniFile inifile; inifile.Load(ini_filename); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index ab8348c3f5..b4372c0aa7 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -209,7 +209,7 @@ void CopySettingsFile(std::string& DeviceName) else Source += "setting-eur.txt"; - std::string Target = std::string(File::GetUserPath(D_WIIUSER_IDX)) + DeviceName; + std::string Target = File::GetUserPath(D_WIIUSER_IDX) + DeviceName; // Check if the target dir exists, otherwise create it std::string TargetDir = Target.substr(0, Target.find_last_of(DIR_SEP)); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index 6f7e6d3681..4d737989e0 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -31,7 +31,7 @@ static Common::replace_v replacements; // This is used by several of the FileIO and /dev/fs/ functions std::string HLE_IPC_BuildFilename(const char* _pFilename, int _size) { - std::string path_full = std::string(File::GetUserPath(D_WIIROOT_IDX)); + std::string path_full = File::GetUserPath(D_WIIROOT_IDX); std::string path_wii(_pFilename); if ((path_wii.length() > 0) && (path_wii[1] == '0')) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index 1b3ab64796..040efb6150 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -46,10 +46,9 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode) { // clear tmp folder { - char Path[260]; - snprintf(Path, sizeof(Path), "%stmp", File::GetUserPath(D_WIIUSER_IDX)); - File::DeleteDirRecursively(Path); - File::CreateDir(Path); + std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp"; + File::DeleteDirRecursively(Path.c_str()); + File::CreateDir(Path.c_str()); } // create home directory @@ -66,7 +65,8 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode) if (GameID == 0) GameID = 0xF00DBEEF; if (TitleID == 0) TitleID = 0x00010000; - snprintf(Path, sizeof(Path), "%stitle/%08x/%08x/data/nocopy/", File::GetUserPath(D_WIIUSER_IDX), TitleID, GameID); + snprintf(Path, sizeof(Path), "%stitle/%08x/%08x/data/nocopy/", + File::GetUserPath(D_WIIUSER_IDX).c_str(), TitleID, GameID); File::CreateFullPath(Path); } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 75040d8b90..1aa6035d40 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -60,16 +60,15 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode) { INFO_LOG(WII_IPC_SD, "Open"); - char filename[300]; - sprintf(filename, "%ssd.raw", File::GetUserPath(D_WIIUSER_IDX)); - m_Card = fopen(filename, "r+b"); + std::string filename = File::GetUserPath(D_WIIUSER_IDX) + "sd.raw"; + m_Card = fopen(filename.c_str(), "r+b"); if(!m_Card) { WARN_LOG(WII_IPC_SD, "Failed to open SD Card image, trying to create a new 128MB image..."); - if (SDCardCreate(128, filename)) + if (SDCardCreate(128, filename.c_str())) { - WARN_LOG(WII_IPC_SD, "Successfully created %s", filename); - m_Card = fopen(filename, "r+b"); + WARN_LOG(WII_IPC_SD, "Successfully created %s", filename.c_str()); + m_Card = fopen(filename.c_str(), "r+b"); } if(!m_Card) { diff --git a/Source/Core/Core/Src/PatchEngine.cpp b/Source/Core/Core/Src/PatchEngine.cpp index 1d82d20e1e..e2fb52afbd 100644 --- a/Source/Core/Core/Src/PatchEngine.cpp +++ b/Source/Core/Core/Src/PatchEngine.cpp @@ -154,7 +154,7 @@ int GetSpeedhackCycles(const u32 addr) void LoadPatches(const char *gameID) { IniFile ini; - std::string filename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + gameID + ".ini"; + std::string filename = File::GetUserPath(D_GAMECONFIG_IDX) + gameID + ".ini"; if (ini.Load(filename.c_str())) { LoadPatchSection("OnFrame", onFrame, ini); ActionReplay::LoadCodes(ini, false); diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp index f1f7b7db1a..ff5f9940cd 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp @@ -234,7 +234,7 @@ void PrintInstructionRunCounts() void LogCompiledInstructions() { static int time = 0; - FILE *f = fopen(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX), time).c_str(), "w"); + FILE *f = fopen(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time).c_str(), "w"); for (int i = 0; i < m_numInstructions; i++) { if (m_allInstructions[i]->compileCount > 0) { @@ -242,7 +242,7 @@ void LogCompiledInstructions() } } fclose(f); - f = fopen(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX), time).c_str(), "w"); + f = fopen(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time).c_str(), "w"); for (int i = 0; i < m_numInstructions; i++) { if (m_allInstructions[i]->compileCount == 0) { @@ -251,7 +251,7 @@ void LogCompiledInstructions() } fclose(f); #ifdef OPLOG - f = fopen(StringFromFormat("%s" OP_TO_LOG "_at.txt", File::GetUserPath(D_LOGS_IDX), time).c_str(), "w"); + f = fopen(StringFromFormat("%s" OP_TO_LOG "_at.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time).c_str(), "w"); for (size_t i = 0; i < rsplocations.size(); i++) { fprintf(f, OP_TO_LOG ": %08x\n", rsplocations[i]); } diff --git a/Source/Core/Core/Src/PowerPC/Profiler.cpp b/Source/Core/Core/Src/PowerPC/Profiler.cpp index ba3d334739..7e6f9e6d49 100644 --- a/Source/Core/Core/Src/PowerPC/Profiler.cpp +++ b/Source/Core/Core/Src/PowerPC/Profiler.cpp @@ -38,12 +38,12 @@ struct BlockStat int blockNum; u64 cost; - bool operator <(const BlockStat &other) const { - return cost > other.cost; - } + bool operator <(const BlockStat &other) const + { return cost > other.cost; } }; -void WriteProfileResults(const char *filename) { +void WriteProfileResults(const char *filename) +{ std::vector stats; stats.reserve(jit->GetBlockCache()->GetNumBlocks()); u64 cost_sum = 0; @@ -55,13 +55,14 @@ void WriteProfileResults(const char *filename) { for (int i = 0; i < jit->GetBlockCache()->GetNumBlocks(); i++) { const JitBlock *block = jit->GetBlockCache()->GetBlock(i); - u64 cost = block->originalSize * (block->runCount / 4); // rough heuristic. mem instructions should cost more. + // Rough heuristic. Mem instructions should cost more. + u64 cost = block->originalSize * (block->runCount / 4); #ifdef _WIN32 - u64 timecost = block->ticCounter; // Indeed ;) + u64 timecost = block->ticCounter; #endif - if (block->runCount >= 1) { // Todo: tweak. + // Todo: tweak. + if (block->runCount >= 1) stats.push_back(BlockStat(i, cost)); - } cost_sum += cost; #ifdef _WIN32 timecost_sum += timecost; @@ -70,7 +71,8 @@ void WriteProfileResults(const char *filename) { sort(stats.begin(), stats.end()); FILE *f = fopen(filename, "w"); - if (!f) { + if (!f) + { PanicAlert("failed to open %s", filename); return; } @@ -85,10 +87,12 @@ void WriteProfileResults(const char *filename) { #ifdef _WIN32 double timePercent = 100.0 * (double)block->ticCounter / (double)timecost_sum; fprintf(f, "%08x\t%s\t%llu\t%llu\t%.2lf\t%llf\t%lf\t%i\n", - block->originalAddress, name.c_str(), stats[i].cost, block->ticCounter, percent, timePercent, (double)block->ticCounter*1000.0/(double)countsPerSec, block->codeSize); + block->originalAddress, name.c_str(), stats[i].cost, + block->ticCounter, percent, timePercent, + (double)block->ticCounter*1000.0/(double)countsPerSec, block->codeSize); #else fprintf(f, "%08x\t%s\t%llu\t???\t%.2lf\t???\t???\t%i\n", - block->originalAddress, name.c_str(), stats[i].cost, /*block->ticCounter.QuadPart,*/ percent, /*timePercent, (double)block->ticCounter.QuadPart*1000.0/(double)countsPerSec.QuadPart,*/ block->codeSize); + block->originalAddress, name.c_str(), stats[i].cost, percent, block->codeSize); #endif } } diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 963d7fd537..207fddc7fe 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -181,10 +181,10 @@ void CompressAndDumpState(saveStruct* saveArg) // Moving to last overwritten save-state if (File::Exists(cur_filename.c_str())) { - if (File::Exists((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str())) - File::Delete((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str()); + if (File::Exists((File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav").c_str())) + File::Delete((File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav").c_str()); - if (!File::Rename(cur_filename.c_str(), (std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str())) + if (!File::Rename(cur_filename.c_str(), (File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav").c_str())) Core::DisplayMessage("Failed to move previous state to state undo backup", 1000); } @@ -515,7 +515,7 @@ void State_Shutdown() static std::string MakeStateFilename(int state_number) { - return StringFromFormat("%s%s.s%02i", File::GetUserPath(D_STATESAVES_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), state_number); + return StringFromFormat("%s%s.s%02i", File::GetUserPath(D_STATESAVES_IDX).c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), state_number); } void State_SaveAs(const std::string &filename) @@ -614,7 +614,7 @@ void State_UndoLoadState() // Load the state that the last save state overwritten on void State_UndoSaveState() { - State_LoadAs((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str()); + State_LoadAs((File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav").c_str()); } size_t State_GetSize() diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp index 5464c68df8..a43675ec87 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp @@ -39,7 +39,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume) TitleID = Common::swap64(TitleID); sprintf(Filename, "%stitle/%08x/%08x/data/banner.bin", - File::GetUserPath(D_WIIUSER_IDX), (u32)(TitleID>>32), (u32)TitleID); + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID); if (!File::Exists(Filename)) { @@ -51,13 +51,13 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume) // Creating title folder sprintf(titleFolder, "%stitle/%08x/%08x/data/", - File::GetUserPath(D_WIIUSER_IDX), (u32)(TitleID>>32), (u32)TitleID); + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID); if(!File::Exists(titleFolder)) File::CreateFullPath(titleFolder); // Extracting banner.bin from opening.bnr sprintf(bnrFilename, "%stitle/%08x/%08x/data/opening.bnr", - File::GetUserPath(D_WIIUSER_IDX), (u32)(TitleID>>32), (u32)TitleID); + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID); if(!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) { m_IsValid = false; diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index fef659428e..eb23059c88 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -34,7 +34,7 @@ cUIDsys cUIDsys::m_Instance; CSharedContent::CSharedContent() { lastID = 0; - sprintf(contentMap, "%sshared1/content.map", File::GetUserPath(D_WIIUSER_IDX)); + sprintf(contentMap, "%sshared1/content.map", File::GetUserPath(D_WIIUSER_IDX).c_str()); if (File::Exists(contentMap)) { @@ -62,7 +62,7 @@ std::string CSharedContent::GetFilenameFromSHA1(u8* _pHash) if (memcmp(_pHash, m_Elements[i].SHA1Hash, 20) == 0) { char szFilename[1024]; - sprintf(szFilename, "%sshared1/%c%c%c%c%c%c%c%c.app", File::GetUserPath(D_WIIUSER_IDX), + sprintf(szFilename, "%sshared1/%c%c%c%c%c%c%c%c.app", File::GetUserPath(D_WIIUSER_IDX).c_str(), m_Elements[i].FileName[0], m_Elements[i].FileName[1], m_Elements[i].FileName[2], m_Elements[i].FileName[3], m_Elements[i].FileName[4], m_Elements[i].FileName[5], m_Elements[i].FileName[6], m_Elements[i].FileName[7]); return szFilename; @@ -90,7 +90,7 @@ std::string CSharedContent::AddSharedContent(u8* _pHash) fwrite(&Element, sizeof(SElement), 1, pFile); fclose(pFile); } - sprintf(tempFilename, "%sshared1/%s.app", File::GetUserPath(D_WIIUSER_IDX), c_ID); + sprintf(tempFilename, "%sshared1/%s.app", File::GetUserPath(D_WIIUSER_IDX).c_str(), c_ID); szFilename = tempFilename; lastID++; } @@ -384,7 +384,7 @@ const INANDContentLoader& CNANDContentManager::GetNANDLoader(u64 _titleId) cUIDsys::cUIDsys() { - sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX)); + sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX).c_str()); lastUID = 0x00001000; if (File::Exists(uidSys)) { diff --git a/Source/Core/DolphinWX/Src/CheatsWindow.cpp b/Source/Core/DolphinWX/Src/CheatsWindow.cpp index 634fe4d926..781ea9f3b3 100644 --- a/Source/Core/DolphinWX/Src/CheatsWindow.cpp +++ b/Source/Core/DolphinWX/Src/CheatsWindow.cpp @@ -51,7 +51,7 @@ wxCheatsWindow::wxCheatsWindow(wxWindow* const parent) const DiscIO::IVolume* const vol = VolumeHandler::GetVolume(); if (vol) { - m_gameini_path = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + vol->GetUniqueID() + ".ini"; + m_gameini_path = File::GetUserPath(D_GAMECONFIG_IDX) + vol->GetUniqueID() + ".ini"; m_gameini.Load(m_gameini_path); m_geckocode_panel->LoadCodes(m_gameini); } diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index b7663d10b0..920b779875 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -1169,7 +1169,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA) { std::string filename = std::string(wxFileSelector( _("Choose a file to open"), - wxString::FromUTF8(File::GetUserPath(D_GCUSER_IDX)), + wxString::FromUTF8(File::GetUserPath(D_GCUSER_IDX).c_str()), isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB), wxEmptyString, _("Gamecube Memory Cards (*.raw,*.gcp)") + wxString(wxT("|*.raw;*.gcp"))).mb_str()); diff --git a/Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.cpp b/Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.cpp index d67660a59c..be19919897 100644 --- a/Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.cpp @@ -16,7 +16,6 @@ // http://code.google.com/p/dolphin-emu/ #include "BreakpointDlg.h" -//#include "Host.h" #include "StringUtil.h" #include "PowerPC/PowerPC.h" #include "BreakpointWindow.h" @@ -63,7 +62,6 @@ void BreakPointDlg::OnOK(wxCommandEvent& WXUNUSED(event)) { PowerPC::breakpoints.Add(Address); Parent->NotifyUpdate(); - //Host_UpdateBreakPointView(); Close(); } else diff --git a/Source/Core/DolphinWX/Src/Debugger/BreakpointView.h b/Source/Core/DolphinWX/Src/Debugger/BreakpointView.h index bf1de12c6b..8e454ee58d 100644 --- a/Source/Core/DolphinWX/Src/Debugger/BreakpointView.h +++ b/Source/Core/DolphinWX/Src/Debugger/BreakpointView.h @@ -20,7 +20,6 @@ #include #include "Common.h" -#include "BreakpointWindow.h" class CBreakPointView : public wxListCtrl { diff --git a/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.cpp index 95b73c8c54..7d40e820f2 100644 --- a/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.cpp @@ -15,8 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include - +#include "BreakpointWindow.h" #include "BreakpointView.h" #include "CodeWindow.h" #include "HW/Memmap.h" @@ -99,7 +98,7 @@ private: BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel) EVT_CLOSE(CBreakPointWindow::OnClose) - EVT_LIST_ITEM_SELECTED(ID_BPS, CBreakPointWindow::OnSelectBP) + EVT_LIST_ITEM_SELECTED(wxID_ANY, CBreakPointWindow::OnSelectBP) END_EVENT_TABLE() CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, @@ -108,7 +107,15 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent : wxPanel(parent, id, position, size, style, title) , m_pCodeWindow(_pCodeWindow) { - CreateGUIControls(); + m_mgr.SetManagedWindow(this); + m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); + + m_BreakPointListView = new CBreakPointView(this, wxID_ANY); + + m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top(). + LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false)); + m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane()); + m_mgr.Update(); } CBreakPointWindow::~CBreakPointWindow() @@ -122,19 +129,6 @@ void CBreakPointWindow::OnClose(wxCloseEvent& event) event.Skip(); } -void CBreakPointWindow::CreateGUIControls() -{ - m_mgr.SetManagedWindow(this); - m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); - - m_BreakPointListView = new CBreakPointView(this, ID_BPS); - - m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top(). - LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false)); - m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane()); - m_mgr.Update(); -} - void CBreakPointWindow::NotifyUpdate() { m_BreakPointListView->Update(); diff --git a/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.h b/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.h index 6f061aad01..43c49d717b 100644 --- a/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.h +++ b/Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.h @@ -19,13 +19,11 @@ #define __BREAKPOINTWINDOW_h__ #include +#include #include class CBreakPointView; -class CBreakPointBar; class CCodeWindow; -class wxListEvent; -class IniFile; class CBreakPointWindow : public wxPanel { @@ -53,18 +51,12 @@ public: private: DECLARE_EVENT_TABLE(); - enum - { - ID_BPS = 1002, - }; - wxAuiManager m_mgr; CBreakPointView* m_BreakPointListView; CCodeWindow* m_pCodeWindow; void OnClose(wxCloseEvent& event); void OnSelectBP(wxListEvent& event); - void CreateGUIControls(); }; #endif diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp index 1d0ebc0204..62b7e42944 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp @@ -19,13 +19,6 @@ #include "Common.h" #include -#include -#include -#include -#include -#include -#include -#include #include "Host.h" @@ -72,50 +65,14 @@ extern "C" // Bitmaps BEGIN_EVENT_TABLE(CCodeWindow, wxPanel) // Menu bar - EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnCPUMode) // Options - EVT_MENU(IDM_BOOTTOPAUSE, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont) - - EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // Jit - EVT_MENU(IDM_JITNOBLOCKCACHE, CCodeWindow::OnCPUMode) - - EVT_MENU(IDM_JITOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITIOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode) - EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode) - - EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu) - EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu) - EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu) - - EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu) - EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu) - - EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu) - EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu) + EVT_MENU_RANGE(IDM_INTERPRETER, IDM_JITSROFF, CCodeWindow::OnCPUMode) + EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont) + EVT_MENU_RANGE(IDM_CLEARCODECACHE, IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu) + EVT_MENU_RANGE(IDM_LOADMAPFILE, IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu) + EVT_MENU_RANGE(IDM_PROFILEBLOCKS, IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu) // Toolbar - EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep) - EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep) - EVT_MENU(IDM_TOGGLE_BREAKPOINT, CCodeWindow::OnCodeStep) - EVT_MENU(IDM_SKIP, CCodeWindow::OnCodeStep) - EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep) - EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep) - EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange) + EVT_MENU_RANGE(IDM_STEP, IDM_ADDRBOX, CCodeWindow::OnCodeStep) // Other EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange) @@ -142,7 +99,30 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter { InitBitmaps(); - CreateGUIControls(_LocalCoreStartupParameter); + wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL); + + DebugInterface* di = &PowerPC::debug_interface; + + codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW); + sizerBig->Add(sizerLeft, 2, wxEXPAND); + sizerBig->Add(codeview, 5, wxEXPAND); + + sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST, + wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND); + sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST, + wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND); + sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition, + wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); + sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition, + wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); + + SetSizer(sizerBig); + + sizerLeft->Fit(this); + sizerBig->Fit(this); + + sync_event.Init(); } wxMenuBar *CCodeWindow::GetMenuBar() @@ -376,35 +356,6 @@ void CCodeWindow::UpdateCallstack() callstack->Append(wxString::FromAscii("invalid callstack")); } -void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter) -{ - // Configure the code window - wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL); - - DebugInterface* di = &PowerPC::debug_interface; - - codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW); - sizerBig->Add(sizerLeft, 2, wxEXPAND); - sizerBig->Add(codeview, 5, wxEXPAND); - - sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST, - wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND); - sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST, - wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND); - sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition, - wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); - sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition, - wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); - - SetSizer(sizerBig); - - sizerLeft->Fit(this); - sizerBig->Fit(this); - - sync_event.Init(); -} - // Create CPU Mode menus void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar) diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Src/Debugger/CodeWindow.h index f84cf4f7fe..dd9cc6300e 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeWindow.h +++ b/Source/Core/DolphinWX/Src/Debugger/CodeWindow.h @@ -28,8 +28,8 @@ #include "CoreParameter.h" // GUI global -#include "../../DolphinWX/Src/Globals.h" -#include "../../DolphinWX/Src/Frame.h" +#include "../Globals.h" +#include "../Frame.h" class CFrame; class CRegisterWindow; @@ -145,7 +145,6 @@ class CCodeWindow void UpdateCallstack(); void InitBitmaps(); - void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter); CCodeView* codeview; wxListBox* callstack; diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp index 786475fb29..e0f59f5813 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp @@ -18,16 +18,8 @@ #include "Common.h" #include "CommonPaths.h" -#include -#include -#include -#include -#include -#include -#include #include - -#include "../../DolphinWX/Src/WxUtils.h" +#include #include "Host.h" @@ -165,7 +157,6 @@ void CCodeWindow::CreateMenuSymbols(wxMenuBar *pMenuBar) { wxMenu *pSymbolsMenu = new wxMenu; pSymbolsMenu->Append(IDM_CLEARSYMBOLS, _("&Clear symbols")); - // pSymbolsMenu->Append(IDM_CLEANSYMBOLS, _("&Clean symbols (zz)")); pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _("&Generate symbol map")); pSymbolsMenu->AppendSeparator(); pSymbolsMenu->Append(IDM_LOADMAPFILE, _("&Load symbol map")); @@ -207,8 +198,25 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS); break; case IDM_WRITEPROFILE: - Profiler::WriteProfileResults("profiler.txt"); - WxUtils::Launch("profiler.txt"); + if (jit != NULL) + { + std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt"; + File::CreateFullPath(filename.c_str()); + Profiler::WriteProfileResults(filename.c_str()); + + wxFileType* filetype = NULL; + if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("txt")))) + { + // From extension failed, trying with MIME type now + if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType(_T("text/plain")))) + // MIME type failed, aborting mission + break; + } + wxString OpenCommand; + OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(filename.c_str())); + if(!OpenCommand.IsEmpty()) + wxExecute(OpenCommand, wxEXEC_SYNC); + } break; } } @@ -227,10 +235,6 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) g_symbolDB.Clear(); Host_NotifyMapLoaded(); break; - case IDM_CLEANSYMBOLS: - g_symbolDB.Clear("zz"); - Host_NotifyMapLoaded(); - break; case IDM_SCANFUNCTIONS: { PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB); diff --git a/Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.cpp b/Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.cpp index 373f84bc4a..fa1abb137c 100644 --- a/Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.cpp @@ -253,58 +253,58 @@ void GFXDebuggerPanel::OnPauseAtNextFrameButton(wxCommandEvent& event) void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event) { - char dump_path[MAX_PATH]; - sprintf(dump_path, "%sDebug/%s/", File::GetUserPath(D_DUMP_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); - if (!File::CreateFullPath(dump_path)) + std::string dump_path = File::GetUserPath(D_DUMP_IDX) + "Debug/" + + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID + "/"; + if (!File::CreateFullPath(dump_path.c_str())) return; switch (m_pDumpList->GetSelection()) { case 0: // Pixel Shader - DumpPixelShader(dump_path); + DumpPixelShader(dump_path.c_str()); break; case 1: // Vertex Shader - DumpVertexShader(dump_path); + DumpVertexShader(dump_path.c_str()); break; case 2: // Pixel Shader Constants - DumpPixelShaderConstants(dump_path); + DumpPixelShaderConstants(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 3: // Vertex Shader Constants - DumpVertexShaderConstants(dump_path); + DumpVertexShaderConstants(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 4: // Textures - DumpTextures(dump_path); + DumpTextures(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 5: // Frame Buffer - DumpFrameBuffer(dump_path); + DumpFrameBuffer(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 6: // Geometry - DumpGeometry(dump_path); + DumpGeometry(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 7: // Vertex Description - DumpVertexDecl(dump_path); + DumpVertexDecl(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 8: // Vertex Matrices - DumpMatrices(dump_path); + DumpMatrices(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; case 9: // Statistics - DumpStats(dump_path); + DumpStats(dump_path.c_str()); wxMessageBox(_("Not implemented"), _("Error"), wxOK); break; } diff --git a/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.cpp b/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.cpp index 5720631e26..75573ec58b 100644 --- a/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.cpp @@ -18,8 +18,8 @@ #include "MemoryCheckDlg.h" #include "Common.h" #include "StringUtil.h" -#include "Host.h" #include "PowerPC/PowerPC.h" +#include "BreakpointWindow.h" #define TEXT_BOX(text) new wxStaticText(this, wxID_ANY, wxT(text), wxDefaultPosition, wxDefaultSize) @@ -29,8 +29,9 @@ BEGIN_EVENT_TABLE(MemoryCheckDlg,wxDialog) EVT_BUTTON(wxID_CANCEL, MemoryCheckDlg::OnCancel) END_EVENT_TABLE() -MemoryCheckDlg::MemoryCheckDlg(wxWindow *parent) +MemoryCheckDlg::MemoryCheckDlg(CBreakPointWindow *parent) : wxDialog(parent, wxID_ANY, _("Memory Check"), wxDefaultPosition, wxDefaultSize) + , m_parent(parent) { m_pEditStartAddress = new wxTextCtrl(this, wxID_ANY, wxT("")); m_pEditEndAddress = new wxTextCtrl(this, wxID_ANY, wxT("")); @@ -111,7 +112,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& WXUNUSED(event)) MemCheck.Break = Break; PowerPC::memchecks.Add(MemCheck); - Host_UpdateBreakPointView(); + m_parent->NotifyUpdate(); Close(); } } diff --git a/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.h b/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.h index 556e698886..fd17605618 100644 --- a/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.h +++ b/Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.h @@ -20,12 +20,15 @@ #include +class CBreakPointWindow; + class MemoryCheckDlg : public wxDialog { public: - MemoryCheckDlg(wxWindow *parent); + MemoryCheckDlg(CBreakPointWindow *parent); private: + CBreakPointWindow *m_parent; wxCheckBox* m_pReadFlag; wxCheckBox* m_pWriteFlag; wxCheckBox* m_log_flag; diff --git a/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp index fc5803c3d6..c0c3665c46 100644 --- a/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp @@ -231,7 +231,7 @@ void CMemoryWindow::OnHostMessage(wxCommandEvent& event) // Write mram to file void CMemoryWindow::OnDumpMemory( wxCommandEvent& event ) { - FILE* f = fopen(File::GetUserPath(F_RAMDUMP_IDX), "wb"); + FILE* f = fopen(File::GetUserPath(F_RAMDUMP_IDX).c_str(), "wb"); if (f && Memory::m_pRAM) { fwrite(Memory::m_pRAM, Memory::REALRAM_SIZE, 1, f); @@ -246,7 +246,7 @@ void CMemoryWindow::OnDumpMem2( wxCommandEvent& event ) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { - f = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb"); + f = fopen(File::GetUserPath(F_ARAMDUMP_IDX).c_str(), "wb"); if (f && Memory::m_pEXRAM) { fwrite(Memory::m_pEXRAM, Memory::EXRAM_SIZE, 1, f); @@ -256,7 +256,7 @@ void CMemoryWindow::OnDumpMem2( wxCommandEvent& event ) else { u8* aram = DSP::GetARAMPtr(); - f = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb"); + f = fopen(File::GetUserPath(F_ARAMDUMP_IDX).c_str(), "wb"); if (f && aram) { fwrite(aram, DSP::ARAM_SIZE, 1, f); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 7572c33f70..a5ac44af23 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1632,7 +1632,7 @@ void CFrame::GameListChanged(wxCommandEvent& event) break; case IDM_PURGECACHE: CFileSearch::XStringVector Directories; - Directories.push_back(File::GetUserPath(D_CACHE_IDX)); + Directories.push_back(File::GetUserPath(D_CACHE_IDX).c_str()); CFileSearch::XStringVector Extensions; Extensions.push_back("*.cache"); diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index b4c1de4d21..89ce37af68 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -382,8 +382,7 @@ void CGameListCtrl::OnPaintDrawImages(wxPaintEvent& event) m_imageListSmall->Draw(m_FlagImageIndex[rISOFile.GetCountry()], dc, flagOffset, itemY); - ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + - (rISOFile.GetUniqueID()) + ".ini").c_str()); + ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + rISOFile.GetUniqueID() + ".ini"); ini.Get("EmuState", "EmulationStateId", &nState); m_imageListSmall->Draw(m_EmuStateImageIndex[nState], dc, stateOffset, itemY); @@ -490,8 +489,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index) #ifndef _WIN32 // Load the INI file for columns that read from it IniFile ini; - ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + - (rISOFile.GetUniqueID()) + ".ini").c_str()); + ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + rISOFile.GetUniqueID() + ".ini"); // Emulation status int nState; @@ -780,9 +778,9 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData) case CGameListCtrl::COLUMN_EMULATION_STATE: IniFile ini; int nState1 = 0, nState2 = 0; - std::string GameIni1 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + std::string GameIni1 = File::GetUserPath(D_GAMECONFIG_IDX) + iso1->GetUniqueID() + ".ini"; - std::string GameIni2 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + std::string GameIni2 = File::GetUserPath(D_GAMECONFIG_IDX) + iso2->GetUniqueID() + ".ini"; ini.Load(GameIni1.c_str()); @@ -908,8 +906,7 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event) const GameListItem& rISO = m_ISOFiles[GetItemData(item)]; IniFile ini; - ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + - (rISO.GetUniqueID()) + ".ini").c_str()); + ini.Load(File::GetUserPath(D_GAMECONFIG_IDX) + rISO.GetUniqueID() + ".ini"); // Emulation status std::string emuState[5] = { diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index bbaa9bb9ad..29b6a4c0a2 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -165,7 +165,6 @@ enum // -------------------- // CPU Mode IDM_INTERPRETER, - //IDM_DUALCORE, // not used IDM_AUTOMATICSTART, IDM_BOOTTOPAUSE, IDM_JITNOBLOCKCACHE, IDM_JITBLOCKLINKING, // JIT IDM_JITOFF, @@ -179,14 +178,12 @@ enum // Symbols IDM_CLEARSYMBOLS, - IDM_CLEANSYMBOLS, // not used IDM_SCANFUNCTIONS, IDM_LOADMAPFILE, IDM_SAVEMAPFILE, IDM_SAVEMAPFILEWITHCODES, IDM_CREATESIGNATUREFILE, IDM_RENAME_SYMBOLS, IDM_USESIGNATUREFILE, - //IDM_USESYMBOLFILE, // not used IDM_PATCHHLEFUNCTIONS, // JIT diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index 24679dcf24..7053b449de 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -153,9 +153,9 @@ bool GameListItem::LoadFromCache() void GameListItem::SaveToCache() { - if (!File::IsDirectory(File::GetUserPath(D_CACHE_IDX))) + if (!File::IsDirectory(File::GetUserPath(D_CACHE_IDX).c_str())) { - File::CreateDir(File::GetUserPath(D_CACHE_IDX)); + File::CreateDir(File::GetUserPath(D_CACHE_IDX).c_str()); } CChunkFileReader::Save(CreateCacheFilename(), CACHE_REVISION, *this); @@ -190,7 +190,7 @@ std::string GameListItem::CreateCacheFilename() extension.c_str(), HashFletcher((const u8 *)LegalPathname.c_str(), LegalPathname.size()), File::GetSize(m_FileName.c_str()))); - std::string fullname(std::string(File::GetUserPath(D_CACHE_IDX))); + std::string fullname(File::GetUserPath(D_CACHE_IDX)); fullname += Filename; return fullname; } @@ -229,7 +229,8 @@ const std::string GameListItem::GetWiiFSPath() const Iso->GetTitleID((u8*)&Title); Title = Common::swap64(Title); - sprintf(Path, "%stitle/%08x/%08x/data/", File::GetUserPath(D_WIIUSER_IDX), (u32)(Title>>32), (u32)Title); + sprintf(Path, "%stitle/%08x/%08x/data/", + File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(Title>>32), (u32)Title); if (!File::Exists(Path)) File::CreateFullPath(Path); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index ac78c0b57b..cd080f276b 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -130,7 +130,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW _iniFilename = tmp; } } - GameIniFile = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + _iniFilename + ".ini"; + GameIniFile = File::GetUserPath(D_GAMECONFIG_IDX) + _iniFilename + ".ini"; if (GameIni.Load(GameIniFile.c_str())) LoadGameConfig(); else diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 7b0405718b..8205645045 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -202,7 +202,7 @@ bool DolphinApp::OnInit() #ifdef _WIN32 // Keep the user config dir free unless user wants to save the working dir - if (!File::Exists((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str())) + if (!File::Exists((File::GetUserPath(D_CONFIG_IDX) + "portable").c_str())) { char tmp[1024]; sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(), @@ -216,7 +216,7 @@ bool DolphinApp::OnInit() { if (PanicYesNoT("Dolphin has not been configured with an install location,\nKeep Dolphin portable?")) { - FILE* portable = fopen((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str(), "w"); + FILE* portable = fopen((File::GetUserPath(D_CONFIG_IDX) + "portable").c_str(), "w"); if (!portable) { PanicAlertT("Portable Setting could not be saved\n Are you running Dolphin from read only media or from a directory that dolphin is not located in?"); @@ -264,34 +264,34 @@ bool DolphinApp::OnInit() //create all necessary directories in user directory //TODO : detect the revision and upgrade where necessary File::CopyDir(std::string(SHARED_USER_DIR CONFIG_DIR DIR_SEP).c_str(), - File::GetUserPath(D_CONFIG_IDX)); + File::GetUserPath(D_CONFIG_IDX).c_str()); File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP).c_str(), - File::GetUserPath(D_GAMECONFIG_IDX)); + File::GetUserPath(D_GAMECONFIG_IDX).c_str()); File::CopyDir(std::string(SHARED_USER_DIR MAPS_DIR DIR_SEP).c_str(), - File::GetUserPath(D_MAPS_IDX)); + File::GetUserPath(D_MAPS_IDX).c_str()); File::CopyDir(std::string(SHARED_USER_DIR SHADERS_DIR DIR_SEP).c_str(), - File::GetUserPath(D_SHADERS_IDX)); + File::GetUserPath(D_SHADERS_IDX).c_str()); File::CopyDir(std::string(SHARED_USER_DIR WII_USER_DIR DIR_SEP).c_str(), - File::GetUserPath(D_WIIUSER_IDX)); + File::GetUserPath(D_WIIUSER_IDX).c_str()); File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP).c_str(), - File::GetUserPath(D_OPENCL_IDX)); + File::GetUserPath(D_OPENCL_IDX).c_str()); - if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) - File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX)); - if (!File::Exists(File::GetUserPath(D_CACHE_IDX))) - File::CreateFullPath(File::GetUserPath(D_CACHE_IDX)); - if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX))) - File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX)); - if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX))) - File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX)); - if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX))) - File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX)); - if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX))) - File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX)); - if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX))) - File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX)); - if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX))) - File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX)); + if (!File::Exists(File::GetUserPath(D_GCUSER_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_CACHE_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_CACHE_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX).c_str()); + if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX).c_str())) + File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX).c_str()); #endif LogManager::Init(); @@ -394,7 +394,7 @@ void DolphinApp::InitLanguageSupport() unsigned int language = 0; IniFile ini; - ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); + ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); ini.Get("Interface", "Language", &language, wxLANGUAGE_DEFAULT); // Load language if possible, fall back to system default otherwise diff --git a/Source/Core/DolphinWX/Src/MemcardManager.cpp b/Source/Core/DolphinWX/Src/MemcardManager.cpp index 0ff87310ad..e9dbd594e3 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.cpp +++ b/Source/Core/DolphinWX/Src/MemcardManager.cpp @@ -211,7 +211,7 @@ void CMemcardManager::CreateGUIControls() sPages[slot]->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1); m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, - wxString::From8BitData(File::GetUserPath(D_GCUSER_IDX)), _("Choose a memory card:"), + wxString::From8BitData(File::GetUserPath(D_GCUSER_IDX).c_str()), _("Choose a memory card:"), _("Gamecube Memory Cards (*.raw,*.gcp)") + wxString(wxT("|*.raw;*.gcp")), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350,400), diff --git a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp index 4343742c5b..3b464c59d8 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp @@ -1152,7 +1152,7 @@ bool GCMemcard::Format(bool sjis, bool New, int slot, u16 SizeMb, bool hdrOnly) // Only Format 16MB memcards for now if ((SizeMb != MemCard2043Mb) || (data_size != mc_data_size)) return false; - pStream = fopen(File::GetUserPath(F_GCSRAM_IDX), "rb"); + pStream = fopen(File::GetUserPath(F_GCSRAM_IDX).c_str(), "rb"); if (pStream) { fread(&m_SRAM, 1, 64, pStream); diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp index f59d4821fd..b76573f913 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp @@ -519,7 +519,9 @@ bool CWiiSaveCrypted::getPaths(bool forExport) { if (_saveGameTitle) { - sprintf(pathSavedir, "%stitle/%08x/%08x/data/", File::GetUserPath(D_WIIUSER_IDX), (u32)(_saveGameTitle>>32), (u32)_saveGameTitle); + sprintf(pathSavedir, "%stitle/%08x/%08x/data/", + File::GetUserPath(D_WIIUSER_IDX).c_str(), + (u32)(_saveGameTitle>>32), (u32)_saveGameTitle); sprintf(pathBanner_bin, "%sbanner.bin", pathSavedir); sprintf(_saveGameString, "%c%c%c%c", (u8)(_saveGameTitle >> 24) & 0xFF, (u8)(_saveGameTitle >> 16) & 0xFF, diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index e478a0d04b..cd7be58519 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -43,7 +43,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* , m_game_list(game_list) { IniFile inifile; - inifile.Load(std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini"); + inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini"); IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay"); wxPanel* const panel = new wxPanel(this); @@ -167,7 +167,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* NetPlaySetupDiag::~NetPlaySetupDiag() { IniFile inifile; - const std::string dolphin_ini = std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini"; + const std::string dolphin_ini = File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini"; inifile.Load(dolphin_ini); IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay"); diff --git a/Source/Core/DolphinWX/Src/PHackSettings.cpp b/Source/Core/DolphinWX/Src/PHackSettings.cpp index d1a6fb2200..0f693b4e15 100644 --- a/Source/Core/DolphinWX/Src/PHackSettings.cpp +++ b/Source/Core/DolphinWX/Src/PHackSettings.cpp @@ -31,7 +31,7 @@ CPHackSettings::CPHackSettings(wxWindow* parent, wxWindowID id, const wxString& { CreateGUIControls(); std::string _iniFilename; - _iniFilename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "PH_PRESETS.ini"; + _iniFilename = File::GetUserPath(D_GAMECONFIG_IDX) + "PH_PRESETS.ini"; PHPresetsIni.Load(_iniFilename.c_str()); //PHPresetsIni.SortSections(); //PHPresetsIni.Save(_iniFilename.c_str()); diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index 5e7cc5ec67..15eff72499 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -73,7 +73,7 @@ void VideoConfigDiag::Event_Close(wxCloseEvent& ev) { const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1)); vconfig.GameIniSave((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(), - (std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str()); + (File::GetUserPath(D_GAMECONFIG_IDX) + item->GetUniqueID() + ".ini").c_str()); } EndModal(wxID_OK); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index 4021da2eb6..9907d83d9e 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -156,7 +156,7 @@ void WiimoteConfigPage::RevertSource() void WiimoteConfigDiag::Save(wxCommandEvent&) { - std::string ini_filename = (std::string(File::GetUserPath(D_CONFIG_IDX)) + WIIMOTE_INI_NAME ".ini"); + std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini"; IniFile inifile; inifile.Load(ini_filename); diff --git a/Source/Core/InputCommon/Src/InputConfig.cpp b/Source/Core/InputCommon/Src/InputConfig.cpp index c8813b532c..b9d2a93b99 100644 --- a/Source/Core/InputCommon/Src/InputConfig.cpp +++ b/Source/Core/InputCommon/Src/InputConfig.cpp @@ -29,7 +29,7 @@ InputPlugin::~InputPlugin() bool InputPlugin::LoadConfig() { IniFile inifile; - if (inifile.Load(std::string(File::GetUserPath(D_CONFIG_IDX)) + ini_name + ".ini")) + if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini")) { std::vector< ControllerEmu* >::const_iterator i = controllers.begin(), @@ -53,7 +53,7 @@ bool InputPlugin::LoadConfig() void InputPlugin::SaveConfig() { - std::string ini_filename = (std::string(File::GetUserPath(D_CONFIG_IDX)) + ini_name + ".ini" ); + std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini"; IniFile inifile; inifile.Load(ini_filename); diff --git a/Source/Core/VideoCommon/Src/AVIDump.cpp b/Source/Core/VideoCommon/Src/AVIDump.cpp index 75de09fee9..ac075ecce5 100644 --- a/Source/Core/VideoCommon/Src/AVIDump.cpp +++ b/Source/Core/VideoCommon/Src/AVIDump.cpp @@ -63,7 +63,7 @@ bool AVIDump::CreateFile() m_totalBytes = 0; m_frameCount = 0; char movie_file_name[255]; - sprintf(movie_file_name, "%sframedump%d.avi", File::GetUserPath(D_DUMPFRAMES_IDX), m_fileCount); + sprintf(movie_file_name, "%sframedump%d.avi", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), m_fileCount); // Create path File::CreateFullPath(movie_file_name); @@ -244,7 +244,7 @@ bool AVIDump::CreateFile() s_FormatContext = avformat_alloc_context(); snprintf(s_FormatContext->filename, sizeof(s_FormatContext->filename), "%s", - StringFromFormat("%sframedump0.avi", File::GetUserPath(D_DUMPFRAMES_IDX)).c_str()); + (File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump0.avi").c_str()); File::CreateFullPath(s_FormatContext->filename); if (!(s_FormatContext->oformat = av_guess_format("avi", NULL, NULL)) || diff --git a/Source/Core/VideoCommon/Src/HiresTextures.cpp b/Source/Core/VideoCommon/Src/HiresTextures.cpp index 694150d1ac..76405ded0a 100644 --- a/Source/Core/VideoCommon/Src/HiresTextures.cpp +++ b/Source/Core/VideoCommon/Src/HiresTextures.cpp @@ -36,9 +36,9 @@ void Init(const char *gameCode) textureMap.clear(); CFileSearch::XStringVector Directories; - //Directories.push_back(std::string(File::GetUserPath(D_HIRESTEXTURES_IDX))); + //Directories.push_back(File::GetUserPath(D_HIRESTEXTURES_IDX)); char szDir[MAX_PATH]; - sprintf(szDir,"%s%s",File::GetUserPath(D_HIRESTEXTURES_IDX),gameCode); + sprintf(szDir, "%s%s", File::GetUserPath(D_HIRESTEXTURES_IDX).c_str(), gameCode); Directories.push_back(std::string(szDir)); diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp index 1b695ded15..be98e939ab 100644 --- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp @@ -99,15 +99,15 @@ void TexDecoder_OpenCL_Initialize() cl_device_id *devices = NULL; size_t *binary_sizes = NULL; char **binaries = NULL; - char filename[1024]; + std::string filename; char dolphin_rev[HEADER_SIZE]; - sprintf(filename, "%skernel.bin", File::GetUserPath(D_OPENCL_IDX)); + filename = File::GetUserPath(D_OPENCL_IDX) + "kernel.bin"; snprintf(dolphin_rev, HEADER_SIZE, "%-31s", svn_rev_str); FILE *input = NULL; - input = fopen(filename, "rb"); + input = fopen(filename.c_str(), "rb"); if (input == NULL) { binary_size = 0; @@ -152,10 +152,10 @@ void TexDecoder_OpenCL_Initialize() if (err) { std::string code; - sprintf(filename, "%sTextureDecoder.cl", File::GetUserPath(D_OPENCL_IDX)); - if (!File::ReadFileToString(true, filename, code)) + filename = File::GetUserPath(D_OPENCL_IDX) + "TextureDecoder.cl"; + if (!File::ReadFileToString(true, filename.c_str(), code)) { - ERROR_LOG(VIDEO, "Failed to load OpenCL code %s - file is missing?", filename); + ERROR_LOG(VIDEO, "Failed to load OpenCL code %s - file is missing?", filename.c_str()); return; } @@ -201,9 +201,9 @@ void TexDecoder_OpenCL_Initialize() if (!err) { - sprintf(filename, "%skernel.bin", File::GetUserPath(D_OPENCL_IDX)); + filename = File::GetUserPath(D_OPENCL_IDX) + "kernel.bin"; FILE *output = NULL; - output = fopen(filename, "wb"); + output = fopen(filename.c_str(), "wb"); if (output == NULL) { diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index e8aef15f1c..ce47676437 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -395,14 +395,16 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, if (g_ActiveConfig.bDumpTextures) { char szTemp[MAX_PATH]; - char szDir[MAX_PATH]; + std::string szDir = File::GetUserPath(D_DUMPTEXTURES_IDX) + + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID; // make sure that the directory exists - sprintf(szDir, "%s%s", File::GetUserPath(D_DUMPTEXTURES_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); - if (false == File::Exists(szDir) || false == File::IsDirectory(szDir)) - File::CreateDir(szDir); + if (false == File::Exists(szDir.c_str()) || false == File::IsDirectory(szDir.c_str())) + File::CreateDir(szDir.c_str()); - sprintf(szTemp, "%s/%s_%08x_%i.png", szDir, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (texHash & 0x00000000FFFFFFFFLL), texformat); + sprintf(szTemp, "%s/%s_%08x_%i.png", szDir.c_str(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), + (u32) (texHash & 0x00000000FFFFFFFFLL), texformat); if (false == File::Exists(szTemp)) entry->Save(szTemp); diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp index 84c53b3ebf..a9b50bc6e2 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp @@ -238,7 +238,7 @@ void VertexManager::Flush() //{ // // save the textures // char strfile[255]; - // sprintf(strfile, "%stex%.3d_%d.tga", File::GetUserPath(D_DUMPFRAMES_IDX), g_Config.iSaveTargetId, i); + // sprintf(strfile, "%stex%.3d_%d.tga", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_Config.iSaveTargetId, i); // SaveTexture(strfile, GL_TEXTURE_2D, tentry->texture, tentry->w, tentry->h); //} } @@ -280,10 +280,10 @@ void VertexManager::Flush() { // save the shaders char strfile[255]; - sprintf(strfile, "%sps%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId); + sprintf(strfile, "%sps%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); std::ofstream fps(strfile); fps << ps->strprog.c_str(); - sprintf(strfile, "%svs%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId); + sprintf(strfile, "%svs%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); std::ofstream fvs(strfile); fvs << vs->strprog.c_str(); } @@ -291,7 +291,7 @@ void VertexManager::Flush() if (g_ActiveConfig.iLog & CONF_SAVETARGETS) { char str[128]; - sprintf(str, "%starg%.3d.tga", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId); + sprintf(str, "%starg%.3d.tga", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); TargetRectangle tr; tr.left = 0; tr.right = Renderer::GetTargetWidth(); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp index 2ad9a70faf..40965224a9 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp @@ -325,14 +325,15 @@ void PixelShaderCache::Init() Clear(); - if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX))) - File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX)); + if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX).c_str())) + File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str()); SETSTAT(stats.numPixelShadersCreated, 0); SETSTAT(stats.numPixelShadersAlive, 0); char cache_filename[MAX_PATH]; - sprintf(cache_filename, "%sdx11-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); + sprintf(cache_filename, "%sdx11-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); PixelShaderCacheInserter inserter; g_ps_disk_cache.OpenAndRead(cache_filename, inserter); } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/VertexShaderCache.cpp index 6619852d88..6379f5c208 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/VertexShaderCache.cpp @@ -163,14 +163,15 @@ void VertexShaderCache::Init() for (k = 0;k < 64;k++) vs_constant_offset_table[C_POSTTRANSFORMMATRICES+k] = 696+4*k; for (k = 0;k < 4;k++) vs_constant_offset_table[C_DEPTHPARAMS+k] = 952+4*k; - if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX))) - File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX)); + if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX).c_str())) + File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str()); SETSTAT(stats.numVertexShadersCreated, 0); SETSTAT(stats.numVertexShadersAlive, 0); char cache_filename[MAX_PATH]; - sprintf(cache_filename, "%sdx11-%s-vs.cache", File::GetUserPath(D_SHADERCACHE_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); + sprintf(cache_filename, "%sdx11-%s-vs.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); VertexShaderCacheInserter inserter; g_vs_disk_cache.OpenAndRead(cache_filename, inserter); } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index cac0a429c9..62a7128c3d 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -159,7 +159,7 @@ bool VideoBackend::Initialize(void *&window_handle) frameCount = 0; - g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx11.ini").c_str()); + g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str()); g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); UpdateActiveConfig(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp index 3f8bf95f05..68e412523b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp @@ -269,14 +269,15 @@ void PixelShaderCache::Init() Clear(); - if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX))) - File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX)); + if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX).c_str())) + File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str()); SETSTAT(stats.numPixelShadersCreated, 0); SETSTAT(stats.numPixelShadersAlive, 0); char cache_filename[MAX_PATH]; - sprintf(cache_filename, "%sdx9-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); + sprintf(cache_filename, "%sdx9-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); PixelShaderCacheInserter inserter; g_ps_disk_cache.OpenAndRead(cache_filename, inserter); } @@ -362,7 +363,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components) if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, code); } @@ -376,7 +377,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components) PanicAlert("Failed to compile Pixel Shader:\n\n%s", code); static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, code); } GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 2ba4f1ebc7..e064d4c7ef 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1114,7 +1114,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons else { char msg [255]; - sprintf_s(msg,255, "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", File::GetUserPath(D_DUMPFRAMES_IDX), s_recordWidth, s_recordHeight); + sprintf_s(msg,255, "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), s_recordWidth, s_recordHeight); OSD::AddMessage(msg, 2000); } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp index 2407226593..ca3c394a4c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp @@ -142,7 +142,7 @@ LPDIRECT3DPIXELSHADER9 GetOrCreateEncodingShader(u32 format) if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) { static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, shader); } @@ -554,4 +554,4 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, LPDIRECT3DTEXTURE } // namespace -} // namespace DX9 \ No newline at end of file +} // namespace DX9 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp index b7bf14afef..88b81f2248 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp @@ -140,14 +140,15 @@ void VertexShaderCache::Init() Clear(); delete [] vProg; - if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX))) - File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX)); + if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX).c_str())) + File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str()); SETSTAT(stats.numVertexShadersCreated, 0); SETSTAT(stats.numVertexShadersAlive, 0); char cache_filename[MAX_PATH]; - sprintf(cache_filename, "%sdx9-%s-vs.cache", File::GetUserPath(D_SHADERCACHE_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); + sprintf(cache_filename, "%sdx9-%s-vs.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); VertexShaderCacheInserter inserter; g_vs_disk_cache.OpenAndRead(cache_filename, inserter); } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index e6cc6c3b11..98d2dd0cda 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -139,7 +139,7 @@ bool VideoBackend::Initialize(void *&window_handle) frameCount = 0; - g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); + g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx9.ini").c_str()); g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); // DX9 projection hack could be disabled by commenting out this line UpdateActiveConfig(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp index 29a5c7fb46..32b18b9985 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp @@ -217,7 +217,7 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, code); } @@ -228,7 +228,7 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp ERROR_LOG(VIDEO, "failed to create pixel shader"); static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, code); GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); return NULL; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp index 86b0f12ec9..7442e5d294 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp @@ -48,11 +48,11 @@ void ReloadShader() bool ApplyShader() { - if (s_currentShader != std::string(File::GetUserPath(D_SHADERS_IDX)) + g_ActiveConfig.sPostProcessingShader + ".txt") + if (s_currentShader != File::GetUserPath(D_SHADERS_IDX) + g_ActiveConfig.sPostProcessingShader + ".txt") { // Set immediately to prevent endless recompiles on failure. if (!g_ActiveConfig.sPostProcessingShader.empty()) - s_currentShader = std::string(File::GetUserPath(D_SHADERS_IDX)) + g_ActiveConfig.sPostProcessingShader + ".txt"; + s_currentShader = File::GetUserPath(D_SHADERS_IDX) + g_ActiveConfig.sPostProcessingShader + ".txt"; else s_currentShader.clear(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 0d3c353bb5..ccee1ef777 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1188,7 +1188,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons { OSD::AddMessage(StringFromFormat( "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", - File::GetUserPath(D_DUMPFRAMES_IDX), w, h).c_str(), 2000); + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), w, h).c_str(), 2000); } } if (s_bAVIDumping) @@ -1228,7 +1228,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons if (g_ActiveConfig.bDumpFrames) { s_criticalScreenshot.Enter(); - char movie_file_name[255]; + std::string movie_file_name; w = dst_rect.GetWidth(); h = dst_rect.GetHeight(); data = new u8[3 * w * h]; @@ -1238,14 +1238,14 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons { if (!s_bLastFrameDumped) { - sprintf(movie_file_name, "%sframedump.raw", File::GetUserPath(D_DUMPFRAMES_IDX)); - f_pFrameDump = fopen(movie_file_name, "wb"); + movie_file_name = File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump.raw"; + f_pFrameDump = fopen(movie_file_name.c_str(), "wb"); if (f_pFrameDump == NULL) OSD::AddMessage("Error opening framedump.raw for writing.", 2000); else { char msg [255]; - sprintf(msg, "Dumping Frames to \"%s\" (%dx%d RGB24)", movie_file_name, w, h); + sprintf(msg, "Dumping Frames to \"%s\" (%dx%d RGB24)", movie_file_name.c_str(), w, h); OSD::AddMessage(msg, 2000); } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp index 1270bda015..4a9431a563 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp @@ -336,7 +336,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo if (g_ActiveConfig.bDumpEFBTarget) { static int count = 0; - SaveTexture(StringFromFormat("%sefb_frame_%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX), + SaveTexture(StringFromFormat("%sefb_frame_%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(), count++).c_str(), GL_TEXTURE_2D, texture, realW, realH); } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp index ea945401b6..5035322b13 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp @@ -125,7 +125,7 @@ FRAGMENTSHADER &GetOrCreateEncodingShader(u32 format) if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) { static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, shader); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 67cda00473..a101d6c2d6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -166,7 +166,8 @@ void VertexManager::vFlush() { // save the textures char strfile[255]; - sprintf(strfile, "%stex%.3d_%d.tga", File::GetUserPath(D_DUMPFRAMES_IDX), g_Config.iSaveTargetId, i); + sprintf(strfile, "%stex%.3d_%d.tga", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_Config.iSaveTargetId, i); tentry->Save(strfile); } } @@ -245,10 +246,10 @@ void VertexManager::vFlush() { // save the shaders char strfile[255]; - sprintf(strfile, "%sps%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId); + sprintf(strfile, "%sps%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); std::ofstream fps(strfile); fps << ps->strprog.c_str(); - sprintf(strfile, "%svs%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId); + sprintf(strfile, "%svs%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); std::ofstream fvs(strfile); fvs << vs->strprog.c_str(); } @@ -256,7 +257,7 @@ void VertexManager::vFlush() if (g_ActiveConfig.iLog & CONF_SAVETARGETS) { char str[128]; - sprintf(str, "%starg%.3d.tga", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId); + sprintf(str, "%starg%.3d.tga", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); TargetRectangle tr; tr.left = 0; tr.right = Renderer::GetTargetWidth(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp index 9924508f40..68e430be50 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp @@ -107,7 +107,7 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components) if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { static int counter = 0; char szTemp[MAX_PATH]; - sprintf(szTemp, "%svs_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++); + sprintf(szTemp, "%svs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); SaveData(szTemp, code); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 01989efc94..ca014dbb76 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -108,10 +108,10 @@ std::string VideoBackend::GetName() void GetShaders(std::vector &shaders) { shaders.clear(); - if (File::IsDirectory(File::GetUserPath(D_SHADERS_IDX))) + if (File::IsDirectory(File::GetUserPath(D_SHADERS_IDX).c_str())) { File::FSTEntry entry; - File::ScanDirectoryTree(File::GetUserPath(D_SHADERS_IDX), entry); + File::ScanDirectoryTree(File::GetUserPath(D_SHADERS_IDX).c_str(), entry); for (u32 i = 0; i < entry.children.size(); i++) { std::string name = entry.children[i].virtualName.c_str(); @@ -122,7 +122,7 @@ void GetShaders(std::vector &shaders) } else { - File::CreateDir(File::GetUserPath(D_SHADERS_IDX)); + File::CreateDir(File::GetUserPath(D_SHADERS_IDX).c_str()); } } @@ -163,7 +163,7 @@ bool VideoBackend::Initialize(void *&window_handle) frameCount = 0; - g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); + g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini").c_str()); g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); g_Config.UpdateProjectionHack(); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp index 98458c954c..bb04b4d3dc 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp @@ -113,7 +113,9 @@ void DumpActiveTextures() s32 maxLod = GetMaxTextureLod(texmap); for (s32 mip = 0; mip <= maxLod; ++mip) { - SaveTexture(StringFromFormat("%star%i_ind%i_map%i_mip%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX), swstats.thisFrame.numDrawnObjects, stageNum, texmap, mip).c_str(), texmap, mip); + SaveTexture(StringFromFormat("%star%i_ind%i_map%i_mip%i.tga", + File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(), + swstats.thisFrame.numDrawnObjects, stageNum, texmap, mip).c_str(), texmap, mip); } } @@ -128,7 +130,9 @@ void DumpActiveTextures() s32 maxLod = GetMaxTextureLod(texmap); for (s32 mip = 0; mip <= maxLod; ++mip) { - SaveTexture(StringFromFormat("%star%i_stage%i_map%i_mip%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX), swstats.thisFrame.numDrawnObjects, stageNum, texmap, mip).c_str(), texmap, mip); + SaveTexture(StringFromFormat("%star%i_stage%i_map%i_mip%i.tga", + File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(), + swstats.thisFrame.numDrawnObjects, stageNum, texmap, mip).c_str(), texmap, mip); } } } @@ -231,7 +235,9 @@ void OnObjectEnd() if (!g_bSkipCurrentFrame) { if (g_SWVideoConfig.bDumpObjects && swstats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && swstats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd) - DumpEfb(StringFromFormat("%sobject%i.tga", File::GetUserPath(D_DUMPFRAMES_IDX), swstats.thisFrame.numDrawnObjects).c_str()); + DumpEfb(StringFromFormat("%sobject%i.tga", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), + swstats.thisFrame.numDrawnObjects).c_str()); if (g_SWVideoConfig.bHwRasterizer || drawingHwTriangles) { @@ -244,9 +250,11 @@ void OnObjectEnd() if (DrawnToBuffer[i]) { DrawnToBuffer[i] = false; - (void)SaveTGA(StringFromFormat("%sobject%i_%s(%i).tga", File::GetUserPath(D_DUMPFRAMES_IDX), - swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]).c_str(), EFB_WIDTH, EFB_HEIGHT, ObjectBuffer[i]); - memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i])); + (void)SaveTGA(StringFromFormat("%sobject%i_%s(%i).tga", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), + swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]).c_str(), + EFB_WIDTH, EFB_HEIGHT, ObjectBuffer[i]); + memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i])); } } @@ -260,8 +268,10 @@ void OnFrameEnd() { if (g_SWVideoConfig.bDumpFrames) { - DumpEfb(StringFromFormat("%sframe%i_color.tga", File::GetUserPath(D_DUMPFRAMES_IDX), swstats.frameCount).c_str()); - DumpDepth(StringFromFormat("%sframe%i_depth.tga", File::GetUserPath(D_DUMPFRAMES_IDX), swstats.frameCount).c_str()); + DumpEfb(StringFromFormat("%sframe%i_color.tga", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount).c_str()); + DumpDepth(StringFromFormat("%sframe%i_depth.tga", + File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount).c_str()); } } } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index 52d080b9a9..01ac209e3b 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -65,7 +65,7 @@ void VideoBackend::ShowConfig(void *_hParent) bool VideoBackend::Initialize(void *&window_handle) { - g_SWVideoConfig.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_software.ini").c_str()); + g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); if (!OpenGL_Create(window_handle)) {