diff options
-rw-r--r-- | common/file.cpp | 2 | ||||
-rw-r--r-- | common/file.h | 3 | ||||
-rw-r--r-- | queen/resource.cpp | 8 | ||||
-rw-r--r-- | scumm/debugger.cpp | 2 | ||||
-rw-r--r-- | scumm/resource.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm.cpp | 4 | ||||
-rw-r--r-- | simon/items.cpp | 4 | ||||
-rw-r--r-- | simon/res.cpp | 12 | ||||
-rw-r--r-- | simon/simon.cpp | 24 | ||||
-rw-r--r-- | simon/sound.cpp | 38 | ||||
-rw-r--r-- | simon/sound.h | 7 | ||||
-rw-r--r-- | sky/disk.cpp | 4 | ||||
-rw-r--r-- | sword1/resman.cpp | 2 | ||||
-rw-r--r-- | sword2/resman.cpp | 4 |
15 files changed, 59 insertions, 61 deletions
diff --git a/common/file.cpp b/common/file.cpp index 24c8907002..26f6fcb603 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -140,7 +140,7 @@ File::~File() { delete [] _name; } -bool File::open(const char *filename, const char *directory, AccessMode mode) { +bool File::open(const char *filename, AccessMode mode, const char *directory) { if (_handle) { debug(2, "File %s already opened", filename); return false; diff --git a/common/file.h b/common/file.h index ba8eb469e4..3a268ecc5b 100644 --- a/common/file.h +++ b/common/file.h @@ -48,8 +48,7 @@ public: File(); virtual ~File(); - bool open(const char *filename, const Common::String &directory) { return open(filename, directory.c_str()); } - bool open(const char *filename, const char *directory = NULL, AccessMode mode = kFileReadMode); + bool open(const char *filename, AccessMode mode = kFileReadMode, const char *directory = NULL); void close(); bool isOpen() const; bool ioFailed() const; diff --git a/queen/resource.cpp b/queen/resource.cpp index 4b55824ec9..7184475d21 100644 --- a/queen/resource.cpp +++ b/queen/resource.cpp @@ -143,7 +143,7 @@ uint8 *Resource::loadFileMalloc(const char *filename, uint32 skipBytes, byte *ds } bool Resource::findNormalVersion() { - _resourceFile->open("queen.1", _datafilePath); + _resourceFile->open("queen.1"); if (!_resourceFile->isOpen()) { return false; } @@ -170,7 +170,7 @@ bool Resource::findNormalVersion() { } bool Resource::findCompressedVersion() { - _resourceFile->open("queen.1c", _datafilePath); + _resourceFile->open("queen.1c"); if (!_resourceFile->isOpen()) { return false; } @@ -215,9 +215,9 @@ Language Resource::getLanguage() const { bool Resource::readTableFile(const GameVersion *gameVersion) { File tableFile; - tableFile.open(_tableFilename, _datafilePath); + tableFile.open(_tableFilename); if (!tableFile.isOpen()) - tableFile.open(_tableFilename, ""); // try current directory + tableFile.open(_tableFilename, File::kFileReadMode, ""); // try current directory if (tableFile.isOpen() && tableFile.readUint32BE() == 'QTBL') { if (tableFile.readUint32BE() != CURRENT_TBL_VERSION) warning("Incorrect version of queen.tbl, please update it"); diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 6a68fe0a9e..c4a0da71f5 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -315,7 +315,7 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) { // FIXME add bounds check if (!strncmp(argv[1], "scr", 3)) { - file.open(argv[2], ""); + file.open(argv[2], File::kFileReadMode, ""); if (file.isOpen() == false) { DebugPrintf("Could not open file %s\n", argv[2]); return true; diff --git a/scumm/resource.cpp b/scumm/resource.cpp index ba13e8dbc8..d12fd6e958 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -2278,7 +2278,7 @@ void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int le sprintf(buf, "dumps/%s%d.dmp", tag, idx); #endif - out.open(buf, "", File::kFileWriteMode); + out.open(buf, File::kFileWriteMode, ""); if (out.isOpen() == false) return; out.write(ptr, size); diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 6cd1b830aa..cda559a915 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -1012,9 +1012,9 @@ void ScummEngine_v6he::o6_openFile() { if (slot != -1) { if (mode == 1) - _hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileReadMode); + _hFileTable[slot].open((char*)filename + r, File::kFileReadMode); else if (mode == 2) - _hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileWriteMode); + _hFileTable[slot].open((char*)filename + r, File::kFileWriteMode); else error("o6_openFile(): wrong open file mode"); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 6f683e06b0..192d10e5d5 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1233,7 +1233,7 @@ void ScummEngine::initScummVars() { File f; while (i < 85) { sprintf(buf, "%d.LFL", i); - f.open(buf, _gameDataPath); + f.open(buf); if (f.isOpen() == false) error("Native MIDI support requires Roland patch from LucasArts"); f.close(); @@ -1241,7 +1241,7 @@ void ScummEngine::initScummVars() { } } else if (_gameId == GID_MONKEY_EGA) { File f; - f.open("DISK09.LEC", _gameDataPath); + f.open("DISK09.LEC"); if (f.isOpen() == false) error("Native MIDI support requires Roland patch from LucasArts"); } diff --git a/simon/items.cpp b/simon/items.cpp index d945f6ba76..5e67881576 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -1025,9 +1025,9 @@ int SimonEngine::runScript() { if (_game == GAME_SIMON1CD32) { char buf[10]; sprintf(buf, "%d%s", _sound_file_id, "Effects"); - _sound->readSfxFile(buf, _gameDataPath); + _sound->readSfxFile(buf); sprintf(buf, "%d%s", _sound_file_id, "simon"); - _sound->readVoiceFile(buf, _gameDataPath); + _sound->readVoiceFile(buf); } } diff --git a/simon/res.cpp b/simon/res.cpp index 036bb50d1e..e32c267ee6 100644 --- a/simon/res.cpp +++ b/simon/res.cpp @@ -102,13 +102,13 @@ void SimonEngine::loadGamePcFile(const char *filename) { int i, file_size; /* read main gamepc file */ - in.open(filename, _gameDataPath); + in.open(filename); if (in.isOpen() == false) { char *filename2; filename2 = (char *)malloc(strlen(filename) + 2); strcpy(filename2, filename); strcat(filename2, "."); - in.open(filename2, _gameDataPath); + in.open(filename2); free(filename2); if (in.isOpen() == false) error("Can't open gamepc file '%s' or '%s.'", gss->gamepc_filename, gss->gamepc_filename); @@ -128,9 +128,9 @@ void SimonEngine::loadGamePcFile(const char *filename) { in.close(); /* Read list of TABLE resources */ - in.open("TBLLIST", _gameDataPath); + in.open("TBLLIST"); if (in.isOpen() == false) { - in.open("TBLLIST.", _gameDataPath); + in.open("TBLLIST."); if (in.isOpen() == false) error("Can't open table resources file 'TBLLIST' or 'TBLLIST.'"); } @@ -150,9 +150,9 @@ void SimonEngine::loadGamePcFile(const char *filename) { /* Read list of TEXT resources */ if (_game == GAME_SIMON1ACORN) - in.open("STRIPPED", _gameDataPath); + in.open("STRIPPED"); else - in.open("STRIPPED.TXT", _gameDataPath); + in.open("STRIPPED.TXT"); if (in.isOpen() == false) error("Can't open text resources file 'STRIPPED.TXT'"); diff --git a/simon/simon.cpp b/simon/simon.cpp index 1ef3aa8c7e..624f601aba 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -1196,7 +1196,7 @@ void SimonEngine::loadTablesIntoMem(uint subr_id) { if (_game == GAME_SIMON1WIN) { memcpy(filename, "SFXXXX", 6); - _sound->readSfxFile(filename, _gameDataPath); + _sound->readSfxFile(filename); } else if (_game & GF_SIMON2) { _sound->loadSfxTable(_game_file, _game_offsets_ptr[atoi(filename + 6) - 1 + SOUND_INDEX_BASE]); } @@ -1226,7 +1226,7 @@ void SimonEngine::playSting(uint a) { uint16 mus_offset; sprintf(filename, "STINGS%i.MUS", _sound_file_id); - mus_file.open(filename, _gameDataPath); + mus_file.open(filename); if (!mus_file.isOpen()) { warning("Can't load sound effect from '%s'", filename); return; @@ -1290,7 +1290,7 @@ File *SimonEngine::openTablesFile_gme(const char *filename) { uint SimonEngine::loadTextFile_simon1(const char *filename, byte *dst) { File fo; - fo.open(filename, _gameDataPath); + fo.open(filename); uint32 size; if (fo.isOpen() == false) @@ -1307,7 +1307,7 @@ uint SimonEngine::loadTextFile_simon1(const char *filename, byte *dst) { File *SimonEngine::openTablesFile_simon1(const char *filename) { File *fo = new File(); - fo->open(filename, _gameDataPath); + fo->open(filename); if (fo->isOpen() == false) error("openTablesFile: Can't open '%s'", filename); return fo; @@ -1799,11 +1799,11 @@ uint SimonEngine::item_get_icon_number(Item *item) { void SimonEngine::loadIconFile() { File in; if (_game & GF_ACORN) - in.open("ICONDATA", _gameDataPath); + in.open("ICONDATA"); else if (_game & GF_AMIGA) - in.open("icon.pkd", _gameDataPath); + in.open("icon.pkd"); else - in.open("ICON.DAT", _gameDataPath); + in.open("ICON.DAT"); uint size; if (in.isOpen() == false) @@ -4273,7 +4273,7 @@ void SimonEngine::read_vga_from_datfile_1(uint vga_id) { sprintf(buf, "0%d.VGA", vga_id); } - in.open(buf, _gameDataPath); + in.open(buf); if (in.isOpen() == false) error("read_vga_from_datfile_1: can't open %s", buf); size = in.size(); @@ -4318,7 +4318,7 @@ byte *SimonEngine::read_vga_from_datfile_2(uint id) { sprintf(buf, "%.3d%d.VGA", id >> 1, (id & 1) + 1); } - in.open(buf, _gameDataPath); + in.open(buf); if (in.isOpen() == false) error("read_vga_from_datfile_2: can't open %s", buf); size = in.size(); @@ -4358,7 +4358,7 @@ void SimonEngine::resfile_read(void *dst, uint32 offs, uint32 size) { void SimonEngine::openGameFile() { if (!(_game & GF_OLD_BUNDLE)) { _game_file = new File(); - _game_file->open(gss->gme_filename, _gameDataPath); + _game_file->open(gss->gme_filename); if (_game_file->isOpen() == false) error("Can't open game file '%s'", gss->gme_filename); @@ -4577,7 +4577,7 @@ void SimonEngine::go() { setup_vga_file_buf_pointers(); - _sound = new Sound(_game, gss, _gameDataPath, _mixer); + _sound = new Sound(_game, gss, _mixer); _debugger = new Debugger(this); if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) { @@ -5046,7 +5046,7 @@ void SimonEngine::loadMusic (uint music) { char buf[15]; File f; sprintf(buf, "MOD%d.MUS", music); - f.open(buf, _gameDataPath); + f.open(buf); if (f.isOpen() == false) { warning("Can't load music from '%s'", buf); return; diff --git a/simon/sound.cpp b/simon/sound.cpp index 1d4dd92c3b..50aca0fe1f 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -265,8 +265,8 @@ void FlacSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) } #endif -Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::String &gameDataPath, SoundMixer *mixer) - : _game(game), _gameDataPath(gameDataPath), _mixer(mixer) { +Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer) + : _game(game), _mixer(mixer) { _voice = 0; _effects = 0; @@ -285,7 +285,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str #ifdef USE_FLAC if (!_voice && gss->flac_filename && gss->flac_filename[0]) { - file->open(gss->flac_filename, gameDataPath); + file->open(gss->flac_filename); if (file->isOpen()) { _voice_file = true; _voice = new FlacSound(_mixer, file); @@ -294,7 +294,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str #endif #ifdef USE_MAD if (!_voice && gss->mp3_filename && gss->mp3_filename[0]) { - file->open(gss->mp3_filename, gameDataPath); + file->open(gss->mp3_filename); if (file->isOpen()) { _voice_file = true; _voice = new MP3Sound(_mixer, file); @@ -303,7 +303,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str #endif #ifdef USE_VORBIS if (!_voice && gss->vorbis_filename && gss->vorbis_filename[0]) { - file->open(gss->vorbis_filename, gameDataPath); + file->open(gss->vorbis_filename); if (file->isOpen()) { _voice_file = true; _voice = new VorbisSound(_mixer, file); @@ -313,7 +313,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str if (!_voice) { // for simon2 mac/amiga, only read index file if (_game == GAME_SIMON2MAC) { - file->open("voices.idx", gameDataPath); + file->open("voices.idx"); if (file->isOpen() == false) { warning("Can't open voice index file 'voices.idx'"); } else { @@ -332,7 +332,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str delete file; } else if (_game & GF_WIN) { s = gss->wav_filename; - file->open(s, gameDataPath); + file->open(s); if (file->isOpen() == false) { warning("Can't open voice file %s", s); delete file; @@ -345,7 +345,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str return; } else if (_game & GF_TALKIE) { s = gss->voc_filename; - file->open(s, gameDataPath); + file->open(s); if (file->isOpen() == false) { warning("Can't open voice file %s", s); delete file; @@ -360,7 +360,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str file = new File(); #ifdef USE_MAD if (!_effects && gss->mp3_effects_filename && gss->mp3_effects_filename[0]) { - file->open(gss->mp3_effects_filename, gameDataPath); + file->open(gss->mp3_effects_filename); if (file->isOpen()) { _effects = new MP3Sound(_mixer, file); } @@ -368,7 +368,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str #endif #ifdef USE_VORBIS if (!_effects && gss->vorbis_effects_filename && gss->vorbis_effects_filename[0]) { - file->open(gss->vorbis_effects_filename, gameDataPath); + file->open(gss->vorbis_effects_filename); if (file->isOpen()) { _effects = new VorbisSound(_mixer, file); } @@ -376,7 +376,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str #endif #ifdef USE_FLAC if (!_effects && gss->flac_effects_filename && gss->flac_effects_filename[0]) { - file->open(gss->flac_effects_filename, gameDataPath); + file->open(gss->flac_effects_filename); if (file->isOpen()) { _effects = new FlacSound(_mixer, file); } @@ -384,7 +384,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str #endif if (!_effects) { s = gss->voc_effects_filename; - file->open(s, gameDataPath); + file->open(s); if (file->isOpen() == false) { warning("Can't open effects file %s", s); } else { @@ -402,18 +402,18 @@ Sound::~Sound() { free(_offsets); } -void Sound::readSfxFile(const char *filename, const Common::String &gameDataPath) { +void Sound::readSfxFile(const char *filename) { stopAll(); File *file = new File(); - file->open(filename, gameDataPath); + file->open(filename); if (file->isOpen() == false) { char *filename2; filename2 = (char *)malloc(strlen(filename) + 2); strcpy(filename2, filename); strcat(filename2, "."); - file->open(filename2, gameDataPath); + file->open(filename2); free(filename2); if (file->isOpen() == false) { if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30) @@ -438,18 +438,18 @@ void Sound::loadSfxTable(File *gameFile, uint32 base) { _effects = new VocSound(_mixer, gameFile, base); } -void Sound::readVoiceFile(const char *filename, const Common::String &gameDataPath) { +void Sound::readVoiceFile(const char *filename) { stopAll(); File *file = new File(); - file->open(filename, gameDataPath); + file->open(filename); if (file->isOpen() == false) { char *filename2; filename2 = (char *)malloc(strlen(filename) + 2); strcpy(filename2, filename); strcat(filename2, "."); - file->open(filename2, gameDataPath); + file->open(filename2); free(filename2); if (file->isOpen() == false) { warning("readVoiceFile: Can't load voice file %s", filename); @@ -470,7 +470,7 @@ void Sound::playVoice(uint sound) { _last_voice_file = _filenums[sound]; sprintf(filename, "voices%d.dat", _filenums[sound]); File *file = new File(); - file->open(filename, _gameDataPath); + file->open(filename); if (file->isOpen() == false) { warning("playVoice: Can't load voice file %s", filename); return; diff --git a/simon/sound.h b/simon/sound.h index 79ec0fa9e5..5ca7b2a028 100644 --- a/simon/sound.h +++ b/simon/sound.h @@ -31,7 +31,6 @@ class BaseSound; class Sound { private: byte _game; - const Common::String _gameDataPath; SoundMixer *_mixer; @@ -53,12 +52,12 @@ public: bool _voice_file; uint _ambient_playing; - Sound(const byte game, const GameSpecificSettings *gss, const Common::String &gameDataPath, SoundMixer *mixer); + Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer); ~Sound(); - void readSfxFile(const char *filename, const Common::String &gameDataPath); + void readSfxFile(const char *filename); void loadSfxTable(File *gameFile, uint32 base); - void readVoiceFile(const char *filename, const Common::String &gameDataPath); + void readVoiceFile(const char *filename); void playVoice(uint sound); void playEffects(uint sound); diff --git a/sky/disk.cpp b/sky/disk.cpp index 0b18056c12..53d2934f2e 100644 --- a/sky/disk.cpp +++ b/sky/disk.cpp @@ -407,9 +407,9 @@ void Disk::dumpFile(uint16 fileNr) { filePtr = loadFile(fileNr, NULL); sprintf(buf, "dumps/file-%d.dmp", fileNr); - out.open(buf, "", File::kFileReadMode); + out.open(buf, File::kFileReadMode, ""); if (out.isOpen() == false) { - out.open(buf, "", File::kFileWriteMode); + out.open(buf, File::kFileWriteMode, ""); if (out.isOpen() == false) return; out.write(filePtr, _lastLoadedFileSize); diff --git a/sword1/resman.cpp b/sword1/resman.cpp index fb41e648f4..49123ddba3 100644 --- a/sword1/resman.cpp +++ b/sword1/resman.cpp @@ -145,7 +145,7 @@ void ResMan::dumpRes(uint32 id) { char outn[30]; sprintf(outn, "DUMP%08X.BIN", id); File outf; - if (outf.open(outn, "", File::kFileWriteMode)) { + if (outf.open(outn, File::kFileWriteMode, "")) { resOpen(id); MemHandle *memHandle = resHandle(id); outf.write(memHandle->data, memHandle->size); diff --git a/sword2/resman.cpp b/sword2/resman.cpp index a92ac23cf9..bd4eddd450 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -525,8 +525,8 @@ byte *ResourceManager::openResource(uint32 res, bool dump) { sprintf(buf, "dumps/%s-%d.dmp", tag, res); #endif - if (!out.open(buf, "")) { - if (out.open(buf, "", File::kFileWriteMode)) + if (!out.open(buf, File::kFileReadMode, "")) { + if (out.open(buf, File::kFileWriteMode, "")) out.write(_resList[res].ptr, len); } |