Raffaello/sdl2-hyper-sonic-drivers

Reading files from a pointer

Opened this issue · 1 comments

At the moment is only possible to read a file type from a filename.

Audio files might be packed in file like WAD or similar.

To read from those needs to read them from an already positioned file pointer or having read it all in a memory buffer before decoding it.


It is required to add the read a file type within a file container, like a WAD/PAK or whatever using either a "parent file pointer" or a memory buffer and add these methods as a constructor.

It requires to refactor all files types with this functionality.

So to pass a file pointer already positioned at the starting point of the internal file to be read could be done using the parent class File.


As a library when integrating with some other File I/O ops, for example reading a WAD, it is not really efficient to read the WAD and create a File class pointer to pass to the method to be read, but the read it from memory buffer could be the right alternative.

This bring a consideration that other constructors could be implemented instead of using parent class File:
It could use FILE* or fstream types for eg.

just use a memory buffer where the file has been loaded into memory first..