Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(GAMEENGINE_SRC
# Include/Common/BattleHonors.h
# Include/Common/BezFwdIterator.h
# Include/Common/BezierSegment.h
Include/Common/BIGFileSystem.h
# Include/Common/BitFlags.h
# Include/Common/BitFlagsIO.h
# Include/Common/BorderColors.h
Expand Down Expand Up @@ -644,6 +645,7 @@ set(GAMEENGINE_SRC
Source/Common/System/ArchiveFile.cpp
Source/Common/System/ArchiveFileSystem.cpp
Source/Common/System/AsciiString.cpp
Source/Common/System/BIGFileSystem.cpp
# Source/Common/System/BuildAssistant.cpp
# Source/Common/System/CriticalSection.cpp
# Source/Common/System/DataChunk.cpp
Expand Down
26 changes: 16 additions & 10 deletions Core/GameEngine/Include/Common/ArchiveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,32 @@ class File;
class ArchiveFile
{
public:
ArchiveFile();
virtual ~ArchiveFile();
ArchiveFile(AsciiString name, AsciiString path);
~ArchiveFile();

virtual Bool getFileInfo( const AsciiString& filename, FileInfo *fileInfo) const = 0; ///< fill in the fileInfo struct with info about the file requested.
virtual File* openFile( const Char *filename, Int access = 0) = 0; ///< Open the specified file within the archive file
virtual void closeAllFiles() = 0; ///< Close all file opened in this archive file
virtual AsciiString getName() = 0; ///< Returns the name of the archive file
virtual AsciiString getPath() = 0; ///< Returns full path and name of archive file
virtual void setSearchPriority( Int new_priority ) = 0; ///< Set this archive file's search priority
virtual void close() = 0; ///< Close this archive file
Bool getFileInfo( const AsciiString& filename, FileInfo *fileInfo) const; ///< fill in the fileInfo struct with info about the file requested.
File* openFile( const Char *filename, Int access = 0); ///< Open the specified file within the archive file
void closeAllFiles(); ///< Close all file opened in this archive file
AsciiString getName(); ///< Returns the name of the archive file
AsciiString getPath(); ///< Returns full path and name of archive file
void setSearchPriority( Int new_priority ); ///< Set this archive file's search priority
void close(); ///< Close this archive file
void attachFile(File *file);

void getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const;
void getFileListInDirectory(const DetailedArchivedDirectoryInfo *dirInfo, const AsciiString& currentDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const;

void addFile(const AsciiString& path, const ArchivedFileInfo *fileInfo); ///< add this file to our directory tree.

protected:
void getFileListInDirectory(const DetailedArchivedDirectoryInfo *dirInfo, const AsciiString& currentDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const;
const ArchivedFileInfo * getArchivedFileInfo(const AsciiString& filename) const; ///< return the ArchivedFileInfo from the directory tree.

protected:
File *m_file; ///< file pointer to the archive file on disk. Kept open so we don't have to continuously open and close the file all the time.
FileInfo m_fileInfo; ///< file info of the archive file on disk.
AsciiString m_name; ///< archive file name
AsciiString m_path; ///< archive file path

private:
DetailedArchivedDirectoryInfo m_rootDirectory;
};
8 changes: 3 additions & 5 deletions Core/GameEngine/Include/Common/ArchiveFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,9 @@ class ArchiveFileSystem : public SubsystemInterface
void getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories. Scans each Archive file.
Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance = 0) const; ///< see FileSystem.h

virtual Bool loadBigFilesFromDirectory(AsciiString dir, AsciiString fileMask, Bool overwrite = FALSE) = 0;
virtual Bool loadArchiveFilesFromDirectory(AsciiString dir, AsciiString fileMask, Bool overwrite = FALSE) = 0;

// Unprotected this for copy-protection routines
ArchiveFile* getArchiveFile(const AsciiString& filename, FileInstance instance = 0) const;

void loadMods();
virtual void loadMods() = 0;

ArchivedDirectoryInfo* friend_getArchivedDirectoryInfo(const Char* directory);

Expand All @@ -160,6 +157,7 @@ class ArchiveFileSystem : public SubsystemInterface
AsciiString lastToken; ///< Synonymous for file name if the search directory was a file path
};

ArchiveFile* getArchiveFile(const AsciiString& filename, FileInstance instance = 0) const;
ArchivedDirectoryInfoResult getArchivedDirectoryInfo(const Char* directory);

virtual void loadIntoDirectoryTree(ArchiveFile *archiveFile, Bool overwrite = FALSE, Bool sortedByName = FALSE); ///< load the archive file's header information and apply it to the global archive directory tree. sortedByName inserts by archive filename order (addon number convention), ignoring overwrite.
Expand Down
4 changes: 2 additions & 2 deletions Core/GameEngine/Include/Common/AsciiString.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ class AsciiString
/**
conceptually similar to strtok():

extract the next seps-delimited token from the front
extract the next separators-delimited token from the front
of 'this' and copy it into 'token', returning true if a nonempty
token was found. (note that this modifies 'this' as well, stripping
the token off!)
*/
Bool nextToken(AsciiString* token, const char* seps = nullptr);
Bool nextToken(AsciiString* token, const char* separators = nullptr);

/**
return true iff the string is "NONE" (case-insensitive).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
// //
////////////////////////////////////////////////////////////////////////////////

//////// Win32BIGFileSystem.h ///////////////////////////
//////// BIGFileSystem.h ///////////////////////////
// Bryan Cleveland, August 2002
/////////////////////////////////////////////////////////////

#pragma once

#include "Common/ArchiveFileSystem.h"

class Win32BIGFileSystem : public ArchiveFileSystem
class BIGFileSystem : public ArchiveFileSystem
{
public:
Win32BIGFileSystem();
virtual ~Win32BIGFileSystem() override;
BIGFileSystem();
virtual ~BIGFileSystem() override;

virtual void init() override;
virtual void update() override;
Expand All @@ -49,7 +49,9 @@ class Win32BIGFileSystem : public ArchiveFileSystem
virtual void closeArchiveFile(const Char *filename) override;
virtual void closeAllFiles() override; ///< Close all files associated with ArchiveFiles

virtual Bool loadBigFilesFromDirectory(AsciiString dir, AsciiString fileMask, Bool overwrite = FALSE) override;
virtual Bool loadArchiveFilesFromDirectory(AsciiString dir, AsciiString fileMask, Bool overwrite = FALSE) override;

virtual void loadMods() override;
protected:

};
8 changes: 8 additions & 0 deletions Core/GameEngine/Include/Common/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ typedef UnsignedByte FileInstance;

struct FileInfo {

FileInfo()
: sizeHigh(0)
, sizeLow(0)
, timestampHigh(0)
, timestampLow(0)
{
}

Int64 size() const { return (Int64)sizeHigh << 32 | sizeLow; }
Int64 timestamp() const { return (Int64)timestampHigh << 32 | timestampLow; }

Expand Down
4 changes: 2 additions & 2 deletions Core/GameEngine/Include/Common/UnicodeString.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ class UnicodeString
/**
conceptually similar to strtok():

extract the next whitespace-delimited token from the front
extract the next separators-delimited token from the front
of 'this' and copy it into 'token', returning true if a nonempty
token was found. (note that this modifies 'this' as well, stripping
the token off!)
*/
Bool nextToken(UnicodeString* token, UnicodeString delimiters = UnicodeString::TheEmptyString);
Bool nextToken(UnicodeString* token, const WideChar* separators = nullptr);

//
// You might think it would be a good idea to overload the * operator
Expand Down
Loading
Loading