mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-14 11:19:03 +00:00
Changed: BIG_ENDIAN check is no longer needed
This commit is contained in:
parent
7c6d141108
commit
945ba66a09
1 changed files with 7 additions and 26 deletions
|
@ -65,8 +65,7 @@ void BNPFileHandle::releaseInstance()
|
||||||
bool BNPFileHandle::unpack(const string &dirName, const vector<string>& fileList)
|
bool BNPFileHandle::unpack(const string &dirName, const vector<string>& fileList)
|
||||||
{
|
{
|
||||||
CIFile bnp;
|
CIFile bnp;
|
||||||
if ( !bnp.open(m_openedBNPFile) )
|
bnp.open(m_openedBNPFile);
|
||||||
return false;
|
|
||||||
|
|
||||||
TPackedFilesList::iterator it_files = m_packedFiles.begin();
|
TPackedFilesList::iterator it_files = m_packedFiles.begin();
|
||||||
|
|
||||||
|
@ -99,11 +98,7 @@ bool BNPFileHandle::readHeader(const std::string &filePath)
|
||||||
m_openedBNPFile = filePath;
|
m_openedBNPFile = filePath;
|
||||||
|
|
||||||
CIFile bnp;
|
CIFile bnp;
|
||||||
if ( !bnp.open (filePath) )
|
bnp.open (filePath);
|
||||||
{
|
|
||||||
nlwarning("Could not open file!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bnp.seek(0, IStream::end);
|
bnp.seek(0, IStream::end);
|
||||||
uint32 nFileSize=CFile::getFileSize (filePath );
|
uint32 nFileSize=CFile::getFileSize (filePath );
|
||||||
|
@ -112,9 +107,6 @@ bool BNPFileHandle::readHeader(const std::string &filePath)
|
||||||
uint32 nOffsetFromBegining;
|
uint32 nOffsetFromBegining;
|
||||||
|
|
||||||
bnp.serial(nOffsetFromBegining);
|
bnp.serial(nOffsetFromBegining);
|
||||||
#ifdef NL_BIG_ENDIAN
|
|
||||||
NLMISC_BSWAP32(nOffsetFromBegining);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( !bnp.seek (nOffsetFromBegining, IStream::begin) )
|
if ( !bnp.seek (nOffsetFromBegining, IStream::begin) )
|
||||||
{
|
{
|
||||||
|
@ -125,33 +117,22 @@ bool BNPFileHandle::readHeader(const std::string &filePath)
|
||||||
uint32 nNbFile;
|
uint32 nNbFile;
|
||||||
bnp.serial(nNbFile);
|
bnp.serial(nNbFile);
|
||||||
|
|
||||||
#ifdef NL_BIG_ENDIAN
|
|
||||||
NLMISC_BSWAP32(nNbFile);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (uint32 i = 0; i < nNbFile; ++i)
|
for (uint32 i = 0; i < nNbFile; ++i)
|
||||||
{
|
{
|
||||||
uint8 nStringSize;
|
uint8 nStringSize;
|
||||||
uint32 fileSize;
|
|
||||||
uint32 filePos;
|
|
||||||
char sName[256];
|
char sName[256];
|
||||||
|
|
||||||
bnp.serial(nStringSize);
|
bnp.serial(nStringSize);
|
||||||
bnp.serialBuffer( (uint8*)sName, nStringSize);
|
bnp.serialBuffer( (uint8*)sName, nStringSize);
|
||||||
sName[nStringSize] = 0;
|
sName[nStringSize] = 0;
|
||||||
|
|
||||||
PackedFile tmpPackedFile;
|
PackedFile tmpPackedFile;
|
||||||
tmpPackedFile.m_name = sName;
|
tmpPackedFile.m_name = sName;
|
||||||
tmpPackedFile.m_path = m_openedBNPFile;
|
tmpPackedFile.m_path = m_openedBNPFile;
|
||||||
|
|
||||||
bnp.serial(fileSize);
|
bnp.serial(tmpPackedFile.m_size);
|
||||||
tmpPackedFile.m_size = fileSize;
|
bnp.serial(tmpPackedFile.m_pos);
|
||||||
#ifdef NL_BIG_ENDIAN
|
|
||||||
NLMISC_BSWAP32(tmpBNPFile.Size);
|
|
||||||
#endif
|
|
||||||
bnp.serial(filePos);
|
|
||||||
tmpPackedFile.m_pos = filePos;
|
|
||||||
#ifdef NL_BIG_ENDIAN
|
|
||||||
NLMISC_BSWAP32(tmpBNPFile.Pos);
|
|
||||||
#endif
|
|
||||||
m_packedFiles.push_back (tmpPackedFile);
|
m_packedFiles.push_back (tmpPackedFile);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue