reverted all src changes from rev95 commit (because all old work was just removed)

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@107 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
albertzeyer
2009-07-22 21:50:13 +00:00
parent ef725f8581
commit 23ef380643
50 changed files with 5547 additions and 5582 deletions

View File

@@ -10,11 +10,11 @@
#include <string.h>
#include <fstream>
CPatcher::CPatcher(int episode, int version,unsigned char *data, char *datadir) {
CPatcher::CPatcher(int episode, int version,unsigned char *data, const std::string& datadir) {
m_episode = episode;
m_version = version;
m_data = data;
strcpy(m_datadirectory, datadir);
m_datadirectory = datadir;
}
CPatcher::~CPatcher() {
@@ -35,7 +35,7 @@ void CPatcher::patchMemory()
// change to the proper directory
chdir("data");
chdir(m_datadirectory);
chdir(m_datadirectory.c_str());
// TODO: Extend this part further with more commands
while(!m_TextList.empty())
@@ -80,7 +80,6 @@ void CPatcher::patchMemory()
}
}
}
}
if(!m_TextList.empty())
@@ -109,7 +108,7 @@ bool CPatcher::loadPatchfile()
{
bool ret = false;
chdir("data");
chdir(m_datadirectory);
chdir(m_datadirectory.c_str());
// Detect the patchfile
DIR *dir = opendir(".");
struct dirent *dp;
@@ -121,8 +120,9 @@ bool CPatcher::loadPatchfile()
if(strstr(dp->d_name,".pat"))
{
// The file was found! now read it into the memory!
char* buf;
ifstream Patchfile(dp->d_name);
std::ifstream Patchfile(dp->d_name);
while(!Patchfile.eof())
{
@@ -157,12 +157,12 @@ bool CPatcher::loadPatchfile()
return ret;
}
void CPatcher::patchMemfromFile(const char *patch_file_name, int offset)
void CPatcher::patchMemfromFile(const std::string& patch_file_name, int offset)
{
unsigned char *buf_to_patch;
unsigned char byte;
ifstream Patchfile(patch_file_name, ios::binary);
std::ifstream Patchfile(patch_file_name.c_str(), std::ios::binary);
if(!Patchfile) return;