wavelength 1.0.0
Loading...
Searching...
No Matches
arkfile.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/file.h"
4#include "os/string.h"
5
11class ArkFile : public File {
12public:
21 ArkFile(const char *pszFile, int nMode);
22
29 ~ArkFile() override;
30
39 static const char *ArchivePath(const char *pszPath);
40
50 int Read(void *pBuffer, int nBytes) override;
51
61 bool ReadAsync(void *pBuffer, int nBytes) override;
62
72 int Write(const void *pBuffer, int nBytes) override;
73
83 int Seek(int nOffset, int nOrigin) override;
84
92 int Tell() override {
93 return mTell;
94 }
95
102 void Flush() override {
103 }
104
112 bool Eof() override {
113 return mTell == mSize;
114 }
115
123 bool Fail() override {
124 return mFail != 0;
125 }
126
134 int Size() override {
135 return mSize;
136 }
137
145 int UncompressedSize() override {
146 return mUncompressedSize;
147 }
148
157 bool ReadDone(int *pnBytes) override;
158
166 void TaskDone(int nBytes);
167
168private:
169 long long mArkOffset;
170 int mSize;
171 int mUncompressedSize;
172 int mNumOutstanding;
173 int mBytesRead;
174 int mTell;
175 int mFail;
176 String mFilename;
177};
int Tell() override
Report the position.
Definition arkfile.h:92
bool Eof() override
Report whether the position is at the end.
Definition arkfile.h:112
int Seek(int nOffset, int nOrigin) override
Move the position.
int Size() override
Report the size.
Definition arkfile.h:134
void Flush() override
Do nothing.
Definition arkfile.h:102
bool ReadAsync(void *pBuffer, int nBytes) override
Start reading bytes, one task for each block of the disc they cover.
~ArkFile() override
Drop the reads still waiting for the disc.
bool Fail() override
Report whether the file was not found.
Definition arkfile.h:123
int Read(void *pBuffer, int nBytes) override
Read bytes and wait for them.
bool ReadDone(int *pnBytes) override
Advance the disc cache and report whether every task of the read finished.
int UncompressedSize() override
Report the size before compression.
Definition arkfile.h:145
static const char * ArchivePath(const char *pszPath)
Express a path relative to the root of the game files, as the archive records it.
void TaskDone(int nBytes)
Count a finished task of the read.
ArkFile(const char *pszFile, int nMode)
Find a file in the main archive.
int Write(const void *pBuffer, int nBytes) override
Report that an archive file cannot be written.
Open file of the host or the disc.
Definition file.h:29
Growable text buffer that is also a PrnStream.
Definition string.h:19