43 :
VFSSource(vfs), m_datpath(file), m_data(vfs->open(file)), m_filelist() {
46 <<
"loading: " << file
47 <<
" filesize: " <<
m_data->getDataLength());
54 <<
"FileListLength: " << fileListLength
55 <<
" ArchiveSize: " << archiveSize);
57 if (archiveSize !=
m_data->getDataLength())
58 throw InvalidFormat(
"size mismatch");
60 m_data->setIndex( archiveSize - fileListLength - 8);
89 while( load_per_cycle-- ) {
121 throw NotFound(name);
132 std::string name = path;
135 if (name.find(
"./") == 0) {
139 type_filelist::const_iterator i =
m_filelist.find(name);
145 <<
"Missing '" << name
157 return list(pathstr,
false);
161 return list(pathstr,
true);
164 std::set<std::string>
DAT2::list(
const std::string& pathstr,
bool dirs)
const {
165 std::set<std::string>
list;
166 std::string path = pathstr;
176 if (path.find(
"./") == 0) {
180 size_t lastIndex = path.size();
181 if (lastIndex != 0 && path[lastIndex-1] !=
'/') {
185 type_filelist::const_iterator end =
m_filelist.end();
186 for (type_filelist::const_iterator i =
m_filelist.begin(); i != end; ++i) {
187 const std::string& file = i->first;
188 if (file.find(path) == 0) {
189 std::string cleanedfile = file.substr(path.size(), file.size());
190 bool isdir = cleanedfile.find(
'/') != std::string::npos;
193 cleanedfile = cleanedfile.substr(0, cleanedfile.find(
'/'));
194 if (cleanedfile.find(
'/') != cleanedfile.rfind(
'/')) {
201 list.insert(cleanedfile);
uint32_t m_filecount
number of file entries to read
std::set< std::string > listFiles(const std::string &pathstr) const
list all files in a directory of this source
The needed information for the extraction.
Timer m_timer
lazy loading timer
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
const RawDataDAT2::s_info & getInfo(const std::string &name) const
Get Information needed to unpack and extract data.
VFSSource abstract baseclass.
static Logger _log(LM_AUDIO)
void readFileEntry() const
read a bunch of file entries
void setInterval(int32_t msec)
Set the interval in milliseconds.
std::set< std::string > listDirectories(const std::string &pathstr) const
list all directories in a directory of this source
void start()
Start the timer.
std::set< std::string > list(const std::string &pathstr, bool dirs) const
VFS * getVFS() const
get the VFS this source is associated with.
type_filelist::const_iterator findFileEntry(const std::string &name) const
find a file entry
A subclass of RawDataMemSource, that fills itself with a FALLOUT1 .DAT file entry.
bool fileExists(const std::string &name) const
check if the given file exists
RawData * open(const std::string &file) const
open a file inside this source
std::unique_ptr< RawData > m_data
uint32_t m_currentIndex
current index in file
#define FL_LOG(logger, msg)
void stop()
Stop the timer.
the main VFS (virtual file system) class
std::string fixPath(std::string path) const
DAT2(VFS *vfs, const std::string &path)
Constructor Create a VFSSource for a Fallout2 DAT file.
void setCallback(const type_callback &callback)
Set the callback that will be called.
Used to access diffrent kinds of data.