From 2180b2d6b534d3786f89d02fe508c60c68b7ff89 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 19 Nov 2010 17:03:07 +0000 Subject: COMMON: Split common/stream.h into several headers svn-id: r54385 --- engines/agi/agi.cpp | 1 + engines/agi/preagi_winnie.cpp | 1 + engines/agi/sound_2gs.cpp | 5 +- engines/agi/sound_midi.cpp | 1 + engines/agos/res.cpp | 1 + engines/agos/res_snd.cpp | 1 + engines/agos/sound.cpp | 11 +- engines/cine/anim.cpp | 4 +- engines/cine/bg.cpp | 2 +- engines/cine/object.cpp | 2 +- engines/cine/saveload.cpp | 2 +- engines/cine/sound.cpp | 2 +- engines/cruise/dataLoader.cpp | 1 + engines/cruise/overlay.cpp | 2 +- engines/draci/animation.cpp | 2 + engines/draci/barchive.cpp | 2 +- engines/draci/game.cpp | 2 +- engines/draci/screen.cpp | 2 +- engines/draci/script.cpp | 2 +- engines/draci/sound.cpp | 5 +- engines/draci/sprite.cpp | 2 +- engines/draci/walking.cpp | 4 +- engines/gob/dataio.cpp | 2 +- engines/gob/demos/demoplayer.cpp | 1 + engines/gob/map_v1.cpp | 2 +- engines/gob/resources.cpp | 2 +- engines/gob/save/saveconverter.cpp | 1 + engines/gob/save/saveconverter.h | 2 +- engines/gob/save/savefile.cpp | 1 + engines/gob/sound/sounddesc.cpp | 2 +- engines/groovie/music.cpp | 1 + engines/groovie/resource.cpp | 1 + engines/groovie/saveload.cpp | 1 + engines/kyra/resource_intern.cpp | 3 +- engines/kyra/saveload_hof.cpp | 1 + engines/kyra/saveload_lol.cpp | 1 + engines/kyra/saveload_mr.cpp | 1 + engines/kyra/screen.cpp | 1 + engines/lastexpress/data/animation.cpp | 2 +- engines/lastexpress/data/archive.cpp | 1 + engines/lastexpress/data/cursor.cpp | 2 +- engines/lastexpress/data/snd.cpp | 1 + engines/lastexpress/game/savegame.h | 1 + engines/m4/assets.cpp | 4 +- engines/m4/compression.cpp | 6 + engines/m4/compression.h | 4 +- engines/m4/converse.cpp | 1 + engines/m4/graphics.cpp | 2 +- engines/m4/m4.cpp | 2 +- engines/m4/midi.cpp | 2 +- engines/m4/resource.cpp | 2 + engines/m4/script.h | 2 +- engines/m4/woodscript.cpp | 2 + engines/m4/woodscript.h | 2 +- engines/made/database.cpp | 4 +- engines/made/redreader.cpp | 8 +- engines/made/redreader.h | 4 +- engines/made/resource.cpp | 1 + engines/mohawk/bitmap.cpp | 1 + engines/mohawk/livingbooks.h | 1 + engines/mohawk/resource.cpp | 1 + engines/mohawk/riven_saveload.h | 1 + engines/parallaction/disk_ns.cpp | 4 +- engines/parallaction/font.cpp | 6 +- engines/parallaction/parallaction.cpp | 2 +- engines/parallaction/parallaction.h | 2 +- engines/parallaction/parser.cpp | 3 +- engines/parallaction/parser.h | 9 +- engines/queen/resource.cpp | 1 + engines/queen/sound.cpp | 8 +- engines/saga/music.cpp | 1 + engines/saga/saga.h | 2 +- engines/sci/graphics/maciconbar.cpp | 4 +- engines/sci/sound/audio.cpp | 9 +- engines/sci/sound/drivers/amigamac.cpp | 1 + engines/sci/sound/drivers/midi.cpp | 1 + engines/scumm/file.cpp | 2 + engines/scumm/file.h | 1 + engines/scumm/file_nes.h | 1 + engines/scumm/he/cup_player_he.cpp | 1 + engines/scumm/he/resource_he.cpp | 2 +- engines/scumm/he/resource_he.h | 3 - engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 2 +- engines/scumm/saveload.cpp | 1 + engines/scumm/sound.cpp | 6 +- engines/sword1/sound.cpp | 9 +- engines/sword2/console.cpp | 1 + engines/sword2/header.cpp | 293 ++++++++++++++++++++++++++ engines/sword2/header.h | 255 ++-------------------- engines/sword2/icons.cpp | 2 +- engines/sword2/module.mk | 1 + engines/sword2/music.cpp | 2 + engines/sword2/object.h | 2 +- engines/sword2/screen.h | 15 +- engines/sword2/sound.cpp | 1 + engines/sword25/gfx/graphicengine.h | 4 +- engines/sword25/gfx/image/pngloader.cpp | 1 + engines/sword25/gfx/screenshot.cpp | 7 +- engines/sword25/gfx/screenshot.h | 2 +- engines/sword25/kernel/persistenceservice.cpp | 2 +- engines/teenagent/inventory.cpp | 2 +- engines/teenagent/objects.cpp | 2 +- engines/teenagent/pack.cpp | 2 + engines/testbed/midi.cpp | 3 +- engines/testbed/midi.h | 2 +- engines/tinsel/music.cpp | 3 +- engines/tinsel/sound.cpp | 1 + engines/toon/audio.cpp | 2 + engines/toon/resource.cpp | 2 + engines/toon/toon.cpp | 6 + engines/toon/toon.h | 8 +- engines/touche/resource.cpp | 2 +- engines/tucker/resource.cpp | 2 +- 113 files changed, 487 insertions(+), 356 deletions(-) create mode 100644 engines/sword2/header.cpp (limited to 'engines') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index cfe921a91e..885704b9c6 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -27,6 +27,7 @@ #include "common/events.h" #include "common/EventRecorder.h" #include "common/file.h" +#include "common/memstream.h" #include "common/savefile.h" #include "common/config-manager.h" #include "common/debug-channels.h" diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 14d90f3211..643cbd86a9 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -30,6 +30,7 @@ #include "graphics/cursorman.h" #include "common/events.h" +#include "common/memstream.h" #include "common/savefile.h" namespace Agi { diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index 2748344b36..4ed4fb7bab 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -26,6 +26,7 @@ #include "common/config-manager.h" #include "common/fs.h" #include "common/md5.h" +#include "common/memstream.h" #include "common/str-array.h" #include "agi/agi.h" @@ -839,7 +840,7 @@ bool SoundGen2GS::loadInstrumentHeaders(const Common::FSNode &exePath, const IIg } // Read the whole executable file into memory - Common::SharedPtr data(file.readStream(file.size())); + Common::SharedPtr data(file.readStream(file.size())); file.close(); // Check that we got enough data to be able to parse the instruments @@ -891,7 +892,7 @@ bool SoundGen2GS::loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo // Open the wave file and read it into memory file.open(wavePath); - Common::SharedPtr uint8Wave(file.readStream(file.size())); + Common::SharedPtr uint8Wave(file.readStream(file.size())); file.close(); // Check that we got the whole wave file diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp index f7f38a8d55..9011ecaa86 100644 --- a/engines/agi/sound_midi.cpp +++ b/engines/agi/sound_midi.cpp @@ -47,6 +47,7 @@ #include "sound/midiparser.h" #include "common/config-manager.h" #include "common/file.h" +#include "common/memstream.h" #include "common/stream.h" #include "agi/agi.h" diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 5775e71a7a..2d99f7bcef 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -27,6 +27,7 @@ #include "common/file.h" +#include "common/memstream.h" #include "common/util.h" #include "agos/agos.h" diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index e3c13ffcbd..7f11367d0f 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -25,6 +25,7 @@ #include "common/config-manager.h" #include "common/file.h" +#include "common/memstream.h" #include "agos/intern.h" #include "agos/agos.h" diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 8914470370..20deb47be8 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -24,6 +24,7 @@ */ #include "common/file.h" +#include "common/memstream.h" #include "common/util.h" #include "agos/agos.h" @@ -305,7 +306,7 @@ class CompressedSound : public BaseSound { public: CompressedSound(Audio::Mixer *mixer, Common::File *file, uint32 base) : BaseSound(mixer, file, base, false) {} - Common::MemoryReadStream *loadStream(uint sound) const { + Common::SeekableReadStream *loadStream(uint sound) const { if (_offsets == NULL) return NULL; @@ -334,7 +335,7 @@ class MP3Sound : public CompressedSound { public: MP3Sound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {} Audio::AudioStream *makeAudioStream(uint sound) { - Common::MemoryReadStream *tmp = loadStream(sound); + Common::SeekableReadStream *tmp = loadStream(sound); if (!tmp) return NULL; return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES); @@ -350,7 +351,7 @@ class VorbisSound : public CompressedSound { public: VorbisSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {} Audio::AudioStream *makeAudioStream(uint sound) { - Common::MemoryReadStream *tmp = loadStream(sound); + Common::SeekableReadStream *tmp = loadStream(sound); if (!tmp) return NULL; return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES); @@ -366,7 +367,7 @@ class FLACSound : public CompressedSound { public: FLACSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {} Audio::AudioStream *makeAudioStream(uint sound) { - Common::MemoryReadStream *tmp = loadStream(sound); + Common::SeekableReadStream *tmp = loadStream(sound); if (!tmp) return NULL; return Audio::makeFLACStream(tmp, DisposeAfterUse::YES); @@ -775,7 +776,7 @@ void Sound::playVoiceData(byte *soundData, uint sound) { void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) { int size = READ_LE_UINT32(soundData + 4) + 8; - Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundData, size); + Common::SeekableReadStream *stream = new Common::MemoryReadStream(soundData, size); Audio::RewindableAudioStream *sndStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES); convertVolume(vol); diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index 747c9221ee..14b8de9e39 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -28,7 +28,7 @@ */ #include "common/endian.h" -#include "common/stream.h" +#include "common/memstream.h" #include "cine/cine.h" #include "cine/anim.h" @@ -485,7 +485,7 @@ void convert4BBP(byte *dest, const byte *source, int16 width, int16 height) { * @param[out] animHeader Image header reference * @param readS Input stream open for reading */ -void loadAnimHeader(AnimHeaderStruct &animHeader, Common::MemoryReadStream readS) { +void loadAnimHeader(AnimHeaderStruct &animHeader, Common::SeekableReadStream &readS) { animHeader.field_0 = readS.readByte(); animHeader.field_1 = readS.readByte(); animHeader.field_2 = readS.readByte(); diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp index 08722c42e5..449e254021 100644 --- a/engines/cine/bg.cpp +++ b/engines/cine/bg.cpp @@ -25,7 +25,7 @@ #include "common/endian.h" -#include "common/stream.h" +#include "common/memstream.h" #include "cine/cine.h" #include "cine/various.h" diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp index 82dc0a6ef1..2b456ad49d 100644 --- a/engines/cine/object.cpp +++ b/engines/cine/object.cpp @@ -25,7 +25,7 @@ #include "common/endian.h" -#include "common/scummsys.h" +#include "common/memstream.h" #include "common/util.h" #include "cine/cine.h" diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp index 0f7c50b7e5..fd426be66a 100644 --- a/engines/cine/saveload.cpp +++ b/engines/cine/saveload.cpp @@ -801,7 +801,7 @@ bool CineEngine::makeLoad(char *saveName) { // Hopefully devices with more limited memory can also cope with this memory allocation. saveSize = 256 * 1024; } - Common::SharedPtr in(saveFile->readStream(saveSize)); + Common::SharedPtr in(saveFile->readStream(saveSize)); // Try to detect the used savegame format enum CineSaveGameFormat saveGameFormat = detectSaveGameFormat(*in); diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index dd4b4d4ab4..7ba084128b 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -25,7 +25,7 @@ #include "common/endian.h" #include "common/file.h" -#include "common/system.h" +#include "common/memstream.h" #include "cine/cine.h" #include "cine/sound.h" diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp index b48240b30e..03a2117f07 100644 --- a/engines/cruise/dataLoader.cpp +++ b/engines/cruise/dataLoader.cpp @@ -25,6 +25,7 @@ #include "cruise/cruise_main.h" #include "common/endian.h" +#include "common/memstream.h" namespace Cruise { diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index 01920fa8f1..9a77891deb 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -23,7 +23,7 @@ * */ -#include "common/stream.h" +#include "common/memstream.h" #include "cruise/cruise.h" #include "cruise/cruise_main.h" diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index 2bedbe1801..d7582ec31d 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -31,6 +31,8 @@ #include "draci/sound.h" #include "draci/surface.h" +#include "common/memstream.h" + namespace Draci { Animation::Animation(DraciEngine *vm, int id, uint z, bool playing) : _vm(vm) { diff --git a/engines/draci/barchive.cpp b/engines/draci/barchive.cpp index 8f9e836ba3..5307e04250 100644 --- a/engines/draci/barchive.cpp +++ b/engines/draci/barchive.cpp @@ -25,7 +25,7 @@ #include "common/debug.h" #include "common/str.h" -#include "common/stream.h" +#include "common/memstream.h" #include "draci/barchive.h" #include "draci/draci.h" diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index cb2832552a..eef81d808e 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -25,7 +25,7 @@ #include "common/keyboard.h" #include "common/serializer.h" -#include "common/stream.h" +#include "common/memstream.h" #include "common/system.h" #include "common/util.h" diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp index 9e91a14cfc..987bbf2ac1 100644 --- a/engines/draci/screen.cpp +++ b/engines/draci/screen.cpp @@ -23,7 +23,7 @@ * */ -#include "common/stream.h" +#include "common/memstream.h" #include "common/system.h" #include "draci/draci.h" diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 583afa736f..2a27541ad9 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -25,7 +25,7 @@ #include "common/array.h" #include "common/debug.h" -#include "common/stream.h" +#include "common/memstream.h" #include "common/stack.h" #include "draci/draci.h" diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp index 6828066c3a..af096256ea 100644 --- a/engines/draci/sound.cpp +++ b/engines/draci/sound.cpp @@ -28,7 +28,8 @@ #include "common/debug.h" #include "common/file.h" #include "common/str.h" -#include "common/stream.h" +#include "common/substream.h" +#include "common/memstream.h" #include "common/unzip.h" #include "draci/sound.h" @@ -301,7 +302,7 @@ uint Sound::playSoundBuffer(Audio::SoundHandle *handle, const SoundSample &buffe // only used for dubbing, which is only played from one place in // script.cpp, which blocks until the dubbed sentence has finished // playing. - Common::SeekableReadStream* stream; + Common::SeekableReadStream *stream; const int skip = buffer._format == RAW80 ? 80 : 0; if (buffer._stream) { stream = new Common::SeekableSubReadStream( diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index cb3aa58cfa..65c6e21ee4 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -23,7 +23,7 @@ * */ -#include "common/stream.h" +#include "common/memstream.h" #include "draci/draci.h" #include "draci/font.h" diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index 02612832d2..c6f9a58a85 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -23,9 +23,7 @@ * */ -#include - -#include "common/stream.h" +#include "common/memstream.h" #include "draci/draci.h" #include "draci/animation.h" diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp index e409025fc3..b145441b4a 100644 --- a/engines/gob/dataio.cpp +++ b/engines/gob/dataio.cpp @@ -25,7 +25,7 @@ #include "common/endian.h" #include "common/types.h" -#include "common/stream.h" +#include "common/memstream.h" #include "gob/gob.h" #include "gob/dataio.h" diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp index 011c524798..9013f600a5 100644 --- a/engines/gob/demos/demoplayer.cpp +++ b/engines/gob/demos/demoplayer.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" #include "common/file.h" +#include "common/memstream.h" #include "gob/gob.h" #include "gob/demos/demoplayer.h" diff --git a/engines/gob/map_v1.cpp b/engines/gob/map_v1.cpp index 3df1cb8512..372f501887 100644 --- a/engines/gob/map_v1.cpp +++ b/engines/gob/map_v1.cpp @@ -23,7 +23,7 @@ * */ -#include "common/stream.h" +#include "common/memstream.h" #include "gob/gob.h" #include "gob/map.h" diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp index 9b0cc39215..56941aa4c1 100644 --- a/engines/gob/resources.cpp +++ b/engines/gob/resources.cpp @@ -25,7 +25,7 @@ #include "common/util.h" #include "common/endian.h" -#include "common/stream.h" +#include "common/memstream.h" #include "gob/gob.h" #include "gob/resources.h" diff --git a/engines/gob/save/saveconverter.cpp b/engines/gob/save/saveconverter.cpp index 7bfb2a2da2..59d313138b 100644 --- a/engines/gob/save/saveconverter.cpp +++ b/engines/gob/save/saveconverter.cpp @@ -24,6 +24,7 @@ */ #include "common/endian.h" +#include "common/memstream.h" #include "common/savefile.h" #include "gob/gob.h" diff --git a/engines/gob/save/saveconverter.h b/engines/gob/save/saveconverter.h index 3ae48e1edc..dd5f43875e 100644 --- a/engines/gob/save/saveconverter.h +++ b/engines/gob/save/saveconverter.h @@ -77,7 +77,7 @@ protected: Common::String _fileName; byte *_data; - Common::MemoryReadStream *_stream; + Common::SeekableReadStream *_stream; Common::InSaveFile *openSave() const; diff --git a/engines/gob/save/savefile.cpp b/engines/gob/save/savefile.cpp index 79e931fe30..3869ea2def 100644 --- a/engines/gob/save/savefile.cpp +++ b/engines/gob/save/savefile.cpp @@ -25,6 +25,7 @@ #include "common/util.h" #include "common/endian.h" +#include "common/memstream.h" #include "common/system.h" #include "common/savefile.h" diff --git a/engines/gob/sound/sounddesc.cpp b/engines/gob/sound/sounddesc.cpp index 2efb3e90f2..9df8bbb4bc 100644 --- a/engines/gob/sound/sounddesc.cpp +++ b/engines/gob/sound/sounddesc.cpp @@ -24,7 +24,7 @@ */ #include "common/util.h" -#include "common/stream.h" +#include "common/memstream.h" #include "sound/mixer.h" #include "sound/decoders/raw.h" #include "sound/decoders/wave.h" diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index d21eb019ae..fd2cc2bec8 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -30,6 +30,7 @@ #include "backends/audiocd/audiocd.h" #include "common/config-manager.h" #include "common/macresman.h" +#include "common/memstream.h" #include "sound/midiparser.h" namespace Groovie { diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp index 32cc1735ef..5d4ccf7d91 100644 --- a/engines/groovie/resource.cpp +++ b/engines/groovie/resource.cpp @@ -25,6 +25,7 @@ #include "common/archive.h" #include "common/macresman.h" +#include "common/substream.h" #include "groovie/resource.h" #include "groovie/groovie.h" diff --git a/engines/groovie/saveload.cpp b/engines/groovie/saveload.cpp index 423829c5fe..4e3e4cfcf8 100644 --- a/engines/groovie/saveload.cpp +++ b/engines/groovie/saveload.cpp @@ -26,6 +26,7 @@ #include "groovie/saveload.h" #include "common/system.h" +#include "common/substream.h" #define SUPPORTED_SAVEFILE_VERSION 1 // 0 - Just script variables, compatible with the original diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index dff8759d55..f26cb8fb26 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -26,8 +26,9 @@ #include "kyra/resource_intern.h" #include "kyra/resource.h" -#include "common/stream.h" #include "common/endian.h" +#include "common/memstream.h" +#include "common/substream.h" namespace Kyra { diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp index e957718f95..ced103b7e3 100644 --- a/engines/kyra/saveload_hof.cpp +++ b/engines/kyra/saveload_hof.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" #include "common/savefile.h" +#include "common/substream.h" #include "common/system.h" #include "kyra/kyra_v2.h" diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp index aee24957a0..ee4fbf4dc1 100644 --- a/engines/kyra/saveload_lol.cpp +++ b/engines/kyra/saveload_lol.cpp @@ -31,6 +31,7 @@ #include "common/endian.h" #include "common/savefile.h" +#include "common/substream.h" #include "common/system.h" #include "graphics/scaler.h" diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp index 80c9b2b83c..7c583f95ee 100644 --- a/engines/kyra/saveload_mr.cpp +++ b/engines/kyra/saveload_mr.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" #include "common/savefile.h" +#include "common/substream.h" #include "common/system.h" #include "kyra/kyra_mr.h" diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 8b0a87f0c8..c86e043db7 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -25,6 +25,7 @@ #include "common/endian.h" +#include "common/memstream.h" #include "common/system.h" #include "engines/util.h" diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index cc44d6869e..d105a34f8c 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -225,7 +225,7 @@ AnimFrame *Animation::processChunkFrame(Common::SeekableReadStream *in, const Ch assert (c.frame == 0); // Create a temporary chunk buffer - Common::MemoryReadStream *str = in->readStream(c.size); + Common::SeekableReadStream *str = in->readStream(c.size); // Read the frame information FrameInfo i; diff --git a/engines/lastexpress/data/archive.cpp b/engines/lastexpress/data/archive.cpp index 1a5b6905a3..ab95c28b1e 100644 --- a/engines/lastexpress/data/archive.cpp +++ b/engines/lastexpress/data/archive.cpp @@ -32,6 +32,7 @@ #include "common/debug.h" #include "common/file.h" +#include "common/substream.h" namespace LastExpress { diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp index 5489fc3d21..3acb8dd4c0 100644 --- a/engines/lastexpress/data/cursor.cpp +++ b/engines/lastexpress/data/cursor.cpp @@ -42,7 +42,7 @@ bool Cursor::load(Common::SeekableReadStream *stream) { return false; // Load the whole file to memory - Common::MemoryReadStream *data = stream->readStream((uint32) stream->size()); + Common::SeekableReadStream *data = stream->readStream((uint32) stream->size()); delete stream; if (!data) return false; diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp index 496bd58772..b98e490215 100644 --- a/engines/lastexpress/data/snd.cpp +++ b/engines/lastexpress/data/snd.cpp @@ -32,6 +32,7 @@ #include "sound/decoders/adpcm.h" #include "sound/audiostream.h" +#include "common/memstream.h" namespace LastExpress { diff --git a/engines/lastexpress/game/savegame.h b/engines/lastexpress/game/savegame.h index d3ba5d13af..5c0e0e9890 100644 --- a/engines/lastexpress/game/savegame.h +++ b/engines/lastexpress/game/savegame.h @@ -78,6 +78,7 @@ #include "common/savefile.h" #include "common/serializer.h" +#include "common/memstream.h" namespace LastExpress { diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index 07cbff5bf1..c4113e00d0 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -28,6 +28,8 @@ #include "m4/compression.h" #include "m4/graphics.h" +#include "common/memstream.h" + namespace M4 { BaseAsset::BaseAsset(MadsM4Engine *vm) : _vm(vm) { @@ -382,7 +384,7 @@ void SpriteAsset::loadStreamingFrame(M4Sprite *frame, int frameIndex, int destX, loadFrameHeader(frameHeader); if (frameHeader.w > 0 && frameHeader.h > 0) { - Common::MemoryReadStream *frameData = _stream->readStream(getFrameSize(frameIndex)); + Common::SeekableReadStream *frameData = _stream->readStream(getFrameSize(frameIndex)); if (frameHeader.stream) { frame->loadDeltaRle(frameData, destX - frameHeader.x, destY - frameHeader.y); } else { diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp index 2b3f4e1388..9b1416945c 100644 --- a/engines/m4/compression.cpp +++ b/engines/m4/compression.cpp @@ -26,6 +26,8 @@ #include "m4/compression.h" #include "m4/m4.h" +#include "common/memstream.h" + namespace M4 { const char *madsPackString = "MADSPACK"; @@ -90,6 +92,10 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { _dataOffset = stream->pos(); } +Common::SeekableReadStream *MadsPack::getItemStream(int index) { + return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO); +} + MadsPack::~MadsPack() { for (int i = 0; i < _count; ++i) delete[] _items[i].data; diff --git a/engines/m4/compression.h b/engines/m4/compression.h index 00e3d1f927..93c7d9af9e 100644 --- a/engines/m4/compression.h +++ b/engines/m4/compression.h @@ -58,9 +58,7 @@ public: int getCount() const { return _count; } MadsPackEntry &getItem(int index) const { return _items[index]; } MadsPackEntry &operator[](int index) const { return _items[index]; } - Common::MemoryReadStream *getItemStream(int index) { - return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO); - } + Common::SeekableReadStream *getItemStream(int index); int getDataOffset() const { return _dataOffset; } }; diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 1a0e2e8d3b..70c30d28f2 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -25,6 +25,7 @@ #include "common/array.h" #include "common/hashmap.h" +#include "common/substream.h" #include "m4/converse.h" #include "m4/resource.h" diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 6d01db50bd..eb2fc9e4b5 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -740,7 +740,7 @@ void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) { void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData) { MadsPack packData(source); - Common::MemoryReadStream *sourceUnc = packData.getItemStream(0); + Common::SeekableReadStream *sourceUnc = packData.getItemStream(0); int sceneWidth = sourceUnc->readUint16LE(); int sceneHeight = sourceUnc->readUint16LE(); diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index 93490a0821..73dba87e99 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -288,7 +288,7 @@ void MadsM4Engine::dumpFile(const char* filename, bool uncompress) { } } else { MadsPack packData(fileS); - Common::MemoryReadStream *sourceUnc; + Common::SeekableReadStream *sourceUnc; for (int i = 0; i < packData.getCount(); i++) { sourceUnc = packData.getItemStream(i); debugCN(kDebugCore, "Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size()); diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp index 2c767fdf5a..f130ddc3b5 100644 --- a/engines/m4/midi.cpp +++ b/engines/m4/midi.cpp @@ -28,7 +28,7 @@ #include "m4/m4.h" #include "m4/midi.h" -#include "common/stream.h" +#include "common/memstream.h" namespace M4 { diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp index fd54d439a6..70abc47960 100644 --- a/engines/m4/resource.cpp +++ b/engines/m4/resource.cpp @@ -27,6 +27,8 @@ #include "m4/resource.h" #include "m4/events.h" +#include "common/substream.h" + namespace M4 { FileSystem::FileSystem(const char *hashFilename) { diff --git a/engines/m4/script.h b/engines/m4/script.h index 2012926330..32b5701419 100644 --- a/engines/m4/script.h +++ b/engines/m4/script.h @@ -223,7 +223,7 @@ public: uint32 readUint32(); protected: ScriptInterpreter *_inter; - Common::MemoryReadStream *_code; + Common::SeekableReadStream *_code; }; struct ScriptFunctionEntry { diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp index ccd3401d3c..4928e0af8d 100644 --- a/engines/m4/woodscript.cpp +++ b/engines/m4/woodscript.cpp @@ -25,6 +25,8 @@ #include "m4/woodscript.h" +#include "common/memstream.h" + namespace M4 { // FIXME: Put in Engine/WoodScript class diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h index 0f72935f8d..4b0f457193 100644 --- a/engines/m4/woodscript.h +++ b/engines/m4/woodscript.h @@ -77,7 +77,7 @@ public: uint32 pos() const { return _code->pos() / 4; } protected: WoodScript *_ws; - Common::MemoryReadStream *_code; + Common::SeekableReadStream *_code; Sequence *_sequence; static int32 _dataFormats[]; bool decodeArgument(int32 format, int32 data, long *&arg, long &value); diff --git a/engines/made/database.cpp b/engines/made/database.cpp index 51308cb7e5..2aa378edf5 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -275,7 +275,7 @@ void GameDatabase::openFromRed(const char *redFilename, const char *filename) { _isRedSource = true; _filename = filename; _redFilename = redFilename; - Common::MemoryReadStream *fileS = RedReader::loadFromRed(redFilename, filename); + Common::SeekableReadStream *fileS = RedReader::loadFromRed(redFilename, filename); if (!fileS) error("GameDatabase::openFromRed() Could not load %s from %s", filename, redFilename); load(*fileS); @@ -289,7 +289,7 @@ void GameDatabase::reload() { error("GameDatabase::reload() Could not open %s", _filename.c_str()); reloadFromStream(fd); } else { - Common::MemoryReadStream *fileS = RedReader::loadFromRed(_redFilename.c_str(), _filename.c_str()); + Common::SeekableReadStream *fileS = RedReader::loadFromRed(_redFilename.c_str(), _filename.c_str()); if (!fileS) error("GameDatabase::openFromRed() Could not load %s from %s", _filename.c_str(), _redFilename.c_str()); reloadFromStream(*fileS); diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp index 4ca8d27eab..3d36b69a28 100644 --- a/engines/made/redreader.cpp +++ b/engines/made/redreader.cpp @@ -24,11 +24,11 @@ */ #include "made/redreader.h" +#include "common/memstream.h" namespace Made { - -Common::MemoryReadStream *RedReader::load(const char *redFilename, const char *filename) { +Common::SeekableReadStream *RedReader::load(const char *redFilename, const char *filename) { Common::File fd; FileEntry fileEntry; @@ -49,9 +49,9 @@ Common::MemoryReadStream *RedReader::load(const char *redFilename, const char *f } -Common::MemoryReadStream *RedReader::loadFromRed(const char *redFilename, const char *filename) { +Common::SeekableReadStream *RedReader::loadFromRed(const char *redFilename, const char *filename) { RedReader* red = new RedReader(); - Common::MemoryReadStream* stream = red->load(redFilename, filename); + Common::SeekableReadStream *stream = red->load(redFilename, filename); delete red; return stream; } diff --git a/engines/made/redreader.h b/engines/made/redreader.h index b734ca02e1..a6e72c4e00 100644 --- a/engines/made/redreader.h +++ b/engines/made/redreader.h @@ -34,8 +34,8 @@ namespace Made { class RedReader { public: - Common::MemoryReadStream *load(const char *redFilename, const char *filename); - static Common::MemoryReadStream *loadFromRed(const char *redFilename, const char *filename); + Common::SeekableReadStream *load(const char *redFilename, const char *filename); + static Common::SeekableReadStream *loadFromRed(const char *redFilename, const char *filename); private: struct FileEntry { uint32 compSize, origSize; diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index ecc2378f15..6140e7e0de 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -24,6 +24,7 @@ */ #include "common/endian.h" +#include "common/memstream.h" #include "sound/mixer.h" #include "sound/decoders/raw.h" diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index 0e26e4844b..ec38a4261f 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -28,6 +28,7 @@ #include "common/debug.h" #include "common/util.h" #include "common/endian.h" +#include "common/memstream.h" #include "common/system.h" namespace Mohawk { diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 6bd0729bbf..82f6f97adb 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -31,6 +31,7 @@ #include "mohawk/graphics.h" #include "common/config-file.h" +#include "common/substream.h" namespace Mohawk { diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp index 74efd6770f..899776245d 100644 --- a/engines/mohawk/resource.cpp +++ b/engines/mohawk/resource.cpp @@ -25,6 +25,7 @@ #include "mohawk/resource.h" +#include "common/substream.h" #include "common/util.h" namespace Mohawk { diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h index 9cc9bc3737..fbd9f7cb36 100644 --- a/engines/mohawk/riven_saveload.h +++ b/engines/mohawk/riven_saveload.h @@ -28,6 +28,7 @@ #include "common/savefile.h" #include "common/str.h" +#include "common/memstream.h" namespace Mohawk { diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 0b893fbe2c..12455af5e7 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -25,6 +25,8 @@ #include "common/config-manager.h" #include "common/fs.h" +#include "common/memstream.h" +#include "common/substream.h" #include "parallaction/parser.h" #include "parallaction/parallaction.h" @@ -1087,4 +1089,4 @@ Common::SeekableReadStream* AmigaDisk_ns::loadSound(const char* name) { return tryOpenFile(path); } -} // namespace Parallaction +} // End of namespace Parallaction diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp index bf2bf6d419..18f469f0a2 100644 --- a/engines/parallaction/font.cpp +++ b/engines/parallaction/font.cpp @@ -24,7 +24,7 @@ */ #include "common/endian.h" -#include "common/stream.h" +#include "common/memstream.h" #include "parallaction/parallaction.h" @@ -670,7 +670,6 @@ GfxObj* DosDisk_br::createInventoryObjects(Common::SeekableReadStream &stream) { void Parallaction_ns::initFonts() { - if (getPlatform() == Common::kPlatformPC) { _dialogueFont = _disk->loadFont("comic"); _labelFont = _disk->loadFont("topaz"); @@ -683,7 +682,6 @@ void Parallaction_ns::initFonts() { _menuFont = _disk->loadFont("slide"); _introFont = _disk->loadFont("intro"); } - } void Parallaction_br::initFonts() { @@ -701,4 +699,4 @@ void Parallaction_br::initFonts() { } } -} +} // End of namespace Parallaction diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 2de7fe9d64..1c0ab9defd 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -1004,4 +1004,4 @@ void Parallaction::scheduleLocationSwitch(const char *location) { } -} // namespace Parallaction +} // End of namespace Parallaction diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index ded1b3bda4..a8a57ed2d8 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -606,7 +606,7 @@ private: extern Parallaction *_vm; -} // namespace Parallaction +} // End of namespace Parallaction #endif diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp index df1e91e8b4..c964b74512 100644 --- a/engines/parallaction/parser.cpp +++ b/engines/parallaction/parser.cpp @@ -257,5 +257,4 @@ void Parser::parseStatement() { (*(*_currentOpcodes)[_lookup])(); } - -} // namespace Parallaction +} // End of namespace Parallaction diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index 5eb26e9fa1..7887b2192f 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -409,13 +409,6 @@ public: virtual void parse(Script *script, ProgramPtr program); }; - -} // namespace Parallaction +} // End of namespace Parallaction #endif - - - - - - diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp index 1e2eff8458..a70d1f1613 100644 --- a/engines/queen/resource.cpp +++ b/engines/queen/resource.cpp @@ -26,6 +26,7 @@ #include "common/debug.h" #include "common/endian.h" #include "common/config-manager.h" +#include "common/substream.h" #include "queen/resource.h" namespace Queen { diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index 659da2dd97..10ffd61724 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -26,7 +26,7 @@ #include "common/config-manager.h" #include "common/endian.h" -#include "common/stream.h" +#include "common/memstream.h" #include "queen/sound.h" #include "queen/input.h" @@ -119,7 +119,7 @@ public: MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {} protected: void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) { - Common::MemoryReadStream *tmp = f->readStream(size); + Common::SeekableReadStream *tmp = f->readStream(size); assert(tmp); _mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, DisposeAfterUse::YES))); } @@ -132,7 +132,7 @@ public: OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {} protected: void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) { - Common::MemoryReadStream *tmp = f->readStream(size); + Common::SeekableReadStream *tmp = f->readStream(size); assert(tmp); _mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, DisposeAfterUse::YES))); } @@ -145,7 +145,7 @@ public: FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {} protected: void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) { - Common::MemoryReadStream *tmp = f->readStream(size); + Common::SeekableReadStream *tmp = f->readStream(size); assert(tmp); _mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFLACStream(tmp, DisposeAfterUse::YES))); } diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index f1cdcbce46..081fe955fc 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -36,6 +36,7 @@ #include "sound/decoders/raw.h" #include "common/config-manager.h" #include "common/file.h" +#include "common/substream.h" namespace Saga { diff --git a/engines/saga/saga.h b/engines/saga/saga.h index f710a9e8ab..149f1cb580 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -30,7 +30,7 @@ #include "common/array.h" #include "common/random.h" -#include "common/stream.h" +#include "common/memstream.h" #include "sound/mididrv.h" #include "saga/gfx.h" diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp index 6f2c9596db..2ce17ab531 100644 --- a/engines/sci/graphics/maciconbar.cpp +++ b/engines/sci/graphics/maciconbar.cpp @@ -30,7 +30,7 @@ #include "sci/graphics/maciconbar.h" #include "sci/graphics/palette.h" -#include "common/stream.h" +#include "common/memstream.h" #include "common/system.h" #include "graphics/pict.h" #include "graphics/surface.h" @@ -54,7 +54,7 @@ void GfxMacIconBar::drawIcons() { if (!res) continue; - Common::MemoryReadStream *stream = new Common::MemoryReadStream(res->data, res->size); + Common::SeekableReadStream *stream = new Common::MemoryReadStream(res->data, res->size); Graphics::Surface *surf = pict->decodeImage(stream, pal); remapColors(surf, pal); diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index aebaaabbd7..829a94d90c 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -32,6 +32,7 @@ #include "backends/audiocd/audiocd.h" #include "common/file.h" +#include "common/memstream.h" #include "common/system.h" #include "sound/audiostream.h" @@ -281,7 +282,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 // additional buffer here. MP3/OGG/FLAC decompression works on-the-fly // instead. memcpy(compressedData, audioRes->data, audioRes->size); - Common::MemoryReadStream *compressedStream = new Common::MemoryReadStream(compressedData, audioRes->size, DisposeAfterUse::YES); + Common::SeekableReadStream *compressedStream = new Common::MemoryReadStream(compressedData, audioRes->size, DisposeAfterUse::YES); switch (audioCompressionType) { case MKID_BE('MP3 '): @@ -315,7 +316,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 } } else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKID_BE('RIFF')) { // WAVE detected - Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); + Common::SeekableReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); // Calculate samplelen from WAVE header int waveSize = 0, waveRate = 0; @@ -327,7 +328,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 audioStream = Audio::makeWAVStream(waveStream, DisposeAfterUse::YES); } else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKID_BE('FORM')) { // AIFF detected - Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); + Common::SeekableReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); // Calculate samplelen from AIFF header int waveSize = 0, waveRate = 0; @@ -340,7 +341,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 } else if (audioRes->size > 14 && READ_BE_UINT16(audioRes->data) == 1 && READ_BE_UINT16(audioRes->data + 2) == 1 && READ_BE_UINT16(audioRes->data + 4) == 5 && READ_BE_UINT32(audioRes->data + 10) == 0x00018051) { // Mac snd detected - Common::MemoryReadStream *sndStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); + Common::SeekableReadStream *sndStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); audioSeekStream = Audio::makeMacSndStream(sndStream, DisposeAfterUse::YES); } else { diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp index 07c0582124..7cf798a27e 100644 --- a/engines/sci/sound/drivers/amigamac.cpp +++ b/engines/sci/sound/drivers/amigamac.cpp @@ -29,6 +29,7 @@ #include "common/file.h" #include "common/frac.h" +#include "common/memstream.h" #include "common/util.h" namespace Sci { diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp index a8f20dc0e2..5a096d2be3 100644 --- a/engines/sci/sound/drivers/midi.cpp +++ b/engines/sci/sound/drivers/midi.cpp @@ -27,6 +27,7 @@ #include "common/config-manager.h" #include "common/file.h" +#include "common/memstream.h" #include "sound/fmopl.h" #include "sound/softsynth/emumidi.h" diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 08feb7ffd5..95b99d22bd 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -27,6 +27,8 @@ #include "scumm/scumm.h" +#include "common/substream.h" + namespace Scumm { #pragma mark - diff --git a/engines/scumm/file.h b/engines/scumm/file.h index c37c2f036e..1dcd3cd7a8 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -27,6 +27,7 @@ #define SCUMM_FILE_H #include "common/file.h" +#include "common/memstream.h" #include "scumm/detection.h" diff --git a/engines/scumm/file_nes.h b/engines/scumm/file_nes.h index 274ec02ed0..df2528c357 100644 --- a/engines/scumm/file_nes.h +++ b/engines/scumm/file_nes.h @@ -27,6 +27,7 @@ #define SCUMM_FILE_NES_H #include "common/file.h" +#include "common/memstream.h" #include "scumm/file.h" diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp index 87afe5fd90..fedbdbf377 100644 --- a/engines/scumm/he/cup_player_he.cpp +++ b/engines/scumm/he/cup_player_he.cpp @@ -26,6 +26,7 @@ #ifdef ENABLE_HE #include "common/system.h" +#include "common/memstream.h" #include "sound/audiostream.h" #include "sound/mixer.h" #include "sound/decoders/raw.h" diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index f7a7d3a567..70663b1b33 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -832,7 +832,7 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int uint32 c, d; int completed; int matched = 0; - MemoryReadStream *in = new MemoryReadStream(data, datasize); + Common::MemoryReadStream *in = new Common::MemoryReadStream(data, datasize); if (!in->read(&dir, sizeof(Win32CursorIconFileDir)- sizeof(Win32CursorIconFileDirEntry))) goto cleanup; diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index 65190ea41c..b3f3479406 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -147,9 +147,6 @@ public: bool _arg_raw; Common::String _fileName; CachedCursor _cursorCache[MAX_CACHED_CURSORS]; - - typedef Common::MemoryReadStream MemoryReadStream; - }; class Win32ResExtractor : public ResExtractor { diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 24cac8707b..1d4769a7f5 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -700,7 +700,7 @@ int32 ImuseDigiSndMgr::getDataFromRegion(SoundDesc *soundDesc, int region, byte assert(len); if (!soundDesc->compressedStream) { - Common::MemoryReadStream *tmp = cmpFile->readStream(len); + Common::SeekableReadStream *tmp = cmpFile->readStream(len); assert(tmp); #ifdef USE_FLAC if (soundMode == 3) diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 2d5a84900b..7273f9f871 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -24,6 +24,7 @@ */ #include "common/config-manager.h" +#include "common/memstream.h" #include "common/savefile.h" #include "common/system.h" #include "common/zlib.h" diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 380b52031f..ee8825d946 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -598,7 +598,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle #ifdef USE_MAD { assert(size > 0); - Common::MemoryReadStream *tmp = _sfxFile->readStream(size); + Common::SeekableReadStream *tmp = _sfxFile->readStream(size); assert(tmp); input = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES); } @@ -608,7 +608,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle #ifdef USE_VORBIS { assert(size > 0); - Common::MemoryReadStream *tmp = _sfxFile->readStream(size); + Common::SeekableReadStream *tmp = _sfxFile->readStream(size); assert(tmp); input = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES); } @@ -618,7 +618,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle #ifdef USE_FLAC { assert(size > 0); - Common::MemoryReadStream *tmp = _sfxFile->readStream(size); + Common::SeekableReadStream *tmp = _sfxFile->readStream(size); assert(tmp); input = Audio::makeFLACStream(tmp, DisposeAfterUse::YES); } diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 55600cfb63..92bed1b624 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -29,6 +29,7 @@ #include "common/util.h" #include "common/events.h" #include "common/EventRecorder.h" +#include "common/memstream.h" #include "common/system.h" #include "sword1/sound.h" @@ -366,7 +367,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { } } else if (_cowMode == CowPSX && sampleSize != 0xffffffff) { _cowFile.seek(index * 2048); - Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize); assert(tmp); stream = Audio::makeVagStream(tmp); _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan); @@ -379,7 +380,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_FLAC else if (_cowMode == CowFLAC) { _cowFile.seek(index); - Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize); assert(tmp); stream = Audio::makeFLACStream(tmp, DisposeAfterUse::YES); _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan); @@ -393,7 +394,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_VORBIS else if (_cowMode == CowVorbis) { _cowFile.seek(index); - Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize); assert(tmp); stream = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES); _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan); @@ -407,7 +408,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_MAD else if (_cowMode == CowMP3) { _cowFile.seek(index); - Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize); assert(tmp); stream = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES); _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan); diff --git a/engines/sword2/console.cpp b/engines/sword2/console.cpp index 20fd79bc38..6f4665a34c 100644 --- a/engines/sword2/console.cpp +++ b/engines/sword2/console.cpp @@ -26,6 +26,7 @@ */ +#include "common/memstream.h" #include "common/rect.h" #include "common/system.h" diff --git a/engines/sword2/header.cpp b/engines/sword2/header.cpp new file mode 100644 index 0000000000..c930b0c8e7 --- /dev/null +++ b/engines/sword2/header.cpp @@ -0,0 +1,293 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "sword2/header.h" +#include "sword2/screen.h" +#include "sword2/sword2.h" + +#include "common/memstream.h" +#include "common/endian.h" + +namespace Sword2 { + +void ResHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + fileType = readS.readByte(); + compType = readS.readByte(); + compSize = readS.readUint32LE(); + decompSize = readS.readUint32LE(); + readS.read(name, NAME_LEN); +} + +void ResHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeByte(fileType); + writeS.writeByte(compType); + writeS.writeUint32LE(compSize); + writeS.writeUint32LE(decompSize); + writeS.write(name, NAME_LEN); +} + +void AnimHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + if (Sword2Engine::isPsx()) { + noAnimFrames = readS.readUint16LE(); + feetStartX = readS.readUint16LE(); + feetStartY = readS.readUint16LE(); + feetEndX = readS.readUint16LE(); + feetEndY = readS.readUint16LE(); + blend = readS.readUint16LE(); + runTimeComp = readS.readByte(); + feetStartDir = readS.readByte(); + feetEndDir = readS.readByte(); + } else { + runTimeComp = readS.readByte(); + noAnimFrames = readS.readUint16LE(); + feetStartX = readS.readUint16LE(); + feetStartY = readS.readUint16LE(); + feetStartDir = readS.readByte(); + feetEndX = readS.readUint16LE(); + feetEndY = readS.readUint16LE(); + feetEndDir = readS.readByte(); + blend = readS.readUint16LE(); + } +} + +void AnimHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeByte(runTimeComp); + writeS.writeUint16LE(noAnimFrames); + writeS.writeUint16LE(feetStartX); + writeS.writeUint16LE(feetStartY); + writeS.writeByte(feetStartDir); + writeS.writeUint16LE(feetEndX); + writeS.writeUint16LE(feetEndY); + writeS.writeByte(feetEndDir); + writeS.writeUint16LE(blend); +} + +int CdtEntry::size() { + if (Sword2Engine::isPsx()) + return 12; + else + return 9; +} + +void CdtEntry::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + if (Sword2Engine::isPsx()) { + readS.readByte(); // Skip a byte in psx version + x = readS.readUint16LE(); + y = readS.readUint16LE(); + frameOffset = readS.readUint32LE(); + frameType = readS.readByte(); + } else { + x = readS.readUint16LE(); + y = readS.readUint16LE(); + frameOffset = readS.readUint32LE(); + frameType = readS.readByte(); + } +} + +void CdtEntry::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint16LE(x); + writeS.writeUint16LE(y); + writeS.writeUint32LE(frameOffset); + writeS.writeByte(frameType); +} + +void FrameHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + compSize = readS.readUint32LE(); + width = readS.readUint16LE(); + height = readS.readUint16LE(); + + if (Sword2Engine::isPsx()) { // In PSX version, frames are half height + height *= 2; + width = (width % 2) ? width + 1 : width; + } +} + +void FrameHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint32LE(compSize); + writeS.writeUint16LE(width); + writeS.writeUint16LE(height); +} + +void MultiScreenHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + palette = readS.readUint32LE(); + bg_parallax[0] = readS.readUint32LE(); + bg_parallax[1] = readS.readUint32LE(); + screen = readS.readUint32LE(); + fg_parallax[0] = readS.readUint32LE(); + fg_parallax[1] = readS.readUint32LE(); + layers = readS.readUint32LE(); + paletteTable = readS.readUint32LE(); + maskOffset = readS.readUint32LE(); +} + +void MultiScreenHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint32LE(palette); + writeS.writeUint32LE(bg_parallax[0]); + writeS.writeUint32LE(bg_parallax[1]); + writeS.writeUint32LE(screen); + writeS.writeUint32LE(fg_parallax[0]); + writeS.writeUint32LE(fg_parallax[1]); + writeS.writeUint32LE(layers); + writeS.writeUint32LE(paletteTable); + writeS.writeUint32LE(maskOffset); +} + +void ScreenHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + width = readS.readUint16LE(); + height = readS.readUint16LE(); + noLayers = readS.readUint16LE(); +} + +void ScreenHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint16LE(width); + writeS.writeUint16LE(height); + writeS.writeUint16LE(noLayers); +} + +void LayerHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + x = readS.readUint16LE(); + y = readS.readUint16LE(); + width = readS.readUint16LE(); + height = readS.readUint16LE(); + maskSize = readS.readUint32LE(); + offset = readS.readUint32LE(); +} + +void LayerHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint16LE(x); + writeS.writeUint16LE(y); + writeS.writeUint16LE(width); + writeS.writeUint16LE(height); + writeS.writeUint32LE(maskSize); + writeS.writeUint32LE(offset); +} + +void TextHeader::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + noOfLines = readS.readUint32LE(); +} + +void TextHeader::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint32LE(noOfLines); +} + +void PSXScreensEntry::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + bgPlxXres = readS.readUint16LE(); + bgPlxYres = readS.readUint16LE(); + bgPlxOffset = readS.readUint32LE(); + bgPlxSize = readS.readUint32LE(); + bgXres = readS.readUint16LE(); + bgYres = readS.readUint16LE(); + bgOffset = readS.readUint32LE(); + bgSize = readS.readUint32LE(); + fgPlxXres = readS.readUint16LE(); + fgPlxYres = readS.readUint16LE(); + fgPlxOffset = readS.readUint32LE(); + fgPlxSize = readS.readUint32LE(); +} + +void PSXScreensEntry::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint16LE(bgPlxXres); + writeS.writeUint16LE(bgPlxYres); + writeS.writeUint32LE(bgPlxOffset); + writeS.writeUint32LE(bgPlxSize); + writeS.writeUint16LE(bgXres); + writeS.writeUint16LE(bgYres); + writeS.writeUint32LE(bgOffset); + writeS.writeUint32LE(bgSize); + writeS.writeUint16LE(fgPlxXres); + writeS.writeUint16LE(fgPlxYres); + writeS.writeUint32LE(fgPlxOffset); + writeS.writeUint32LE(fgPlxSize); +} + +void PSXFontEntry::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + offset = readS.readUint16LE() / 2; + skipLines = readS.readUint16LE(); + charWidth = readS.readUint16LE() / 2; + charHeight = readS.readUint16LE(); +} + +void PSXFontEntry::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint16LE(offset); + writeS.writeUint16LE(skipLines); + writeS.writeUint16LE(charWidth); + writeS.writeUint16LE(charHeight); +} + +void Parallax::read(byte *addr) { + Common::MemoryReadStream readS(addr, size()); + + w = readS.readUint16LE(); + h = readS.readUint16LE(); +} + +void Parallax::write(byte *addr) { + Common::MemoryWriteStream writeS(addr, size()); + + writeS.writeUint16LE(w); + writeS.writeUint16LE(h); +} + +} // End of namespace Sword2 diff --git a/engines/sword2/header.h b/engines/sword2/header.h index 67cbba35af..3f64152bb9 100644 --- a/engines/sword2/header.h +++ b/engines/sword2/header.h @@ -28,7 +28,6 @@ #ifndef SWORD2_HEADER_H #define SWORD2_HEADER_H -#include "common/stream.h" #include "common/endian.h" namespace Sword2 { @@ -60,25 +59,8 @@ struct ResHeader { return 44; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - fileType = readS.readByte(); - compType = readS.readByte(); - compSize = readS.readUint32LE(); - decompSize = readS.readUint32LE(); - readS.read(name, NAME_LEN); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeByte(fileType); - writeS.writeByte(compType); - writeS.writeUint32LE(compSize); - writeS.writeUint32LE(decompSize); - writeS.write(name, NAME_LEN); - } + void read(byte *addr); + void write(byte *addr); }; // fileType @@ -156,45 +138,8 @@ struct AnimHeader { return 15; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - if (Sword2Engine::isPsx()) { - noAnimFrames = readS.readUint16LE(); - feetStartX = readS.readUint16LE(); - feetStartY = readS.readUint16LE(); - feetEndX = readS.readUint16LE(); - feetEndY = readS.readUint16LE(); - blend = readS.readUint16LE(); - runTimeComp = readS.readByte(); - feetStartDir = readS.readByte(); - feetEndDir = readS.readByte(); - } else { - runTimeComp = readS.readByte(); - noAnimFrames = readS.readUint16LE(); - feetStartX = readS.readUint16LE(); - feetStartY = readS.readUint16LE(); - feetStartDir = readS.readByte(); - feetEndX = readS.readUint16LE(); - feetEndY = readS.readUint16LE(); - feetEndDir = readS.readByte(); - blend = readS.readUint16LE(); - } - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeByte(runTimeComp); - writeS.writeUint16LE(noAnimFrames); - writeS.writeUint16LE(feetStartX); - writeS.writeUint16LE(feetStartY); - writeS.writeByte(feetStartDir); - writeS.writeUint16LE(feetEndX); - writeS.writeUint16LE(feetEndY); - writeS.writeByte(feetEndDir); - writeS.writeUint16LE(blend); - } + void read(byte *addr); + void write(byte *addr); }; @@ -221,38 +166,10 @@ struct CdtEntry { uint8 frameType; // 0 = print sprite normally with top-left // corner at (x,y), otherwise see below... - static int size() { - if (Sword2Engine::isPsx()) - return 12; - else - return 9; - } - - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - if (Sword2Engine::isPsx()) { - readS.readByte(); // Skip a byte in psx version - x = readS.readUint16LE(); - y = readS.readUint16LE(); - frameOffset = readS.readUint32LE(); - frameType = readS.readByte(); - } else { - x = readS.readUint16LE(); - y = readS.readUint16LE(); - frameOffset = readS.readUint32LE(); - frameType = readS.readByte(); - } - } + static int size(); - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint16LE(x); - writeS.writeUint16LE(y); - writeS.writeUint32LE(frameOffset); - writeS.writeByte(frameType); - } + void read(byte *addr); + void write(byte *addr); }; // 'frameType' bit values @@ -277,26 +194,8 @@ struct FrameHeader { return 8; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - compSize = readS.readUint32LE(); - width = readS.readUint16LE(); - height = readS.readUint16LE(); - - if (Sword2Engine::isPsx()) { // In PSX version, frames are half height - height *= 2; - width = (width % 2) ? width + 1 : width; - } - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint32LE(compSize); - writeS.writeUint16LE(width); - writeS.writeUint16LE(height); - } + void read(byte *addr); + void write(byte *addr); }; //---------------------------------------------------------- @@ -331,33 +230,8 @@ struct MultiScreenHeader { return 36; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - palette = readS.readUint32LE(); - bg_parallax[0] = readS.readUint32LE(); - bg_parallax[1] = readS.readUint32LE(); - screen = readS.readUint32LE(); - fg_parallax[0] = readS.readUint32LE(); - fg_parallax[1] = readS.readUint32LE(); - layers = readS.readUint32LE(); - paletteTable = readS.readUint32LE(); - maskOffset = readS.readUint32LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint32LE(palette); - writeS.writeUint32LE(bg_parallax[0]); - writeS.writeUint32LE(bg_parallax[1]); - writeS.writeUint32LE(screen); - writeS.writeUint32LE(fg_parallax[0]); - writeS.writeUint32LE(fg_parallax[1]); - writeS.writeUint32LE(layers); - writeS.writeUint32LE(paletteTable); - writeS.writeUint32LE(maskOffset); - } + void read(byte *addr); + void write(byte *addr); }; // Screen Header @@ -371,21 +245,8 @@ struct ScreenHeader { return 6; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - width = readS.readUint16LE(); - height = readS.readUint16LE(); - noLayers = readS.readUint16LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint16LE(width); - writeS.writeUint16LE(height); - writeS.writeUint16LE(noLayers); - } + void read(byte *addr); + void write(byte *addr); }; // Layer Header @@ -406,27 +267,8 @@ struct LayerHeader { return 16; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - x = readS.readUint16LE(); - y = readS.readUint16LE(); - width = readS.readUint16LE(); - height = readS.readUint16LE(); - maskSize = readS.readUint32LE(); - offset = readS.readUint32LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint16LE(x); - writeS.writeUint16LE(y); - writeS.writeUint16LE(width); - writeS.writeUint16LE(height); - writeS.writeUint32LE(maskSize); - writeS.writeUint32LE(offset); - } + void read(byte *addr); + void write(byte *addr); }; //---------------------------------------------------------- @@ -511,17 +353,8 @@ struct TextHeader { return 4; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - noOfLines = readS.readUint32LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint32LE(noOfLines); - } + void read(byte *addr); + void write(byte *addr); }; // a text file has: @@ -567,39 +400,8 @@ struct PSXScreensEntry { return 36; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - bgPlxXres = readS.readUint16LE(); - bgPlxYres = readS.readUint16LE(); - bgPlxOffset = readS.readUint32LE(); - bgPlxSize = readS.readUint32LE(); - bgXres = readS.readUint16LE(); - bgYres = readS.readUint16LE(); - bgOffset = readS.readUint32LE(); - bgSize = readS.readUint32LE(); - fgPlxXres = readS.readUint16LE(); - fgPlxYres = readS.readUint16LE(); - fgPlxOffset = readS.readUint32LE(); - fgPlxSize = readS.readUint32LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint16LE(bgPlxXres); - writeS.writeUint16LE(bgPlxYres); - writeS.writeUint32LE(bgPlxOffset); - writeS.writeUint32LE(bgPlxSize); - writeS.writeUint16LE(bgXres); - writeS.writeUint16LE(bgYres); - writeS.writeUint32LE(bgOffset); - writeS.writeUint32LE(bgSize); - writeS.writeUint16LE(fgPlxXres); - writeS.writeUint16LE(fgPlxYres); - writeS.writeUint32LE(fgPlxOffset); - writeS.writeUint32LE(fgPlxSize); - } + void read(byte *addr); + void write(byte *addr); }; // PSXFontEntry is present in font resource file, it is used @@ -615,23 +417,8 @@ struct PSXFontEntry { return 8; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - offset = readS.readUint16LE() / 2; - skipLines = readS.readUint16LE(); - charWidth = readS.readUint16LE() / 2; - charHeight = readS.readUint16LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint16LE(offset); - writeS.writeUint16LE(skipLines); - writeS.writeUint16LE(charWidth); - writeS.writeUint16LE(charHeight); - } + void read(byte *addr); + void write(byte *addr); }; } // End of namespace Sword2 diff --git a/engines/sword2/icons.cpp b/engines/sword2/icons.cpp index 4652fc0bc1..b115eb373b 100644 --- a/engines/sword2/icons.cpp +++ b/engines/sword2/icons.cpp @@ -26,7 +26,7 @@ */ -#include "common/stream.h" +#include "common/memstream.h" #include "common/rect.h" #include "sword2/sword2.h" diff --git a/engines/sword2/module.mk b/engines/sword2/module.mk index c675b9561e..bf586aefff 100644 --- a/engines/sword2/module.mk +++ b/engines/sword2/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ debug.o \ events.o \ function.o \ + header.o \ icons.o \ interpreter.o \ layers.o \ diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 89073fef8e..1519c5d73f 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -33,6 +33,8 @@ #include "common/file.h" +#include "common/memstream.h" +#include "common/substream.h" #include "common/system.h" #include "sound/decoders/mp3.h" diff --git a/engines/sword2/object.h b/engines/sword2/object.h index b6b6ca5174..98c9f6863b 100644 --- a/engines/sword2/object.h +++ b/engines/sword2/object.h @@ -28,7 +28,7 @@ #ifndef SWORD2_OBJECT_H #define SWORD2_OBJECT_H -#include "common/stream.h" +#include "common/memstream.h" #include "common/endian.h" namespace Sword2 { diff --git a/engines/sword2/screen.h b/engines/sword2/screen.h index afad64011d..0abaebc5af 100644 --- a/engines/sword2/screen.h +++ b/engines/sword2/screen.h @@ -192,19 +192,8 @@ struct Parallax { return 4; } - void read(byte *addr) { - Common::MemoryReadStream readS(addr, size()); - - w = readS.readUint16LE(); - h = readS.readUint16LE(); - } - - void write(byte *addr) { - Common::MemoryWriteStream writeS(addr, size()); - - writeS.writeUint16LE(w); - writeS.writeUint16LE(h); - } + void read(byte *addr); + void write(byte *addr); }; class Screen { diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index b1d0dee81b..abacbd16f0 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -37,6 +37,7 @@ #include "common/file.h" +#include "common/memstream.h" #include "common/system.h" #include "sword2/sword2.h" diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 3f3e111f74..ccfa2ed363 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -281,8 +281,8 @@ public: Graphics::Surface _frameBuffer; Graphics::Surface *getFrameBuffer() { return &_frameBuffer; } - Common::MemoryReadStream *_thumbnail; - Common::MemoryReadStream *getThumbnail() { return _thumbnail; } + Common::SeekableReadStream *_thumbnail; + Common::SeekableReadStream *getThumbnail() { return _thumbnail; } // Access methods diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp index 1b72595a8f..581d5fd917 100644 --- a/engines/sword25/gfx/image/pngloader.cpp +++ b/engines/sword25/gfx/image/pngloader.cpp @@ -35,6 +35,7 @@ // Disable symbol overrides so that we can use png.h #define FORBIDDEN_SYMBOL_ALLOW_ALL +#include "common/memstream.h" #include "sword25/gfx/image/image.h" #include "sword25/gfx/image/pngloader.h" #include diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp index 3dc88237f9..b7bb31c8e4 100644 --- a/engines/sword25/gfx/screenshot.cpp +++ b/engines/sword25/gfx/screenshot.cpp @@ -37,8 +37,7 @@ #define BS_LOG_PREFIX "SCREENSHOT" -#include "common/system.h" -#include "common/savefile.h" +#include "common/memstream.h" #include "sword25/gfx/screenshot.h" #include "sword25/kernel/filesystemutil.h" #include @@ -123,7 +122,7 @@ bool Screenshot::saveToFile(Graphics::Surface *data, Common::WriteStream *stream // ----------------------------------------------------------------------------- -Common::MemoryReadStream *Screenshot::createThumbnail(Graphics::Surface *data) { +Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data) { // This method takes a screen image with a dimension of 800x600, and creates a screenshot with a dimension of 200x125. // First 50 pixels are cut off the top and bottom (the interface boards in the game). The remaining image of 800x500 // will be on a 16th of its size, reduced by being handed out in 4x4 pixel blocks and the average of each block @@ -177,7 +176,7 @@ Common::MemoryReadStream *Screenshot::createThumbnail(Graphics::Surface *data) { saveToFile(&thumbnail, stream); // Output a MemoryReadStream that encompasses the written data - Common::MemoryReadStream *result = new Common::MemoryReadStream(stream->getData(), stream->size(), + Common::SeekableReadStream *result = new Common::MemoryReadStream(stream->getData(), stream->size(), DisposeAfterUse::YES); return result; } diff --git a/engines/sword25/gfx/screenshot.h b/engines/sword25/gfx/screenshot.h index eefaa1bca6..a0f615f9e6 100644 --- a/engines/sword25/gfx/screenshot.h +++ b/engines/sword25/gfx/screenshot.h @@ -43,7 +43,7 @@ namespace Sword25 { class Screenshot { public: static bool saveToFile(Graphics::Surface *data, Common::WriteStream *stream); - static Common::MemoryReadStream *createThumbnail(Graphics::Surface *data); + static Common::SeekableReadStream *createThumbnail(Graphics::Surface *data); }; } // End of namespace Sword25 diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index 564f031cf3..0508f2be8f 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -316,7 +316,7 @@ bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotF } // Get the screenshot - Common::MemoryReadStream *thumbnail = Kernel::getInstance()->getGfx()->getThumbnail(); + Common::SeekableReadStream *thumbnail = Kernel::getInstance()->getGfx()->getThumbnail(); if (thumbnail) { byte *buffer = new Byte[FILE_COPY_BUFFER_SIZE]; diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index 47267dabf0..16a5f20ee6 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -22,7 +22,7 @@ * $Id$ */ -#include "common/stream.h" +#include "common/memstream.h" #include "common/ptr.h" #include "teenagent/inventory.h" diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index f8df4fee77..e6442d3809 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -23,7 +23,7 @@ */ #include "common/debug.h" -#include "common/stream.h" +#include "common/memstream.h" #include "teenagent/objects.h" #include "teenagent/resources.h" diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp index e3b7a33960..8584e05807 100644 --- a/engines/teenagent/pack.cpp +++ b/engines/teenagent/pack.cpp @@ -25,6 +25,8 @@ #include "teenagent/pack.h" #include "common/util.h" #include "common/debug.h" +#include "common/memstream.h" +#include "common/substream.h" namespace TeenAgent { diff --git a/engines/testbed/midi.cpp b/engines/testbed/midi.cpp index 0ec2678d47..499c44e50a 100644 --- a/engines/testbed/midi.cpp +++ b/engines/testbed/midi.cpp @@ -24,6 +24,7 @@ #include "common/archive.h" #include "common/events.h" +#include "common/memstream.h" #include "graphics/cursorman.h" @@ -34,7 +35,7 @@ namespace Testbed { -bool MidiTests::loadMusicInMemory(Common::MemoryWriteStreamDynamic *ws) { +bool MidiTests::loadMusicInMemory(Common::WriteStream *ws) { Common::SeekableReadStream *midiFile = SearchMan.createReadStreamForMember("music.mid"); if (!midiFile) { Testsuite::logPrintf("Error! Can't open Midi music file, check game data directory for file music.mid\n"); diff --git a/engines/testbed/midi.h b/engines/testbed/midi.h index c73d937834..0fb5cf80d5 100644 --- a/engines/testbed/midi.h +++ b/engines/testbed/midi.h @@ -36,7 +36,7 @@ namespace Testbed { namespace MidiTests { // Helper functions for MIDI tests -bool loadMusicInMemory(Common::MemoryWriteStreamDynamic *ws); +bool loadMusicInMemory(Common::WriteStream *ws); void waitForMusicToPlay(MidiParser *parser); // will contain function declarations for MIDI tests diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index c20b456711..ad09631260 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -36,6 +36,7 @@ #include "common/config-manager.h" #include "common/file.h" +#include "common/memstream.h" #include "tinsel/config.h" #include "tinsel/sound.h" @@ -835,7 +836,7 @@ bool PCMMusicPlayer::getNextChunk() { uint32 sampleOffset, sampleLength, sampleCLength; Common::File file; byte *buffer; - Common::MemoryReadStream *sampleStream; + Common::SeekableReadStream *sampleStream; switch (_state) { case S_NEW: diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 0a32ab143f..0624409f92 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -37,6 +37,7 @@ #include "common/config-manager.h" #include "common/endian.h" #include "common/file.h" +#include "common/memstream.h" #include "common/system.h" #include "sound/mixer.h" diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp index c83375f610..d0e9b168ae 100644 --- a/engines/toon/audio.cpp +++ b/engines/toon/audio.cpp @@ -24,6 +24,8 @@ */ #include "toon/audio.h" +#include "common/memstream.h" +#include "common/substream.h" namespace Toon { diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp index 3f879df781..61e3ffb111 100644 --- a/engines/toon/resource.cpp +++ b/engines/toon/resource.cpp @@ -25,6 +25,8 @@ #include "toon/resource.h" #include "common/file.h" +#include "common/memstream.h" +#include "common/substream.h" #include "toon/toon.h" diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index d86beadcd1..61b6e1bfe3 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -30,6 +30,8 @@ #include "common/config-manager.h" #include "common/EventRecorder.h" #include "common/savefile.h" +#include "common/memstream.h" + #include "engines/util.h" #include "graphics/surface.h" #include "graphics/thumbnail.h" @@ -1799,6 +1801,10 @@ void ToonEngine::drawInfoLine() { } } +Common::WriteStream *ToonEngine::getSaveBufferStream() { + return _saveBufferStream; +} + const char *ToonEngine::getLocationString(int32 locationId, bool alreadyVisited) { if (alreadyVisited) return _locationDirVisited[locationId]; diff --git a/engines/toon/toon.h b/engines/toon/toon.h index 920ec080aa..05b2bac47c 100644 --- a/engines/toon/toon.h +++ b/engines/toon/toon.h @@ -43,6 +43,10 @@ #include "toon/audio.h" #include "toon/console.h" +namespace Common { +class MemoryWriteStreamDynamic; +} + #define TOON_DAT_VER_MAJ 0 // 1 byte #define TOON_DAT_VER_MIN 3 // 1 byte #define TOON_SAVEGAME_VERSION 4 @@ -308,9 +312,7 @@ public: return _pathFinding; } - Common::WriteStream *getSaveBufferStream() { - return _saveBufferStream; - } + Common::WriteStream *getSaveBufferStream(); bool shouldQuitGame() const { return _shouldQuit; diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp index 8a810f09d8..f76084d556 100644 --- a/engines/touche/resource.cpp +++ b/engines/touche/resource.cpp @@ -666,7 +666,7 @@ void ToucheEngine::res_loadSpeechSegment(int num) { return; } _fSpeech[0].seek(offs); - Common::MemoryReadStream *tmp = _fSpeech[0].readStream(size); + Common::SeekableReadStream *tmp = _fSpeech[0].readStream(size); if (tmp) stream = (compressedSpeechFilesTable[_compressedSpeechData].makeStream)(tmp, DisposeAfterUse::YES); } diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 025721e5fc..1d1daf5adc 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -268,7 +268,7 @@ Audio::RewindableAudioStream *CompressedSound::load(CompressedSoundType type, in int soundSize = _fCompressedSound.readUint32LE(); if (soundSize != 0) { _fCompressedSound.seek(dirOffset + dirSize * 8 + soundOffset); - Common::MemoryReadStream *tmp = _fCompressedSound.readStream(soundSize); + Common::SeekableReadStream *tmp = _fCompressedSound.readStream(soundSize); if (tmp) { stream = (compressedSoundFilesTable[_compressedSoundType].makeStream)(tmp, DisposeAfterUse::YES); } -- cgit v1.2.3