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
This commit is contained in:
Glenn Rice 2011-02-28 20:40:15 +00:00
parent 1b8f476024
commit ba54fac9eb
82 changed files with 408 additions and 449 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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");

View File

@ -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) {

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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();

View File

@ -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)
{

View File

@ -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();
}

View File

@ -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);

View File

@ -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));

View File

@ -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'))

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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]);
}

View File

@ -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<BlockStat> 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
}
}

View File

@ -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()

View File

@ -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;

View File

@ -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))
{

View File

@ -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);
}

View File

@ -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());

View File

@ -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

View File

@ -20,7 +20,6 @@
#include <wx/listctrl.h>
#include "Common.h"
#include "BreakpointWindow.h"
class CBreakPointView : public wxListCtrl
{

View File

@ -15,8 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <wx/imaglist.h>
#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();

View File

@ -19,13 +19,11 @@
#define __BREAKPOINTWINDOW_h__
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <wx/aui/aui.h>
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

View File

@ -19,13 +19,6 @@
#include "Common.h"
#include <wx/wx.h>
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/textdlg.h>
#include <wx/listctrl.h>
#include <wx/thread.h>
#include <wx/mstream.h>
#include <wx/tipwin.h>
#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)

View File

@ -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;

View File

@ -18,16 +18,8 @@
#include "Common.h"
#include "CommonPaths.h"
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/textdlg.h>
#include <wx/listctrl.h>
#include <wx/thread.h>
#include <wx/mstream.h>
#include <wx/tipwin.h>
#include <wx/fontdlg.h>
#include "../../DolphinWX/Src/WxUtils.h"
#include <wx/mimetype.h>
#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);

View File

@ -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;
}

View File

@ -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();
}
}

View File

@ -20,12 +20,15 @@
#include <wx/wx.h>
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;

View File

@ -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);

View File

@ -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");

View File

@ -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] = {

View File

@ -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

View File

@ -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<GameListItem>(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);

View File

@ -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

View File

@ -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

View File

@ -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),

View File

@ -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);

View File

@ -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,

View File

@ -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");

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)) ||

View File

@ -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));

View File

@ -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)
{

View File

@ -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);

View File

@ -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();

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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
} // namespace DX9

View File

@ -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);
}

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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();

View File

@ -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);
}

View File

@ -108,10 +108,10 @@ std::string VideoBackend::GetName()
void GetShaders(std::vector<std::string> &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<std::string> &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();

View File

@ -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());
}
}
}

View File

@ -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))
{