aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-05-10 22:56:25 +0000
committerMax Horn2005-05-10 22:56:25 +0000
commitb75c969e666b9f262a05e0d1e54d56f7d3e45441 (patch)
treee4868d14ac249a63e01f905472ec9be69f04a028
parent55c37c18ceed916eb3744666d3d10783b0cf8783 (diff)
downloadscummvm-rg350-b75c969e666b9f262a05e0d1e54d56f7d3e45441.tar.gz
scummvm-rg350-b75c969e666b9f262a05e0d1e54d56f7d3e45441.tar.bz2
scummvm-rg350-b75c969e666b9f262a05e0d1e54d56f7d3e45441.zip
Moved class File and the MD5 stuff to namespace Common
svn-id: r18037
-rw-r--r--base/engine.cpp4
-rw-r--r--base/main.cpp4
-rw-r--r--common/file.cpp9
-rw-r--r--common/file.h12
-rw-r--r--common/md5.cpp4
-rw-r--r--common/md5.h4
-rw-r--r--gob/dataio.cpp10
-rw-r--r--gob/dataio.h6
-rw-r--r--gob/global.cpp2
-rw-r--r--gob/global.h2
-rw-r--r--gob/gob.cpp2
-rw-r--r--gob/inter.cpp2
-rw-r--r--graphics/animation.cpp4
-rw-r--r--graphics/animation.h6
-rw-r--r--kyra/resource.cpp6
-rw-r--r--queen/queen.cpp2
-rw-r--r--queen/resource.cpp8
-rw-r--r--queen/resource.h6
-rw-r--r--queen/sound.cpp6
-rw-r--r--queen/talk.cpp2
-rw-r--r--saga/actor.cpp4
-rw-r--r--saga/actor.h16
-rw-r--r--saga/game.cpp8
-rw-r--r--saga/music.cpp12
-rw-r--r--saga/rscfile.cpp4
-rw-r--r--saga/rscfile.h2
-rw-r--r--saga/saga.cpp20
-rw-r--r--saga/saveload.cpp6
-rw-r--r--saga/sndres.cpp4
-rw-r--r--scumm/charset.cpp4
-rw-r--r--scumm/debugger.cpp4
-rw-r--r--scumm/imuse_digi/dimuse_bndmgr.cpp4
-rw-r--r--scumm/imuse_digi/dimuse_bndmgr.h4
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp6
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.h2
-rw-r--r--scumm/intern.h2
-rw-r--r--scumm/resource.cpp4
-rw-r--r--scumm/resource_v3.cpp2
-rw-r--r--scumm/resource_v4.cpp2
-rw-r--r--scumm/resource_v7he.cpp12
-rw-r--r--scumm/resource_v7he.h8
-rw-r--r--scumm/script_v6he.cpp6
-rw-r--r--scumm/script_v72he.cpp8
-rw-r--r--scumm/script_v80he.cpp2
-rw-r--r--scumm/scumm.cpp6
-rw-r--r--scumm/smush/smush_player.h2
-rw-r--r--scumm/sound.cpp6
-rw-r--r--scumm/sound.h4
-rw-r--r--scumm/util.cpp4
-rw-r--r--scumm/util.h2
-rw-r--r--scumm/vars.cpp4
-rw-r--r--scumm/wiz_he.cpp8
-rw-r--r--simon/icons.cpp2
-rw-r--r--simon/midi.cpp8
-rw-r--r--simon/midi.h12
-rw-r--r--simon/res.cpp12
-rw-r--r--simon/simon.cpp6
-rw-r--r--simon/simon.h28
-rw-r--r--simon/sound.cpp2
-rw-r--r--simon/sound.h2
-rw-r--r--sky/compact.cpp2
-rw-r--r--sky/compact.h6
-rw-r--r--sky/disk.cpp8
-rw-r--r--sky/disk.h8
-rw-r--r--sound/audiostream.cpp4
-rw-r--r--sound/flac.cpp4
-rw-r--r--sound/flac.h6
-rw-r--r--sound/mixer.h1
-rw-r--r--sound/mp3.cpp3
-rw-r--r--sound/mp3.h6
-rw-r--r--sound/softsynth/mt32.cpp8
-rw-r--r--sound/vorbis.cpp4
-rw-r--r--sound/vorbis.h6
-rw-r--r--sword1/animation.cpp2
-rw-r--r--sword1/control.cpp2
-rw-r--r--sword1/credits.cpp2
-rw-r--r--sword1/music.cpp4
-rw-r--r--sword1/music.h6
-rw-r--r--sword1/resman.cpp12
-rw-r--r--sword1/resman.h4
-rw-r--r--sword1/sound.h2
-rw-r--r--sword1/sword1.cpp18
-rw-r--r--sword2/build_display.cpp2
-rw-r--r--sword2/driver/d_sound.cpp8
-rw-r--r--sword2/resman.cpp14
-rw-r--r--sword2/resman.h8
-rw-r--r--sword2/sound.cpp4
-rw-r--r--sword2/sound.h10
-rw-r--r--sword2/startup.cpp2
-rw-r--r--sword2/sword2.cpp12
90 files changed, 291 insertions, 242 deletions
diff --git a/base/engine.cpp b/base/engine.cpp
index 0e01fa5b3b..081fd27b4f 100644
--- a/base/engine.cpp
+++ b/base/engine.cpp
@@ -42,13 +42,13 @@ Engine::Engine(OSystem *syst)
_timer = g_timer;
// Add default file directory
- File::addDefaultDirectory(_gameDataPath);
+ Common::File::addDefaultDirectory(_gameDataPath);
_saveFileMan = _system->getSavefileManager();
}
Engine::~Engine() {
- File::resetDefaultDirectories();
+ Common::File::resetDefaultDirectories();
delete _mixer;
delete _saveFileMan;
diff --git a/base/main.cpp b/base/main.cpp
index 287b0a891a..32e63c9f74 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -279,10 +279,10 @@ static int runGame(GameDetector &detector, OSystem &system) {
// Add extrapath (if any) to the directory search list
if (ConfMan.hasKey("extrapath"))
- File::addDefaultDirectory(ConfMan.get("extrapath"));
+ Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain))
- File::addDefaultDirectory(ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain));
+ Common::File::addDefaultDirectory(ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain));
int result;
diff --git a/common/file.cpp b/common/file.cpp
index 7f948f7bc7..7128796623 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -22,8 +22,9 @@
#include "common/file.h"
#include "common/util.h"
+namespace Common {
-Common::StringList File::_defaultDirectories;
+StringList File::_defaultDirectories;
static FILE *fopenNoCase(const char *filename, const char *directory, const char *mode) {
@@ -99,7 +100,7 @@ static FILE *fopenNoCase(const char *filename, const char *directory, const char
return file;
}
-void File::addDefaultDirectory(const Common::String &directory) {
+void File::addDefaultDirectory(const String &directory) {
_defaultDirectories.push_back(directory);
}
@@ -153,7 +154,7 @@ bool File::open(const char *filename, AccessMode mode, const char *directory) {
if (mode == kFileWriteMode || directory) {
_handle = fopenNoCase(filename, directory ? directory : "", modeStr);
} else {
- Common::StringList::const_iterator x;
+ StringList::const_iterator x;
// Try all default directories
for (x = _defaultDirectories.begin(); _handle == NULL && x != _defaultDirectories.end(); ++x) {
_handle = fopenNoCase(filename, x->c_str(), modeStr);
@@ -282,3 +283,5 @@ uint32 File::write(const void *ptr, uint32 len) {
return len;
}
+
+} // End of namespace Common
diff --git a/common/file.h b/common/file.h
index ead42c0788..9669158503 100644
--- a/common/file.h
+++ b/common/file.h
@@ -27,7 +27,9 @@
#include "common/str.h"
#include "common/stream.h"
-class File : public Common::SeekableReadStream, public Common::WriteStream {
+namespace Common {
+
+class File : public SeekableReadStream, public WriteStream {
protected:
/** POSIX file handle to the actual file; 0 if no file is open. */
FILE *_handle;
@@ -39,10 +41,10 @@ protected:
int32 _refcount;
/** The name of this file, for debugging. */
- Common::String _name;
+ String _name;
- static Common::StringList _defaultDirectories;
+ static StringList _defaultDirectories;
public:
enum AccessMode {
@@ -50,7 +52,7 @@ public:
kFileWriteMode = 2
};
- static void addDefaultDirectory(const Common::String &directory);
+ static void addDefaultDirectory(const String &directory);
static void resetDefaultDirectories();
File();
@@ -76,4 +78,6 @@ public:
uint32 write(const void *dataPtr, uint32 dataSize);
};
+} // End of namespace Common
+
#endif
diff --git a/common/md5.cpp b/common/md5.cpp
index f0e277172c..65a26a6026 100644
--- a/common/md5.cpp
+++ b/common/md5.cpp
@@ -30,6 +30,8 @@
#include "common/md5.h"
#include "common/util.h"
+namespace Common {
+
#define GET_UINT32(n,b,i) (n) = READ_LE_UINT32(b + i)
#define PUT_UINT32(n,b,i) WRITE_LE_UINT32(b + i, n)
@@ -278,6 +280,8 @@ bool md5_file( const char *name, uint8 digest[16], const char *directory, uint32
return true;
}
+} // End of namespace Common
+
#ifdef TEST
#include <stdlib.h>
diff --git a/common/md5.h b/common/md5.h
index a6f329a811..b795bfa963 100644
--- a/common/md5.h
+++ b/common/md5.h
@@ -23,6 +23,8 @@
#include "common/scummsys.h"
+namespace Common {
+
typedef struct
{
uint32 total[2];
@@ -37,4 +39,6 @@ void md5_finish( md5_context *ctx, uint8 digest[16] );
bool md5_file( const char *name, uint8 digest[16], const char *directory = NULL, uint32 length = 0 );
+} // End of namespace Common
+
#endif
diff --git a/gob/dataio.cpp b/gob/dataio.cpp
index c01c36083e..a3ffabbf6c 100644
--- a/gob/dataio.cpp
+++ b/gob/dataio.cpp
@@ -30,7 +30,7 @@ int16 file_write(int16 handle, char *buf, int16 size) {
return filesHandles[handle].write(buf, size);
}
-int16 file_open(const char *path, File::AccessMode mode) {
+int16 file_open(const char *path, Common::File::AccessMode mode) {
int16 i;
for (i = 0; i < MAX_FILES; i++) {
@@ -48,7 +48,7 @@ int16 file_open(const char *path, File::AccessMode mode) {
return -1;
}
-File *file_getHandle(int16 handle) {
+Common::File *file_getHandle(int16 handle) {
return &filesHandles[handle];
}
@@ -284,10 +284,10 @@ void data_closeData(int16 handle) {
file_getHandle(handle)->close();
}
-int16 data_openData(const char *path, File::AccessMode mode) {
+int16 data_openData(const char *path, Common::File::AccessMode mode) {
int16 handle;
- if (mode != File::kFileReadMode)
+ if (mode != Common::File::kFileReadMode)
return file_open(path, mode);
handle = data_getChunk(path);
@@ -320,7 +320,7 @@ void data_seekData(int16 handle, int32 pos, int16 from) {
int32 data_getDataSize(const char *name) {
char buf[128];
int32 chunkSz;
- File file;
+ Common::File file;
strcpy(buf, name);
chunkSz = data_getChunkSize(buf);
diff --git a/gob/dataio.h b/gob/dataio.h
index d7d5917016..c5699b9cfa 100644
--- a/gob/dataio.h
+++ b/gob/dataio.h
@@ -36,8 +36,8 @@ struct ChunkDesc {
byte packed;
};
-int16 file_open(const char *path, File::AccessMode mode = File::kFileReadMode);
-File *file_getHandle(int16 handle);
+int16 file_open(const char *path, Common::File::AccessMode mode = Common::File::kFileReadMode);
+Common::File *file_getHandle(int16 handle);
int16 data_getChunk(const char *chunkName);
char data_freeChunk(int16 handle);
int32 data_readChunk(int16 handle, char *buf, int16 size);
@@ -47,7 +47,7 @@ void data_openDataFile(const char *src);
void data_closeDataFile(void);
char *data_getUnpackedData(const char *name);
void data_closeData(int16 handle);
-int16 data_openData(const char *path, File::AccessMode mode = File::kFileReadMode);
+int16 data_openData(const char *path, Common::File::AccessMode mode = Common::File::kFileReadMode);
int32 data_readData(int16 handle, char *buf, int16 size);
void data_seekData(int16 handle, int32 pos, int16 from);
int32 data_getDataSize(const char *name);
diff --git a/gob/global.cpp b/gob/global.cpp
index 16605777a9..9ec7410d57 100644
--- a/gob/global.cpp
+++ b/gob/global.cpp
@@ -92,7 +92,7 @@ char useJoystick = 1;
/* Files */
int16 filesCount = 0;
-File filesHandles[MAX_FILES];
+Common::File filesHandles[MAX_FILES];
/* Data files */
struct ChunkDesc *dataFiles[MAX_DATA_FILES];
diff --git a/gob/global.h b/gob/global.h
index fac456f2fc..35611392f7 100644
--- a/gob/global.h
+++ b/gob/global.h
@@ -116,7 +116,7 @@ extern char useJoystick;
#define MAX_FILES 30
extern int16 filesCount;
-extern File filesHandles[MAX_FILES];
+extern Common::File filesHandles[MAX_FILES];
/* Data files */
extern struct ChunkDesc *dataFiles[MAX_DATA_FILES];
diff --git a/gob/gob.cpp b/gob/gob.cpp
index 4348728384..43a21d61d8 100644
--- a/gob/gob.cpp
+++ b/gob/gob.cpp
@@ -97,7 +97,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
uint8 md5sum[16];
char md5str[32 + 1];
- if (md5_file(file->path().c_str(), md5sum, NULL, kMD5FileSizeLimit)) {
+ if (Common::md5_file(file->path().c_str(), md5sum, NULL, kMD5FileSizeLimit)) {
for (int i = 0; i < 16; i++) {
sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
}
diff --git a/gob/inter.cpp b/gob/inter.cpp
index 733f3ea94e..4bc314125e 100644
--- a/gob/inter.cpp
+++ b/gob/inter.cpp
@@ -489,7 +489,7 @@ void inter_writeData(void) {
offset = parse_parseValExpr();
WRITE_VAR(1, 1);
- handle = data_openData(inter_resStr, File::kFileWriteMode);
+ handle = data_openData(inter_resStr, Common::File::kFileWriteMode);
if (handle < 0)
return;
diff --git a/graphics/animation.cpp b/graphics/animation.cpp
index 1401d642c9..77be43fdc5 100644
--- a/graphics/animation.cpp
+++ b/graphics/animation.cpp
@@ -71,7 +71,7 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
// Load lookup palettes
sprintf(tempFile, "%s.pal", name);
- File f;
+ Common::File f;
if (!f.open(tempFile)) {
warning("Cutscene: %s palette missing", tempFile);
@@ -120,7 +120,7 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
#endif
// Open MPEG2 stream
- _mpegFile = new File();
+ _mpegFile = new Common::File();
sprintf(tempFile, "%s.mp2", name);
if (!_mpegFile->open(tempFile)) {
warning("Cutscene: Could not open %s", tempFile);
diff --git a/graphics/animation.h b/graphics/animation.h
index a74c473b8a..087d9febc7 100644
--- a/graphics/animation.h
+++ b/graphics/animation.h
@@ -63,6 +63,10 @@ typedef sequence_t mpeg2_sequence_t;
#define BUFFER_SIZE 4096
+namespace Common {
+ class File;
+}
+
namespace Graphics {
class BaseAnimationState {
@@ -82,7 +86,7 @@ protected:
const mpeg2_info_t *_mpegInfo;
#endif
- File *_mpegFile;
+ Common::File *_mpegFile;
SoundHandle _bgSound;
AudioStream *_bgSoundStream;
diff --git a/kyra/resource.cpp b/kyra/resource.cpp
index f661b979ed..e93814a79f 100644
--- a/kyra/resource.cpp
+++ b/kyra/resource.cpp
@@ -90,7 +90,7 @@ Resourcemanager::~Resourcemanager() {
uint8* Resourcemanager::fileData(const char* file, uint32* size) {
uint8* buffer = 0;
- File file_;
+ Common::File file_;
// test to open it in the main dir
if (file_.open(file)) {
@@ -183,11 +183,11 @@ VMContext* Resourcemanager::loadScript(const char* file) {
// Pak file manager
#define PAKFile_Iterate Common::List<PakChunk*>::iterator start=_files.begin();start != _files.end(); ++start
PAKFile::PAKFile(/*const Common::String &path, */const Common::String& file) {
- File pakfile;
+ Common::File pakfile;
_buffer = 0;
_open = false;
- if (!pakfile.open(file.c_str())){ /*, File::kFileReadMode, path.c_str())) {*/
+ if (!pakfile.open(file.c_str())){ /*, Common::File::kFileReadMode, path.c_str())) {*/
printf("pakfile couldn't open %s\n", file.c_str());
return;
}
diff --git a/queen/queen.cpp b/queen/queen.cpp
index cb16bf6676..67b28f8308 100644
--- a/queen/queen.cpp
+++ b/queen/queen.cpp
@@ -95,7 +95,7 @@ DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) {
const char *gameName = file->displayName().c_str();
if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {
- File dataFile;
+ Common::File dataFile;
dataFile.open(file->path().c_str());
assert(dataFile.isOpen());
diff --git a/queen/resource.cpp b/queen/resource.cpp
index 1019bea5e2..75292bca96 100644
--- a/queen/resource.cpp
+++ b/queen/resource.cpp
@@ -54,7 +54,7 @@ static int compareResourceEntry(const void *a, const void *b) {
Resource::Resource()
: _resourceEntries(0), _resourceTable(NULL) {
- _resourceFile = new File();
+ _resourceFile = new Common::File();
if (!findCompressedVersion() && !findNormalVersion())
error("Could not open resource file '%s'", "queen.1");
checkJASVersion();
@@ -190,7 +190,7 @@ Language Resource::getLanguage() const {
}
bool Resource::readTableFile(const GameVersion *gameVersion) {
- File tableFile;
+ Common::File tableFile;
tableFile.open(_tableFilename);
if (tableFile.isOpen() && tableFile.readUint32BE() == 'QTBL') {
if (tableFile.readUint32BE() != CURRENT_TBL_VERSION)
@@ -214,7 +214,7 @@ void Resource::readTableCompResource() {
readTableEntries(_resourceFile);
}
-void Resource::readTableEntries(File *file) {
+void Resource::readTableEntries(Common::File *file) {
_resourceEntries = file->readUint16BE();
_resourceTable = new ResourceEntry[_resourceEntries];
for (uint16 i = 0; i < _resourceEntries; ++i) {
@@ -237,7 +237,7 @@ const GameVersion *Resource::detectGameVersion(uint32 size) const {
return NULL;
}
-File *Resource::giveCompressedSound(const char *filename, uint32 *size) {
+Common::File *Resource::giveCompressedSound(const char *filename, uint32 *size) {
assert(strstr(filename, ".SB"));
ResourceEntry *re = resourceEntry(filename);
assert(re != NULL);
diff --git a/queen/resource.h b/queen/resource.h
index 920b2405e9..7e45a75453 100644
--- a/queen/resource.h
+++ b/queen/resource.h
@@ -68,7 +68,7 @@ public:
bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }
//! returns a reference to a sound file
- File *giveCompressedSound(const char *filename, uint32 *size);
+ Common::File *giveCompressedSound(const char *filename, uint32 *size);
bool isDemo() const { return !strcmp(_versionString, "PE100"); }
bool isInterview() const { return !strcmp(_versionString, "PEint"); }
@@ -114,7 +114,7 @@ public:
protected:
- File *_resourceFile;
+ Common::File *_resourceFile;
//! compression type for audio files
uint8 _compression;
@@ -146,7 +146,7 @@ protected:
void readTableCompResource();
//! read the resource table from the specified file
- void readTableEntries(File *file);
+ void readTableEntries(Common::File *file);
//! detect game version based on queen.1 datafile size
const GameVersion *detectGameVersion(uint32 size) const;
diff --git a/queen/sound.cpp b/queen/sound.cpp
index 0170d451bc..7e8b8bc306 100644
--- a/queen/sound.cpp
+++ b/queen/sound.cpp
@@ -200,7 +200,7 @@ void SBSound::sfxPlay(const char *name, bool isSpeech) {
#ifdef USE_MAD
void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
uint32 size;
- File *f = _vm->resource()->giveCompressedSound(name, &size);
+ Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeMP3Stream(f, size));
}
#endif
@@ -208,7 +208,7 @@ void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
#ifdef USE_VORBIS
void OGGSound::sfxPlay(const char *name, bool isSpeech) {
uint32 size;
- File *f = _vm->resource()->giveCompressedSound(name, &size);
+ Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeVorbisStream(f, size));
}
#endif
@@ -216,7 +216,7 @@ void OGGSound::sfxPlay(const char *name, bool isSpeech) {
#ifdef USE_FLAC
void FLACSound::sfxPlay(const char *name, bool isSpeech) {
uint32 size;
- File *f = _vm->resource()->giveCompressedSound(name, &size);
+ Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeFlacStream(f, size));
}
#endif
diff --git a/queen/talk.cpp b/queen/talk.cpp
index bbf623e791..c2976ffb5c 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -355,7 +355,7 @@ byte *Talk::loadDialogFile(const char *filename) {
for (int i = 0; i < ARRAYSIZE(dogFiles); ++i) {
if (!scumm_stricmp(filename, dogFiles[i].filename) &&
_vm->resource()->getLanguage() == dogFiles[i].lang) {
- File fdog;
+ Common::File fdog;
fdog.open(filename);
if (fdog.isOpen()) {
debug(6, "Loading dog file '%s' from game data path", filename);
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 43f262f26a..2272977154 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -2296,7 +2296,7 @@ void Actor::drawPathTest() {
#endif
}
-void Actor::saveState(File& out) {
+void Actor::saveState(Common::File& out) {
uint16 i;
out.writeSint16LE(getProtagState());
@@ -2312,7 +2312,7 @@ void Actor::saveState(File& out) {
}
}
-void Actor::loadState(File& in) {
+void Actor::loadState(Common::File& in) {
int32 i;
setProtagState(in.readSint16LE());
diff --git a/saga/actor.h b/saga/actor.h
index 6064e259ef..9bc2658d47 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -141,12 +141,12 @@ struct Location {
Location() {
x = y = z = 0;
}
- void saveState(File& out) {
+ void saveState(Common::File& out) {
out.writeSint32LE(x);
out.writeSint32LE(y);
out.writeSint32LE(z);
}
- void loadState(File& in) {
+ void loadState(Common::File& in) {
x = in.readSint32LE();
y = in.readSint32LE();
z = in.readSint32LE();
@@ -222,7 +222,7 @@ public:
int32 screenDepth; //
int32 screenScale; //
- void saveState(File& out) {
+ void saveState(Common::File& out) {
out.writeUint16LE(flags);
out.writeSint32LE(nameIndex);
out.writeSint32LE(sceneNumber);
@@ -232,7 +232,7 @@ public:
out.writeSint32LE(screenDepth);
out.writeSint32LE(screenScale);
}
- void loadState(File& in) {
+ void loadState(Common::File& in) {
flags = in.readUint16LE();
nameIndex = in.readSint32LE();
sceneNumber = in.readSint32LE();
@@ -297,7 +297,7 @@ public:
Location partialTarget;
int32 walkFrameSequence;
- void saveState(File& out) {
+ void saveState(Common::File& out) {
CommonObjectData::saveState(out);
out.writeUint16LE(actorFlags);
out.writeSint32LE(currentAction);
@@ -330,7 +330,7 @@ public:
partialTarget.saveState(out);
out.writeSint32LE(walkFrameSequence);
}
- void loadState(File& in) {
+ void loadState(Common::File& in) {
CommonObjectData::loadState(in);
actorFlags = in.readUint16LE();
currentAction = in.readSint32LE();
@@ -495,8 +495,8 @@ public:
return _activeSpeech.stringsCount > 0;
}
- void saveState(File& out);
- void loadState(File& in);
+ void saveState(Common::File& out);
+ void loadState(Common::File& in);
void setProtagState(int state);
int getProtagState() { return _protagState; }
diff --git a/saga/game.cpp b/saga/game.cpp
index 5689dd96f9..d53e9bb863 100644
--- a/saga/game.cpp
+++ b/saga/game.cpp
@@ -761,7 +761,7 @@ int detectGame(const FSList &fslist, bool mode) {
uint16 file_count;
uint16 file_n;
- File test_file;
+ Common::File test_file;
bool file_missing;
Common::String tstr, tstr1;
@@ -790,7 +790,7 @@ int detectGame(const FSList &fslist, bool mode) {
tstr.toLowercase();
if (filesList.contains(tstr) || filesList.contains(tstr1)) {
- if (md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
+ if (Common::md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
for (int j = 0; j < 16; j++) {
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
}
@@ -801,12 +801,12 @@ int detectGame(const FSList &fslist, bool mode) {
}
}
} else {
- File testFile;
+ Common::File testFile;
for (StringSet::const_iterator file = filesList.begin(); file != filesList.end(); ++file) {
if (testFile.open(file->_key.c_str())) {
testFile.close();
- if (md5_file(file->_key.c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
+ if (Common::md5_file(file->_key.c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
for (int j = 0; j < 16; j++) {
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
}
diff --git a/saga/music.cpp b/saga/music.cpp
index 40ce5f670a..2a6e1b9d82 100644
--- a/saga/music.cpp
+++ b/saga/music.cpp
@@ -42,7 +42,7 @@ namespace Saga {
class RAWInputStream : public AudioStream {
private:
- File *_file;
+ Common::File *_file;
uint32 _file_pos;
uint32 _start_pos;
uint32 _end_pos;
@@ -56,7 +56,7 @@ private:
inline bool eosIntern() const;
public:
- RAWInputStream(File *file, int size, bool looping);
+ RAWInputStream(Common::File *file, int size, bool looping);
~RAWInputStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -66,7 +66,7 @@ public:
int getRate() const { return 11025; }
};
-RAWInputStream::RAWInputStream(File *file, int size, bool looping)
+RAWInputStream::RAWInputStream(Common::File *file, int size, bool looping)
: _file(file), _finished(false), _looping(looping),
_bufferEnd(_buf + BUFFER_SIZE) {
@@ -147,7 +147,7 @@ void RAWInputStream::refill() {
}
AudioStream *makeRAWStream(const char *filename, uint32 pos, int size, bool looping) {
- File *file = new File();
+ Common::File *file = new Common::File();
if (!file->open(filename)) {
delete file;
@@ -285,7 +285,7 @@ Music::Music(SoundMixer *mixer, MidiDriver *driver, int enabled) : _mixer(mixer)
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume"));
if (_vm->getGameType() == GType_ITE) {
- File file;
+ Common::File file;
byte footerBuf[ARRAYSIZE(_digiTableITECD) * 8];
// The lookup table is stored at the end of music.rsc. I don't
@@ -400,7 +400,7 @@ int Music::play(uint32 music_rn, uint16 flags) {
AudioStream *audioStream = NULL;
MidiParser *parser;
- File midiFile;
+ Common::File midiFile;
if (_vm->getGameType() == GType_ITE) {
if (music_rn >= 9 && music_rn <= 34) {
diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp
index 0fbde0ab81..045d2e21f8 100644
--- a/saga/rscfile.cpp
+++ b/saga/rscfile.cpp
@@ -50,7 +50,7 @@ RSCFILE_CONTEXT *RSC_CreateContext() {
empty_context.rc_file_loaded = 0;
empty_context.rc_res_table = NULL;
empty_context.rc_res_ct = 0;
- empty_context.rc_file = new File();
+ empty_context.rc_file = new Common::File();
RSCFILE_CONTEXT *new_context;
new_context = (RSCFILE_CONTEXT *)malloc(sizeof(*new_context));
@@ -257,7 +257,7 @@ int RSC_LoadResource(RSCFILE_CONTEXT *rsc, uint32 res_num, byte **res_p, size_t
substnum = -1;
if (substnum != -1) {
- File in;
+ Common::File in;
if (in.open(substitutes[substnum].fname)) {
res_size = in.size();
diff --git a/saga/rscfile.h b/saga/rscfile.h
index e1548abc89..c09f36ac5f 100644
--- a/saga/rscfile.h
+++ b/saga/rscfile.h
@@ -44,7 +44,7 @@ struct RSCFILE_RESOURCE {
struct RSCFILE_CONTEXT {
const char *rc_file_fspec;
- File *rc_file;
+ Common::File *rc_file;
int rc_file_loaded;
RSCFILE_RESOURCE *rc_res_table;
size_t rc_res_ct;
diff --git a/saga/saga.cpp b/saga/saga.cpp
index 462517d09b..c3a5ff528d 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -142,16 +142,16 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
// The Linux version of Inherit the Earth puts all data files in an
// 'itedata' sub-directory, except for voices.rsc
- File::addDefaultDirectory(_gameDataPath + "itedata/");
+ Common::File::addDefaultDirectory(_gameDataPath + "itedata/");
// The Windows version of Inherit the Earth puts various data files in
// other subdirectories.
- File::addDefaultDirectory(_gameDataPath + "graphics/");
- File::addDefaultDirectory(_gameDataPath + "music/");
- File::addDefaultDirectory(_gameDataPath + "sound/");
+ Common::File::addDefaultDirectory(_gameDataPath + "graphics/");
+ Common::File::addDefaultDirectory(_gameDataPath + "music/");
+ Common::File::addDefaultDirectory(_gameDataPath + "sound/");
// Mac CD Wyrmkeep
- File::addDefaultDirectory(_gameDataPath + "patch/");
+ Common::File::addDefaultDirectory(_gameDataPath + "patch/");
// Setup mixer
if (!_mixer->isReady()) {
@@ -202,15 +202,15 @@ int SagaEngine::init(GameDetector &detector) {
// Add some default directories
// Win32 demo & full game
- File::addDefaultDirectory("graphics");
- File::addDefaultDirectory("music");
- File::addDefaultDirectory("sound");
+ Common::File::addDefaultDirectory("graphics");
+ Common::File::addDefaultDirectory("music");
+ Common::File::addDefaultDirectory("sound");
// Linux demo
- File::addDefaultDirectory("itedata");
+ Common::File::addDefaultDirectory("itedata");
// Mac demos & full game
- File::addDefaultDirectory("patch");
+ Common::File::addDefaultDirectory("patch");
// Process command line
diff --git a/saga/saveload.cpp b/saga/saveload.cpp
index 36c397054f..2c7dd17a7b 100644
--- a/saga/saveload.cpp
+++ b/saga/saveload.cpp
@@ -40,9 +40,9 @@
namespace Saga {
void SagaEngine::save(const char *fileName) {
- File out;
+ Common::File out;
- out.open(fileName, File::kFileWriteMode);
+ out.open(fileName, Common::File::kFileWriteMode);
//TODO: version number
// Surrounding scene
@@ -67,7 +67,7 @@ void SagaEngine::save(const char *fileName) {
}
void SagaEngine::load(const char *fileName) {
- File in;
+ Common::File in;
int commonBufferSize;
int sceneNumber, insetSceneNumber;
int mapx, mapy;
diff --git a/saga/sndres.cpp b/saga/sndres.cpp
index fd4a84daab..2d77d3e779 100644
--- a/saga/sndres.cpp
+++ b/saga/sndres.cpp
@@ -83,7 +83,7 @@ int SndRes::playVoice(uint32 voice_rn) {
// separate file (p2_a.voc or P2_A.iaf), to correct voice 4 in
// the intro. Use that, if available.
- File f;
+ Common::File f;
uint32 size;
bool voc = false;
@@ -235,7 +235,7 @@ int SndRes::getVoiceLength(uint32 voice_rn) {
assert(_init);
- File f;
+ Common::File f;
// The Wyrmkeep release of Inherit the Earth provides a separate file
// (p2_a.voc or P2_A.iaf), to correct voice 4 in the intro. Use that,
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 {
diff --git a/simon/icons.cpp b/simon/icons.cpp
index 9f7bcc7eac..7a6fd6f105 100644
--- a/simon/icons.cpp
+++ b/simon/icons.cpp
@@ -29,7 +29,7 @@
namespace Simon {
void SimonEngine::loadIconFile() {
- File in;
+ Common::File in;
if (_game & GF_ACORN)
in.open("ICONDATA");
else if (_game & GF_AMIGA)
diff --git a/simon/midi.cpp b/simon/midi.cpp
index ed0d23f23e..98dc5bc0d6 100644
--- a/simon/midi.cpp
+++ b/simon/midi.cpp
@@ -335,7 +335,7 @@ static int simon1_gmf_size[] = {
17256, 5103, 8794, 4884, 16
};
-void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
+void MidiPlayer::loadSMF (Common::File *in, int song, bool sfx) {
Common::StackLock lock(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
@@ -409,7 +409,7 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
p->parser = parser; // That plugs the power cord into the wall
}
-void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
+void MidiPlayer::loadMultipleSMF (Common::File *in, bool sfx) {
// This is a special case for Simon 2 Windows.
// Instead of having multiple sequences as
// separate tracks in a Type 2 file, simon2win
@@ -465,7 +465,7 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
}
}
-void MidiPlayer::loadXMIDI(File *in, bool sfx) {
+void MidiPlayer::loadXMIDI(Common::File *in, bool sfx) {
Common::StackLock lock(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p);
@@ -512,7 +512,7 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) {
p->parser = parser; // That plugs the power cord into the wall
}
-void MidiPlayer::loadS1D (File *in, bool sfx) {
+void MidiPlayer::loadS1D (Common::File *in, bool sfx) {
Common::StackLock lock(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p);
diff --git a/simon/midi.h b/simon/midi.h
index 828782690e..913e93fb04 100644
--- a/simon/midi.h
+++ b/simon/midi.h
@@ -26,7 +26,9 @@
#include "sound/midiparser.h"
#include "common/mutex.h"
-class File;
+namespace Common {
+ class File;
+}
namespace Simon {
@@ -83,10 +85,10 @@ public:
MidiPlayer (OSystem *system);
virtual ~MidiPlayer();
- void loadSMF (File *in, int song, bool sfx = false);
- void loadMultipleSMF (File *in, bool sfx = false);
- void loadXMIDI (File *in, bool sfx = false);
- void loadS1D (File *in, bool sfx = false);
+ void loadSMF (Common::File *in, int song, bool sfx = false);
+ void loadMultipleSMF (Common::File *in, bool sfx = false);
+ void loadXMIDI (Common::File *in, bool sfx = false);
+ void loadS1D (Common::File *in, bool sfx = false);
void mapMT32toGM (bool map);
void setLoop (bool loop);
diff --git a/simon/res.cpp b/simon/res.cpp
index 0174a8ba17..c7a6a76127 100644
--- a/simon/res.cpp
+++ b/simon/res.cpp
@@ -97,7 +97,7 @@ static const char *const opcode_arg_table_simon2dos[256] = {
};
void SimonEngine::loadGamePcFile(const char *filename) {
- File in;
+ Common::File in;
int num_inited_objects;
int i, file_size;
@@ -164,7 +164,7 @@ void SimonEngine::loadGamePcFile(const char *filename) {
in.close();
}
-void SimonEngine::readGamePcText(File *in) {
+void SimonEngine::readGamePcText(Common::File *in) {
uint text_size;
byte *text_mem;
@@ -178,7 +178,7 @@ void SimonEngine::readGamePcText(File *in) {
setupStringTable(text_mem, _stringTabNum);
}
-void SimonEngine::readItemFromGamePc(File *in, Item *item) {
+void SimonEngine::readItemFromGamePc(Common::File *in, Item *item) {
uint32 type;
item->unk2 = in->readUint16BE();
@@ -199,7 +199,7 @@ void SimonEngine::readItemFromGamePc(File *in, Item *item) {
}
}
-void SimonEngine::readItemChildren(File *in, Item *item, uint type) {
+void SimonEngine::readItemChildren(Common::File *in, Item *item, uint type) {
if (type == 1) {
uint fr1 = in->readUint16BE();
uint fr2 = in->readUint16BE();
@@ -246,14 +246,14 @@ void SimonEngine::readItemChildren(File *in, Item *item, uint type) {
}
}
-uint fileReadItemID(File *in) {
+uint fileReadItemID(Common::File *in) {
uint32 val = in->readUint32BE();
if (val == 0xFFFFFFFF)
return 0;
return val + 2;
}
-byte *SimonEngine::readSingleOpcode(File *in, byte *ptr) {
+byte *SimonEngine::readSingleOpcode(Common::File *in, byte *ptr) {
int i, l;
const char *string_ptr;
uint val;
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 1621cd1253..31ddcf820d 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -46,6 +46,8 @@
#include "globals.h"
#endif
+using Common::File;
+
struct SimonGameSettings {
const char *name;
const char *description;
@@ -128,7 +130,7 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
for (StringSet::const_iterator iter = fileSet.begin(); iter != fileSet.end(); ++iter) {
uint8 md5sum[16];
const char *name = iter->_key.c_str();
- if (md5_file(name, md5sum)) {
+ if (Common::md5_file(name, md5sum)) {
char md5str[32+1];
for (int j = 0; j < 16; j++) {
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
@@ -317,7 +319,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
if (f.isOpen() == false)
strcat(buf, ".");
- if (md5_file(buf, md5sum)) {
+ if (Common::md5_file(buf, md5sum)) {
char md5str[32+1];
for (int j = 0; j < 16; j++) {
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
diff --git a/simon/simon.h b/simon/simon.h
index 7fc9273db0..537554e513 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -36,7 +36,7 @@ namespace Simon {
//#define DUMP_FILE_NR 8
//#define DUMP_BITMAPS_FILE_NR 8
-uint fileReadItemID(File *in);
+uint fileReadItemID(Common::File *in);
#define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y))
#define NUM_PALETTE_FADEOUT 32
@@ -138,7 +138,7 @@ protected:
FORMAT_VOC
} SoundFormat;
- File *_gameFile;
+ Common::File *_gameFile;
byte *_strippedTxtMem;
uint _textSize;
@@ -376,15 +376,15 @@ public:
virtual ~SimonEngine();
protected:
- int allocGamePcVars(File *in);
+ int allocGamePcVars(Common::File *in);
void loginPlayerHelper(Item *item, int a, int b);
void loginPlayer();
void allocateStringTable(int num);
void setupStringTable(byte *mem, int num);
void setupLocalStringTable(byte *mem, int num);
- void readGamePcText(File *in);
- void readItemChildren(File *in, Item *item, uint tmp);
- void readItemFromGamePc(File *in, Item *item);
+ void readGamePcText(Common::File *in);
+ void readItemChildren(Common::File *in, Item *item, uint tmp);
+ void readItemFromGamePc(Common::File *in, Item *item);
void loadGamePcFile(const char *filename);
byte *allocateItem(uint size);
@@ -398,11 +398,11 @@ protected:
void allocTablesHeap();
Subroutine *createSubroutine(uint a);
- void readSubroutine(File *in, Subroutine *sub);
+ void readSubroutine(Common::File *in, Subroutine *sub);
SubroutineLine *createSubroutineLine(Subroutine *sub, int a);
- void readSubroutineLine(File *in, SubroutineLine *new_table, Subroutine *sub);
- byte *readSingleOpcode(File *in, byte *ptr);
- void readSubroutineBlock(File *in);
+ void readSubroutineLine(Common::File *in, SubroutineLine *new_table, Subroutine *sub);
+ byte *readSingleOpcode(Common::File *in, byte *ptr);
+ void readSubroutineBlock(Common::File *in);
Subroutine *getSubroutineByID(uint subroutine_id);
@@ -524,14 +524,14 @@ protected:
uint loadTextFile(const char *filename, byte *dst);
- File *openTablesFile(const char *filename);
- void closeTablesFile(File *in);
+ Common::File *openTablesFile(const char *filename);
+ void closeTablesFile(Common::File *in);
uint loadTextFile_simon1(const char *filename, byte *dst);
- File *openTablesFile_simon1(const char *filename);
+ Common::File *openTablesFile_simon1(const char *filename);
uint loadTextFile_gme(const char *filename, byte *dst);
- File *openTablesFile_gme(const char *filename);
+ Common::File *openTablesFile_gme(const char *filename);
void invokeTimeEvent(TimeEvent *te);
bool kickoffTimeEvents();
diff --git a/simon/sound.cpp b/simon/sound.cpp
index a712d828d1..ca95d19f2f 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -30,6 +30,8 @@
#include "sound/vorbis.h"
#include "sound/wave.h"
+using Common::File;
+
namespace Simon {
#define SOUND_BIG_ENDIAN true
diff --git a/simon/sound.h b/simon/sound.h
index ad0b535f5f..c95dd1d321 100644
--- a/simon/sound.h
+++ b/simon/sound.h
@@ -57,7 +57,7 @@ public:
~Sound();
void readSfxFile(const char *filename);
- void loadSfxTable(File *gameFile, uint32 base);
+ void loadSfxTable(Common::File *gameFile, uint32 base);
void readVoiceFile(const char *filename);
void playVoice(uint sound);
diff --git a/sky/compact.cpp b/sky/compact.cpp
index de9b5c7b3b..3cc3bad054 100644
--- a/sky/compact.cpp
+++ b/sky/compact.cpp
@@ -118,7 +118,7 @@ static const uint32 turnTableOffsets[] = {
#define TURNTABLE_SIZE (sizeof(turnTableOffsets)/sizeof(uint32))
SkyCompact::SkyCompact(void) {
- _cptFile = new File();
+ _cptFile = new Common::File();
if (!_cptFile->open("sky.cpt")) {
GUI::MessageDialog dialog("Unable to find \"sky.cpt\" file!\n"
"Please download it from www.scummvm.org", "OK", NULL);
diff --git a/sky/compact.h b/sky/compact.h
index 972c7b60d1..9440ad2101 100644
--- a/sky/compact.h
+++ b/sky/compact.h
@@ -26,7 +26,9 @@
#include "sky/struc.h"
#include "sky/skydefs.h"
-class File;
+namespace Common {
+ class File;
+}
enum CptIds {
CPT_JOEY = 1,
@@ -79,7 +81,7 @@ private:
char ***_cptNames;
uint16 **_cptSizes;
uint16 **_cptTypes;
- File *_cptFile;
+ Common::File *_cptFile;
uint32 _resetDataPos;
};
diff --git a/sky/disk.cpp b/sky/disk.cpp
index 06a59f0b4b..a6573d2efe 100644
--- a/sky/disk.cpp
+++ b/sky/disk.cpp
@@ -41,8 +41,8 @@ static const char *dinnerFilename = "sky.dnr";
Disk::Disk(const Common::String &gameDataPath) {
_prefRoot = NULL;
- _dataDiskHandle = new File();
- _dnrHandle = new File();
+ _dataDiskHandle = new Common::File();
+ _dnrHandle = new Common::File();
uint32 entriesRead;
@@ -404,14 +404,14 @@ void Disk::fnFlushBuffers(void) {
void Disk::dumpFile(uint16 fileNr) {
char buf[128];
- File out;
+ Common::File out;
byte* filePtr;
filePtr = loadFile(fileNr);
sprintf(buf, "dumps/file-%d.dmp", fileNr);
if (!out.exists(buf, "")) {
- if (out.open(buf, File::kFileWriteMode, ""))
+ if (out.open(buf, Common::File::kFileWriteMode, ""))
out.write(filePtr, _lastLoadedFileSize);
}
free(filePtr);
diff --git a/sky/disk.h b/sky/disk.h
index 3b4b16ed2b..c885ab65bf 100644
--- a/sky/disk.h
+++ b/sky/disk.h
@@ -27,7 +27,9 @@
#include "common/str.h"
#include "sky/rnc_deco.h"
-class File;
+namespace Common {
+ class File;
+}
namespace Sky {
@@ -73,8 +75,8 @@ protected:
uint32 _dinnerTableEntries;
uint8 *_dinnerTableArea;
- File *_dataDiskHandle;
- File *_dnrHandle;
+ Common::File *_dataDiskHandle;
+ Common::File *_dnrHandle;
RncDecoder _rncDecoder;
uint16 _buildList[MAX_FILES_IN_LIST];
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp
index ddc91dcbf1..2194267708 100644
--- a/sound/audiostream.cpp
+++ b/sound/audiostream.cpp
@@ -36,7 +36,7 @@ struct StreamFileFormat {
* Pointer to a function which tries to open a file of type StreamFormat.
* Return NULL in case of an error (invalid/nonexisting file).
*/
- AudioStream* (*openStreamFile)(File *file, uint32 size);
+ AudioStream* (*openStreamFile)(Common::File *file, uint32 size);
};
static const StreamFileFormat STREAM_FILEFORMATS[] = {
@@ -66,7 +66,7 @@ AudioStream* AudioStream::openStreamFile(const char *filename)
char *ext = &buffer[len+1];
AudioStream* stream = NULL;
- File *fileHandle = new File();
+ Common::File *fileHandle = new Common::File();
for (int i = 0; i < ARRAYSIZE(STREAM_FILEFORMATS)-1 && stream == NULL; ++i) {
strcpy(ext, STREAM_FILEFORMATS[i].fileExtension);
diff --git a/sound/flac.cpp b/sound/flac.cpp
index 409bb293a1..412f4c8651 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -32,6 +32,10 @@
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
#include <FLAC/seekable_stream_decoder.h>
+
+using Common::File;
+
+
#pragma mark -
#pragma mark --- Flac stream ---
#pragma mark -
diff --git a/sound/flac.h b/sound/flac.h
index 6cf1c9ec87..2250f342ea 100644
--- a/sound/flac.h
+++ b/sound/flac.h
@@ -29,11 +29,13 @@
class AudioStream;
class DigitalTrackInfo;
-class File;
+namespace Common {
+ class File;
+}
DigitalTrackInfo *getFlacTrack(int track);
-AudioStream *makeFlacStream(File *file, uint32 size);
+AudioStream *makeFlacStream(Common::File *file, uint32 size);
#endif // #ifdef USE_FLAC
#endif // #ifndef SOUND_FLAC_H
diff --git a/sound/mixer.h b/sound/mixer.h
index 4d9dac8b1b..dfa7573738 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -30,7 +30,6 @@
class AudioStream;
class Channel;
-class File;
class OSystem;
class SoundHandle {
diff --git a/sound/mp3.cpp b/sound/mp3.cpp
index 79a4635be1..3028c22421 100644
--- a/sound/mp3.cpp
+++ b/sound/mp3.cpp
@@ -32,6 +32,9 @@
#include <mad.h>
+using Common::File;
+
+
#pragma mark -
#pragma mark --- MP3 (MAD) stream ---
#pragma mark -
diff --git a/sound/mp3.h b/sound/mp3.h
index 28fa622b44..27886686ce 100644
--- a/sound/mp3.h
+++ b/sound/mp3.h
@@ -29,11 +29,13 @@
class AudioStream;
class DigitalTrackInfo;
-class File;
+namespace Common {
+ class File;
+}
DigitalTrackInfo *getMP3Track(int track);
-AudioStream *makeMP3Stream(File *file, uint32 size);
+AudioStream *makeMP3Stream(Common::File *file, uint32 size);
#endif
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 75abaabbcc..58f13f45c6 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -74,13 +74,11 @@ public:
int getRate() const { return _outputRate; }
};
-typedef File SFile;
-
class MT32File: public MT32Emu::File {
- SFile file;
+ Common::File file;
public:
bool open(const char *filename, OpenMode mode) {
- SFile::AccessMode accessMode = mode == OpenMode_read ? SFile::kFileReadMode : SFile::kFileWriteMode;
+ Common::File::AccessMode accessMode = mode == OpenMode_read ? Common::File::kFileReadMode : Common::File::kFileWriteMode;
return file.open(filename, accessMode);
}
void close() {
@@ -473,7 +471,7 @@ void MidiDriver_ThreadedMT32::onTimer() {
MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer) {
// HACK: It will stay here until engine plugin loader overhaul
if (ConfMan.hasKey("extrapath"))
- File::addDefaultDirectory(ConfMan.get("extrapath"));
+ Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
return new MidiDriver_MT32(mixer);
}
diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp
index deca2c62c3..f2f7781220 100644
--- a/sound/vorbis.cpp
+++ b/sound/vorbis.cpp
@@ -32,8 +32,10 @@
#include <vorbis/vorbisfile.h>
-static AudioStream *makeVorbisStream(OggVorbis_File *file, int duration);
+using Common::File;
+
+static AudioStream *makeVorbisStream(OggVorbis_File *file, int duration);
#pragma mark -
#pragma mark --- Ogg Vorbis Audio CD emulation ---
diff --git a/sound/vorbis.h b/sound/vorbis.h
index fa784b5a87..293af1e378 100644
--- a/sound/vorbis.h
+++ b/sound/vorbis.h
@@ -29,11 +29,13 @@
class AudioStream;
class DigitalTrackInfo;
-class File;
+namespace Common {
+ class File;
+}
DigitalTrackInfo *getVorbisTrack(int track);
-AudioStream *makeVorbisStream(File *file, uint32 size);
+AudioStream *makeVorbisStream(Common::File *file, uint32 size);
#endif
diff --git a/sword1/animation.cpp b/sword1/animation.cpp
index 35d6a090cc..e0c9794f85 100644
--- a/sword1/animation.cpp
+++ b/sword1/animation.cpp
@@ -108,7 +108,7 @@ void MoviePlayer::play(uint32 id) {
// these sequences are language specific
char sndName[20];
sprintf(sndName, "%s.snd", _sequenceList[id]);
- File *oggSource = new File();
+ Common::File *oggSource = new Common::File();
if (oggSource->open(sndName)) {
SplittedAudioStream *sStream = new SplittedAudioStream();
uint32 numSegs = oggSource->readUint32LE(); // number of audio segments, either 1 or 2.
diff --git a/sword1/control.cpp b/sword1/control.cpp
index d1bbc9c32a..a572aaee4a 100644
--- a/sword1/control.cpp
+++ b/sword1/control.cpp
@@ -186,7 +186,7 @@ void Control::askForCd(void) {
_system->setPalette(palOut, 0, 256);
free(palOut);
- File test;
+ Common::File test;
char fName[10];
uint8 textA[50];
sprintf(fName, "cd%d.id", SwordEngine::_systemVars.currentCD);
diff --git a/sword1/credits.cpp b/sword1/credits.cpp
index 3ab89bbe11..511dd37e42 100644
--- a/sword1/credits.cpp
+++ b/sword1/credits.cpp
@@ -303,7 +303,7 @@ ArcFile::~ArcFile(void) {
}
bool ArcFile::open(const char *name) {
- File arc;
+ Common::File arc;
if (!arc.open(name))
return false;
_bufPos = _buf = (uint8*)malloc(arc.size());
diff --git a/sword1/music.cpp b/sword1/music.cpp
index 66995afc5d..f8b60bca5b 100644
--- a/sword1/music.cpp
+++ b/sword1/music.cpp
@@ -36,11 +36,11 @@
namespace Sword1 {
-WaveAudioStream *makeWaveStream(File *source, uint32 size) {
+WaveAudioStream *makeWaveStream(Common::File *source, uint32 size) {
return new WaveAudioStream(source, size);
}
-WaveAudioStream::WaveAudioStream(File *source, uint32 pSize) {
+WaveAudioStream::WaveAudioStream(Common::File *source, uint32 pSize) {
int rate, size;
byte flags;
diff --git a/sword1/music.h b/sword1/music.h
index 1920edd0f1..53873c87cc 100644
--- a/sword1/music.h
+++ b/sword1/music.h
@@ -43,14 +43,14 @@ enum MusicMode {
class WaveAudioStream : public AudioStream {
public:
- WaveAudioStream(File *source, uint32 pSize);
+ WaveAudioStream(Common::File *source, uint32 pSize);
virtual ~WaveAudioStream();
virtual int readBuffer(int16 *buffer, const int numSamples);
virtual bool isStereo(void) const { return _isStereo; };
virtual bool endOfData(void) const;
virtual int getRate(void) const { return _rate; };
private:
- File *_sourceFile;
+ Common::File *_sourceFile;
uint8 *_sampleBuf;
uint32 _rate;
bool _isStereo;
@@ -60,7 +60,7 @@ private:
class MusicHandle : public AudioStream {
private:
- File _file;
+ Common::File _file;
bool _looping;
int32 _fading;
int32 _fadeSamples;
diff --git a/sword1/resman.cpp b/sword1/resman.cpp
index cfeafce330..4d7f29d07a 100644
--- a/sword1/resman.cpp
+++ b/sword1/resman.cpp
@@ -79,7 +79,7 @@ ResMan::~ResMan(void) {
}
void ResMan::loadCluDescript(const char *fileName) {
- File file;
+ Common::File file;
file.open(fileName);
if (!file.isOpen()) {
@@ -205,8 +205,8 @@ void *ResMan::openFetchRes(uint32 id) {
void ResMan::dumpRes(uint32 id) {
char outn[30];
sprintf(outn, "DUMP%08X.BIN", id);
- File outf;
- if (outf.open(outn, File::kFileWriteMode)) {
+ Common::File outf;
+ if (outf.open(outn, Common::File::kFileWriteMode)) {
resOpen(id);
MemHandle *memHandle = resHandle(id);
outf.write(memHandle->data, memHandle->size);
@@ -253,7 +253,7 @@ void ResMan::resOpen(uint32 id) { // load resource ID into memory
if (memHandle->cond == MEM_FREED) { // memory has been freed
uint32 size = resLength(id);
_memMan->alloc(memHandle, size);
- File *clusFile = resFile(id);
+ Common::File *clusFile = resFile(id);
assert(clusFile);
clusFile->seek( resOffset(id) );
clusFile->read( memHandle->data, size);
@@ -288,7 +288,7 @@ FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
return (FrameHeader*)frameFile;
}
-File *ResMan::resFile(uint32 id) {
+Common::File *ResMan::resFile(uint32 id) {
Clu *cluster = _prj.clu + ((id >> 24) - 1);
if (cluster->file == NULL) {
_openClus++;
@@ -298,7 +298,7 @@ File *ResMan::resFile(uint32 id) {
_openCluEnd->nextOpen = cluster;
_openCluEnd = cluster;
}
- cluster->file = new File();
+ cluster->file = new Common::File();
char fileName[15];
sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label);
cluster->file->open(fileName);
diff --git a/sword1/resman.h b/sword1/resman.h
index 901bacc3d4..568e214c44 100644
--- a/sword1/resman.h
+++ b/sword1/resman.h
@@ -40,7 +40,7 @@ struct Grp {
struct Clu {
uint32 refCount;
- File *file;
+ Common::File *file;
char label[MAX_LABEL_SIZE];
uint32 noGrp;
Grp *grp;
@@ -70,7 +70,7 @@ private:
uint32 resLength(uint32 id);
MemHandle *resHandle(uint32 id);
uint32 resOffset(uint32 id);
- File *resFile(uint32 id);
+ Common::File *resFile(uint32 id);
void openCptResourceBigEndian(uint32 id);
void openScriptResourceBigEndian(uint32 id);
diff --git a/sword1/sound.h b/sword1/sound.h
index 982a941a4b..8a65f0dcf0 100644
--- a/sword1/sound.h
+++ b/sword1/sound.h
@@ -96,7 +96,7 @@ private:
void calcWaveVolume(int16 *data, uint32 length);
bool _waveVolume[WAVE_VOL_TAB_LENGTH];
uint16 _waveVolPos;
- File _cowFile;
+ Common::File _cowFile;
uint32 *_cowHeader;
uint32 _cowHeaderSize;
uint8 _currentCowFile;
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index 8be47448bc..aa08e352d0 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -131,14 +131,14 @@ SwordEngine::SwordEngine(GameDetector *detector, OSystem *syst)
warning("Sound initialization failed");
// Add default file directories
- File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
- File::addDefaultDirectory(_gameDataPath + "MUSIC/");
- File::addDefaultDirectory(_gameDataPath + "SPEECH/");
- File::addDefaultDirectory(_gameDataPath + "VIDEO/");
- File::addDefaultDirectory(_gameDataPath + "clusters/");
- File::addDefaultDirectory(_gameDataPath + "music/");
- File::addDefaultDirectory(_gameDataPath + "speech/");
- File::addDefaultDirectory(_gameDataPath + "video/");
+ Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
+ Common::File::addDefaultDirectory(_gameDataPath + "MUSIC/");
+ Common::File::addDefaultDirectory(_gameDataPath + "SPEECH/");
+ Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
+ Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
+ Common::File::addDefaultDirectory(_gameDataPath + "music/");
+ Common::File::addDefaultDirectory(_gameDataPath + "speech/");
+ Common::File::addDefaultDirectory(_gameDataPath + "video/");
}
SwordEngine::~SwordEngine() {
@@ -334,7 +334,7 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
}
void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or what...
- File test;
+ Common::File test;
bool fileExists[30];
bool isFullVersion = false; // default to demo version
bool missingTypes[8] = { false, false, false, false, false, false, false, false };
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp
index 9b0dbe750a..397b4e9eda 100644
--- a/sword2/build_display.cpp
+++ b/sword2/build_display.cpp
@@ -698,7 +698,7 @@ void Screen::rollCredits() {
// now, let's just the standard speech font instead.
SpriteInfo spriteInfo;
- File f;
+ Common::File f;
int i;
// Read the "Smacker" logo
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 1432c14a31..7a792417b6 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -40,7 +40,7 @@
namespace Sword2 {
-static AudioStream *makeCLUStream(File *fp, int size);
+static AudioStream *makeCLUStream(Common::File *fp, int size);
static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) {
if (!fh->file->isOpen()) {
@@ -64,7 +64,7 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd
char filename[20];
for (int i = 0; i < ARRAYSIZE(file_types); i++) {
- File f;
+ Common::File f;
sprintf(filename, "%s%d.%s", base, cd, file_types[i].ext);
if (f.open(filename)) {
@@ -156,7 +156,7 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd
#define GetCompressedSign(n) (((n) >> 3) & 1)
#define GetCompressedAmplitude(n) ((n) & 7)
-CLUInputStream::CLUInputStream(File *file, int size)
+CLUInputStream::CLUInputStream(Common::File *file, int size)
: _file(file), _firstTime(true), _bufferEnd(_outbuf + BUFFER_SIZE) {
_file->incRef();
@@ -226,7 +226,7 @@ void CLUInputStream::refill() {
_bufferEnd = out;
}
-AudioStream *makeCLUStream(File *file, int size) {
+AudioStream *makeCLUStream(Common::File *file, int size) {
return new CLUInputStream(file, size);
}
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 417d8fe394..e11048c625 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -68,7 +68,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) {
// within the clusters at this point it makes no difference. We only
// wish to know what resource files there are and what is in each
- File file;
+ Common::File file;
uint32 size;
byte *temp;
@@ -418,7 +418,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
// care which CD it's on. But if we can't find it, keep asking
// for the CD until we do.
- File *file = openCluFile(cluFileNum);
+ Common::File *file = openCluFile(cluFileNum);
if (_resFiles[cluFileNum].entryTab == NULL) {
// we didn't read from this file before, get its index table
@@ -443,7 +443,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
StandardHeader *header = (StandardHeader *) _resList[res].ptr;
char buf[256];
const char *tag;
- File out;
+ Common::File out;
switch (header->fileType) {
case ANIMATION_FILE:
@@ -497,7 +497,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
#endif
if (!out.exists(buf, "")) {
- if (out.open(buf, File::kFileWriteMode, ""))
+ if (out.open(buf, Common::File::kFileWriteMode, ""))
out.write(_resList[res].ptr, len);
}
}
@@ -563,8 +563,8 @@ void ResourceManager::addToCacheList(Resource *res) {
_cacheEnd = res;
}
-File *ResourceManager::openCluFile(uint16 fileNum) {
- File *file = new File;
+Common::File *ResourceManager::openCluFile(uint16 fileNum) {
+ Common::File *file = new Common::File;
while (!file->open(_resFiles[fileNum].fileName)) {
// HACK: We have to check for this, or it'll be impossible to
// quit while the game is asking for the user to insert a CD.
@@ -585,7 +585,7 @@ File *ResourceManager::openCluFile(uint16 fileNum) {
return file;
}
-void ResourceManager::readCluIndex(uint16 fileNum, File *file) {
+void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
if (_resFiles[fileNum].entryTab == NULL) {
// we didn't read from this file before, get its index table
if (file == NULL)
diff --git a/sword2/resman.h b/sword2/resman.h
index 1e50f91047..e8b7b061a6 100644
--- a/sword2/resman.h
+++ b/sword2/resman.h
@@ -21,7 +21,9 @@
#ifndef RESMAN_H
#define RESMAN_H
-class File;
+namespace Common {
+ class File;
+}
#define MAX_MEM_CACHE (8 * 1024 * 1024) // we keep up to 8 megs of resource data files in memory
#define MAX_res_files 20
@@ -54,8 +56,8 @@ struct ResourceFile {
class ResourceManager {
private:
- File *openCluFile(uint16 fileNum);
- void readCluIndex(uint16 fileNum, File *file = NULL);
+ Common::File *openCluFile(uint16 fileNum);
+ void readCluIndex(uint16 fileNum, Common::File *file = NULL);
void removeFromCacheList(Resource *res);
void addToCacheList(Resource *res);
void checkMemUsage();
diff --git a/sword2/sound.cpp b/sword2/sound.cpp
index addaba928c..738f470f23 100644
--- a/sword2/sound.cpp
+++ b/sword2/sound.cpp
@@ -53,14 +53,14 @@ Sound::Sound(Sword2Engine *vm) {
for (i = 0; i < MAXMUS; i++) {
_music[i] = NULL;
- _musicFile[i].file = new File;
+ _musicFile[i].file = new Common::File;
_musicFile[i].idxTab = NULL;
_musicFile[i].idxLen = 0;
_musicFile[i].fileSize = 0;
_musicFile[i].fileType = 0;
_musicFile[i].inUse = false;
- _speechFile[i].file = new File;
+ _speechFile[i].file = new Common::File;
_speechFile[i].idxTab = NULL;
_speechFile[i].idxLen = 0;
_speechFile[i].fileSize = 0;
diff --git a/sword2/sound.h b/sword2/sound.h
index f34ba70014..1866ec1225 100644
--- a/sword2/sound.h
+++ b/sword2/sound.h
@@ -80,7 +80,7 @@ enum {
class CLUInputStream : public AudioStream {
private:
- File *_file;
+ Common::File *_file;
bool _firstTime;
uint32 _file_pos;
uint32 _end_pos;
@@ -98,7 +98,7 @@ private:
}
public:
- CLUInputStream(File *file, int size);
+ CLUInputStream(Common::File *file, int size);
~CLUInputStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -109,7 +109,7 @@ public:
};
struct SoundFileHandle {
- File *file;
+ Common::File *file;
uint32 *idxTab;
uint32 idxLen;
uint32 fileSize;
@@ -120,7 +120,7 @@ struct SoundFileHandle {
class MusicInputStream : public AudioStream {
private:
int _cd;
- //File *_file;
+ //Common::File *_file;
SoundFileHandle *_fh;
uint32 _musicId;
AudioStream *_decoder;
@@ -201,7 +201,7 @@ private:
SoundHandle _soundHandleSpeech;
MusicInputStream *_music[MAXMUS];
- //File _musicFile[MAXMUS];
+ //Common::File _musicFile[MAXMUS];
SoundFileHandle _musicFile[MAXMUS];
SoundFileHandle _speechFile[MAXMUS];
diff --git a/sword2/startup.cpp b/sword2/startup.cpp
index bc2f226df8..b6aedf81c1 100644
--- a/sword2/startup.cpp
+++ b/sword2/startup.cpp
@@ -40,7 +40,7 @@ bool Sword2Engine::initStartMenu() {
// We query each in turn and setup an array of start structures.
// If the file doesn't exist then we say so and return a 0.
- File fp;
+ Common::File fp;
// ok, load in the master screen manager file
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index a4d57e8821..0f64db936d 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -109,12 +109,12 @@ namespace Sword2 {
Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst) {
// Add default file directories
- File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
- File::addDefaultDirectory(_gameDataPath + "SWORD2/");
- File::addDefaultDirectory(_gameDataPath + "VIDEO/");
- File::addDefaultDirectory(_gameDataPath + "clusters/");
- File::addDefaultDirectory(_gameDataPath + "sword2/");
- File::addDefaultDirectory(_gameDataPath + "video/");
+ Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
+ Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/");
+ Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
+ Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
+ Common::File::addDefaultDirectory(_gameDataPath + "sword2/");
+ Common::File::addDefaultDirectory(_gameDataPath + "video/");
_features = detector->_game.features;
_targetName = detector->_targetName;