mirror of
https://github.com/id-Software/GtkRadiant.git
synced 2026-03-20 00:49:29 +01:00
The GtkRadiant sources as originally released under the GPL license.
This commit is contained in:
11
plugins/vfspk3/.cvsignore
Normal file
11
plugins/vfspk3/.cvsignore
Normal file
@@ -0,0 +1,11 @@
|
||||
*.d
|
||||
*.o
|
||||
*.so
|
||||
Debug
|
||||
Release
|
||||
*.aps
|
||||
*.plg
|
||||
*.bak
|
||||
*.BAK
|
||||
*.opt
|
||||
*.ncb
|
||||
178
plugins/vfspk3/archive.cpp
Normal file
178
plugins/vfspk3/archive.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GtkRadiant is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "archive.h"
|
||||
|
||||
#include "idatastream.h"
|
||||
#include "iarchive.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
||||
#include "stream/filestream.h"
|
||||
#include "stream/textfilestream.h"
|
||||
#include "string/string.h"
|
||||
#include "os/path.h"
|
||||
#include "os/file.h"
|
||||
#include "os/dir.h"
|
||||
#include "archivelib.h"
|
||||
#include "fs_path.h"
|
||||
|
||||
#include "vfspk3.h"
|
||||
|
||||
|
||||
class DirectoryArchive : public Archive
|
||||
{
|
||||
CopiedString m_root;
|
||||
public:
|
||||
DirectoryArchive(const char* root) : m_root(root)
|
||||
{
|
||||
}
|
||||
|
||||
void release()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
virtual ArchiveFile* openFile(const char* name)
|
||||
{
|
||||
UnixPath path(m_root.c_str());
|
||||
path.push_filename(name);
|
||||
DirectoryArchiveFile* file = new DirectoryArchiveFile(name, path.c_str());
|
||||
if(!file->failed())
|
||||
{
|
||||
return file;
|
||||
}
|
||||
file->release();
|
||||
return 0;
|
||||
}
|
||||
virtual ArchiveTextFile* openTextFile(const char* name)
|
||||
{
|
||||
UnixPath path(m_root.c_str());
|
||||
path.push_filename(name);
|
||||
DirectoryArchiveTextFile* file = new DirectoryArchiveTextFile(name, path.c_str());
|
||||
if(!file->failed())
|
||||
{
|
||||
return file;
|
||||
}
|
||||
file->release();
|
||||
return 0;
|
||||
}
|
||||
virtual bool containsFile(const char* name)
|
||||
{
|
||||
UnixPath path(m_root.c_str());
|
||||
path.push_filename(name);
|
||||
return file_readable(path.c_str());
|
||||
}
|
||||
virtual void forEachFile(VisitorFunc visitor, const char* root)
|
||||
{
|
||||
std::vector<Directory*> dirs;
|
||||
UnixPath path(m_root.c_str());
|
||||
path.push(root);
|
||||
dirs.push_back(directory_open(path.c_str()));
|
||||
|
||||
while(!dirs.empty() && directory_good(dirs.back()))
|
||||
{
|
||||
const char* name = directory_read_and_increment(dirs.back());
|
||||
|
||||
if(name == 0)
|
||||
{
|
||||
directory_close(dirs.back());
|
||||
dirs.pop_back();
|
||||
path.pop();
|
||||
}
|
||||
else if(!string_equal(name, ".") && !string_equal(name, ".."))
|
||||
{
|
||||
path.push_filename(name);
|
||||
|
||||
bool is_directory = file_is_directory(path.c_str());
|
||||
|
||||
if(!is_directory)
|
||||
visitor.file(path_make_relative(path.c_str(), m_root.c_str()));
|
||||
|
||||
path.pop();
|
||||
|
||||
if(is_directory)
|
||||
{
|
||||
path.push(name);
|
||||
|
||||
if(!visitor.directory(path_make_relative(path.c_str(), m_root.c_str()), dirs.size()))
|
||||
dirs.push_back(directory_open(path.c_str()));
|
||||
else
|
||||
path.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Archive* OpenArchive(const char* name)
|
||||
{
|
||||
return new DirectoryArchive(name);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
class TestArchive
|
||||
{
|
||||
class TestVisitor : public Archive::IVisitor
|
||||
{
|
||||
public:
|
||||
virtual void visit(const char* name)
|
||||
{
|
||||
int bleh = 0;
|
||||
}
|
||||
};
|
||||
public:
|
||||
void test1()
|
||||
{
|
||||
Archive* archive = OpenArchive("d:/quake/id1/");
|
||||
ArchiveFile* file = archive->openFile("quake101.wad");
|
||||
if(file != 0)
|
||||
{
|
||||
char buffer[1024];
|
||||
file->getInputStream().read(buffer, 1024);
|
||||
file->release();
|
||||
}
|
||||
TestVisitor visitor;
|
||||
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 0), "");
|
||||
archive->release();
|
||||
}
|
||||
void test2()
|
||||
{
|
||||
Archive* archive = OpenArchive("d:/gtkradiant_root/baseq3/");
|
||||
TestVisitor visitor;
|
||||
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 2), "");
|
||||
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFiles, 1), "textures");
|
||||
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eDirectories, 1), "textures");
|
||||
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 1), "textures");
|
||||
archive->release();
|
||||
}
|
||||
TestArchive()
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
}
|
||||
};
|
||||
|
||||
TestArchive g_test;
|
||||
|
||||
#endif
|
||||
29
plugins/vfspk3/archive.h
Normal file
29
plugins/vfspk3/archive.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GtkRadiant is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_ARCHIVE_H)
|
||||
#define INCLUDED_ARCHIVE_H
|
||||
|
||||
#include "iarchive.h"
|
||||
|
||||
const _QERArchiveTable* GetArchiveTable(ArchiveModules& archiveModules, const char* type);
|
||||
|
||||
#endif
|
||||
682
plugins/vfspk3/vfs.cpp
Normal file
682
plugins/vfspk3/vfs.cpp
Normal file
@@ -0,0 +1,682 @@
|
||||
/*
|
||||
Copyright (c) 2001, Loki software, inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
Neither the name of Loki software nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//
|
||||
// Rules:
|
||||
//
|
||||
// - Directories should be searched in the following order: ~/.q3a/baseq3,
|
||||
// install dir (/usr/local/games/quake3/baseq3) and cd_path (/mnt/cdrom/baseq3).
|
||||
//
|
||||
// - Pak files are searched first inside the directories.
|
||||
// - Case insensitive.
|
||||
// - Unix-style slashes (/) (windows is backwards .. everyone knows that)
|
||||
//
|
||||
// Leonardo Zide (leo@lokigames.com)
|
||||
//
|
||||
|
||||
#include "vfs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib/gslist.h>
|
||||
#include <glib/gdir.h>
|
||||
#include <glib/gstrfuncs.h>
|
||||
|
||||
#include "qerplugin.h"
|
||||
#include "idatastream.h"
|
||||
#include "iarchive.h"
|
||||
ArchiveModules& FileSystemQ3API_getArchiveModules();
|
||||
#include "ifilesystem.h"
|
||||
|
||||
#include "generic/callback.h"
|
||||
#include "string/string.h"
|
||||
#include "stream/stringstream.h"
|
||||
#include "os/path.h"
|
||||
#include "moduleobservers.h"
|
||||
|
||||
|
||||
#define VFS_MAXDIRS 8
|
||||
|
||||
#if defined(WIN32)
|
||||
#define PATH_MAX 260
|
||||
#endif
|
||||
|
||||
#define gamemode_get GlobalRadiant().getGameMode
|
||||
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// Global variables
|
||||
|
||||
Archive* OpenArchive(const char* name);
|
||||
|
||||
struct archive_entry_t
|
||||
{
|
||||
CopiedString name;
|
||||
Archive* archive;
|
||||
bool is_pakfile;
|
||||
};
|
||||
|
||||
#include <list>
|
||||
|
||||
typedef std::list<archive_entry_t> archives_t;
|
||||
|
||||
static archives_t g_archives;
|
||||
static char g_strDirs[VFS_MAXDIRS][PATH_MAX+1];
|
||||
static int g_numDirs;
|
||||
static bool g_bUsePak = true;
|
||||
|
||||
ModuleObservers g_observers;
|
||||
|
||||
// =============================================================================
|
||||
// Static functions
|
||||
|
||||
static void AddSlash (char *str)
|
||||
{
|
||||
std::size_t n = strlen (str);
|
||||
if (n > 0)
|
||||
{
|
||||
if (str[n-1] != '\\' && str[n-1] != '/')
|
||||
{
|
||||
globalErrorStream() << "WARNING: directory path does not end with separator: " << str << "\n";
|
||||
strcat (str, "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void FixDOSName (char *src)
|
||||
{
|
||||
if (src == 0 || strchr(src, '\\') == 0)
|
||||
return;
|
||||
|
||||
globalErrorStream() << "WARNING: invalid path separator '\\': " << src << "\n";
|
||||
|
||||
while (*src)
|
||||
{
|
||||
if (*src == '\\')
|
||||
*src = '/';
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const _QERArchiveTable* GetArchiveTable(ArchiveModules& archiveModules, const char* ext)
|
||||
{
|
||||
StringOutputStream tmp(16);
|
||||
tmp << LowerCase(ext);
|
||||
return archiveModules.findModule(tmp.c_str());
|
||||
}
|
||||
static void InitPakFile (ArchiveModules& archiveModules, const char *filename)
|
||||
{
|
||||
const _QERArchiveTable* table = GetArchiveTable(archiveModules, path_get_extension(filename));
|
||||
|
||||
if(table != 0)
|
||||
{
|
||||
archive_entry_t entry;
|
||||
entry.name = filename;
|
||||
entry.archive = table->m_pfnOpenArchive(filename);
|
||||
entry.is_pakfile = true;
|
||||
g_archives.push_back(entry);
|
||||
globalOutputStream() << " pak file: " << filename << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
inline void pathlist_prepend_unique(GSList*& pathlist, char* path)
|
||||
{
|
||||
if(g_slist_find_custom(pathlist, path, (GCompareFunc)path_compare) == 0)
|
||||
{
|
||||
pathlist = g_slist_prepend(pathlist, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free(path);
|
||||
}
|
||||
}
|
||||
|
||||
class DirectoryListVisitor : public Archive::Visitor
|
||||
{
|
||||
GSList*& m_matches;
|
||||
const char* m_directory;
|
||||
public:
|
||||
DirectoryListVisitor(GSList*& matches, const char* directory)
|
||||
: m_matches(matches), m_directory(directory)
|
||||
{}
|
||||
void visit(const char* name)
|
||||
{
|
||||
const char* subname = path_make_relative(name, m_directory);
|
||||
if(subname != name)
|
||||
{
|
||||
if(subname[0] == '/')
|
||||
++subname;
|
||||
char* dir = g_strdup(subname);
|
||||
char* last_char = dir + strlen(dir);
|
||||
if(last_char != dir && *(--last_char) == '/')
|
||||
*last_char = '\0';
|
||||
pathlist_prepend_unique(m_matches, dir);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class FileListVisitor : public Archive::Visitor
|
||||
{
|
||||
GSList*& m_matches;
|
||||
const char* m_directory;
|
||||
const char* m_extension;
|
||||
public:
|
||||
FileListVisitor(GSList*& matches, const char* directory, const char* extension)
|
||||
: m_matches(matches), m_directory(directory), m_extension(extension)
|
||||
{}
|
||||
void visit(const char* name)
|
||||
{
|
||||
const char* subname = path_make_relative(name, m_directory);
|
||||
if(subname != name)
|
||||
{
|
||||
if(subname[0] == '/')
|
||||
++subname;
|
||||
if(m_extension[0] == '*' || extension_equal(path_get_extension(subname), m_extension))
|
||||
pathlist_prepend_unique(m_matches, g_strdup (subname));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static GSList* GetListInternal (const char *refdir, const char *ext, bool directories, std::size_t depth)
|
||||
{
|
||||
GSList* files = 0;
|
||||
|
||||
ASSERT_MESSAGE(refdir[strlen(refdir) - 1] == '/', "search path does not end in '/'");
|
||||
|
||||
if(directories)
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
DirectoryListVisitor visitor(files, refdir);
|
||||
(*i).archive->forEachFile(Archive::VisitorFunc(visitor, Archive::eDirectories, depth), refdir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
FileListVisitor visitor(files, refdir, ext);
|
||||
(*i).archive->forEachFile(Archive::VisitorFunc(visitor, Archive::eFiles, depth), refdir);
|
||||
}
|
||||
}
|
||||
|
||||
files = g_slist_reverse(files);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
inline int ascii_to_upper(int c)
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
{
|
||||
return c - ('a' - 'A');
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*!
|
||||
This behaves identically to stricmp(a,b), except that ASCII chars
|
||||
[\]^`_ come AFTER alphabet chars instead of before. This is because
|
||||
it converts all alphabet chars to uppercase before comparison,
|
||||
while stricmp converts them to lowercase.
|
||||
*/
|
||||
static int string_compare_nocase_upper(const char* a, const char* b)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
int c1 = ascii_to_upper(*a++);
|
||||
int c2 = ascii_to_upper(*b++);
|
||||
|
||||
if (c1 < c2)
|
||||
{
|
||||
return -1; // a < b
|
||||
}
|
||||
if (c1 > c2)
|
||||
{
|
||||
return 1; // a > b
|
||||
}
|
||||
if(c1 == 0)
|
||||
{
|
||||
return 0; // a == b
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Arnout: note - sort pakfiles in reverse order. This ensures that
|
||||
// later pakfiles override earlier ones. This because the vfs module
|
||||
// returns a filehandle to the first file it can find (while it should
|
||||
// return the filehandle to the file in the most overriding pakfile, the
|
||||
// last one in the list that is).
|
||||
|
||||
//!\todo Analyse the code in rtcw/q3 to see which order it sorts pak files.
|
||||
class PakLess
|
||||
{
|
||||
public:
|
||||
bool operator()(const CopiedString& self, const CopiedString& other) const
|
||||
{
|
||||
return string_compare_nocase_upper(self.c_str(), other.c_str()) > 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<CopiedString, PakLess> Archives;
|
||||
|
||||
// =============================================================================
|
||||
// Global functions
|
||||
|
||||
// reads all pak files from a dir
|
||||
void InitDirectory(const char* directory, ArchiveModules& archiveModules)
|
||||
{
|
||||
if (g_numDirs == (VFS_MAXDIRS-1))
|
||||
return;
|
||||
|
||||
strncpy(g_strDirs[g_numDirs], directory, PATH_MAX);
|
||||
g_strDirs[g_numDirs][PATH_MAX] = '\0';
|
||||
FixDOSName (g_strDirs[g_numDirs]);
|
||||
AddSlash (g_strDirs[g_numDirs]);
|
||||
|
||||
const char* path = g_strDirs[g_numDirs];
|
||||
|
||||
g_numDirs++;
|
||||
|
||||
{
|
||||
archive_entry_t entry;
|
||||
entry.name = path;
|
||||
entry.archive = OpenArchive(path);
|
||||
entry.is_pakfile = false;
|
||||
g_archives.push_back(entry);
|
||||
}
|
||||
|
||||
if (g_bUsePak)
|
||||
{
|
||||
GDir* dir = g_dir_open (path, 0, 0);
|
||||
|
||||
if (dir != 0)
|
||||
{
|
||||
globalOutputStream() << "vfs directory: " << path << "\n";
|
||||
|
||||
const char* ignore_prefix = "";
|
||||
const char* override_prefix = "";
|
||||
|
||||
{
|
||||
// See if we are in "sp" or "mp" mapping mode
|
||||
const char* gamemode = gamemode_get();
|
||||
|
||||
if (strcmp (gamemode, "sp") == 0)
|
||||
{
|
||||
ignore_prefix = "mp_";
|
||||
override_prefix = "sp_";
|
||||
}
|
||||
else if (strcmp (gamemode, "mp") == 0)
|
||||
{
|
||||
ignore_prefix = "sp_";
|
||||
override_prefix = "mp_";
|
||||
}
|
||||
}
|
||||
|
||||
Archives archives;
|
||||
Archives archivesOverride;
|
||||
for(;;)
|
||||
{
|
||||
const char* name = g_dir_read_name(dir);
|
||||
if(name == 0)
|
||||
break;
|
||||
|
||||
char *ext = strrchr (name, '.');
|
||||
if ((ext == 0) || *(++ext) == '\0' || GetArchiveTable(archiveModules, ext) == 0)
|
||||
continue;
|
||||
|
||||
// using the same kludge as in engine to ensure consistency
|
||||
if(!string_empty(ignore_prefix) && strncmp(name, ignore_prefix, strlen(ignore_prefix)) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(!string_empty(override_prefix) && strncmp(name, override_prefix, strlen(override_prefix)) == 0)
|
||||
{
|
||||
archivesOverride.insert(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
archives.insert(name);
|
||||
}
|
||||
|
||||
g_dir_close (dir);
|
||||
|
||||
// add the entries to the vfs
|
||||
for(Archives::iterator i = archivesOverride.begin(); i != archivesOverride.end(); ++i)
|
||||
{
|
||||
char filename[PATH_MAX];
|
||||
strcpy(filename, path);
|
||||
strcat(filename, (*i).c_str());
|
||||
InitPakFile(archiveModules, filename);
|
||||
}
|
||||
for(Archives::iterator i = archives.begin(); i != archives.end(); ++i)
|
||||
{
|
||||
char filename[PATH_MAX];
|
||||
strcpy(filename, path);
|
||||
strcat(filename, (*i).c_str());
|
||||
InitPakFile(archiveModules, filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "vfs directory not found: " << path << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// frees all memory that we allocated
|
||||
// FIXME TTimo this should be improved so that we can shutdown and restart the VFS without exiting Radiant?
|
||||
// (for instance when modifying the project settings)
|
||||
void Shutdown()
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
(*i).archive->release();
|
||||
}
|
||||
g_archives.clear();
|
||||
|
||||
g_numDirs = 0;
|
||||
}
|
||||
|
||||
#define VFS_SEARCH_PAK 0x1
|
||||
#define VFS_SEARCH_DIR 0x2
|
||||
|
||||
int GetFileCount (const char *filename, int flag)
|
||||
{
|
||||
int count = 0;
|
||||
char fixed[PATH_MAX+1];
|
||||
|
||||
strncpy(fixed, filename, PATH_MAX);
|
||||
fixed[PATH_MAX] = '\0';
|
||||
FixDOSName (fixed);
|
||||
|
||||
if(!flag)
|
||||
flag = VFS_SEARCH_PAK | VFS_SEARCH_DIR;
|
||||
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
if((*i).is_pakfile && (flag & VFS_SEARCH_PAK) != 0
|
||||
|| !(*i).is_pakfile && (flag & VFS_SEARCH_DIR) != 0)
|
||||
{
|
||||
if((*i).archive->containsFile(fixed))
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
ArchiveFile* OpenFile(const char* filename)
|
||||
{
|
||||
ASSERT_MESSAGE(strchr(filename, '\\') == 0, "path contains invalid separator '\\': \"" << filename << "\"");
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
ArchiveFile* file = (*i).archive->openFile(filename);
|
||||
if(file != 0)
|
||||
{
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ArchiveTextFile* OpenTextFile(const char* filename)
|
||||
{
|
||||
ASSERT_MESSAGE(strchr(filename, '\\') == 0, "path contains invalid separator '\\': \"" << filename << "\"");
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
ArchiveTextFile* file = (*i).archive->openTextFile(filename);
|
||||
if(file != 0)
|
||||
{
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NOTE: when loading a file, you have to allocate one extra byte and set it to \0
|
||||
std::size_t LoadFile (const char *filename, void **bufferptr, int index)
|
||||
{
|
||||
char fixed[PATH_MAX+1];
|
||||
|
||||
strncpy (fixed, filename, PATH_MAX);
|
||||
fixed[PATH_MAX] = '\0';
|
||||
FixDOSName (fixed);
|
||||
|
||||
ArchiveFile* file = OpenFile(fixed);
|
||||
|
||||
if(file != 0)
|
||||
{
|
||||
*bufferptr = malloc (file->size()+1);
|
||||
// we need to end the buffer with a 0
|
||||
((char*) (*bufferptr))[file->size()] = 0;
|
||||
|
||||
std::size_t length = file->getInputStream().read((InputStream::byte_type*)*bufferptr, file->size());
|
||||
file->release();
|
||||
return length;
|
||||
}
|
||||
|
||||
*bufferptr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FreeFile (void *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
GSList* GetFileList (const char *dir, const char *ext, std::size_t depth)
|
||||
{
|
||||
return GetListInternal (dir, ext, false, depth);
|
||||
}
|
||||
|
||||
GSList* GetDirList (const char *dir, std::size_t depth)
|
||||
{
|
||||
return GetListInternal (dir, 0, true, depth);
|
||||
}
|
||||
|
||||
void ClearFileDirList (GSList **lst)
|
||||
{
|
||||
while (*lst)
|
||||
{
|
||||
g_free ((*lst)->data);
|
||||
*lst = g_slist_remove (*lst, (*lst)->data);
|
||||
}
|
||||
}
|
||||
|
||||
const char* FindFile(const char* relative)
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
if(!(*i).is_pakfile && (*i).archive->containsFile(relative))
|
||||
{
|
||||
return (*i).name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* FindPath(const char* absolute)
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
if(!(*i).is_pakfile && path_equal_n(absolute, (*i).name.c_str(), string_length((*i).name.c_str())))
|
||||
{
|
||||
return (*i).name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
class Quake3FileSystem : public VirtualFileSystem
|
||||
{
|
||||
public:
|
||||
void initDirectory(const char *path)
|
||||
{
|
||||
InitDirectory(path, FileSystemQ3API_getArchiveModules());
|
||||
}
|
||||
void initialise()
|
||||
{
|
||||
globalOutputStream() << "filesystem initialised\n";
|
||||
g_observers.realise();
|
||||
}
|
||||
void shutdown()
|
||||
{
|
||||
g_observers.unrealise();
|
||||
globalOutputStream() << "filesystem shutdown\n";
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
int getFileCount(const char *filename, int flags)
|
||||
{
|
||||
return GetFileCount(filename, flags);
|
||||
}
|
||||
ArchiveFile* openFile(const char* filename)
|
||||
{
|
||||
return OpenFile(filename);
|
||||
}
|
||||
ArchiveTextFile* openTextFile(const char* filename)
|
||||
{
|
||||
return OpenTextFile(filename);
|
||||
}
|
||||
std::size_t loadFile(const char *filename, void **buffer)
|
||||
{
|
||||
return LoadFile(filename, buffer, 0);
|
||||
}
|
||||
void freeFile(void *p)
|
||||
{
|
||||
FreeFile(p);
|
||||
}
|
||||
|
||||
void forEachDirectory(const char* basedir, const FileNameCallback& callback, std::size_t depth)
|
||||
{
|
||||
GSList* list = GetDirList(basedir, depth);
|
||||
|
||||
for(GSList* i = list; i != 0; i = g_slist_next(i))
|
||||
{
|
||||
callback(reinterpret_cast<const char*>((*i).data));
|
||||
}
|
||||
|
||||
ClearFileDirList(&list);
|
||||
}
|
||||
void forEachFile(const char* basedir, const char* extension, const FileNameCallback& callback, std::size_t depth)
|
||||
{
|
||||
GSList* list = GetFileList(basedir, extension, depth);
|
||||
|
||||
for(GSList* i = list; i != 0; i = g_slist_next(i))
|
||||
{
|
||||
const char* name = reinterpret_cast<const char*>((*i).data);
|
||||
if(extension_equal(path_get_extension(name), extension))
|
||||
{
|
||||
callback(name);
|
||||
}
|
||||
}
|
||||
|
||||
ClearFileDirList(&list);
|
||||
}
|
||||
GSList* getDirList(const char *basedir)
|
||||
{
|
||||
return GetDirList(basedir, 1);
|
||||
}
|
||||
GSList* getFileList(const char *basedir, const char *extension)
|
||||
{
|
||||
return GetFileList(basedir, extension, 1);
|
||||
}
|
||||
void clearFileDirList(GSList **lst)
|
||||
{
|
||||
ClearFileDirList(lst);
|
||||
}
|
||||
|
||||
const char* findFile(const char *name)
|
||||
{
|
||||
return FindFile(name);
|
||||
}
|
||||
const char* findRoot(const char *name)
|
||||
{
|
||||
return FindPath(name);
|
||||
}
|
||||
|
||||
void attach(ModuleObserver& observer)
|
||||
{
|
||||
g_observers.attach(observer);
|
||||
}
|
||||
void detach(ModuleObserver& observer)
|
||||
{
|
||||
g_observers.detach(observer);
|
||||
}
|
||||
|
||||
Archive* getArchive(const char* archiveName)
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
if((*i).is_pakfile)
|
||||
{
|
||||
if(path_equal((*i).name.c_str(), archiveName))
|
||||
{
|
||||
return (*i).archive;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void forEachArchive(const ArchiveNameCallback& callback)
|
||||
{
|
||||
for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
|
||||
{
|
||||
if((*i).is_pakfile)
|
||||
{
|
||||
callback((*i).name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Quake3FileSystem g_Quake3FileSystem;
|
||||
|
||||
void FileSystem_Init()
|
||||
{
|
||||
}
|
||||
|
||||
void FileSystem_Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
VirtualFileSystem& GetFileSystem()
|
||||
{
|
||||
return g_Quake3FileSystem;
|
||||
}
|
||||
39
plugins/vfspk3/vfs.h
Normal file
39
plugins/vfspk3/vfs.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright (c) 2001, Loki software, inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
Neither the name of Loki software nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_VFS_H)
|
||||
#define INCLUDED_VFS_H
|
||||
|
||||
void FileSystem_Init();
|
||||
void FileSystem_Shutdown();
|
||||
class VirtualFileSystem;
|
||||
VirtualFileSystem& GetFileSystem();
|
||||
|
||||
#endif
|
||||
88
plugins/vfspk3/vfspk3.cpp
Normal file
88
plugins/vfspk3/vfspk3.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GtkRadiant is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "vfspk3.h"
|
||||
|
||||
#include "qerplugin.h"
|
||||
#include "iarchive.h"
|
||||
#include "ifilesystem.h"
|
||||
|
||||
#include "modulesystem/singletonmodule.h"
|
||||
#include "modulesystem/modulesmap.h"
|
||||
|
||||
#include "vfs.h"
|
||||
|
||||
class FileSystemDependencies : public GlobalRadiantModuleRef
|
||||
{
|
||||
ArchiveModulesRef m_archive_modules;
|
||||
public:
|
||||
FileSystemDependencies() :
|
||||
m_archive_modules(GlobalRadiant().getRequiredGameDescriptionKeyValue("archivetypes"))
|
||||
{
|
||||
}
|
||||
ArchiveModules& getArchiveModules()
|
||||
{
|
||||
return m_archive_modules.get();
|
||||
}
|
||||
};
|
||||
|
||||
class FileSystemQ3API
|
||||
{
|
||||
VirtualFileSystem* m_filesystemq3;
|
||||
public:
|
||||
typedef VirtualFileSystem Type;
|
||||
STRING_CONSTANT(Name, "*");
|
||||
|
||||
FileSystemQ3API()
|
||||
{
|
||||
FileSystem_Init();
|
||||
m_filesystemq3 = &GetFileSystem();
|
||||
}
|
||||
~FileSystemQ3API()
|
||||
{
|
||||
FileSystem_Shutdown();
|
||||
}
|
||||
VirtualFileSystem* getTable()
|
||||
{
|
||||
return m_filesystemq3;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SingletonModule<FileSystemQ3API, FileSystemDependencies> FileSystemQ3Module;
|
||||
|
||||
FileSystemQ3Module g_FileSystemQ3Module;
|
||||
|
||||
ArchiveModules& FileSystemQ3API_getArchiveModules()
|
||||
{
|
||||
return g_FileSystemQ3Module.getDependencies().getArchiveModules();
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
|
||||
{
|
||||
GlobalErrorStream::instance().setOutputStream(server.getErrorStream());
|
||||
GlobalOutputStream::instance().setOutputStream(server.getOutputStream());
|
||||
GlobalDebugMessageHandler::instance().setHandler(server.getDebugMessageHandler());
|
||||
GlobalModuleServer::instance().set(server);
|
||||
|
||||
g_FileSystemQ3Module.selfRegister();
|
||||
}
|
||||
146
plugins/vfspk3/vfspk3.dsp
Normal file
146
plugins/vfspk3/vfspk3.dsp
Normal file
@@ -0,0 +1,146 @@
|
||||
# Microsoft Developer Studio Project File - Name="vfspk3" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=vfspk3 - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "vfspk3.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "vfspk3.mak" CFG="vfspk3 - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "vfspk3 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "vfspk3 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName "vfspk3"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "vfspk3 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE F90 /compile_only /include:"Release/" /libs:dll /nologo /warn:nofileopt /dll
|
||||
# ADD F90 /compile_only /include:"Release/" /libs:dll /nologo /warn:nofileopt /dll
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFSPK3_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\common" /I "..\..\libs" /I "..\..\..\STLPort\stlport" /I "..\..\..\libxml2\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFSPK3_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 glib-2.0.lib /nologo /dll /machine:I386 /def:".\vfspk3.def" /libpath:"..\..\..\gtk2-win32\lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=Copy to dir...
|
||||
PostBuild_Cmds=copy Release\vfspk3.dll "../../install/modules"
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "vfspk3 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE F90 /check:bounds /compile_only /debug:full /include:"Debug/" /libs:dll /nologo /warn:argument_checking /warn:nofileopt /dll
|
||||
# ADD F90 /check:bounds /compile_only /debug:full /include:"Debug/" /libs:dll /nologo /warn:argument_checking /warn:nofileopt /dll
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFSPK3_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\common" /I "..\..\libs" /I "..\..\..\STLPort\stlport" /I "..\..\..\libxml2\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFSPK3_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 glib-2.0.lib /nologo /dll /debug /machine:I386 /def:".\vfspk3.def" /pdbtype:sept /libpath:"..\..\..\gtk2-win32\lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=Copy to dir...
|
||||
PostBuild_Cmds=copy Debug\vfspk3.dll "../../install/modules"
|
||||
# End Special Build Tool
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "vfspk3 - Win32 Release"
|
||||
# Name "vfspk3 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\archive.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vfs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vfspk3.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vfspk3.def
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vfs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vfspk3.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
25
plugins/vfspk3/vfspk3.h
Normal file
25
plugins/vfspk3/vfspk3.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GtkRadiant is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_VFSPK3_H)
|
||||
#define INCLUDED_VFSPK3_H
|
||||
|
||||
#endif
|
||||
BIN
plugins/vfspk3/vfspk3.proj
Normal file
BIN
plugins/vfspk3/vfspk3.proj
Normal file
Binary file not shown.
7
plugins/vfspk3/vfsq3.def
Normal file
7
plugins/vfspk3/vfsq3.def
Normal file
@@ -0,0 +1,7 @@
|
||||
; vfsq3.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "VFSQ3"
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
Radiant_RegisterModules @1
|
||||
216
plugins/vfspk3/vfsq3.vcproj
Normal file
216
plugins/vfspk3/vfsq3.vcproj
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="vfsq3"
|
||||
ProjectGUID="{0BB50F1C-E139-48A2-B9D8-1E781275777F}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../include;../../libs;"../../../STLPort-4.6/stlport";"../../../gtk2-2.4/include/glib-2.0";"../../../gtk2-2.4/lib/glib-2.0/include""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;VFSQ3_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
MinimalRebuild="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="FALSE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
BrowseInformation="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="glib-2.0.lib"
|
||||
OutputFile="$(OutDir)/vfsq3.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../gtk2-2.4/lib""
|
||||
IgnoreDefaultLibraryNames="msvcprtd.lib"
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/vfsq3.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/vfsq3.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(SolutionDir)install\modules"
|
||||
copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)install\modules""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OptimizeForWindowsApplication="FALSE"
|
||||
AdditionalIncludeDirectories="../../include;../../libs;"../../../STLPort-4.6/stlport";"../../../gtk2-2.4/include/glib-2.0";"../../../gtk2-2.4/lib/glib-2.0/include""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;VFSQ3_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="glib-2.0.lib"
|
||||
OutputFile="$(OutDir)/vfsq3.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../gtk2-2.4/lib""
|
||||
IgnoreDefaultLibraryNames="msvcprt.lib"
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/vfsq3.lib"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="0"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(SolutionDir)install\modules"
|
||||
copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)install\modules""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\vfspk3.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vfspk3.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="modules"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\archive.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\archive.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vfs.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vfs.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\debug.py">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="python "$(SolutionDir)debug.py""
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetName).pdb""
|
||||
Outputs=""$(TargetDir)$(TargetName).pdb""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="python "$(SolutionDir)debug.py""
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetName).pdb""
|
||||
Outputs=""$(TargetDir)$(TargetName).pdb""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vfsq3.def">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Performing Custom Build Step"
|
||||
CommandLine="python "$(SolutionDir)touch.py""
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetFileName)""
|
||||
Outputs=""$(TargetPath)""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Performing Custom Build Step"
|
||||
CommandLine="python "$(SolutionDir)touch.py""
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetFileName)""
|
||||
Outputs=""$(TargetPath)""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
Reference in New Issue
Block a user