-
Notifications
You must be signed in to change notification settings - Fork 166
AGS Virtual FileSystem
Both the AGS Engine and Editor can read and write to virtual files that are stored
in packages (like game.ags or audio.vox).
Below is detailed some of the current implementation used.
A stream is a sequence of bytes with a beginning and an end, where the beginning and end may or may not match the beginning and end of a file. We can define an order in which bytes are stored, an assign meaning to ordered groups of ordered bytes to serialize or deserialize information.
[[0 1 [2 3] 4] 5 6 7]
if we consider 0-7 above as each a byte, we can consider the group of bytes enclosed by any bracket pair as a stream
A stream can then be defined in this way from the following parameters:
- Offset, the position where the stream starts in a group of sequential bytes
- Length, which tells us the end of the stream
- Byte array, the actual bytes in the stream
MultiFileLib is a library that is replicated in both on the Editor and on the Common library in the Engine, that enables assigning meaning to a group of bytes in a file as a stream with the following information:
- Filename, used to identify the group of bytes;
- Offset, the location of this stream in the biggest possible stream of the file.
- Length, the byte size of this stream;
- Datafile, the bytes of this stream;
MultiFileLib is used to abstract the contents of packages read by the engine file in a virtual filesystem, without needing to worry on how they are stored using the filename the same way it uses to read files stored directly in the filesystem on disk.