|
@@ -33,7 +33,7 @@ void CPCXConv::fromFile(std::string path)
|
|
|
{
|
|
|
std::ifstream * is = new std::ifstream();
|
|
|
is -> open(path.c_str(),std::ios::binary);
|
|
|
- is->seekg(0,std::ios::end); // na koniec
|
|
|
+ is->seekg(0,std::ios::end); // to the end
|
|
|
pcxs = is->tellg(); // read length
|
|
|
is->seekg(0,std::ios::beg); // wracamy na poczatek
|
|
|
pcx = new unsigned char[pcxs]; // allocate memory
|
|
@@ -688,64 +688,13 @@ void CLodHandler::extract(std::string FName)
|
|
|
std::cout<<"LOD Extraction error"<<" "<<decRes<<" while extracting to "<<bufff<<std::endl;
|
|
|
}
|
|
|
}
|
|
|
- //for (int j=0; j<entries[i].size; j++)
|
|
|
- // FOut << outp[j];
|
|
|
- //FOut.flush();
|
|
|
delete outp;
|
|
|
- //FOut.close();
|
|
|
- //std::cout<<"*** done\n";
|
|
|
}
|
|
|
FLOD.close();
|
|
|
- //std::cout<<"*** Archive: "+FName+" closed\n";
|
|
|
}
|
|
|
|
|
|
void CLodHandler::extractFile(std::string FName, std::string name)
|
|
|
{
|
|
|
- //std::ifstream FLOD;
|
|
|
- std::ofstream FOut;
|
|
|
- int i;
|
|
|
-
|
|
|
- //std::string Ts;
|
|
|
- ////std::cout<<"*** Loading FAT ... \n";
|
|
|
- //FLOD.open(FName.c_str(),std::ios::binary);
|
|
|
- ////std::cout<<"*** Archive: "+FName+" loaded\n";
|
|
|
- //FLOD.seekg(8,std::ios_base::beg);
|
|
|
- //unsigned char temp[4];
|
|
|
- //FLOD.read((char*)temp,4);
|
|
|
- //totalFiles = readNormalNr(temp,4);
|
|
|
- //FLOD.seekg(0x5c,std::ios_base::beg);
|
|
|
- //entries.reserve(totalFiles);
|
|
|
- ////std::cout<<"*** Loading FAT ...\n";
|
|
|
- //for (int i=0; i<totalFiles; i++)
|
|
|
- //{
|
|
|
- // entries.push_back(Entry());
|
|
|
- // //FLOD.read((char*)entries[i].name,12);
|
|
|
- // char * bufc = new char;
|
|
|
- // bool appending = true;
|
|
|
- // for(int kk=0; kk<12; ++kk)
|
|
|
- // {
|
|
|
- // FLOD.read(bufc, 1);
|
|
|
- // if(appending)
|
|
|
- // {
|
|
|
- // entries[i].name[kk] = *bufc;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // entries[i].name[kk] = 0;
|
|
|
- // appending = false;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // delete bufc;
|
|
|
- // FLOD.read((char*)entries[i].hlam_1,4);
|
|
|
- // FLOD.read((char*)temp,4);
|
|
|
- // entries[i].offset=readNormalNr(temp,4);
|
|
|
- // FLOD.read((char*)temp,4);
|
|
|
- // entries[i].realSize=readNormalNr(temp,4);
|
|
|
- // FLOD.read((char*)entries[i].hlam_2,4);
|
|
|
- // FLOD.read((char*)temp,4);
|
|
|
- // entries[i].size=readNormalNr(temp,4);
|
|
|
- //}
|
|
|
- //std::cout<<" done\n";
|
|
|
std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper);
|
|
|
for (int i=0;i<totalFiles;i++)
|
|
|
{
|
|
@@ -790,15 +739,9 @@ void CLodHandler::extractFile(std::string FName, std::string name)
|
|
|
std::cout<<"LOD Extraction error"<<" "<<decRes<<" while extracting to "<<bufff<<std::endl;
|
|
|
}
|
|
|
}
|
|
|
- //for (int j=0; j<entries[i].size; j++)
|
|
|
- // FOut << outp[j];
|
|
|
- //FOut.flush();
|
|
|
delete outp;
|
|
|
- //FOut.close();
|
|
|
- //std::cout<<"*** done\n";
|
|
|
}
|
|
|
FLOD.close();
|
|
|
- //std::cout<<"*** Archive: "+FName+" closed\n";
|
|
|
}
|
|
|
|
|
|
int CLodHandler::readNormalNr (unsigned char* bufor, int bytCon, bool cyclic)
|
|
@@ -892,7 +835,9 @@ std::string CLodHandler::getTextFile(std::string name)
|
|
|
FLOD.seekg(0, std::ios_base::beg);
|
|
|
unsigned char * decomp = NULL;
|
|
|
int decRes = infs2(outp, entries[i].size, entries[i].realSize, decomp);
|
|
|
- std::string ret = std::string((char*)decomp);
|
|
|
+ std::string ret;
|
|
|
+ for (int itr=0;itr<entries[i].realSize;itr++)
|
|
|
+ ret+= *((char*)decomp+itr);
|
|
|
delete outp;
|
|
|
delete decomp;
|
|
|
return ret;
|