From b75c969e666b9f262a05e0d1e54d56f7d3e45441 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 10 May 2005 22:56:25 +0000 Subject: Moved class File and the MD5 stuff to namespace Common svn-id: r18037 --- scumm/charset.cpp | 4 ++-- scumm/debugger.cpp | 4 ++-- scumm/imuse_digi/dimuse_bndmgr.cpp | 4 ++-- scumm/imuse_digi/dimuse_bndmgr.h | 4 ++-- scumm/imuse_digi/dimuse_sndmgr.cpp | 6 +++--- scumm/imuse_digi/dimuse_sndmgr.h | 2 +- scumm/intern.h | 2 +- scumm/resource.cpp | 4 ++-- scumm/resource_v3.cpp | 2 +- scumm/resource_v4.cpp | 2 +- scumm/resource_v7he.cpp | 12 ++++++------ scumm/resource_v7he.h | 8 ++++---- scumm/script_v6he.cpp | 6 +++--- scumm/script_v72he.cpp | 8 ++++---- scumm/script_v80he.cpp | 2 +- scumm/scumm.cpp | 6 ++++-- scumm/smush/smush_player.h | 2 +- scumm/sound.cpp | 6 +++--- scumm/sound.h | 4 +++- scumm/util.cpp | 4 +++- scumm/util.h | 2 +- scumm/vars.cpp | 4 ++-- scumm/wiz_he.cpp | 8 ++++---- 23 files changed, 56 insertions(+), 50 deletions(-) (limited to 'scumm') diff --git a/scumm/charset.cpp b/scumm/charset.cpp index e3c4c0b7bd..2b358b185d 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -28,14 +28,14 @@ namespace Scumm { void ScummEngine::loadCJKFont() { - File fp; + Common::File fp; _useCJKMode = false; if (_language == Common::JA_JPN && _version <= 5) { // FM-TOWNS v3 / v5 Kanji int numChar = 256 * 32; _2byteWidth = 16; _2byteHeight = 16; // use FM-TOWNS font rom, since game files don't have kanji font resources - if (fp.open("fmt_fnt.rom", File::kFileReadMode)) { + if (fp.open("fmt_fnt.rom", Common::File::kFileReadMode)) { _useCJKMode = true; debug(2, "Loading FM-TOWNS Kanji rom"); _2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar]; diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 847fb9ad27..7f3c0aabb1 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -289,7 +289,7 @@ bool ScummDebugger::Cmd_Script(int argc, const char** argv) { } bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) { - File file; + Common::File file; uint32 size; int resnum; @@ -302,7 +302,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::kFileReadMode); + file.open(argv[2], Common::File::kFileReadMode); if (file.isOpen() == false) { DebugPrintf("Could not open file %s\n", argv[2]); return true; diff --git a/scumm/imuse_digi/dimuse_bndmgr.cpp b/scumm/imuse_digi/dimuse_bndmgr.cpp index b94a2f44b6..1c4a1d40f4 100644 --- a/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -71,7 +71,7 @@ int BundleDirCache::matchFile(const char *filename) { } if (!found) { - File file; + Common::File file; if (file.open(filename) == false) { warning("BundleDirCache::matchFile() Can't open bundle file: %s", filename); @@ -135,7 +135,7 @@ BundleMgr::~BundleMgr() { close(); } -File *BundleMgr::getFile(const char *filename, int32 &offset, int32 &size) { +Common::File *BundleMgr::getFile(const char *filename, int32 &offset, int32 &size) { for (int i = 0; i < _numFiles; i++) { if (!scumm_stricmp(filename, _bundleTable[i].filename)) { _file.seek(_bundleTable[i].offset, SEEK_SET); diff --git a/scumm/imuse_digi/dimuse_bndmgr.h b/scumm/imuse_digi/dimuse_bndmgr.h index 5457ae20b8..be551b2e33 100644 --- a/scumm/imuse_digi/dimuse_bndmgr.h +++ b/scumm/imuse_digi/dimuse_bndmgr.h @@ -67,7 +67,7 @@ private: int _numFiles; int _numCompItems; int _curSample; - File _file; + Common::File _file; bool _compTableLoaded; int _fileBundleId; byte _compOutput[0x2000]; @@ -84,7 +84,7 @@ public: bool open(const char *filename, bool &compressed); void close(); - File *getFile(const char *filename, int32 &offset, int32 &size); + Common::File *getFile(const char *filename, int32 &offset, int32 &size); int32 decompressSampleByName(const char *name, int32 offset, int32 size, byte **comp_final, bool header_outside); int32 decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside); int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside); diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp index 238aeb2e91..af8aafefd9 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -84,7 +84,7 @@ void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, i } while (tag != MKID_BE('DATA')); } -void ImuseDigiSndMgr::prepareSoundFromRMAP(File *file, soundStruct *sound, int32 offset, int32 size) { +void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, soundStruct *sound, int32 offset, int32 size) { int l; file->seek(offset, SEEK_SET); @@ -368,7 +368,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch char fileName[24]; int32 offset = 0, size = 0; sprintf(fileName, "%s.map", soundName); - File *rmapFile = sound->bundle->getFile(fileName, offset, size); + Common::File *rmapFile = sound->bundle->getFile(fileName, offset, size); if (!rmapFile) { closeSound(sound); return NULL; @@ -577,7 +577,7 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b sprintf(fileName, "%s_reg%03d", soundHandle->name, region); if (scumm_stricmp(fileName, soundHandle->lastFileName) != 0) { int32 offs = 0, len = 0; - File *cmpFile; + Common::File *cmpFile; bool oggMode = false; sprintf(fileName, "%s_reg%03d.mp3", soundHandle->name, region); cmpFile = soundHandle->bundle->getFile(fileName, offs, len); diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h index 3e6713a290..4b4d5c488d 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.h +++ b/scumm/imuse_digi/dimuse_sndmgr.h @@ -96,7 +96,7 @@ private: bool checkForProperHandle(soundStruct *soundHandle); soundStruct *allocSlot(); void prepareSound(byte *ptr, soundStruct *sound); - void prepareSoundFromRMAP(File *file, soundStruct *sound, int32 offset, int32 size); + void prepareSoundFromRMAP(Common::File *file, soundStruct *sound, int32 offset, int32 size); ScummEngine *_vm; byte _disk; diff --git a/scumm/intern.h b/scumm/intern.h index 48a0b26043..af549c4d77 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -675,7 +675,7 @@ protected: const OpcodeEntryv60he *_opcodesv60he; - File _hFileTable[17]; + Common::File _hFileTable[17]; public: ScummEngine_v60he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v6(detector, syst, gs, md5sum) {} diff --git a/scumm/resource.cpp b/scumm/resource.cpp index e8c5423f8a..e9238da226 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -1227,7 +1227,7 @@ void ScummEngine::allocateArrays() { void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int length) { char buf[256]; - File out; + Common::File out; uint32 size; if (length >= 0) @@ -1245,7 +1245,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, Common::File::kFileWriteMode); if (out.isOpen() == false) return; out.write(ptr, size); diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp index 909050de10..6d504d8110 100644 --- a/scumm/resource_v3.cpp +++ b/scumm/resource_v3.cpp @@ -104,7 +104,7 @@ void ScummEngine_v3::loadCharset(int no) { checkRange(2, 0, no, "Loading illegal charset %d"); closeRoom(); - File file; + Common::File file; char buf[20]; sprintf(buf, "%02d.LFL", 99 - no); diff --git a/scumm/resource_v4.cpp b/scumm/resource_v4.cpp index 2b63dc0d4f..e00c96aa9a 100644 --- a/scumm/resource_v4.cpp +++ b/scumm/resource_v4.cpp @@ -136,7 +136,7 @@ void ScummEngine_v4::loadCharset(int no) { checkRange(4, 0, no, "Loading illegal charset %d"); closeRoom(); - File file; + Common::File file; char buf[20]; sprintf(buf, "%03d.LFL", 900 + no); diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp index 4e56d3669b..21ee28e4dd 100644 --- a/scumm/resource_v7he.cpp +++ b/scumm/resource_v7he.cpp @@ -142,7 +142,7 @@ int Win32ResExtractor::extractResource(const char *resType, char *resName, byte /* initiate stuff */ fi.memory = NULL; - fi.file = new File; + fi.file = new Common::File; if (!_fileName[0]) { // We are running for the first time snprintf(_fileName, 256, "%s.he3", _vm->getGameName()); @@ -1279,7 +1279,7 @@ void MacResExtractor::setCursor(int id) { int cursorsize; int w = 0, h = 0, hotspot_x = 0, hotspot_y = 0; int keycolor; - File f; + Common::File f; if (!_fileName[0]) // We are running for the first time if (_vm->_substResFileNameIndex > 0) { @@ -1314,7 +1314,7 @@ void MacResExtractor::setCursor(int id) { } int MacResExtractor::extractResource(int id, byte **buf) { - File in; + Common::File in; int size; in.open(_fileName); @@ -1345,7 +1345,7 @@ int MacResExtractor::extractResource(int id, byte **buf) { #define MBI_RFLEN 87 #define MAXNAMELEN 63 -bool MacResExtractor::init(File in) { +bool MacResExtractor::init(Common::File in) { byte infoHeader[MBI_INFOHDR]; int32 data_size, rsrc_size; int32 data_size_pad, rsrc_size_pad; @@ -1397,7 +1397,7 @@ bool MacResExtractor::init(File in) { return true; } -byte *MacResExtractor::getResource(File in, const char *typeID, int16 resID, int *size) { +byte *MacResExtractor::getResource(Common::File in, const char *typeID, int16 resID, int *size) { int i; int typeNum = -1; int resNum = -1; @@ -1434,7 +1434,7 @@ byte *MacResExtractor::getResource(File in, const char *typeID, int16 resID, int return buf; } -void MacResExtractor::readMap(File in) { +void MacResExtractor::readMap(Common::File in) { int i, j, len; in.seek(_mapOffset + 22); diff --git a/scumm/resource_v7he.h b/scumm/resource_v7he.h index 8144cdd35b..fc64a04241 100644 --- a/scumm/resource_v7he.h +++ b/scumm/resource_v7he.h @@ -156,7 +156,7 @@ class Win32ResExtractor { #endif struct WinLibrary { - File *file; + Common::File *file; byte *memory; byte *first_resource; bool is_PE_binary; @@ -490,9 +490,9 @@ public: private: int extractResource(int id, byte **buf); - bool init(File in); - void readMap(File in); - byte *getResource(File in, const char *typeID, int16 resID, int *size); + bool init(Common::File in); + void readMap(Common::File in); + byte *getResource(Common::File in, const char *typeID, int16 resID, int *size); void convertIcons(byte *data, int datasize, byte **cursor, int *w, int *h, int *hotspot_x, int *hotspot_y, int *keycolor); diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index ee21de7efe..f8489bab2f 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -1007,12 +1007,12 @@ void ScummEngine_v60he::o60_openFile() { if (slot != -1) { switch(mode) { case 1: - _hFileTable[slot].open((char*)filename + r, File::kFileReadMode, _saveFileMan->getSavePath()); + _hFileTable[slot].open((char*)filename + r, Common::File::kFileReadMode, _saveFileMan->getSavePath()); if (_hFileTable[slot].isOpen() == false) - _hFileTable[slot].open((char*)filename + r, File::kFileReadMode); + _hFileTable[slot].open((char*)filename + r, Common::File::kFileReadMode); break; case 2: - _hFileTable[slot].open((char*)filename + r, File::kFileWriteMode, _saveFileMan->getSavePath()); + _hFileTable[slot].open((char*)filename + r, Common::File::kFileWriteMode, _saveFileMan->getSavePath()); break; default: error("o60_openFile(): wrong open file mode %d", mode); diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 62e2284c16..55b371fdc6 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -538,7 +538,7 @@ int ScummEngine_v72he::convertFilePath(byte *dst, bool setFilePath) { } if (setFilePath) { - File f; + Common::File f; char filePath[256], newFilePath[256]; sprintf(filePath, "%s%s", _gameDataPath.c_str(), dst + r); @@ -1752,12 +1752,12 @@ void ScummEngine_v72he::o72_openFile() { if (slot != -1) { switch(mode) { case 1: - _hFileTable[slot].open((char*)filename + r, File::kFileReadMode, _saveFileMan->getSavePath()); + _hFileTable[slot].open((char*)filename + r, Common::File::kFileReadMode, _saveFileMan->getSavePath()); if (_hFileTable[slot].isOpen() == false) - _hFileTable[slot].open((char*)filename + r, File::kFileReadMode, _gameDataPath.c_str()); + _hFileTable[slot].open((char*)filename + r, Common::File::kFileReadMode, _gameDataPath.c_str()); break; case 2: - _hFileTable[slot].open((char*)filename + r, File::kFileWriteMode, _saveFileMan->getSavePath()); + _hFileTable[slot].open((char*)filename + r, Common::File::kFileWriteMode, _saveFileMan->getSavePath()); break; default: error("o72_openFile(): wrong open file mode %d", mode); diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index ee9c88ccb7..018d68e6b3 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -406,7 +406,7 @@ void ScummEngine_v80he::o80_getFileSize() { copyScriptString(filename, sizeof(filename)); - File f; + Common::File f; if (f.open((char *)filename) == false) { push(-1); return; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 361d16167b..38350d1e4b 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -72,6 +72,8 @@ extern bool isSmartphone(void); static int generateSubstResFileName_(const char *filename, char *buf, int bufsize, int index); +using Common::File; + namespace Scumm { // Use g_scumm from error() ONLY @@ -2628,7 +2630,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { uint8 md5sum[16]; const char *name = iter->_key.c_str(); - if (md5_file(name, md5sum, 0, kMD5FileSizeLimit)) { + if (Common::md5_file(name, md5sum, 0, kMD5FileSizeLimit)) { char md5str[32+1]; for (int j = 0; j < 16; j++) { sprintf(md5str + j*2, "%02x", (int)md5sum[j]); @@ -2772,7 +2774,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { game.platform = Common::kPlatformMacintosh; } - if (md5_file(detectName, md5sum, ConfMan.get("path").c_str(), kMD5FileSizeLimit)) { + if (Common::md5_file(detectName, md5sum, ConfMan.get("path").c_str(), kMD5FileSizeLimit)) { for (int j = 0; j < 16; j++) { sprintf(gameMD5 + j*2, "%02x", (int)md5sum[j]); } diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index 395058d158..dc57258dbf 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -61,7 +61,7 @@ private: SoundHandle _compressedFileSoundHandle; bool _compressedFileMode; - File _compressedFile; + Common::File _compressedFile; byte _IACToutput[4096]; int32 _IACTpos; bool _storeFrame; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 14ca1a21e1..63f2af0b2c 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -165,7 +165,7 @@ void Sound::setOverrideFreq(int freq) { void Sound::setupHEMusicFile() { int i, total_size; char buf[32], buf1[128]; - File musicFile; + Common::File musicFile; sprintf(buf, "%s.he4", _vm->getGameName()); @@ -238,7 +238,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { int music_offs; char buf[32], buf1[128]; - File musicFile; + Common::File musicFile; sprintf(buf, "%s.he4", _vm->getGameName()); @@ -1397,7 +1397,7 @@ int ScummEngine::readSoundResource(int type, int idx) { // Used in 3DO version of puttputt joins the parade and probably others // Specifies a separate file to be used for music from what I gather. int tmpsize; - File dmuFile; + Common::File dmuFile; char buffer[128]; debugC(DEBUG_SOUND, "Found base tag FMUS in sound %d, size %d", idx, total_size); debugC(DEBUG_SOUND, "It was at position %d", _fileHandle->pos()); diff --git a/scumm/sound.h b/scumm/sound.h index b4602cd834..a792629e99 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -25,7 +25,9 @@ #include "sound/audiostream.h" #include "sound/mixer.h" -class File; +namespace Common { + class File; +} namespace Scumm { diff --git a/scumm/util.cpp b/scumm/util.cpp index aa8b9d0a45..5328eb3787 100644 --- a/scumm/util.cpp +++ b/scumm/util.cpp @@ -23,6 +23,8 @@ #include "common/util.h" #include "common/md5.h" +using Common::File; + namespace Scumm { #pragma mark - @@ -1197,7 +1199,7 @@ bool ScummNESFile::open(const char *filename, AccessMode mode) { uint8 md5sum[16]; if (_ROMset == kROMsetNum) { - if (md5_file(filename, md5sum)) { + if (Common::md5_file(filename, md5sum)) { char md5str[32+1]; for (int j = 0; j < 16; j++) { sprintf(md5str + j*2, "%02x", (int)md5sum[j]); diff --git a/scumm/util.h b/scumm/util.h index 7fbf4035dd..53e5187182 100644 --- a/scumm/util.h +++ b/scumm/util.h @@ -27,7 +27,7 @@ namespace Scumm { -class BaseScummFile : public File { +class BaseScummFile : public Common::File { public: virtual void setEnc(byte value) = 0; diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 1dd1f43292..079a02d600 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -603,7 +603,7 @@ void ScummEngine::initScummVars() { && (_platform == Common::kPlatformPC)) { if (_gameId == GID_LOOM) { char buf[50]; - File f; + Common::File f; for (int i = 82; i < 86; i++) { sprintf(buf, "%d.LFL", i); f.open(buf); @@ -612,7 +612,7 @@ void ScummEngine::initScummVars() { f.close(); } } else if (_gameId == GID_MONKEY_EGA) { - File f; + Common::File f; f.open("DISK09.LEC"); if (f.isOpen() == false) error("Native MIDI support requires Roland patch from LucasArts"); diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index 2829e9202b..d0778bee62 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -1713,7 +1713,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) { break; case 3: if (params->processFlags & kWPFUseFile) { - File f; + Common::File f; // Convert Windows path separators to something more portable strncpy(buf, (const char *)params->filename, 512); @@ -1722,7 +1722,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) { buf[i] = '/'; } - if (f.open((const char *)buf, File::kFileReadMode)) { + if (f.open((const char *)buf, Common::File::kFileReadMode)) { uint32 id = f.readUint32LE(); if (id == TO_LE_32(MKID('AWIZ')) || id == TO_LE_32(MKID('MULT'))) { uint32 size = f.readUint32BE(); @@ -1751,7 +1751,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) { break; case 4: if (params->processFlags & kWPFUseFile) { - File f; + Common::File f; switch(params->fileWriteMode) { case 2: @@ -1768,7 +1768,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) { buf[i] = '/'; } - if (!f.open((const char *)buf, File::kFileWriteMode)) { + if (!f.open((const char *)buf, Common::File::kFileWriteMode)) { warning("Unable to open for write '%s'", buf); VAR(119) = -3; } else { -- cgit v1.2.3