Fixed Quake3Explorer and added codeblocks project. Ensure paths in createFileList end in /, fixed bug in mountPointReader
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2596 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
dd98649ba5
commit
c3240d1561
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 21 Quake 3 Explorer" />
|
||||
<Option pch_mode="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Linux">
|
||||
<Option platforms="Unix;" />
|
||||
<Option output="../../bin/Linux/Quake3Explorer" prefix_auto="0" extension_auto="0" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-W" />
|
||||
<Add option="-g" />
|
||||
<Add option="-D_IRR_STATIC_LIB_" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="Xxf86vm" />
|
||||
<Add library="GL" />
|
||||
<Add directory="../../lib/Linux" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Windows">
|
||||
<Option platforms="Windows;" />
|
||||
<Option output="../../bin/Win32-gcc/Quake3Explorer" prefix_auto="0" extension_auto="1" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option projectResourceIncludeDirsRelation="1" />
|
||||
<Compiler>
|
||||
<Add option="-W" />
|
||||
<Add option="-g" />
|
||||
<Add directory="../../lib/Win32-gcc" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add directory="../../lib/Win32-gcc/" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<VirtualTargets>
|
||||
<Add alias="All" targets="Windows;" />
|
||||
</VirtualTargets>
|
||||
<Compiler>
|
||||
<Add option="-W" />
|
||||
<Add option="-g" />
|
||||
<Add directory="../../include" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="Irrlicht" />
|
||||
</Linker>
|
||||
<Unit filename="main.cpp" />
|
||||
<Unit filename="q3factory.cpp" />
|
||||
<Unit filename="q3factory.h" />
|
||||
<Unit filename="sound.cpp" />
|
||||
<Unit filename="sound.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
<envvars />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
|
@ -188,7 +188,7 @@ s32 GameData::save ( const string<c16> &filename )
|
|||
IFileSystem *fs = Device->getFileSystem();
|
||||
for ( i = 0; i != fs->getFileArchiveCount(); ++i )
|
||||
{
|
||||
CurrentArchiveList.push_back ( fs->getFileArchive ( i )->getArchiveName() );
|
||||
CurrentArchiveList.push_back ( fs->getFileArchive(i)->getFileList()->getPath() );
|
||||
}
|
||||
|
||||
// Store Player Position and Rotation
|
||||
|
@ -209,7 +209,7 @@ s32 GameData::save ( const string<c16> &filename )
|
|||
file->write ( buf, (s32) strlen ( buf ) );
|
||||
for ( i = 0; i != fs->getFileArchiveCount(); ++i )
|
||||
{
|
||||
snprintf ( buf, 128, "archive %s\n",stringc ( fs->getFileArchive ( i )->getArchiveName() ).c_str () );
|
||||
snprintf ( buf, 128, "archive %s\n",stringc ( fs->getFileArchive(i)->getFileList()->getPath() ).c_str () );
|
||||
file->write ( buf, (s32) strlen ( buf ) );
|
||||
}
|
||||
|
||||
|
@ -843,7 +843,7 @@ void CQuake3EventHandler::AddArchive ( const core::string<c16>& archiveName )
|
|||
bool exists = false;
|
||||
for ( i = 0; i != fs->getFileArchiveCount(); ++i )
|
||||
{
|
||||
if ( fs->getFileArchive ( i )->getArchiveName() == archiveName )
|
||||
if ( fs->getFileArchive(i)->getFileList()->getPath() == archiveName )
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
|
@ -874,6 +874,9 @@ void CQuake3EventHandler::AddArchive ( const core::string<c16>& archiveName )
|
|||
case io::EFAT_ZIP:
|
||||
typeName = "ZIP";
|
||||
break;
|
||||
case io::EFAT_GZIP:
|
||||
typeName = "gzip";
|
||||
break;
|
||||
case io::EFAT_FOLDER:
|
||||
typeName = "Mount";
|
||||
break;
|
||||
|
@ -888,7 +891,7 @@ void CQuake3EventHandler::AddArchive ( const core::string<c16>& archiveName )
|
|||
}
|
||||
|
||||
gui.ArchiveList->setCellText ( index, 0, typeName );
|
||||
gui.ArchiveList->setCellText ( index, 1, archive->getArchiveName () );
|
||||
gui.ArchiveList->setCellText ( index, 1, archive->getFileList()->getPath() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
<Project filename="16.Quake3MapShader/Quake3MapShader.cbp" />
|
||||
<Project filename="18.SplitScreen/SplitScreen.cbp" />
|
||||
<Project filename="19.MouseAndJoystick/MouseAndJoystick.cbp" />
|
||||
<Project filename="20.ManagedLights/ManagedLights.cbp" active="1" />
|
||||
<Project filename="20.ManagedLights/ManagedLights.cbp" />
|
||||
<Project filename="21.Quake3Explorer/Quake3Explorer.cbp" />
|
||||
<Project filename="Demo/demo.cbp" />
|
||||
<Project filename="../source/Irrlicht/Irrlicht-gcc.cbp" />
|
||||
<Project filename="../source/Irrlicht/Irrlicht-gcc.cbp" active="1" />
|
||||
</Workspace>
|
||||
</CodeBlocks_workspace_file>
|
||||
|
|
|
@ -43,27 +43,6 @@ enum E_FILE_ARCHIVE_TYPE
|
|||
EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
|
||||
};
|
||||
|
||||
/*
|
||||
//! Base Info which all File archives must support on browsing
|
||||
struct IFileArchiveEntry
|
||||
{
|
||||
IFileArchiveEntry() {}
|
||||
|
||||
core::string<c16> simpleFileName;
|
||||
core::string<c16> path;
|
||||
|
||||
bool operator < (const IFileArchiveEntry& other) const
|
||||
{
|
||||
return path < other.path;
|
||||
}
|
||||
|
||||
bool operator == (const IFileArchiveEntry& other) const
|
||||
{
|
||||
return path == other.path;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
//! The FileArchive manages archives and provides access to files inside them.
|
||||
class IFileArchive : public virtual IReferenceCounted
|
||||
{
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "irrArray.h"
|
||||
#include "coreutil.h"
|
||||
|
||||
#include "os.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace io
|
||||
|
@ -85,6 +87,8 @@ u32 CFileList::addItem(const core::string<c16>& fullPath, u32 size, bool isDirec
|
|||
if (IgnorePaths)
|
||||
entry.FullName = entry.Name;
|
||||
|
||||
//os::Printer::log(Path.c_str(), entry.FullName);
|
||||
|
||||
Files.push_back(entry);
|
||||
|
||||
return Files.size() - 1;
|
||||
|
|
|
@ -557,12 +557,15 @@ EFileSystemType CFileSystem::setFileListSystem(EFileSystemType listType)
|
|||
IFileList* CFileSystem::createFileList()
|
||||
{
|
||||
CFileList* r = 0;
|
||||
core::string<c16> Path = getWorkingDirectory();
|
||||
Path.replace('\\', '/');
|
||||
if (lastChar(Path) != '/')
|
||||
Path.append('/');
|
||||
|
||||
//! Construct a native filesystem
|
||||
//! Construct from native filesystem
|
||||
if (FileSystemType == FILESYSTEM_NATIVE)
|
||||
{
|
||||
core::string<c16> fullPath;
|
||||
core::string<c16> Path = getWorkingDirectory();
|
||||
// --------------------------------------------
|
||||
//! Windows version
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
|
@ -577,8 +580,7 @@ IFileList* CFileSystem::createFileList()
|
|||
{
|
||||
do
|
||||
{
|
||||
fullPath = WorkingDirectory[FILESYSTEM_NATIVE] + "/";
|
||||
fullPath += c_file.name;
|
||||
fullPath = Path + c_file.name;
|
||||
|
||||
r->addItem(fullPath, c_file.size, (_A_SUBDIR & c_file.attrib) != 0, 0);
|
||||
}
|
||||
|
@ -601,7 +603,7 @@ IFileList* CFileSystem::createFileList()
|
|||
|
||||
r = new CFileList(Path, false, false);
|
||||
|
||||
r->addItem(Path + "/..", 0, true, 0);
|
||||
r->addItem(Path + "..", 0, true, 0);
|
||||
|
||||
//! We use the POSIX compliant methods instead of scandir
|
||||
DIR* dirHandle=opendir(Path.c_str());
|
||||
|
@ -612,8 +614,7 @@ IFileList* CFileSystem::createFileList()
|
|||
{
|
||||
u32 size = 0;
|
||||
bool isDirectory = false;
|
||||
fullPath = Path + "/";
|
||||
fullPath += dirEntry->d_name;
|
||||
fullPath = Path + dirEntry->d_name;
|
||||
|
||||
if((strcmp(dirEntry->d_name, ".")==0) ||
|
||||
(strcmp(dirEntry->d_name, "..")==0))
|
||||
|
@ -643,18 +644,17 @@ IFileList* CFileSystem::createFileList()
|
|||
else
|
||||
{
|
||||
//! create file list for the virtual filesystem
|
||||
r = new CFileList(WorkingDirectory[FILESYSTEM_VIRTUAL], false, false);
|
||||
r = new CFileList(Path, false, false);
|
||||
|
||||
//! add relative navigation
|
||||
SFileListEntry e2;
|
||||
SFileListEntry e3;
|
||||
|
||||
//! PWD
|
||||
r->addItem(r->getPath() + "/.", 0, true, 0);
|
||||
r->addItem(Path + ".", 0, true, 0);
|
||||
|
||||
//! add parent dir if we can go up
|
||||
if (WorkingDirectory[FILESYSTEM_VIRTUAL].size())
|
||||
r->addItem(r->getPath() + "/..", 0, true, 0);
|
||||
//! parent
|
||||
r->addItem(Path + "..", 0, true, 0);
|
||||
|
||||
//! merge archives
|
||||
for (u32 i=0; i < FileArchives.size(); ++i)
|
||||
|
@ -663,10 +663,9 @@ IFileList* CFileSystem::createFileList()
|
|||
|
||||
for (u32 j=0; j < merge->getFileCount(); ++j)
|
||||
{
|
||||
if (core::isInSameDirectory(WorkingDirectory[FILESYSTEM_VIRTUAL], merge->getFullFileName(j)))
|
||||
if (core::isInSameDirectory(Path, merge->getFullFileName(j)) == 0)
|
||||
{
|
||||
core::string<c16> fullPath = r->getPath() + "/";
|
||||
fullPath += merge->getFullFileName(j);
|
||||
core::string<c16> fullPath = merge->getFullFileName(j);
|
||||
r->addItem(fullPath, merge->getFileSize(j), merge->isDirectory(j), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,19 +118,23 @@ void CMountPointReader::buildDirectory()
|
|||
IFileList * list = Parent->createFileList();
|
||||
|
||||
const u32 size = list->getFileCount();
|
||||
for (u32 i = 0; i!= size; ++i)
|
||||
for (u32 i=0; i < size; ++i)
|
||||
{
|
||||
core::string<c16> full = list->getFullFileName(i);
|
||||
full = full.subString(Path.size(), full.size() - Path.size());
|
||||
|
||||
if (!list->isDirectory(i))
|
||||
{
|
||||
addItem(list->getFullFileName(i), list->getFileSize(i), false, RealFileNames.size());
|
||||
addItem(full, list->getFileSize(i), false, RealFileNames.size());
|
||||
RealFileNames.push_back(list->getFullFileName(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
const core::string<c16>& full = list->getFullFileName(i);
|
||||
const core::string<c16> rel = list->getFileName(i);
|
||||
core::string<c16> pwd = Parent->getWorkingDirectory() + "/";
|
||||
pwd += rel;
|
||||
core::string<c16> pwd = Parent->getWorkingDirectory();
|
||||
if (core::lastChar(pwd) != '/')
|
||||
pwd.append('/');
|
||||
pwd.append(rel);
|
||||
|
||||
if ( rel != "." && rel != ".." )
|
||||
{
|
||||
|
@ -158,11 +162,10 @@ IReadFile* CMountPointReader::createAndOpenFile(u32 index)
|
|||
IReadFile* CMountPointReader::createAndOpenFile(const core::string<c16>& filename)
|
||||
{
|
||||
s32 index = findFile(filename, false);
|
||||
|
||||
if (index == -1)
|
||||
if (index != -1)
|
||||
return createAndOpenFile(index);
|
||||
else
|
||||
return 0;
|
||||
|
||||
return createReadFile( RealFileNames[Files[index].ID] );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue