isle-portable/LEGO1/mxdsfile.h
Mark Langen 51ec2c97c6
100% Match of MxDSFile (#51)
* 100% Match of MxDSFile

* ...almost, MxDSFile::Open is still not quite matching but all of the
  other methods are 100% matching.

* Turns out that most of the virtual methods and some of the members are
  actually on the MxDSSource base class, which I've pulled out as part
  of this.

* In order to implement the methods I added the MXIOINFO class, which
  seems to be a thin wrapper around the MMIOINFO windows structure. We
  can tell this because MMIOINFO::~MMIOINFO was included in the DLL
  exports, and calls down to a function which deconstructs something
  looking exactly like MMIOINFO.

* Add mxdssource.cpp

* mattkc feedback

* some accuracy improvements

* Use FOURCC macro

* Tirival solve in mxioinfo.cpp

* Update mxdsfile.cpp

0xFFFFFFFF -> -1

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
2023-06-27 11:44:02 -07:00

46 lines
1.2 KiB
C++

#ifndef MXDSFILE_H
#define MXDSFILE_H
#include "mxcore.h"
#include "mxstring.h"
#include "mxioinfo.h"
#include "mxdssource.h"
class MxDSFile : public MxDSSource
{
public:
__declspec(dllexport) MxDSFile(const char *filename, unsigned long skipReadingChunks);
__declspec(dllexport) virtual ~MxDSFile();
__declspec(dllexport) virtual long Open(unsigned long);
__declspec(dllexport) virtual long Close();
__declspec(dllexport) virtual long Read(unsigned char *,unsigned long);
__declspec(dllexport) virtual long Seek(long,int);
__declspec(dllexport) virtual unsigned long GetBufferSize();
__declspec(dllexport) virtual unsigned long GetStreamBuffersNum();
private:
long ReadChunks();
struct ChunkHeader {
ChunkHeader()
: majorVersion(0)
, minorVersion(0)
, bufferSize(0)
, streamBuffersNum(0)
{}
unsigned short majorVersion;
unsigned short minorVersion;
unsigned long bufferSize;
short streamBuffersNum;
short reserved;
};
MxString m_filename;
MXIOINFO m_io;
ChunkHeader m_header;
// If false, read chunks immediately on open, otherwise
// skip reading chunks until ReadChunks is explicitly called.
unsigned long m_skipReadingChunks;
};
#endif // MXDSFILE_H