diff options
author | Nicola Mettifogo | 2007-02-25 20:35:47 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-02-25 20:35:47 +0000 |
commit | cacff9a9f26eff5111b1f5eef3491ac406f1245d (patch) | |
tree | 389ab1f28c51810e5634b98239319fa097d09a47 /engines/parallaction/disk.h | |
parent | 0c77177ef1d8ffc27710c5b2562069a4e3f6ed02 (diff) | |
download | scummvm-rg350-cacff9a9f26eff5111b1f5eef3491ac406f1245d.tar.gz scummvm-rg350-cacff9a9f26eff5111b1f5eef3491ac406f1245d.tar.bz2 scummvm-rg350-cacff9a9f26eff5111b1f5eef3491ac406f1245d.zip |
wrapped archive routines into a new class named Archive. File-level static variables have been made members of the new class.
svn-id: r25866
Diffstat (limited to 'engines/parallaction/disk.h')
-rw-r--r-- | engines/parallaction/disk.h | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 3b61cd31d1..45663198a1 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -24,6 +24,7 @@ #define PARALLACTION_DISK_H #include "parallaction/defs.h" +#include "common/file.h" namespace Parallaction { @@ -31,17 +32,47 @@ namespace Parallaction { // ARCHIVE MANAGEMENT //------------------------------------------------------ -void openArchive(const char *file); -void closeArchive(); -bool openArchivedFile(const char *name); -void closeArchivedFile(); +#define MAX_ARCHIVE_ENTRIES 384 -uint16 getArchivedFileLength(const char *name); +#define DIRECTORY_OFFSET_IN_FILE 0x4000 -int16 readArchivedFile(void *buffer, uint16 size); -char *readArchivedFileText(char *buf, uint16 size); +class Archive { +protected: + + bool _file; + uint16 _fileIndex; + uint32 _fileOffset; + uint32 _fileCursor; + uint32 _fileEndOffset; + + char _archiveDir[MAX_ARCHIVE_ENTRIES][32]; + uint32 _archiveLenghts[MAX_ARCHIVE_ENTRIES]; + uint32 _archiveOffsets[MAX_ARCHIVE_ENTRIES]; + + Common::File _archive; + +public: + Archive() { + _file = false; + _fileIndex = 0; + _fileOffset = 0; + _fileCursor = 0; + _fileEndOffset = 0; + } + + void open(const char *file); + void close(); + + bool openArchivedFile(const char *name); + void closeArchivedFile(); + + uint16 getArchivedFileLength(const char *name); + + int16 readArchivedFile(void *buffer, uint16 size); + char *readArchivedFileText(char *buf, uint16 size); +}; |