summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorGlenn Rice <glennricster@gmail.com>2011-02-28 20:40:15 +0000
committerGlenn Rice <glennricster@gmail.com>2011-02-28 20:40:15 +0000
commitba54fac9eb74be6f73e20e2de953cf6f355be57f (patch)
treeee496d869da4f8a7026b94991fe33f560cb9851a /Source/Core/VideoCommon
parent1b8f4760247934e3bac649d45a887d304b5eb724 (diff)
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
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/AVIDump.cpp4
-rw-r--r--Source/Core/VideoCommon/Src/HiresTextures.cpp4
-rw-r--r--Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp16
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.cpp12
-rw-r--r--Source/Core/VideoCommon/Src/VertexManagerBase.cpp8
5 files changed, 23 insertions, 21 deletions
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();