COMMON: Allow IFF containers to have custom header IDs

The IFF format used in the Nancy Drew engine uses a
non-standard id that reads DATA instead of FORM, though
the rest of the format is identical. This commit allows such
nonstandard ids to be used without needing to massage the
data first.
This commit is contained in:
Kaloyan Chehlarski 2023-10-24 19:26:34 +03:00
parent 943fdf0aac
commit fc0988fdfc
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,7 @@
namespace Common {
IFFParser::IFFParser(ReadStream *stream, bool disposeStream) : _stream(stream), _disposeStream(disposeStream) {
IFFParser::IFFParser(ReadStream *stream, bool disposeStream, IFF_ID formHeaderID) : _stream(stream), _disposeStream(disposeStream), _formHeaderID(formHeaderID) {
setInputStream(stream);
}
@ -42,7 +42,7 @@ void IFFParser::setInputStream(ReadStream *stream) {
_chunk.setInputStream(stream);
_formChunk.readHeader();
if (_formChunk.id != ID_FORM) {
if (_formChunk.id != _formHeaderID) {
error("IFFParser input is not a FORM type IFF file");
}
_formSize = _formChunk.size;

View File

@ -67,6 +67,8 @@ page 376) */
/* Amiga Contiguous Bitmap (AmigaBasic) */
#define ID_8SVX MKTAG('8','S','V','X')
/* Amiga 8 bits voice */
#define ID_DATA MKTAG('D','A','T','A')
/* Replaces FORM in Nancy Drew IFFs */
/* generic */
@ -226,6 +228,7 @@ protected:
uint32 _formSize;
IFF_ID _formType;
IFF_ID _formHeaderID;
ReadStream *_stream;
bool _disposeStream;
@ -233,7 +236,7 @@ protected:
void setInputStream(ReadStream *stream);
public:
IFFParser(ReadStream *stream, bool disposeStream = false);
IFFParser(ReadStream *stream, bool disposeStream = false, IFF_ID formHeaderID = ID_FORM);
~IFFParser();
/**