mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
More conversion from char * to std::string.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7266 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -57,7 +57,7 @@ namespace AudioCommon
|
||||
if (ac_Config.m_DumpAudio)
|
||||
{
|
||||
std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav";
|
||||
File::CreateFullPath(audio_file_name.c_str());
|
||||
File::CreateFullPath(audio_file_name);
|
||||
mixer->StartLogAudio(audio_file_name.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -185,11 +185,11 @@ public:
|
||||
{
|
||||
INFO_LOG(COMMON, "ChunkReader: Loading %s" , _rFilename.c_str());
|
||||
|
||||
if (! File::Exists(_rFilename.c_str()))
|
||||
if (!File::Exists(_rFilename))
|
||||
return false;
|
||||
|
||||
// Check file size
|
||||
u64 fileSize = File::GetSize(_rFilename.c_str());
|
||||
u64 fileSize = File::GetSize(_rFilename);
|
||||
u64 headerSize = sizeof(SChunkHeader);
|
||||
if (fileSize < headerSize) {
|
||||
ERROR_LOG(COMMON,"ChunkReader: File too small");
|
||||
|
||||
+180
-282
File diff suppressed because it is too large
Load Diff
@@ -57,6 +57,7 @@ enum {
|
||||
F_RAMDUMP_IDX,
|
||||
F_ARAMDUMP_IDX,
|
||||
F_GCSRAM_IDX,
|
||||
NUM_PATH_INDICES
|
||||
};
|
||||
|
||||
namespace File
|
||||
@@ -73,13 +74,13 @@ struct FSTEntry
|
||||
};
|
||||
|
||||
// Returns true if file filename exists
|
||||
bool Exists(const char *filename);
|
||||
bool Exists(const std::string filename);
|
||||
|
||||
// Returns true if filename is a directory
|
||||
bool IsDirectory(const char *filename);
|
||||
bool IsDirectory(const std::string filename);
|
||||
|
||||
// Returns the size of filename (64bit)
|
||||
u64 GetSize(const char *filename);
|
||||
u64 GetSize(const std::string filename);
|
||||
|
||||
// Overloaded GetSize, accepts file descriptor
|
||||
u64 GetSize(const int fd);
|
||||
@@ -88,46 +89,46 @@ u64 GetSize(const int fd);
|
||||
u64 GetSize(FILE *f);
|
||||
|
||||
// Returns true if successful, or path already exists.
|
||||
bool CreateDir(const char *filename);
|
||||
bool CreateDir(const std::string filename);
|
||||
|
||||
// Creates the full path of fullPath returns true on success
|
||||
bool CreateFullPath(const char *fullPath);
|
||||
bool CreateFullPath(const std::string fullPath);
|
||||
|
||||
// Deletes a given filename, return true on success
|
||||
// Doesn't supports deleting a directory
|
||||
bool Delete(const char *filename);
|
||||
bool Delete(const std::string filename);
|
||||
|
||||
// Deletes a directory filename, returns true on success
|
||||
bool DeleteDir(const char *filename);
|
||||
bool DeleteDir(const std::string filename);
|
||||
|
||||
// renames file srcFilename to destFilename, returns true on success
|
||||
bool Rename(const char *srcFilename, const char *destFilename);
|
||||
bool Rename(const std::string srcFilename, const std::string destFilename);
|
||||
|
||||
// copies file srcFilename to destFilename, returns true on success
|
||||
bool Copy(const char *srcFilename, const char *destFilename);
|
||||
bool Copy(const std::string srcFilename, const std::string destFilename);
|
||||
|
||||
// creates an empty file filename, returns true on success
|
||||
bool CreateEmptyFile(const char *filename);
|
||||
bool CreateEmptyFile(const std::string filename);
|
||||
|
||||
// Scans the directory tree gets, starting from _Directory and adds the
|
||||
// results into parentEntry. Returns the number of files+directories found
|
||||
u32 ScanDirectoryTree(const char *directory, FSTEntry& parentEntry);
|
||||
u32 ScanDirectoryTree(const std::string directory, FSTEntry& parentEntry);
|
||||
|
||||
// deletes the given directory and anything under it. Returns true on success.
|
||||
bool DeleteDirRecursively(const char *directory);
|
||||
bool DeleteDirRecursively(const std::string directory);
|
||||
|
||||
// Returns the current directory
|
||||
std::string GetCurrentDir();
|
||||
|
||||
// Create directory and copy contents (does not overwrite existing files)
|
||||
void CopyDir(const char *source_path, const char *dest_path);
|
||||
void CopyDir(const std::string source_path, const std::string dest_path);
|
||||
|
||||
// Set the current directory to given directory
|
||||
bool SetCurrentDir(const char *directory);
|
||||
bool SetCurrentDir(const std::string 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).
|
||||
std::string &GetUserPath(int DirIDX);
|
||||
std::string &GetUserPath(const unsigned int DirIDX);
|
||||
|
||||
// Returns the path to where the sys file are
|
||||
std::string GetSysDirectory();
|
||||
|
||||
@@ -54,7 +54,7 @@ bool CheckTitleTMD(u64 _titleID)
|
||||
{
|
||||
std::string TitlePath;
|
||||
TitlePath = CreateTitleContentPath(_titleID) + "/title.tmd";
|
||||
if (File::Exists(TitlePath.c_str()))
|
||||
if (File::Exists(TitlePath))
|
||||
{
|
||||
FILE* pTMDFile = fopen(TitlePath.c_str(), "rb");
|
||||
if(pTMDFile)
|
||||
@@ -74,7 +74,7 @@ bool CheckTitleTMD(u64 _titleID)
|
||||
bool CheckTitleTIK(u64 _titleID)
|
||||
{
|
||||
std::string TikPath = Common::CreateTicketFileName(_titleID);
|
||||
if (File::Exists(TikPath.c_str()))
|
||||
if (File::Exists(TikPath))
|
||||
{
|
||||
FILE* pTIKFile = fopen(TikPath.c_str(), "rb");
|
||||
if(pTIKFile)
|
||||
@@ -112,7 +112,7 @@ void ReadReplacements(replace_v& replacements)
|
||||
std::string filename(File::GetUserPath(D_WIIROOT_IDX));
|
||||
filename += replace_fname;
|
||||
|
||||
if (!File::Exists(filename.c_str()))
|
||||
if (!File::Exists(filename))
|
||||
CreateReplacementFile(filename);
|
||||
|
||||
std::ifstream f(filename.c_str());
|
||||
|
||||
@@ -288,7 +288,7 @@ bool CBoot::BootUp()
|
||||
// ELF
|
||||
case SCoreStartupParameter::BOOT_ELF:
|
||||
{
|
||||
if(!File::Exists(_StartupPara.m_strFilename.c_str()))
|
||||
if(!File::Exists(_StartupPara.m_strFilename))
|
||||
{
|
||||
PanicAlertT("The file you specified (%s) does not exist",
|
||||
_StartupPara.m_strFilename.c_str());
|
||||
|
||||
@@ -499,7 +499,8 @@ static inline std::string GenerateScreenshotName()
|
||||
std::string gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID();
|
||||
tempname = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
|
||||
|
||||
if (!File::CreateFullPath(tempname.c_str())) {
|
||||
if (!File::CreateFullPath(tempname))
|
||||
{
|
||||
//fallback to old-style screenshots, without folder.
|
||||
tempname = File::GetUserPath(D_SCREENSHOTS_IDX);
|
||||
}
|
||||
@@ -508,7 +509,7 @@ static inline std::string GenerateScreenshotName()
|
||||
|
||||
do
|
||||
name = StringFromFormat("%s-%d.png", tempname.c_str(), index++);
|
||||
while (File::Exists(name.c_str()));
|
||||
while (File::Exists(name));
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||
bool bootDrive = cdio_is_cdrom(m_strFilename);
|
||||
// Check if the file exist, we may have gotten it from a --elf command line
|
||||
// that gave an incorrect file name
|
||||
if (!bootDrive && !File::Exists(m_strFilename.c_str()))
|
||||
if (!bootDrive && !File::Exists(m_strFilename))
|
||||
{
|
||||
PanicAlertT("The specified file \"%s\" does not exist", m_strFilename.c_str());
|
||||
return false;
|
||||
@@ -304,7 +304,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||
m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL;
|
||||
if (!bHLE_BS2)
|
||||
{
|
||||
if (!File::Exists(m_strBootROM.c_str()))
|
||||
if (!File::Exists(m_strBootROM))
|
||||
{
|
||||
WARN_LOG(BOOT, "bootrom file %s not found - using HLE.", m_strBootROM.c_str());
|
||||
bHLE_BS2 = true;
|
||||
@@ -340,7 +340,7 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri
|
||||
if (!hasregion)
|
||||
{
|
||||
// filename doesn't have region in the extension
|
||||
if (File::Exists(filename.c_str()))
|
||||
if (File::Exists(filename))
|
||||
{
|
||||
// If the old file exists we are polite and ask if we should copy it
|
||||
std::string oldFilename = filename;
|
||||
@@ -352,7 +352,7 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri
|
||||
"Would you like to copy the old file to this new location?\n",
|
||||
isSlotA ? 'A':'B', isSlotA ? 'A':'B', filename.c_str()))
|
||||
{
|
||||
if (!File::Copy(oldFilename.c_str(), filename.c_str()))
|
||||
if (!File::Copy(oldFilename, filename))
|
||||
PanicAlertT("Copy failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,9 @@ void DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
|
||||
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;
|
||||
|
||||
if (!File::Exists(irom_file.c_str()))
|
||||
if (!File::Exists(irom_file))
|
||||
irom_file = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP DSP_IROM;
|
||||
if (!File::Exists(coef_file.c_str()))
|
||||
if (!File::Exists(coef_file))
|
||||
coef_file = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP DSP_COEF;
|
||||
bCanWork = DSPCore_Init(irom_file.c_str(), coef_file.c_str(), AudioCommon::UseJIT());
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ void innerFlush(flushStruct* data)
|
||||
{
|
||||
std::string dir;
|
||||
SplitPath(data->filename, &dir, 0, 0);
|
||||
if(!File::IsDirectory(dir.c_str()))
|
||||
File::CreateFullPath(dir.c_str());
|
||||
if(!File::IsDirectory(dir))
|
||||
File::CreateFullPath(dir);
|
||||
pFile = fopen(data->filename.c_str(), "wb");
|
||||
}
|
||||
|
||||
|
||||
@@ -213,10 +213,10 @@ void CopySettingsFile(std::string& DeviceName)
|
||||
|
||||
// Check if the target dir exists, otherwise create it
|
||||
std::string TargetDir = Target.substr(0, Target.find_last_of(DIR_SEP));
|
||||
if (!File::IsDirectory(TargetDir.c_str()))
|
||||
File::CreateFullPath(Target.c_str());
|
||||
if (!File::IsDirectory(TargetDir))
|
||||
File::CreateFullPath(Target);
|
||||
|
||||
if (File::Copy(Source.c_str(), Target.c_str()))
|
||||
if (File::Copy(Source, Target))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: Copied %s to %s", Source.c_str(), Target.c_str());
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ bool CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode)
|
||||
|
||||
// The file must exist before we can open it
|
||||
// It should be created by ISFS_CreateFile, not here
|
||||
if(File::Exists(m_Filename.c_str()))
|
||||
if(File::Exists(m_Filename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FileIO: Open %s (%s)", m_Name.c_str(), Modes[_Mode]);
|
||||
switch(_Mode)
|
||||
|
||||
@@ -445,11 +445,11 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
||||
std::string TicketFilename = Common::CreateTicketFileName(TitleID);
|
||||
|
||||
u32 ViewCount = 0;
|
||||
if (File::Exists(TicketFilename.c_str()))
|
||||
if (File::Exists(TicketFilename))
|
||||
{
|
||||
const u32 SIZE_OF_ONE_TICKET = 676;
|
||||
|
||||
u32 FileSize = (u32)(File::GetSize(TicketFilename.c_str()));
|
||||
u32 FileSize = (u32)(File::GetSize(TicketFilename));
|
||||
_dbg_assert_msg_(WII_IPC_ES, (FileSize % SIZE_OF_ONE_TICKET) == 0, "IOCTL_ES_GETVIEWCNT ticket file size seems to be wrong");
|
||||
|
||||
ViewCount = FileSize / SIZE_OF_ONE_TICKET;
|
||||
@@ -481,7 +481,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
||||
u32 maxViews = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
|
||||
|
||||
std::string TicketFilename = Common::CreateTicketFileName(TitleID);
|
||||
if (File::Exists(TicketFilename.c_str()))
|
||||
if (File::Exists(TicketFilename))
|
||||
{
|
||||
const u32 SIZE_OF_ONE_TICKET = 676;
|
||||
FILE* pFile = fopen(TicketFilename.c_str(), "rb");
|
||||
@@ -807,9 +807,9 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
|
||||
dataPath = Common::CreateTitleDataPath(tmdTitleID) + DIR_SEP;
|
||||
tmdPath = contentPath + "/title.tmd";
|
||||
|
||||
File::CreateFullPath(contentPath.c_str());
|
||||
File::CreateFullPath(dataPath.c_str());
|
||||
if(!File::Exists(tmdPath.c_str()))
|
||||
File::CreateFullPath(contentPath);
|
||||
File::CreateFullPath(dataPath);
|
||||
if(!File::Exists(tmdPath))
|
||||
{
|
||||
FILE* _pTMDFile = fopen(tmdPath.c_str(), "wb");
|
||||
if (_pTMDFile)
|
||||
|
||||
@@ -47,7 +47,7 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
|
||||
// clear tmp folder
|
||||
{
|
||||
std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp";
|
||||
File::DeleteDirRecursively(Path.c_str());
|
||||
File::DeleteDirRecursively(Path);
|
||||
File::CreateDir(Path.c_str());
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: IOCTL_READ_DIR %s", DirName.c_str());
|
||||
|
||||
if (!File::Exists(DirName.c_str()))
|
||||
if (!File::Exists(DirName))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "FS: Search not found: %s", DirName.c_str());
|
||||
ReturnValue = FS_DIRFILE_NOT_FOUND;
|
||||
@@ -133,7 +133,7 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
}
|
||||
|
||||
// AyuanX: what if we return "found one successfully" if it is a file?
|
||||
else if (!File::IsDirectory(DirName.c_str()))
|
||||
else if (!File::IsDirectory(DirName))
|
||||
{
|
||||
// It's not a directory, so error.
|
||||
// Games don't usually seem to care WHICH error they get, as long as it's <0
|
||||
@@ -214,10 +214,10 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
u32 iNodes = 0;
|
||||
|
||||
INFO_LOG(WII_IPC_FILEIO, "IOCTL_GETUSAGE %s", path.c_str());
|
||||
if (File::IsDirectory(path.c_str()))
|
||||
if (File::IsDirectory(path))
|
||||
{
|
||||
File::FSTEntry parentDir;
|
||||
iNodes = File::ScanDirectoryTree(path.c_str(), parentDir);
|
||||
iNodes = File::ScanDirectoryTree(path, parentDir);
|
||||
|
||||
u64 totalSize = ComputeTotalFileSize(parentDir); // "Real" size, to be converted to nand blocks
|
||||
|
||||
@@ -315,8 +315,8 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s, OwnerID %#x, GroupID %#x, Attributes %#x", DirName.c_str(), OwnerID, GroupID, Attribs);
|
||||
|
||||
DirName += DIR_SEP;
|
||||
File::CreateFullPath(DirName.c_str());
|
||||
_dbg_assert_msg_(WII_IPC_FILEIO, File::IsDirectory(DirName.c_str()), "FS: CREATE_DIR %s failed", DirName.c_str());
|
||||
File::CreateFullPath(DirName);
|
||||
_dbg_assert_msg_(WII_IPC_FILEIO, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed", DirName.c_str());
|
||||
|
||||
return FS_RESULT_OK;
|
||||
}
|
||||
@@ -359,13 +359,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
u8 GroupPerm = 0x3; // read/write
|
||||
u8 OtherPerm = 0x3; // read/write
|
||||
u8 Attributes = 0x00; // no attributes
|
||||
if (File::IsDirectory(Filename.c_str()))
|
||||
if (File::IsDirectory(Filename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set", Filename.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File::Exists(Filename.c_str()))
|
||||
if (File::Exists(Filename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR %s - all permission flags are set", Filename.c_str());
|
||||
}
|
||||
@@ -401,11 +401,11 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
|
||||
std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn+Offset), 64);
|
||||
Offset += 64;
|
||||
if (File::Delete(Filename.c_str()))
|
||||
if (File::Delete(Filename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: DeleteFile %s", Filename.c_str());
|
||||
}
|
||||
else if (File::DeleteDir(Filename.c_str()))
|
||||
else if (File::DeleteDir(Filename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: DeleteDir %s", Filename.c_str());
|
||||
}
|
||||
@@ -430,16 +430,16 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
Offset += 64;
|
||||
|
||||
// try to make the basis directory
|
||||
File::CreateFullPath(FilenameRename.c_str());
|
||||
File::CreateFullPath(FilenameRename);
|
||||
|
||||
// if there is already a file, delete it
|
||||
if (File::Exists(FilenameRename.c_str()))
|
||||
if (File::Exists(FilenameRename))
|
||||
{
|
||||
File::Delete(FilenameRename.c_str());
|
||||
File::Delete(FilenameRename);
|
||||
}
|
||||
|
||||
// finally try to rename the file
|
||||
if (File::Rename(Filename.c_str(), FilenameRename.c_str()))
|
||||
if (File::Rename(Filename, FilenameRename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
|
||||
}
|
||||
@@ -475,15 +475,15 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
DEBUG_LOG(WII_IPC_FILEIO, " Attributes: 0x%02x", Attributes);
|
||||
|
||||
// check if the file already exist
|
||||
if (File::Exists(Filename.c_str()))
|
||||
if (File::Exists(Filename))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "\tresult = FS_RESULT_EXISTS");
|
||||
return FS_FILE_EXIST;
|
||||
}
|
||||
|
||||
// create the file
|
||||
File::CreateFullPath(Filename.c_str()); // just to be sure
|
||||
bool Result = File::CreateEmptyFile(Filename.c_str());
|
||||
File::CreateFullPath(Filename); // just to be sure
|
||||
bool Result = File::CreateEmptyFile(Filename);
|
||||
if (!Result)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_FILEIO, "CWII_IPC_HLE_Device_fs: couldn't create new file");
|
||||
|
||||
@@ -201,25 +201,21 @@ bool BeginRecordingInput(int controllers)
|
||||
if(g_playMode != MODE_NONE || controllers == 0 || g_recordfd != NULL)
|
||||
return false;
|
||||
|
||||
const char *filename = g_recordFile.c_str();
|
||||
|
||||
if(File::Exists(filename))
|
||||
File::Delete(filename);
|
||||
if(File::Exists(g_recordFile))
|
||||
File::Delete(g_recordFile);
|
||||
|
||||
if (Core::isRunning())
|
||||
{
|
||||
std::string tmpStateFilename = g_recordFile;
|
||||
tmpStateFilename.append(".sav");
|
||||
const char *stateFilename = tmpStateFilename.c_str();
|
||||
const std::string stateFilename = g_recordFile + ".sav";
|
||||
if(File::Exists(stateFilename))
|
||||
File::Delete(stateFilename);
|
||||
State_SaveAs(stateFilename);
|
||||
State_SaveAs(stateFilename.c_str());
|
||||
g_bRecordingFromSaveState = true;
|
||||
}
|
||||
|
||||
g_recordfd = fopen(filename, "wb");
|
||||
g_recordfd = fopen(g_recordFile.c_str(), "wb");
|
||||
if(!g_recordfd) {
|
||||
PanicAlertT("Error opening file %s for recording", filename);
|
||||
PanicAlertT("Error opening file %s for recording", g_recordFile.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -360,8 +356,8 @@ bool PlayInput(const char *filename)
|
||||
|
||||
DTMHeader header;
|
||||
|
||||
File::Delete(g_recordFile.c_str());
|
||||
File::Copy(filename, g_recordFile.c_str());
|
||||
File::Delete(g_recordFile);
|
||||
File::Copy(filename, g_recordFile);
|
||||
|
||||
g_recordfd = fopen(g_recordFile.c_str(), "r+b");
|
||||
if(!g_recordfd)
|
||||
@@ -377,9 +373,8 @@ bool PlayInput(const char *filename)
|
||||
// Load savestate (and skip to frame data)
|
||||
if(header.bFromSaveState)
|
||||
{
|
||||
std::string stateFilename = filename;
|
||||
stateFilename.append(".sav");
|
||||
if(File::Exists(stateFilename.c_str()))
|
||||
const std::string stateFilename = std::string(filename) + ".sav";
|
||||
if(File::Exists(stateFilename))
|
||||
Core::SetStateFileName(stateFilename);
|
||||
g_bRecordingFromSaveState = true;
|
||||
}
|
||||
@@ -445,8 +440,8 @@ void LoadInput(const char *filename)
|
||||
if (g_recordfd)
|
||||
fclose(g_recordfd);
|
||||
|
||||
File::Delete(g_recordFile.c_str());
|
||||
File::Copy(filename, g_recordFile.c_str());
|
||||
File::Delete(g_recordFile);
|
||||
File::Copy(filename, g_recordFile);
|
||||
|
||||
g_recordfd = fopen(g_recordFile.c_str(), "r+b");
|
||||
fseeko(g_recordfd, 0, SEEK_END);
|
||||
@@ -569,8 +564,8 @@ void EndPlayInput(bool cont)
|
||||
// if playback ends before the end of the file.
|
||||
SaveRecording(g_tmpRecordFile.c_str());
|
||||
fclose(g_recordfd);
|
||||
File::Delete(g_recordFile.c_str());
|
||||
File::Copy(g_tmpRecordFile.c_str(), g_recordFile.c_str());
|
||||
File::Delete(g_recordFile);
|
||||
File::Copy(g_tmpRecordFile, g_recordFile);
|
||||
g_recordfd = fopen(g_recordFile.c_str(), "r+b");
|
||||
fseeko(g_recordfd, 0, SEEK_END);
|
||||
g_playMode = MODE_RECORDING;
|
||||
@@ -624,7 +619,7 @@ void SaveRecording(const char *filename)
|
||||
bool success = false;
|
||||
fclose(g_recordfd);
|
||||
File::Delete(filename);
|
||||
success = File::Copy(g_recordFile.c_str(), filename);
|
||||
success = File::Copy(g_recordFile, filename);
|
||||
|
||||
if (success && g_bRecordingFromSaveState)
|
||||
{
|
||||
@@ -632,7 +627,7 @@ void SaveRecording(const char *filename)
|
||||
tmpStateFilename.append(".sav");
|
||||
std::string stateFilename = filename;
|
||||
stateFilename.append(".sav");
|
||||
success = File::Copy(tmpStateFilename.c_str(), stateFilename.c_str());
|
||||
success = File::Copy(tmpStateFilename, stateFilename);
|
||||
}
|
||||
|
||||
if (success /* && !g_bReadOnly*/)
|
||||
|
||||
@@ -86,7 +86,7 @@ void LoadPatchSection(const char *section, std::vector<Patch> &patches, IniFile
|
||||
|
||||
std::string::size_type loc = line.find_first_of('=', 0);
|
||||
if (loc != std::string::npos)
|
||||
line.at(loc) = ':';
|
||||
line[loc] = ':';
|
||||
|
||||
std::vector<std::string> items;
|
||||
SplitString(line, ':', items);
|
||||
|
||||
@@ -179,12 +179,12 @@ void CompressAndDumpState(saveStruct* saveArg)
|
||||
Common::SetCurrentThreadName("SaveState thread");
|
||||
|
||||
// Moving to last overwritten save-state
|
||||
if (File::Exists(cur_filename.c_str()))
|
||||
if (File::Exists(cur_filename))
|
||||
{
|
||||
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::Exists(File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav"))
|
||||
File::Delete((File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav"));
|
||||
|
||||
if (!File::Rename(cur_filename.c_str(), (File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav").c_str()))
|
||||
if (!File::Rename(cur_filename, File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav"))
|
||||
Core::DisplayMessage("Failed to move previous state to state undo backup", 1000);
|
||||
}
|
||||
|
||||
@@ -388,8 +388,8 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
if (File::Exists(StringFromFormat("%s.dtm", cur_filename.c_str()).c_str()))
|
||||
Frame::LoadInput(StringFromFormat("%s.dtm", cur_filename.c_str()).c_str());
|
||||
if (File::Exists(cur_filename + ".dtm"))
|
||||
Frame::LoadInput((cur_filename + ".dtm").c_str());
|
||||
else if (!Frame::IsRecordingInputFromSaveState())
|
||||
Frame::EndPlayInput(false);
|
||||
|
||||
|
||||
@@ -157,11 +157,11 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
|
||||
, m_IosVersion(0x09)
|
||||
, m_BootIndex(-1)
|
||||
{
|
||||
if (File::IsDirectory(_rName.c_str()))
|
||||
if (File::IsDirectory(_rName))
|
||||
{
|
||||
m_Valid = CreateFromDirectory(_rName);
|
||||
}
|
||||
else if (File::Exists(_rName.c_str()))
|
||||
else if (File::Exists(_rName))
|
||||
{
|
||||
m_Valid = CreateFromWAD(_rName);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
|
||||
TMDFileName.c_str());
|
||||
return false;
|
||||
}
|
||||
u64 Size = File::GetSize(TMDFileName.c_str());
|
||||
u64 Size = File::GetSize(TMDFileName);
|
||||
u8* pTMD = new u8[(u32)Size];
|
||||
fread(pTMD, (size_t)Size, 1, pTMDFile);
|
||||
fclose(pTMDFile);
|
||||
|
||||
@@ -92,7 +92,7 @@ CVolumeDirectory::~CVolumeDirectory()
|
||||
bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
|
||||
{
|
||||
std::string directoryName = ExtractDirectoryName(_rDirectory);
|
||||
return File::IsDirectory(directoryName.c_str());
|
||||
return File::IsDirectory(directoryName);
|
||||
}
|
||||
|
||||
bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
|
||||
@@ -513,7 +513,7 @@ static u32 ComputeNameSize(const File::FSTEntry& parentEntry)
|
||||
|
||||
u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry)
|
||||
{
|
||||
u32 foundEntries = ScanDirectoryTree(_Directory.c_str(), parentEntry);
|
||||
u32 foundEntries = ScanDirectoryTree(_Directory, parentEntry);
|
||||
m_totalNameSize += ComputeNameSize(parentEntry);
|
||||
return foundEntries;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
||||
if (jit != NULL)
|
||||
{
|
||||
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
|
||||
File::CreateFullPath(filename.c_str());
|
||||
File::CreateFullPath(filename);
|
||||
Profiler::WriteProfileResults(filename.c_str());
|
||||
|
||||
wxFileType* filetype = NULL;
|
||||
@@ -254,7 +254,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
||||
break;
|
||||
}
|
||||
case IDM_LOADMAPFILE:
|
||||
if (!File::Exists(mapfile.c_str()))
|
||||
if (!File::Exists(mapfile))
|
||||
{
|
||||
g_symbolDB.Clear();
|
||||
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user