diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp index 4624ee437bd..d75fb947044 100644 --- a/audio/audiostream.cpp +++ b/audio/audiostream.cpp @@ -65,12 +65,12 @@ static const StreamFileFormat STREAM_FILEFORMATS[] = { { "WAV", ".wav", makeWAVStream }, }; -SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::String &basename) { +SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::Path &basename) { SeekableAudioStream *stream = nullptr; Common::File *fileHandle = new Common::File(); for (int i = 0; i < ARRAYSIZE(STREAM_FILEFORMATS); ++i) { - Common::String filename = basename + STREAM_FILEFORMATS[i].fileExtension; + Common::Path filename = basename.append(STREAM_FILEFORMATS[i].fileExtension); fileHandle->open(filename); if (fileHandle->isOpen()) { // Create the stream object @@ -83,7 +83,7 @@ SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::String &b delete fileHandle; if (stream == nullptr) - debug(1, "SeekableAudioStream::openStreamFile: Could not open compressed AudioFile %s", basename.c_str()); + debug(1, "SeekableAudioStream::openStreamFile: Could not open compressed AudioFile %s", basename.toString(Common::Path::kNativeSeparator).c_str()); return stream; } diff --git a/audio/audiostream.h b/audio/audiostream.h index 0de0ce45404..1f7127e4fc6 100644 --- a/audio/audiostream.h +++ b/audio/audiostream.h @@ -24,12 +24,12 @@ #include "common/ptr.h" #include "common/scummsys.h" -#include "common/str.h" #include "common/types.h" #include "audio/timestamp.h" namespace Common { +class Path; class SeekableReadStream; } @@ -222,7 +222,7 @@ public: * @return A SeekableAudioStream ready to use in case of success. * NULL in case of an error (e.g. invalid/non-existing file). */ - static SeekableAudioStream *openStreamFile(const Common::String &basename); + static SeekableAudioStream *openStreamFile(const Common::Path &basename); /** * Seek to a given offset in the stream. diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp index 41c29c249e7..0c1db3b7469 100644 --- a/audio/decoders/quicktime.cpp +++ b/audio/decoders/quicktime.cpp @@ -85,7 +85,7 @@ QuickTimeAudioDecoder::~QuickTimeAudioDecoder() { delete _audioTracks[i]; } -bool QuickTimeAudioDecoder::loadAudioFile(const Common::String &filename) { +bool QuickTimeAudioDecoder::loadAudioFile(const Common::Path &filename) { if (!Common::QuickTimeParser::parseFile(filename)) return false; @@ -657,7 +657,7 @@ public: QuickTimeAudioStream() {} ~QuickTimeAudioStream() {} - bool openFromFile(const Common::String &filename) { + bool openFromFile(const Common::Path &filename) { return QuickTimeAudioDecoder::loadAudioFile(filename) && !_audioTracks.empty(); } @@ -687,7 +687,7 @@ public: Timestamp getLength() const override { return _audioTracks[0]->getLength(); } }; -SeekableAudioStream *makeQuickTimeStream(const Common::String &filename) { +SeekableAudioStream *makeQuickTimeStream(const Common::Path &filename) { QuickTimeAudioStream *audioStream = new QuickTimeAudioStream(); if (!audioStream->openFromFile(filename)) { diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index 299c7d82e52..3cc3391dac3 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -50,7 +50,7 @@ class SeekableAudioStream; * @param filename the filename of the file from which to read the data * @return a new SeekableAudioStream, or NULL, if an error occurred */ -SeekableAudioStream *makeQuickTimeStream(const Common::String &filename); +SeekableAudioStream *makeQuickTimeStream(const Common::Path &filename); /** * Try to load a QuickTime sound file from the given seekable stream and create a SeekableAudioStream diff --git a/audio/decoders/quicktime_intern.h b/audio/decoders/quicktime_intern.h index 81d89542a83..7fde52e5343 100644 --- a/audio/decoders/quicktime_intern.h +++ b/audio/decoders/quicktime_intern.h @@ -53,7 +53,7 @@ public: * Load a QuickTime audio file * @param filename the filename to load */ - bool loadAudioFile(const Common::String &filename); + bool loadAudioFile(const Common::Path &filename); /** * Load a QuickTime audio file from a SeekableReadStream diff --git a/audio/midiparser_qt.cpp b/audio/midiparser_qt.cpp index c5407f6e01a..83ca3c1746b 100644 --- a/audio/midiparser_qt.cpp +++ b/audio/midiparser_qt.cpp @@ -95,7 +95,7 @@ bool MidiParser_QT::loadFromContainerStream(Common::SeekableReadStream *stream, return true; } -bool MidiParser_QT::loadFromContainerFile(const Common::String &fileName) { +bool MidiParser_QT::loadFromContainerFile(const Common::Path &fileName) { unloadMusic(); if (!parseFile(fileName)) diff --git a/audio/midiparser_qt.h b/audio/midiparser_qt.h index 5edfc6543b5..58d3fd40bc7 100644 --- a/audio/midiparser_qt.h +++ b/audio/midiparser_qt.h @@ -74,7 +74,7 @@ public: /** * Load the MIDI from a QuickTime file */ - bool loadFromContainerFile(const Common::String &fileName); + bool loadFromContainerFile(const Common::Path &fileName); protected: // MidiParser diff --git a/audio/miles.h b/audio/miles.h index 11dcc2fbeb8..1203e1731d8 100644 --- a/audio/miles.h +++ b/audio/miles.h @@ -304,11 +304,11 @@ private: MilesMT32SysExQueueEntry _milesSysExQueues[MILES_CONTROLLER_SYSEX_QUEUE_COUNT]; }; -extern MidiDriver_Multisource *MidiDriver_Miles_AdLib_create(const Common::String &filenameAdLib, const Common::String &filenameOPL3, Common::SeekableReadStream *streamAdLib = nullptr, Common::SeekableReadStream *streamOPL3 = nullptr); +extern MidiDriver_Multisource *MidiDriver_Miles_AdLib_create(const Common::Path &filenameAdLib, const Common::Path &filenameOPL3, Common::SeekableReadStream *streamAdLib = nullptr, Common::SeekableReadStream *streamOPL3 = nullptr); -extern MidiDriver_Miles_Midi *MidiDriver_Miles_MT32_create(const Common::String &instrumentDataFilename); +extern MidiDriver_Miles_Midi *MidiDriver_Miles_MT32_create(const Common::Path &instrumentDataFilename); -extern MidiDriver_Miles_Midi *MidiDriver_Miles_MIDI_create(MusicType midiType, const Common::String &instrumentDataFilename); +extern MidiDriver_Miles_Midi *MidiDriver_Miles_MIDI_create(MusicType midiType, const Common::Path &instrumentDataFilename); /** @} */ } // End of namespace Audio diff --git a/audio/miles_adlib.cpp b/audio/miles_adlib.cpp index dd500445aa5..af36f1e9ac3 100644 --- a/audio/miles_adlib.cpp +++ b/audio/miles_adlib.cpp @@ -1271,9 +1271,9 @@ void MidiDriver_Miles_AdLib::setRegisterStereo(uint8 reg, uint8 valueLeft, uint8 _opl->write(0x223, valueRight); } -MidiDriver_Multisource *MidiDriver_Miles_AdLib_create(const Common::String &filenameAdLib, const Common::String &filenameOPL3, Common::SeekableReadStream *streamAdLib, Common::SeekableReadStream *streamOPL3) { +MidiDriver_Multisource *MidiDriver_Miles_AdLib_create(const Common::Path &filenameAdLib, const Common::Path &filenameOPL3, Common::SeekableReadStream *streamAdLib, Common::SeekableReadStream *streamOPL3) { // Load adlib instrument data from file SAMPLE.AD (OPL3: SAMPLE.OPL) - Common::String timbreFilename; + Common::Path timbreFilename; Common::SeekableReadStream *timbreStream = nullptr; bool preferOPL3 = false; @@ -1374,12 +1374,12 @@ MidiDriver_Multisource *MidiDriver_Miles_AdLib_create(const Common::String &file // If none of them exists and also no stream was passed, we can't do anything about it if (!filenameAdLib.empty()) { if (!filenameOPL3.empty()) { - error("MILES-ADLIB: could not open timbre file (%s or %s)", filenameAdLib.c_str(), filenameOPL3.c_str()); + error("MILES-ADLIB: could not open timbre file (%s or %s)", filenameAdLib.toString(Common::Path::kNativeSeparator).c_str(), filenameOPL3.toString(Common::Path::kNativeSeparator).c_str()); } else { - error("MILES-ADLIB: could not open timbre file (%s)", filenameAdLib.c_str()); + error("MILES-ADLIB: could not open timbre file (%s)", filenameAdLib.toString(Common::Path::kNativeSeparator).c_str()); } } else { - error("MILES-ADLIB: could not open timbre file (%s)", filenameOPL3.c_str()); + error("MILES-ADLIB: could not open timbre file (%s)", filenameOPL3.toString(Common::Path::kNativeSeparator).c_str()); } } } @@ -1389,14 +1389,14 @@ MidiDriver_Multisource *MidiDriver_Miles_AdLib_create(const Common::String &file // We prefer this situation if (!fileStream->open(timbreFilename)) - error("MILES-ADLIB: could not open timbre file (%s)", timbreFilename.c_str()); + error("MILES-ADLIB: could not open timbre file (%s)", timbreFilename.toString(Common::Path::kNativeSeparator).c_str()); streamSize = fileStream->size(); streamDataPtr = new byte[streamSize]; if (fileStream->read(streamDataPtr, streamSize) != streamSize) - error("MILES-ADLIB: error while reading timbre file (%s)", timbreFilename.c_str()); + error("MILES-ADLIB: error while reading timbre file (%s)", timbreFilename.toString(Common::Path::kNativeSeparator).c_str()); fileStream->close(); } else if (timbreStream) { diff --git a/audio/miles_midi.cpp b/audio/miles_midi.cpp index 3b5cd968780..f8fc91e8b5c 100644 --- a/audio/miles_midi.cpp +++ b/audio/miles_midi.cpp @@ -794,11 +794,11 @@ void MidiDriver_Miles_Midi::writeToSystemArea(byte index, byte value) { sysExMT32(sysExData, 1, targetAddress); } -MidiDriver_Miles_Midi *MidiDriver_Miles_MT32_create(const Common::String &instrumentDataFilename) { +MidiDriver_Miles_Midi *MidiDriver_Miles_MT32_create(const Common::Path &instrumentDataFilename) { return MidiDriver_Miles_MIDI_create(MT_MT32, instrumentDataFilename); } -MidiDriver_Miles_Midi *MidiDriver_Miles_MIDI_create(MusicType midiType, const Common::String &instrumentDataFilename) { +MidiDriver_Miles_Midi *MidiDriver_Miles_MIDI_create(MusicType midiType, const Common::Path &instrumentDataFilename) { assert(midiType == MT_MT32 || midiType == MT_GM || midiType == MT_GS); MilesMT32InstrumentEntry *instrumentTablePtr = nullptr; @@ -820,7 +820,7 @@ MidiDriver_Miles_Midi *MidiDriver_Miles_MIDI_create(MusicType midiType, const Co uint16 instrumentDataSize; if (!fileStream->open(instrumentDataFilename)) - error("MILES-MIDI: could not open instrument file '%s'", instrumentDataFilename.c_str()); + error("MILES-MIDI: could not open instrument file '%s'", instrumentDataFilename.toString(Common::Path::kNativeSeparator).c_str()); fileSize = fileStream->size();