Moved class File and the MD5 stuff to namespace Common
svn-id: r18037
This commit is contained in:
parent
55c37c18ce
commit
b75c969e66
90 changed files with 291 additions and 242 deletions
|
@ -42,13 +42,13 @@ Engine::Engine(OSystem *syst)
|
||||||
_timer = g_timer;
|
_timer = g_timer;
|
||||||
|
|
||||||
// Add default file directory
|
// Add default file directory
|
||||||
File::addDefaultDirectory(_gameDataPath);
|
Common::File::addDefaultDirectory(_gameDataPath);
|
||||||
|
|
||||||
_saveFileMan = _system->getSavefileManager();
|
_saveFileMan = _system->getSavefileManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine::~Engine() {
|
Engine::~Engine() {
|
||||||
File::resetDefaultDirectories();
|
Common::File::resetDefaultDirectories();
|
||||||
|
|
||||||
delete _mixer;
|
delete _mixer;
|
||||||
delete _saveFileMan;
|
delete _saveFileMan;
|
||||||
|
|
|
@ -279,10 +279,10 @@ static int runGame(GameDetector &detector, OSystem &system) {
|
||||||
|
|
||||||
// Add extrapath (if any) to the directory search list
|
// Add extrapath (if any) to the directory search list
|
||||||
if (ConfMan.hasKey("extrapath"))
|
if (ConfMan.hasKey("extrapath"))
|
||||||
File::addDefaultDirectory(ConfMan.get("extrapath"));
|
Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
|
||||||
|
|
||||||
if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain))
|
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;
|
int result;
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/util.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) {
|
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;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::addDefaultDirectory(const Common::String &directory) {
|
void File::addDefaultDirectory(const String &directory) {
|
||||||
_defaultDirectories.push_back(directory);
|
_defaultDirectories.push_back(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ bool File::open(const char *filename, AccessMode mode, const char *directory) {
|
||||||
if (mode == kFileWriteMode || directory) {
|
if (mode == kFileWriteMode || directory) {
|
||||||
_handle = fopenNoCase(filename, directory ? directory : "", modeStr);
|
_handle = fopenNoCase(filename, directory ? directory : "", modeStr);
|
||||||
} else {
|
} else {
|
||||||
Common::StringList::const_iterator x;
|
StringList::const_iterator x;
|
||||||
// Try all default directories
|
// Try all default directories
|
||||||
for (x = _defaultDirectories.begin(); _handle == NULL && x != _defaultDirectories.end(); ++x) {
|
for (x = _defaultDirectories.begin(); _handle == NULL && x != _defaultDirectories.end(); ++x) {
|
||||||
_handle = fopenNoCase(filename, x->c_str(), modeStr);
|
_handle = fopenNoCase(filename, x->c_str(), modeStr);
|
||||||
|
@ -282,3 +283,5 @@ uint32 File::write(const void *ptr, uint32 len) {
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
class File : public Common::SeekableReadStream, public Common::WriteStream {
|
namespace Common {
|
||||||
|
|
||||||
|
class File : public SeekableReadStream, public WriteStream {
|
||||||
protected:
|
protected:
|
||||||
/** POSIX file handle to the actual file; 0 if no file is open. */
|
/** POSIX file handle to the actual file; 0 if no file is open. */
|
||||||
FILE *_handle;
|
FILE *_handle;
|
||||||
|
@ -39,10 +41,10 @@ protected:
|
||||||
int32 _refcount;
|
int32 _refcount;
|
||||||
|
|
||||||
/** The name of this file, for debugging. */
|
/** The name of this file, for debugging. */
|
||||||
Common::String _name;
|
String _name;
|
||||||
|
|
||||||
|
|
||||||
static Common::StringList _defaultDirectories;
|
static StringList _defaultDirectories;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum AccessMode {
|
enum AccessMode {
|
||||||
|
@ -50,7 +52,7 @@ public:
|
||||||
kFileWriteMode = 2
|
kFileWriteMode = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static void addDefaultDirectory(const Common::String &directory);
|
static void addDefaultDirectory(const String &directory);
|
||||||
static void resetDefaultDirectories();
|
static void resetDefaultDirectories();
|
||||||
|
|
||||||
File();
|
File();
|
||||||
|
@ -76,4 +78,6 @@ public:
|
||||||
uint32 write(const void *dataPtr, uint32 dataSize);
|
uint32 write(const void *dataPtr, uint32 dataSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "common/md5.h"
|
#include "common/md5.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
#define GET_UINT32(n,b,i) (n) = READ_LE_UINT32(b + i)
|
#define GET_UINT32(n,b,i) (n) = READ_LE_UINT32(b + i)
|
||||||
#define PUT_UINT32(n,b,i) WRITE_LE_UINT32(b + i, n)
|
#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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32 total[2];
|
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 );
|
bool md5_file( const char *name, uint8 digest[16], const char *directory = NULL, uint32 length = 0 );
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ int16 file_write(int16 handle, char *buf, int16 size) {
|
||||||
return filesHandles[handle].write(buf, 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;
|
int16 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_FILES; i++) {
|
for (i = 0; i < MAX_FILES; i++) {
|
||||||
|
@ -48,7 +48,7 @@ int16 file_open(const char *path, File::AccessMode mode) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
File *file_getHandle(int16 handle) {
|
Common::File *file_getHandle(int16 handle) {
|
||||||
return &filesHandles[handle];
|
return &filesHandles[handle];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,10 +284,10 @@ void data_closeData(int16 handle) {
|
||||||
file_getHandle(handle)->close();
|
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;
|
int16 handle;
|
||||||
|
|
||||||
if (mode != File::kFileReadMode)
|
if (mode != Common::File::kFileReadMode)
|
||||||
return file_open(path, mode);
|
return file_open(path, mode);
|
||||||
|
|
||||||
handle = data_getChunk(path);
|
handle = data_getChunk(path);
|
||||||
|
@ -320,7 +320,7 @@ void data_seekData(int16 handle, int32 pos, int16 from) {
|
||||||
int32 data_getDataSize(const char *name) {
|
int32 data_getDataSize(const char *name) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int32 chunkSz;
|
int32 chunkSz;
|
||||||
File file;
|
Common::File file;
|
||||||
|
|
||||||
strcpy(buf, name);
|
strcpy(buf, name);
|
||||||
chunkSz = data_getChunkSize(buf);
|
chunkSz = data_getChunkSize(buf);
|
||||||
|
|
|
@ -36,8 +36,8 @@ struct ChunkDesc {
|
||||||
byte packed;
|
byte packed;
|
||||||
};
|
};
|
||||||
|
|
||||||
int16 file_open(const char *path, File::AccessMode mode = File::kFileReadMode);
|
int16 file_open(const char *path, Common::File::AccessMode mode = Common::File::kFileReadMode);
|
||||||
File *file_getHandle(int16 handle);
|
Common::File *file_getHandle(int16 handle);
|
||||||
int16 data_getChunk(const char *chunkName);
|
int16 data_getChunk(const char *chunkName);
|
||||||
char data_freeChunk(int16 handle);
|
char data_freeChunk(int16 handle);
|
||||||
int32 data_readChunk(int16 handle, char *buf, int16 size);
|
int32 data_readChunk(int16 handle, char *buf, int16 size);
|
||||||
|
@ -47,7 +47,7 @@ void data_openDataFile(const char *src);
|
||||||
void data_closeDataFile(void);
|
void data_closeDataFile(void);
|
||||||
char *data_getUnpackedData(const char *name);
|
char *data_getUnpackedData(const char *name);
|
||||||
void data_closeData(int16 handle);
|
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);
|
int32 data_readData(int16 handle, char *buf, int16 size);
|
||||||
void data_seekData(int16 handle, int32 pos, int16 from);
|
void data_seekData(int16 handle, int32 pos, int16 from);
|
||||||
int32 data_getDataSize(const char *name);
|
int32 data_getDataSize(const char *name);
|
||||||
|
|
|
@ -92,7 +92,7 @@ char useJoystick = 1;
|
||||||
|
|
||||||
/* Files */
|
/* Files */
|
||||||
int16 filesCount = 0;
|
int16 filesCount = 0;
|
||||||
File filesHandles[MAX_FILES];
|
Common::File filesHandles[MAX_FILES];
|
||||||
|
|
||||||
/* Data files */
|
/* Data files */
|
||||||
struct ChunkDesc *dataFiles[MAX_DATA_FILES];
|
struct ChunkDesc *dataFiles[MAX_DATA_FILES];
|
||||||
|
|
|
@ -116,7 +116,7 @@ extern char useJoystick;
|
||||||
#define MAX_FILES 30
|
#define MAX_FILES 30
|
||||||
|
|
||||||
extern int16 filesCount;
|
extern int16 filesCount;
|
||||||
extern File filesHandles[MAX_FILES];
|
extern Common::File filesHandles[MAX_FILES];
|
||||||
|
|
||||||
/* Data files */
|
/* Data files */
|
||||||
extern struct ChunkDesc *dataFiles[MAX_DATA_FILES];
|
extern struct ChunkDesc *dataFiles[MAX_DATA_FILES];
|
||||||
|
|
|
@ -97,7 +97,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
|
||||||
uint8 md5sum[16];
|
uint8 md5sum[16];
|
||||||
char md5str[32 + 1];
|
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++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
|
sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,7 @@ void inter_writeData(void) {
|
||||||
offset = parse_parseValExpr();
|
offset = parse_parseValExpr();
|
||||||
|
|
||||||
WRITE_VAR(1, 1);
|
WRITE_VAR(1, 1);
|
||||||
handle = data_openData(inter_resStr, File::kFileWriteMode);
|
handle = data_openData(inter_resStr, Common::File::kFileWriteMode);
|
||||||
|
|
||||||
if (handle < 0)
|
if (handle < 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -71,7 +71,7 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
|
||||||
// Load lookup palettes
|
// Load lookup palettes
|
||||||
sprintf(tempFile, "%s.pal", name);
|
sprintf(tempFile, "%s.pal", name);
|
||||||
|
|
||||||
File f;
|
Common::File f;
|
||||||
|
|
||||||
if (!f.open(tempFile)) {
|
if (!f.open(tempFile)) {
|
||||||
warning("Cutscene: %s palette missing", tempFile);
|
warning("Cutscene: %s palette missing", tempFile);
|
||||||
|
@ -120,7 +120,7 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Open MPEG2 stream
|
// Open MPEG2 stream
|
||||||
_mpegFile = new File();
|
_mpegFile = new Common::File();
|
||||||
sprintf(tempFile, "%s.mp2", name);
|
sprintf(tempFile, "%s.mp2", name);
|
||||||
if (!_mpegFile->open(tempFile)) {
|
if (!_mpegFile->open(tempFile)) {
|
||||||
warning("Cutscene: Could not open %s", tempFile);
|
warning("Cutscene: Could not open %s", tempFile);
|
||||||
|
|
|
@ -63,6 +63,10 @@ typedef sequence_t mpeg2_sequence_t;
|
||||||
|
|
||||||
#define BUFFER_SIZE 4096
|
#define BUFFER_SIZE 4096
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
class BaseAnimationState {
|
class BaseAnimationState {
|
||||||
|
@ -82,7 +86,7 @@ protected:
|
||||||
const mpeg2_info_t *_mpegInfo;
|
const mpeg2_info_t *_mpegInfo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
File *_mpegFile;
|
Common::File *_mpegFile;
|
||||||
|
|
||||||
SoundHandle _bgSound;
|
SoundHandle _bgSound;
|
||||||
AudioStream *_bgSoundStream;
|
AudioStream *_bgSoundStream;
|
||||||
|
|
|
@ -90,7 +90,7 @@ Resourcemanager::~Resourcemanager() {
|
||||||
|
|
||||||
uint8* Resourcemanager::fileData(const char* file, uint32* size) {
|
uint8* Resourcemanager::fileData(const char* file, uint32* size) {
|
||||||
uint8* buffer = 0;
|
uint8* buffer = 0;
|
||||||
File file_;
|
Common::File file_;
|
||||||
|
|
||||||
// test to open it in the main dir
|
// test to open it in the main dir
|
||||||
if (file_.open(file)) {
|
if (file_.open(file)) {
|
||||||
|
@ -183,11 +183,11 @@ VMContext* Resourcemanager::loadScript(const char* file) {
|
||||||
// Pak file manager
|
// Pak file manager
|
||||||
#define PAKFile_Iterate Common::List<PakChunk*>::iterator start=_files.begin();start != _files.end(); ++start
|
#define PAKFile_Iterate Common::List<PakChunk*>::iterator start=_files.begin();start != _files.end(); ++start
|
||||||
PAKFile::PAKFile(/*const Common::String &path, */const Common::String& file) {
|
PAKFile::PAKFile(/*const Common::String &path, */const Common::String& file) {
|
||||||
File pakfile;
|
Common::File pakfile;
|
||||||
_buffer = 0;
|
_buffer = 0;
|
||||||
_open = false;
|
_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());
|
printf("pakfile couldn't open %s\n", file.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) {
|
||||||
const char *gameName = file->displayName().c_str();
|
const char *gameName = file->displayName().c_str();
|
||||||
|
|
||||||
if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {
|
if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {
|
||||||
File dataFile;
|
Common::File dataFile;
|
||||||
dataFile.open(file->path().c_str());
|
dataFile.open(file->path().c_str());
|
||||||
assert(dataFile.isOpen());
|
assert(dataFile.isOpen());
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ static int compareResourceEntry(const void *a, const void *b) {
|
||||||
|
|
||||||
Resource::Resource()
|
Resource::Resource()
|
||||||
: _resourceEntries(0), _resourceTable(NULL) {
|
: _resourceEntries(0), _resourceTable(NULL) {
|
||||||
_resourceFile = new File();
|
_resourceFile = new Common::File();
|
||||||
if (!findCompressedVersion() && !findNormalVersion())
|
if (!findCompressedVersion() && !findNormalVersion())
|
||||||
error("Could not open resource file '%s'", "queen.1");
|
error("Could not open resource file '%s'", "queen.1");
|
||||||
checkJASVersion();
|
checkJASVersion();
|
||||||
|
@ -190,7 +190,7 @@ Language Resource::getLanguage() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Resource::readTableFile(const GameVersion *gameVersion) {
|
bool Resource::readTableFile(const GameVersion *gameVersion) {
|
||||||
File tableFile;
|
Common::File tableFile;
|
||||||
tableFile.open(_tableFilename);
|
tableFile.open(_tableFilename);
|
||||||
if (tableFile.isOpen() && tableFile.readUint32BE() == 'QTBL') {
|
if (tableFile.isOpen() && tableFile.readUint32BE() == 'QTBL') {
|
||||||
if (tableFile.readUint32BE() != CURRENT_TBL_VERSION)
|
if (tableFile.readUint32BE() != CURRENT_TBL_VERSION)
|
||||||
|
@ -214,7 +214,7 @@ void Resource::readTableCompResource() {
|
||||||
readTableEntries(_resourceFile);
|
readTableEntries(_resourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::readTableEntries(File *file) {
|
void Resource::readTableEntries(Common::File *file) {
|
||||||
_resourceEntries = file->readUint16BE();
|
_resourceEntries = file->readUint16BE();
|
||||||
_resourceTable = new ResourceEntry[_resourceEntries];
|
_resourceTable = new ResourceEntry[_resourceEntries];
|
||||||
for (uint16 i = 0; i < _resourceEntries; ++i) {
|
for (uint16 i = 0; i < _resourceEntries; ++i) {
|
||||||
|
@ -237,7 +237,7 @@ const GameVersion *Resource::detectGameVersion(uint32 size) const {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
File *Resource::giveCompressedSound(const char *filename, uint32 *size) {
|
Common::File *Resource::giveCompressedSound(const char *filename, uint32 *size) {
|
||||||
assert(strstr(filename, ".SB"));
|
assert(strstr(filename, ".SB"));
|
||||||
ResourceEntry *re = resourceEntry(filename);
|
ResourceEntry *re = resourceEntry(filename);
|
||||||
assert(re != NULL);
|
assert(re != NULL);
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }
|
bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }
|
||||||
|
|
||||||
//! returns a reference to a sound file
|
//! 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 isDemo() const { return !strcmp(_versionString, "PE100"); }
|
||||||
bool isInterview() const { return !strcmp(_versionString, "PEint"); }
|
bool isInterview() const { return !strcmp(_versionString, "PEint"); }
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
File *_resourceFile;
|
Common::File *_resourceFile;
|
||||||
|
|
||||||
//! compression type for audio files
|
//! compression type for audio files
|
||||||
uint8 _compression;
|
uint8 _compression;
|
||||||
|
@ -146,7 +146,7 @@ protected:
|
||||||
void readTableCompResource();
|
void readTableCompResource();
|
||||||
|
|
||||||
//! read the resource table from the specified file
|
//! 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
|
//! detect game version based on queen.1 datafile size
|
||||||
const GameVersion *detectGameVersion(uint32 size) const;
|
const GameVersion *detectGameVersion(uint32 size) const;
|
||||||
|
|
|
@ -200,7 +200,7 @@ void SBSound::sfxPlay(const char *name, bool isSpeech) {
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
|
void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
|
||||||
uint32 size;
|
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));
|
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeMP3Stream(f, size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -208,7 +208,7 @@ void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
void OGGSound::sfxPlay(const char *name, bool isSpeech) {
|
void OGGSound::sfxPlay(const char *name, bool isSpeech) {
|
||||||
uint32 size;
|
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));
|
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeVorbisStream(f, size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -216,7 +216,7 @@ void OGGSound::sfxPlay(const char *name, bool isSpeech) {
|
||||||
#ifdef USE_FLAC
|
#ifdef USE_FLAC
|
||||||
void FLACSound::sfxPlay(const char *name, bool isSpeech) {
|
void FLACSound::sfxPlay(const char *name, bool isSpeech) {
|
||||||
uint32 size;
|
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));
|
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeFlacStream(f, size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -355,7 +355,7 @@ byte *Talk::loadDialogFile(const char *filename) {
|
||||||
for (int i = 0; i < ARRAYSIZE(dogFiles); ++i) {
|
for (int i = 0; i < ARRAYSIZE(dogFiles); ++i) {
|
||||||
if (!scumm_stricmp(filename, dogFiles[i].filename) &&
|
if (!scumm_stricmp(filename, dogFiles[i].filename) &&
|
||||||
_vm->resource()->getLanguage() == dogFiles[i].lang) {
|
_vm->resource()->getLanguage() == dogFiles[i].lang) {
|
||||||
File fdog;
|
Common::File fdog;
|
||||||
fdog.open(filename);
|
fdog.open(filename);
|
||||||
if (fdog.isOpen()) {
|
if (fdog.isOpen()) {
|
||||||
debug(6, "Loading dog file '%s' from game data path", filename);
|
debug(6, "Loading dog file '%s' from game data path", filename);
|
||||||
|
|
|
@ -2296,7 +2296,7 @@ void Actor::drawPathTest() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::saveState(File& out) {
|
void Actor::saveState(Common::File& out) {
|
||||||
uint16 i;
|
uint16 i;
|
||||||
|
|
||||||
out.writeSint16LE(getProtagState());
|
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;
|
int32 i;
|
||||||
|
|
||||||
setProtagState(in.readSint16LE());
|
setProtagState(in.readSint16LE());
|
||||||
|
|
16
saga/actor.h
16
saga/actor.h
|
@ -141,12 +141,12 @@ struct Location {
|
||||||
Location() {
|
Location() {
|
||||||
x = y = z = 0;
|
x = y = z = 0;
|
||||||
}
|
}
|
||||||
void saveState(File& out) {
|
void saveState(Common::File& out) {
|
||||||
out.writeSint32LE(x);
|
out.writeSint32LE(x);
|
||||||
out.writeSint32LE(y);
|
out.writeSint32LE(y);
|
||||||
out.writeSint32LE(z);
|
out.writeSint32LE(z);
|
||||||
}
|
}
|
||||||
void loadState(File& in) {
|
void loadState(Common::File& in) {
|
||||||
x = in.readSint32LE();
|
x = in.readSint32LE();
|
||||||
y = in.readSint32LE();
|
y = in.readSint32LE();
|
||||||
z = in.readSint32LE();
|
z = in.readSint32LE();
|
||||||
|
@ -222,7 +222,7 @@ public:
|
||||||
int32 screenDepth; //
|
int32 screenDepth; //
|
||||||
int32 screenScale; //
|
int32 screenScale; //
|
||||||
|
|
||||||
void saveState(File& out) {
|
void saveState(Common::File& out) {
|
||||||
out.writeUint16LE(flags);
|
out.writeUint16LE(flags);
|
||||||
out.writeSint32LE(nameIndex);
|
out.writeSint32LE(nameIndex);
|
||||||
out.writeSint32LE(sceneNumber);
|
out.writeSint32LE(sceneNumber);
|
||||||
|
@ -232,7 +232,7 @@ public:
|
||||||
out.writeSint32LE(screenDepth);
|
out.writeSint32LE(screenDepth);
|
||||||
out.writeSint32LE(screenScale);
|
out.writeSint32LE(screenScale);
|
||||||
}
|
}
|
||||||
void loadState(File& in) {
|
void loadState(Common::File& in) {
|
||||||
flags = in.readUint16LE();
|
flags = in.readUint16LE();
|
||||||
nameIndex = in.readSint32LE();
|
nameIndex = in.readSint32LE();
|
||||||
sceneNumber = in.readSint32LE();
|
sceneNumber = in.readSint32LE();
|
||||||
|
@ -297,7 +297,7 @@ public:
|
||||||
Location partialTarget;
|
Location partialTarget;
|
||||||
int32 walkFrameSequence;
|
int32 walkFrameSequence;
|
||||||
|
|
||||||
void saveState(File& out) {
|
void saveState(Common::File& out) {
|
||||||
CommonObjectData::saveState(out);
|
CommonObjectData::saveState(out);
|
||||||
out.writeUint16LE(actorFlags);
|
out.writeUint16LE(actorFlags);
|
||||||
out.writeSint32LE(currentAction);
|
out.writeSint32LE(currentAction);
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
partialTarget.saveState(out);
|
partialTarget.saveState(out);
|
||||||
out.writeSint32LE(walkFrameSequence);
|
out.writeSint32LE(walkFrameSequence);
|
||||||
}
|
}
|
||||||
void loadState(File& in) {
|
void loadState(Common::File& in) {
|
||||||
CommonObjectData::loadState(in);
|
CommonObjectData::loadState(in);
|
||||||
actorFlags = in.readUint16LE();
|
actorFlags = in.readUint16LE();
|
||||||
currentAction = in.readSint32LE();
|
currentAction = in.readSint32LE();
|
||||||
|
@ -495,8 +495,8 @@ public:
|
||||||
return _activeSpeech.stringsCount > 0;
|
return _activeSpeech.stringsCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveState(File& out);
|
void saveState(Common::File& out);
|
||||||
void loadState(File& in);
|
void loadState(Common::File& in);
|
||||||
|
|
||||||
void setProtagState(int state);
|
void setProtagState(int state);
|
||||||
int getProtagState() { return _protagState; }
|
int getProtagState() { return _protagState; }
|
||||||
|
|
|
@ -761,7 +761,7 @@ int detectGame(const FSList &fslist, bool mode) {
|
||||||
|
|
||||||
uint16 file_count;
|
uint16 file_count;
|
||||||
uint16 file_n;
|
uint16 file_n;
|
||||||
File test_file;
|
Common::File test_file;
|
||||||
bool file_missing;
|
bool file_missing;
|
||||||
|
|
||||||
Common::String tstr, tstr1;
|
Common::String tstr, tstr1;
|
||||||
|
@ -790,7 +790,7 @@ int detectGame(const FSList &fslist, bool mode) {
|
||||||
tstr.toLowercase();
|
tstr.toLowercase();
|
||||||
|
|
||||||
if (filesList.contains(tstr) || filesList.contains(tstr1)) {
|
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++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
||||||
}
|
}
|
||||||
|
@ -801,12 +801,12 @@ int detectGame(const FSList &fslist, bool mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File testFile;
|
Common::File testFile;
|
||||||
|
|
||||||
for (StringSet::const_iterator file = filesList.begin(); file != filesList.end(); ++file) {
|
for (StringSet::const_iterator file = filesList.begin(); file != filesList.end(); ++file) {
|
||||||
if (testFile.open(file->_key.c_str())) {
|
if (testFile.open(file->_key.c_str())) {
|
||||||
testFile.close();
|
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++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Saga {
|
||||||
|
|
||||||
class RAWInputStream : public AudioStream {
|
class RAWInputStream : public AudioStream {
|
||||||
private:
|
private:
|
||||||
File *_file;
|
Common::File *_file;
|
||||||
uint32 _file_pos;
|
uint32 _file_pos;
|
||||||
uint32 _start_pos;
|
uint32 _start_pos;
|
||||||
uint32 _end_pos;
|
uint32 _end_pos;
|
||||||
|
@ -56,7 +56,7 @@ private:
|
||||||
inline bool eosIntern() const;
|
inline bool eosIntern() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RAWInputStream(File *file, int size, bool looping);
|
RAWInputStream(Common::File *file, int size, bool looping);
|
||||||
~RAWInputStream();
|
~RAWInputStream();
|
||||||
|
|
||||||
int readBuffer(int16 *buffer, const int numSamples);
|
int readBuffer(int16 *buffer, const int numSamples);
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
int getRate() const { return 11025; }
|
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),
|
: _file(file), _finished(false), _looping(looping),
|
||||||
_bufferEnd(_buf + BUFFER_SIZE) {
|
_bufferEnd(_buf + BUFFER_SIZE) {
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void RAWInputStream::refill() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStream *makeRAWStream(const char *filename, uint32 pos, int size, bool looping) {
|
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)) {
|
if (!file->open(filename)) {
|
||||||
delete file;
|
delete file;
|
||||||
|
@ -285,7 +285,7 @@ Music::Music(SoundMixer *mixer, MidiDriver *driver, int enabled) : _mixer(mixer)
|
||||||
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
||||||
|
|
||||||
if (_vm->getGameType() == GType_ITE) {
|
if (_vm->getGameType() == GType_ITE) {
|
||||||
File file;
|
Common::File file;
|
||||||
byte footerBuf[ARRAYSIZE(_digiTableITECD) * 8];
|
byte footerBuf[ARRAYSIZE(_digiTableITECD) * 8];
|
||||||
|
|
||||||
// The lookup table is stored at the end of music.rsc. I don't
|
// 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;
|
AudioStream *audioStream = NULL;
|
||||||
MidiParser *parser;
|
MidiParser *parser;
|
||||||
File midiFile;
|
Common::File midiFile;
|
||||||
|
|
||||||
if (_vm->getGameType() == GType_ITE) {
|
if (_vm->getGameType() == GType_ITE) {
|
||||||
if (music_rn >= 9 && music_rn <= 34) {
|
if (music_rn >= 9 && music_rn <= 34) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ RSCFILE_CONTEXT *RSC_CreateContext() {
|
||||||
empty_context.rc_file_loaded = 0;
|
empty_context.rc_file_loaded = 0;
|
||||||
empty_context.rc_res_table = NULL;
|
empty_context.rc_res_table = NULL;
|
||||||
empty_context.rc_res_ct = 0;
|
empty_context.rc_res_ct = 0;
|
||||||
empty_context.rc_file = new File();
|
empty_context.rc_file = new Common::File();
|
||||||
RSCFILE_CONTEXT *new_context;
|
RSCFILE_CONTEXT *new_context;
|
||||||
|
|
||||||
new_context = (RSCFILE_CONTEXT *)malloc(sizeof(*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;
|
substnum = -1;
|
||||||
|
|
||||||
if (substnum != -1) {
|
if (substnum != -1) {
|
||||||
File in;
|
Common::File in;
|
||||||
|
|
||||||
if (in.open(substitutes[substnum].fname)) {
|
if (in.open(substitutes[substnum].fname)) {
|
||||||
res_size = in.size();
|
res_size = in.size();
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct RSCFILE_RESOURCE {
|
||||||
|
|
||||||
struct RSCFILE_CONTEXT {
|
struct RSCFILE_CONTEXT {
|
||||||
const char *rc_file_fspec;
|
const char *rc_file_fspec;
|
||||||
File *rc_file;
|
Common::File *rc_file;
|
||||||
int rc_file_loaded;
|
int rc_file_loaded;
|
||||||
RSCFILE_RESOURCE *rc_res_table;
|
RSCFILE_RESOURCE *rc_res_table;
|
||||||
size_t rc_res_ct;
|
size_t rc_res_ct;
|
||||||
|
|
|
@ -142,16 +142,16 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
|
||||||
|
|
||||||
// The Linux version of Inherit the Earth puts all data files in an
|
// The Linux version of Inherit the Earth puts all data files in an
|
||||||
// 'itedata' sub-directory, except for voices.rsc
|
// '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
|
// The Windows version of Inherit the Earth puts various data files in
|
||||||
// other subdirectories.
|
// other subdirectories.
|
||||||
File::addDefaultDirectory(_gameDataPath + "graphics/");
|
Common::File::addDefaultDirectory(_gameDataPath + "graphics/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "music/");
|
Common::File::addDefaultDirectory(_gameDataPath + "music/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "sound/");
|
Common::File::addDefaultDirectory(_gameDataPath + "sound/");
|
||||||
|
|
||||||
// Mac CD Wyrmkeep
|
// Mac CD Wyrmkeep
|
||||||
File::addDefaultDirectory(_gameDataPath + "patch/");
|
Common::File::addDefaultDirectory(_gameDataPath + "patch/");
|
||||||
|
|
||||||
// Setup mixer
|
// Setup mixer
|
||||||
if (!_mixer->isReady()) {
|
if (!_mixer->isReady()) {
|
||||||
|
@ -202,15 +202,15 @@ int SagaEngine::init(GameDetector &detector) {
|
||||||
|
|
||||||
// Add some default directories
|
// Add some default directories
|
||||||
// Win32 demo & full game
|
// Win32 demo & full game
|
||||||
File::addDefaultDirectory("graphics");
|
Common::File::addDefaultDirectory("graphics");
|
||||||
File::addDefaultDirectory("music");
|
Common::File::addDefaultDirectory("music");
|
||||||
File::addDefaultDirectory("sound");
|
Common::File::addDefaultDirectory("sound");
|
||||||
|
|
||||||
// Linux demo
|
// Linux demo
|
||||||
File::addDefaultDirectory("itedata");
|
Common::File::addDefaultDirectory("itedata");
|
||||||
|
|
||||||
// Mac demos & full game
|
// Mac demos & full game
|
||||||
File::addDefaultDirectory("patch");
|
Common::File::addDefaultDirectory("patch");
|
||||||
|
|
||||||
// Process command line
|
// Process command line
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
namespace Saga {
|
namespace Saga {
|
||||||
|
|
||||||
void SagaEngine::save(const char *fileName) {
|
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
|
//TODO: version number
|
||||||
|
|
||||||
// Surrounding scene
|
// Surrounding scene
|
||||||
|
@ -67,7 +67,7 @@ void SagaEngine::save(const char *fileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SagaEngine::load(const char *fileName) {
|
void SagaEngine::load(const char *fileName) {
|
||||||
File in;
|
Common::File in;
|
||||||
int commonBufferSize;
|
int commonBufferSize;
|
||||||
int sceneNumber, insetSceneNumber;
|
int sceneNumber, insetSceneNumber;
|
||||||
int mapx, mapy;
|
int mapx, mapy;
|
||||||
|
|
|
@ -83,7 +83,7 @@ int SndRes::playVoice(uint32 voice_rn) {
|
||||||
// separate file (p2_a.voc or P2_A.iaf), to correct voice 4 in
|
// separate file (p2_a.voc or P2_A.iaf), to correct voice 4 in
|
||||||
// the intro. Use that, if available.
|
// the intro. Use that, if available.
|
||||||
|
|
||||||
File f;
|
Common::File f;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
bool voc = false;
|
bool voc = false;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ int SndRes::getVoiceLength(uint32 voice_rn) {
|
||||||
|
|
||||||
assert(_init);
|
assert(_init);
|
||||||
|
|
||||||
File f;
|
Common::File f;
|
||||||
|
|
||||||
// The Wyrmkeep release of Inherit the Earth provides a separate file
|
// 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,
|
// (p2_a.voc or P2_A.iaf), to correct voice 4 in the intro. Use that,
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
void ScummEngine::loadCJKFont() {
|
void ScummEngine::loadCJKFont() {
|
||||||
File fp;
|
Common::File fp;
|
||||||
_useCJKMode = false;
|
_useCJKMode = false;
|
||||||
if (_language == Common::JA_JPN && _version <= 5) { // FM-TOWNS v3 / v5 Kanji
|
if (_language == Common::JA_JPN && _version <= 5) { // FM-TOWNS v3 / v5 Kanji
|
||||||
int numChar = 256 * 32;
|
int numChar = 256 * 32;
|
||||||
_2byteWidth = 16;
|
_2byteWidth = 16;
|
||||||
_2byteHeight = 16;
|
_2byteHeight = 16;
|
||||||
// use FM-TOWNS font rom, since game files don't have kanji font resources
|
// 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;
|
_useCJKMode = true;
|
||||||
debug(2, "Loading FM-TOWNS Kanji rom");
|
debug(2, "Loading FM-TOWNS Kanji rom");
|
||||||
_2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar];
|
_2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar];
|
||||||
|
|
|
@ -289,7 +289,7 @@ bool ScummDebugger::Cmd_Script(int argc, const char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) {
|
bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) {
|
||||||
File file;
|
Common::File file;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
int resnum;
|
int resnum;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) {
|
||||||
// FIXME add bounds check
|
// FIXME add bounds check
|
||||||
|
|
||||||
if (!strncmp(argv[1], "scr", 3)) {
|
if (!strncmp(argv[1], "scr", 3)) {
|
||||||
file.open(argv[2], File::kFileReadMode);
|
file.open(argv[2], Common::File::kFileReadMode);
|
||||||
if (file.isOpen() == false) {
|
if (file.isOpen() == false) {
|
||||||
DebugPrintf("Could not open file %s\n", argv[2]);
|
DebugPrintf("Could not open file %s\n", argv[2]);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -71,7 +71,7 @@ int BundleDirCache::matchFile(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
File file;
|
Common::File file;
|
||||||
|
|
||||||
if (file.open(filename) == false) {
|
if (file.open(filename) == false) {
|
||||||
warning("BundleDirCache::matchFile() Can't open bundle file: %s", filename);
|
warning("BundleDirCache::matchFile() Can't open bundle file: %s", filename);
|
||||||
|
@ -135,7 +135,7 @@ BundleMgr::~BundleMgr() {
|
||||||
close();
|
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++) {
|
for (int i = 0; i < _numFiles; i++) {
|
||||||
if (!scumm_stricmp(filename, _bundleTable[i].filename)) {
|
if (!scumm_stricmp(filename, _bundleTable[i].filename)) {
|
||||||
_file.seek(_bundleTable[i].offset, SEEK_SET);
|
_file.seek(_bundleTable[i].offset, SEEK_SET);
|
||||||
|
|
|
@ -67,7 +67,7 @@ private:
|
||||||
int _numFiles;
|
int _numFiles;
|
||||||
int _numCompItems;
|
int _numCompItems;
|
||||||
int _curSample;
|
int _curSample;
|
||||||
File _file;
|
Common::File _file;
|
||||||
bool _compTableLoaded;
|
bool _compTableLoaded;
|
||||||
int _fileBundleId;
|
int _fileBundleId;
|
||||||
byte _compOutput[0x2000];
|
byte _compOutput[0x2000];
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
bool open(const char *filename, bool &compressed);
|
bool open(const char *filename, bool &compressed);
|
||||||
void close();
|
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 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 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);
|
int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside);
|
||||||
|
|
|
@ -84,7 +84,7 @@ void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, i
|
||||||
} while (tag != MKID_BE('DATA'));
|
} 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;
|
int l;
|
||||||
|
|
||||||
file->seek(offset, SEEK_SET);
|
file->seek(offset, SEEK_SET);
|
||||||
|
@ -368,7 +368,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
|
||||||
char fileName[24];
|
char fileName[24];
|
||||||
int32 offset = 0, size = 0;
|
int32 offset = 0, size = 0;
|
||||||
sprintf(fileName, "%s.map", soundName);
|
sprintf(fileName, "%s.map", soundName);
|
||||||
File *rmapFile = sound->bundle->getFile(fileName, offset, size);
|
Common::File *rmapFile = sound->bundle->getFile(fileName, offset, size);
|
||||||
if (!rmapFile) {
|
if (!rmapFile) {
|
||||||
closeSound(sound);
|
closeSound(sound);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -577,7 +577,7 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b
|
||||||
sprintf(fileName, "%s_reg%03d", soundHandle->name, region);
|
sprintf(fileName, "%s_reg%03d", soundHandle->name, region);
|
||||||
if (scumm_stricmp(fileName, soundHandle->lastFileName) != 0) {
|
if (scumm_stricmp(fileName, soundHandle->lastFileName) != 0) {
|
||||||
int32 offs = 0, len = 0;
|
int32 offs = 0, len = 0;
|
||||||
File *cmpFile;
|
Common::File *cmpFile;
|
||||||
bool oggMode = false;
|
bool oggMode = false;
|
||||||
sprintf(fileName, "%s_reg%03d.mp3", soundHandle->name, region);
|
sprintf(fileName, "%s_reg%03d.mp3", soundHandle->name, region);
|
||||||
cmpFile = soundHandle->bundle->getFile(fileName, offs, len);
|
cmpFile = soundHandle->bundle->getFile(fileName, offs, len);
|
||||||
|
|
|
@ -96,7 +96,7 @@ private:
|
||||||
bool checkForProperHandle(soundStruct *soundHandle);
|
bool checkForProperHandle(soundStruct *soundHandle);
|
||||||
soundStruct *allocSlot();
|
soundStruct *allocSlot();
|
||||||
void prepareSound(byte *ptr, soundStruct *sound);
|
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;
|
ScummEngine *_vm;
|
||||||
byte _disk;
|
byte _disk;
|
||||||
|
|
|
@ -675,7 +675,7 @@ protected:
|
||||||
|
|
||||||
const OpcodeEntryv60he *_opcodesv60he;
|
const OpcodeEntryv60he *_opcodesv60he;
|
||||||
|
|
||||||
File _hFileTable[17];
|
Common::File _hFileTable[17];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScummEngine_v60he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v6(detector, syst, gs, md5sum) {}
|
ScummEngine_v60he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v6(detector, syst, gs, md5sum) {}
|
||||||
|
|
|
@ -1227,7 +1227,7 @@ void ScummEngine::allocateArrays() {
|
||||||
|
|
||||||
void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int length) {
|
void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int length) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
File out;
|
Common::File out;
|
||||||
|
|
||||||
uint32 size;
|
uint32 size;
|
||||||
if (length >= 0)
|
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);
|
sprintf(buf, "dumps/%s%d.dmp", tag, idx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out.open(buf, File::kFileWriteMode);
|
out.open(buf, Common::File::kFileWriteMode);
|
||||||
if (out.isOpen() == false)
|
if (out.isOpen() == false)
|
||||||
return;
|
return;
|
||||||
out.write(ptr, size);
|
out.write(ptr, size);
|
||||||
|
|
|
@ -104,7 +104,7 @@ void ScummEngine_v3::loadCharset(int no) {
|
||||||
checkRange(2, 0, no, "Loading illegal charset %d");
|
checkRange(2, 0, no, "Loading illegal charset %d");
|
||||||
closeRoom();
|
closeRoom();
|
||||||
|
|
||||||
File file;
|
Common::File file;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
sprintf(buf, "%02d.LFL", 99 - no);
|
sprintf(buf, "%02d.LFL", 99 - no);
|
||||||
|
|
|
@ -136,7 +136,7 @@ void ScummEngine_v4::loadCharset(int no) {
|
||||||
checkRange(4, 0, no, "Loading illegal charset %d");
|
checkRange(4, 0, no, "Loading illegal charset %d");
|
||||||
closeRoom();
|
closeRoom();
|
||||||
|
|
||||||
File file;
|
Common::File file;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
sprintf(buf, "%03d.LFL", 900 + no);
|
sprintf(buf, "%03d.LFL", 900 + no);
|
||||||
|
|
|
@ -142,7 +142,7 @@ int Win32ResExtractor::extractResource(const char *resType, char *resName, byte
|
||||||
|
|
||||||
/* initiate stuff */
|
/* initiate stuff */
|
||||||
fi.memory = NULL;
|
fi.memory = NULL;
|
||||||
fi.file = new File;
|
fi.file = new Common::File;
|
||||||
|
|
||||||
if (!_fileName[0]) { // We are running for the first time
|
if (!_fileName[0]) { // We are running for the first time
|
||||||
snprintf(_fileName, 256, "%s.he3", _vm->getGameName());
|
snprintf(_fileName, 256, "%s.he3", _vm->getGameName());
|
||||||
|
@ -1279,7 +1279,7 @@ void MacResExtractor::setCursor(int id) {
|
||||||
int cursorsize;
|
int cursorsize;
|
||||||
int w = 0, h = 0, hotspot_x = 0, hotspot_y = 0;
|
int w = 0, h = 0, hotspot_x = 0, hotspot_y = 0;
|
||||||
int keycolor;
|
int keycolor;
|
||||||
File f;
|
Common::File f;
|
||||||
|
|
||||||
if (!_fileName[0]) // We are running for the first time
|
if (!_fileName[0]) // We are running for the first time
|
||||||
if (_vm->_substResFileNameIndex > 0) {
|
if (_vm->_substResFileNameIndex > 0) {
|
||||||
|
@ -1314,7 +1314,7 @@ void MacResExtractor::setCursor(int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MacResExtractor::extractResource(int id, byte **buf) {
|
int MacResExtractor::extractResource(int id, byte **buf) {
|
||||||
File in;
|
Common::File in;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
in.open(_fileName);
|
in.open(_fileName);
|
||||||
|
@ -1345,7 +1345,7 @@ int MacResExtractor::extractResource(int id, byte **buf) {
|
||||||
#define MBI_RFLEN 87
|
#define MBI_RFLEN 87
|
||||||
#define MAXNAMELEN 63
|
#define MAXNAMELEN 63
|
||||||
|
|
||||||
bool MacResExtractor::init(File in) {
|
bool MacResExtractor::init(Common::File in) {
|
||||||
byte infoHeader[MBI_INFOHDR];
|
byte infoHeader[MBI_INFOHDR];
|
||||||
int32 data_size, rsrc_size;
|
int32 data_size, rsrc_size;
|
||||||
int32 data_size_pad, rsrc_size_pad;
|
int32 data_size_pad, rsrc_size_pad;
|
||||||
|
@ -1397,7 +1397,7 @@ bool MacResExtractor::init(File in) {
|
||||||
return true;
|
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 i;
|
||||||
int typeNum = -1;
|
int typeNum = -1;
|
||||||
int resNum = -1;
|
int resNum = -1;
|
||||||
|
@ -1434,7 +1434,7 @@ byte *MacResExtractor::getResource(File in, const char *typeID, int16 resID, int
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacResExtractor::readMap(File in) {
|
void MacResExtractor::readMap(Common::File in) {
|
||||||
int i, j, len;
|
int i, j, len;
|
||||||
|
|
||||||
in.seek(_mapOffset + 22);
|
in.seek(_mapOffset + 22);
|
||||||
|
|
|
@ -156,7 +156,7 @@ class Win32ResExtractor {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct WinLibrary {
|
struct WinLibrary {
|
||||||
File *file;
|
Common::File *file;
|
||||||
byte *memory;
|
byte *memory;
|
||||||
byte *first_resource;
|
byte *first_resource;
|
||||||
bool is_PE_binary;
|
bool is_PE_binary;
|
||||||
|
@ -490,9 +490,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int extractResource(int id, byte **buf);
|
int extractResource(int id, byte **buf);
|
||||||
bool init(File in);
|
bool init(Common::File in);
|
||||||
void readMap(File in);
|
void readMap(Common::File in);
|
||||||
byte *getResource(File in, const char *typeID, int16 resID, int *size);
|
byte *getResource(Common::File in, const char *typeID, int16 resID, int *size);
|
||||||
void convertIcons(byte *data, int datasize, byte **cursor, int *w, int *h,
|
void convertIcons(byte *data, int datasize, byte **cursor, int *w, int *h,
|
||||||
int *hotspot_x, int *hotspot_y, int *keycolor);
|
int *hotspot_x, int *hotspot_y, int *keycolor);
|
||||||
|
|
||||||
|
|
|
@ -1007,12 +1007,12 @@ void ScummEngine_v60he::o60_openFile() {
|
||||||
if (slot != -1) {
|
if (slot != -1) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case 1:
|
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)
|
if (_hFileTable[slot].isOpen() == false)
|
||||||
_hFileTable[slot].open((char*)filename + r, File::kFileReadMode);
|
_hFileTable[slot].open((char*)filename + r, Common::File::kFileReadMode);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_hFileTable[slot].open((char*)filename + r, File::kFileWriteMode, _saveFileMan->getSavePath());
|
_hFileTable[slot].open((char*)filename + r, Common::File::kFileWriteMode, _saveFileMan->getSavePath());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("o60_openFile(): wrong open file mode %d", mode);
|
error("o60_openFile(): wrong open file mode %d", mode);
|
||||||
|
|
|
@ -538,7 +538,7 @@ int ScummEngine_v72he::convertFilePath(byte *dst, bool setFilePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setFilePath) {
|
if (setFilePath) {
|
||||||
File f;
|
Common::File f;
|
||||||
char filePath[256], newFilePath[256];
|
char filePath[256], newFilePath[256];
|
||||||
|
|
||||||
sprintf(filePath, "%s%s", _gameDataPath.c_str(), dst + r);
|
sprintf(filePath, "%s%s", _gameDataPath.c_str(), dst + r);
|
||||||
|
@ -1752,12 +1752,12 @@ void ScummEngine_v72he::o72_openFile() {
|
||||||
if (slot != -1) {
|
if (slot != -1) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case 1:
|
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)
|
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;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_hFileTable[slot].open((char*)filename + r, File::kFileWriteMode, _saveFileMan->getSavePath());
|
_hFileTable[slot].open((char*)filename + r, Common::File::kFileWriteMode, _saveFileMan->getSavePath());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("o72_openFile(): wrong open file mode %d", mode);
|
error("o72_openFile(): wrong open file mode %d", mode);
|
||||||
|
|
|
@ -406,7 +406,7 @@ void ScummEngine_v80he::o80_getFileSize() {
|
||||||
|
|
||||||
copyScriptString(filename, sizeof(filename));
|
copyScriptString(filename, sizeof(filename));
|
||||||
|
|
||||||
File f;
|
Common::File f;
|
||||||
if (f.open((char *)filename) == false) {
|
if (f.open((char *)filename) == false) {
|
||||||
push(-1);
|
push(-1);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -72,6 +72,8 @@ extern bool isSmartphone(void);
|
||||||
|
|
||||||
static int generateSubstResFileName_(const char *filename, char *buf, int bufsize, int index);
|
static int generateSubstResFileName_(const char *filename, char *buf, int bufsize, int index);
|
||||||
|
|
||||||
|
using Common::File;
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
// Use g_scumm from error() ONLY
|
// Use g_scumm from error() ONLY
|
||||||
|
@ -2628,7 +2630,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
|
||||||
uint8 md5sum[16];
|
uint8 md5sum[16];
|
||||||
const char *name = iter->_key.c_str();
|
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];
|
char md5str[32+1];
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[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;
|
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++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(gameMD5 + j*2, "%02x", (int)md5sum[j]);
|
sprintf(gameMD5 + j*2, "%02x", (int)md5sum[j]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ private:
|
||||||
|
|
||||||
SoundHandle _compressedFileSoundHandle;
|
SoundHandle _compressedFileSoundHandle;
|
||||||
bool _compressedFileMode;
|
bool _compressedFileMode;
|
||||||
File _compressedFile;
|
Common::File _compressedFile;
|
||||||
byte _IACToutput[4096];
|
byte _IACToutput[4096];
|
||||||
int32 _IACTpos;
|
int32 _IACTpos;
|
||||||
bool _storeFrame;
|
bool _storeFrame;
|
||||||
|
|
|
@ -165,7 +165,7 @@ void Sound::setOverrideFreq(int freq) {
|
||||||
void Sound::setupHEMusicFile() {
|
void Sound::setupHEMusicFile() {
|
||||||
int i, total_size;
|
int i, total_size;
|
||||||
char buf[32], buf1[128];
|
char buf[32], buf1[128];
|
||||||
File musicFile;
|
Common::File musicFile;
|
||||||
|
|
||||||
sprintf(buf, "%s.he4", _vm->getGameName());
|
sprintf(buf, "%s.he4", _vm->getGameName());
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
|
||||||
|
|
||||||
int music_offs;
|
int music_offs;
|
||||||
char buf[32], buf1[128];
|
char buf[32], buf1[128];
|
||||||
File musicFile;
|
Common::File musicFile;
|
||||||
|
|
||||||
sprintf(buf, "%s.he4", _vm->getGameName());
|
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
|
// 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.
|
// Specifies a separate file to be used for music from what I gather.
|
||||||
int tmpsize;
|
int tmpsize;
|
||||||
File dmuFile;
|
Common::File dmuFile;
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
debugC(DEBUG_SOUND, "Found base tag FMUS in sound %d, size %d", idx, total_size);
|
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());
|
debugC(DEBUG_SOUND, "It was at position %d", _fileHandle->pos());
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/md5.h"
|
#include "common/md5.h"
|
||||||
|
|
||||||
|
using Common::File;
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -1197,7 +1199,7 @@ bool ScummNESFile::open(const char *filename, AccessMode mode) {
|
||||||
uint8 md5sum[16];
|
uint8 md5sum[16];
|
||||||
|
|
||||||
if (_ROMset == kROMsetNum) {
|
if (_ROMset == kROMsetNum) {
|
||||||
if (md5_file(filename, md5sum)) {
|
if (Common::md5_file(filename, md5sum)) {
|
||||||
char md5str[32+1];
|
char md5str[32+1];
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
class BaseScummFile : public File {
|
class BaseScummFile : public Common::File {
|
||||||
public:
|
public:
|
||||||
virtual void setEnc(byte value) = 0;
|
virtual void setEnc(byte value) = 0;
|
||||||
|
|
||||||
|
|
|
@ -603,7 +603,7 @@ void ScummEngine::initScummVars() {
|
||||||
&& (_platform == Common::kPlatformPC)) {
|
&& (_platform == Common::kPlatformPC)) {
|
||||||
if (_gameId == GID_LOOM) {
|
if (_gameId == GID_LOOM) {
|
||||||
char buf[50];
|
char buf[50];
|
||||||
File f;
|
Common::File f;
|
||||||
for (int i = 82; i < 86; i++) {
|
for (int i = 82; i < 86; i++) {
|
||||||
sprintf(buf, "%d.LFL", i);
|
sprintf(buf, "%d.LFL", i);
|
||||||
f.open(buf);
|
f.open(buf);
|
||||||
|
@ -612,7 +612,7 @@ void ScummEngine::initScummVars() {
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
} else if (_gameId == GID_MONKEY_EGA) {
|
} else if (_gameId == GID_MONKEY_EGA) {
|
||||||
File f;
|
Common::File f;
|
||||||
f.open("DISK09.LEC");
|
f.open("DISK09.LEC");
|
||||||
if (f.isOpen() == false)
|
if (f.isOpen() == false)
|
||||||
error("Native MIDI support requires Roland patch from LucasArts");
|
error("Native MIDI support requires Roland patch from LucasArts");
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) {
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (params->processFlags & kWPFUseFile) {
|
if (params->processFlags & kWPFUseFile) {
|
||||||
File f;
|
Common::File f;
|
||||||
|
|
||||||
// Convert Windows path separators to something more portable
|
// Convert Windows path separators to something more portable
|
||||||
strncpy(buf, (const char *)params->filename, 512);
|
strncpy(buf, (const char *)params->filename, 512);
|
||||||
|
@ -1722,7 +1722,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) {
|
||||||
buf[i] = '/';
|
buf[i] = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f.open((const char *)buf, File::kFileReadMode)) {
|
if (f.open((const char *)buf, Common::File::kFileReadMode)) {
|
||||||
uint32 id = f.readUint32LE();
|
uint32 id = f.readUint32LE();
|
||||||
if (id == TO_LE_32(MKID('AWIZ')) || id == TO_LE_32(MKID('MULT'))) {
|
if (id == TO_LE_32(MKID('AWIZ')) || id == TO_LE_32(MKID('MULT'))) {
|
||||||
uint32 size = f.readUint32BE();
|
uint32 size = f.readUint32BE();
|
||||||
|
@ -1751,7 +1751,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) {
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (params->processFlags & kWPFUseFile) {
|
if (params->processFlags & kWPFUseFile) {
|
||||||
File f;
|
Common::File f;
|
||||||
|
|
||||||
switch(params->fileWriteMode) {
|
switch(params->fileWriteMode) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1768,7 +1768,7 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) {
|
||||||
buf[i] = '/';
|
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);
|
warning("Unable to open for write '%s'", buf);
|
||||||
VAR(119) = -3;
|
VAR(119) = -3;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
namespace Simon {
|
namespace Simon {
|
||||||
|
|
||||||
void SimonEngine::loadIconFile() {
|
void SimonEngine::loadIconFile() {
|
||||||
File in;
|
Common::File in;
|
||||||
if (_game & GF_ACORN)
|
if (_game & GF_ACORN)
|
||||||
in.open("ICONDATA");
|
in.open("ICONDATA");
|
||||||
else if (_game & GF_AMIGA)
|
else if (_game & GF_AMIGA)
|
||||||
|
|
|
@ -335,7 +335,7 @@ static int simon1_gmf_size[] = {
|
||||||
17256, 5103, 8794, 4884, 16
|
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);
|
Common::StackLock lock(_mutex);
|
||||||
|
|
||||||
MusicInfo *p = sfx ? &_sfx : &_music;
|
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
|
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.
|
// This is a special case for Simon 2 Windows.
|
||||||
// Instead of having multiple sequences as
|
// Instead of having multiple sequences as
|
||||||
// separate tracks in a Type 2 file, simon2win
|
// 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);
|
Common::StackLock lock(_mutex);
|
||||||
MusicInfo *p = sfx ? &_sfx : &_music;
|
MusicInfo *p = sfx ? &_sfx : &_music;
|
||||||
clearConstructs(*p);
|
clearConstructs(*p);
|
||||||
|
@ -512,7 +512,7 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) {
|
||||||
p->parser = parser; // That plugs the power cord into the wall
|
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);
|
Common::StackLock lock(_mutex);
|
||||||
MusicInfo *p = sfx ? &_sfx : &_music;
|
MusicInfo *p = sfx ? &_sfx : &_music;
|
||||||
clearConstructs(*p);
|
clearConstructs(*p);
|
||||||
|
|
12
simon/midi.h
12
simon/midi.h
|
@ -26,7 +26,9 @@
|
||||||
#include "sound/midiparser.h"
|
#include "sound/midiparser.h"
|
||||||
#include "common/mutex.h"
|
#include "common/mutex.h"
|
||||||
|
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Simon {
|
namespace Simon {
|
||||||
|
|
||||||
|
@ -83,10 +85,10 @@ public:
|
||||||
MidiPlayer (OSystem *system);
|
MidiPlayer (OSystem *system);
|
||||||
virtual ~MidiPlayer();
|
virtual ~MidiPlayer();
|
||||||
|
|
||||||
void loadSMF (File *in, int song, bool sfx = false);
|
void loadSMF (Common::File *in, int song, bool sfx = false);
|
||||||
void loadMultipleSMF (File *in, bool sfx = false);
|
void loadMultipleSMF (Common::File *in, bool sfx = false);
|
||||||
void loadXMIDI (File *in, bool sfx = false);
|
void loadXMIDI (Common::File *in, bool sfx = false);
|
||||||
void loadS1D (File *in, bool sfx = false);
|
void loadS1D (Common::File *in, bool sfx = false);
|
||||||
|
|
||||||
void mapMT32toGM (bool map);
|
void mapMT32toGM (bool map);
|
||||||
void setLoop (bool loop);
|
void setLoop (bool loop);
|
||||||
|
|
|
@ -97,7 +97,7 @@ static const char *const opcode_arg_table_simon2dos[256] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void SimonEngine::loadGamePcFile(const char *filename) {
|
void SimonEngine::loadGamePcFile(const char *filename) {
|
||||||
File in;
|
Common::File in;
|
||||||
int num_inited_objects;
|
int num_inited_objects;
|
||||||
int i, file_size;
|
int i, file_size;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ void SimonEngine::loadGamePcFile(const char *filename) {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimonEngine::readGamePcText(File *in) {
|
void SimonEngine::readGamePcText(Common::File *in) {
|
||||||
uint text_size;
|
uint text_size;
|
||||||
byte *text_mem;
|
byte *text_mem;
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void SimonEngine::readGamePcText(File *in) {
|
||||||
setupStringTable(text_mem, _stringTabNum);
|
setupStringTable(text_mem, _stringTabNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimonEngine::readItemFromGamePc(File *in, Item *item) {
|
void SimonEngine::readItemFromGamePc(Common::File *in, Item *item) {
|
||||||
uint32 type;
|
uint32 type;
|
||||||
|
|
||||||
item->unk2 = in->readUint16BE();
|
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) {
|
if (type == 1) {
|
||||||
uint fr1 = in->readUint16BE();
|
uint fr1 = in->readUint16BE();
|
||||||
uint fr2 = 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();
|
uint32 val = in->readUint32BE();
|
||||||
if (val == 0xFFFFFFFF)
|
if (val == 0xFFFFFFFF)
|
||||||
return 0;
|
return 0;
|
||||||
return val + 2;
|
return val + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte *SimonEngine::readSingleOpcode(File *in, byte *ptr) {
|
byte *SimonEngine::readSingleOpcode(Common::File *in, byte *ptr) {
|
||||||
int i, l;
|
int i, l;
|
||||||
const char *string_ptr;
|
const char *string_ptr;
|
||||||
uint val;
|
uint val;
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using Common::File;
|
||||||
|
|
||||||
struct SimonGameSettings {
|
struct SimonGameSettings {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *description;
|
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) {
|
for (StringSet::const_iterator iter = fileSet.begin(); iter != fileSet.end(); ++iter) {
|
||||||
uint8 md5sum[16];
|
uint8 md5sum[16];
|
||||||
const char *name = iter->_key.c_str();
|
const char *name = iter->_key.c_str();
|
||||||
if (md5_file(name, md5sum)) {
|
if (Common::md5_file(name, md5sum)) {
|
||||||
char md5str[32+1];
|
char md5str[32+1];
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
||||||
|
@ -317,7 +319,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
|
||||||
if (f.isOpen() == false)
|
if (f.isOpen() == false)
|
||||||
strcat(buf, ".");
|
strcat(buf, ".");
|
||||||
|
|
||||||
if (md5_file(buf, md5sum)) {
|
if (Common::md5_file(buf, md5sum)) {
|
||||||
char md5str[32+1];
|
char md5str[32+1];
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Simon {
|
||||||
//#define DUMP_FILE_NR 8
|
//#define DUMP_FILE_NR 8
|
||||||
//#define DUMP_BITMAPS_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 CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y))
|
||||||
#define NUM_PALETTE_FADEOUT 32
|
#define NUM_PALETTE_FADEOUT 32
|
||||||
|
@ -138,7 +138,7 @@ protected:
|
||||||
FORMAT_VOC
|
FORMAT_VOC
|
||||||
} SoundFormat;
|
} SoundFormat;
|
||||||
|
|
||||||
File *_gameFile;
|
Common::File *_gameFile;
|
||||||
|
|
||||||
byte *_strippedTxtMem;
|
byte *_strippedTxtMem;
|
||||||
uint _textSize;
|
uint _textSize;
|
||||||
|
@ -376,15 +376,15 @@ public:
|
||||||
virtual ~SimonEngine();
|
virtual ~SimonEngine();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int allocGamePcVars(File *in);
|
int allocGamePcVars(Common::File *in);
|
||||||
void loginPlayerHelper(Item *item, int a, int b);
|
void loginPlayerHelper(Item *item, int a, int b);
|
||||||
void loginPlayer();
|
void loginPlayer();
|
||||||
void allocateStringTable(int num);
|
void allocateStringTable(int num);
|
||||||
void setupStringTable(byte *mem, int num);
|
void setupStringTable(byte *mem, int num);
|
||||||
void setupLocalStringTable(byte *mem, int num);
|
void setupLocalStringTable(byte *mem, int num);
|
||||||
void readGamePcText(File *in);
|
void readGamePcText(Common::File *in);
|
||||||
void readItemChildren(File *in, Item *item, uint tmp);
|
void readItemChildren(Common::File *in, Item *item, uint tmp);
|
||||||
void readItemFromGamePc(File *in, Item *item);
|
void readItemFromGamePc(Common::File *in, Item *item);
|
||||||
void loadGamePcFile(const char *filename);
|
void loadGamePcFile(const char *filename);
|
||||||
|
|
||||||
byte *allocateItem(uint size);
|
byte *allocateItem(uint size);
|
||||||
|
@ -398,11 +398,11 @@ protected:
|
||||||
void allocTablesHeap();
|
void allocTablesHeap();
|
||||||
|
|
||||||
Subroutine *createSubroutine(uint a);
|
Subroutine *createSubroutine(uint a);
|
||||||
void readSubroutine(File *in, Subroutine *sub);
|
void readSubroutine(Common::File *in, Subroutine *sub);
|
||||||
SubroutineLine *createSubroutineLine(Subroutine *sub, int a);
|
SubroutineLine *createSubroutineLine(Subroutine *sub, int a);
|
||||||
void readSubroutineLine(File *in, SubroutineLine *new_table, Subroutine *sub);
|
void readSubroutineLine(Common::File *in, SubroutineLine *new_table, Subroutine *sub);
|
||||||
byte *readSingleOpcode(File *in, byte *ptr);
|
byte *readSingleOpcode(Common::File *in, byte *ptr);
|
||||||
void readSubroutineBlock(File *in);
|
void readSubroutineBlock(Common::File *in);
|
||||||
|
|
||||||
Subroutine *getSubroutineByID(uint subroutine_id);
|
Subroutine *getSubroutineByID(uint subroutine_id);
|
||||||
|
|
||||||
|
@ -524,14 +524,14 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
uint loadTextFile(const char *filename, byte *dst);
|
uint loadTextFile(const char *filename, byte *dst);
|
||||||
File *openTablesFile(const char *filename);
|
Common::File *openTablesFile(const char *filename);
|
||||||
void closeTablesFile(File *in);
|
void closeTablesFile(Common::File *in);
|
||||||
|
|
||||||
uint loadTextFile_simon1(const char *filename, byte *dst);
|
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);
|
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);
|
void invokeTimeEvent(TimeEvent *te);
|
||||||
bool kickoffTimeEvents();
|
bool kickoffTimeEvents();
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "sound/vorbis.h"
|
#include "sound/vorbis.h"
|
||||||
#include "sound/wave.h"
|
#include "sound/wave.h"
|
||||||
|
|
||||||
|
using Common::File;
|
||||||
|
|
||||||
namespace Simon {
|
namespace Simon {
|
||||||
|
|
||||||
#define SOUND_BIG_ENDIAN true
|
#define SOUND_BIG_ENDIAN true
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
~Sound();
|
~Sound();
|
||||||
|
|
||||||
void readSfxFile(const char *filename);
|
void readSfxFile(const char *filename);
|
||||||
void loadSfxTable(File *gameFile, uint32 base);
|
void loadSfxTable(Common::File *gameFile, uint32 base);
|
||||||
void readVoiceFile(const char *filename);
|
void readVoiceFile(const char *filename);
|
||||||
|
|
||||||
void playVoice(uint sound);
|
void playVoice(uint sound);
|
||||||
|
|
|
@ -118,7 +118,7 @@ static const uint32 turnTableOffsets[] = {
|
||||||
#define TURNTABLE_SIZE (sizeof(turnTableOffsets)/sizeof(uint32))
|
#define TURNTABLE_SIZE (sizeof(turnTableOffsets)/sizeof(uint32))
|
||||||
|
|
||||||
SkyCompact::SkyCompact(void) {
|
SkyCompact::SkyCompact(void) {
|
||||||
_cptFile = new File();
|
_cptFile = new Common::File();
|
||||||
if (!_cptFile->open("sky.cpt")) {
|
if (!_cptFile->open("sky.cpt")) {
|
||||||
GUI::MessageDialog dialog("Unable to find \"sky.cpt\" file!\n"
|
GUI::MessageDialog dialog("Unable to find \"sky.cpt\" file!\n"
|
||||||
"Please download it from www.scummvm.org", "OK", NULL);
|
"Please download it from www.scummvm.org", "OK", NULL);
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
#include "sky/struc.h"
|
#include "sky/struc.h"
|
||||||
#include "sky/skydefs.h"
|
#include "sky/skydefs.h"
|
||||||
|
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
enum CptIds {
|
enum CptIds {
|
||||||
CPT_JOEY = 1,
|
CPT_JOEY = 1,
|
||||||
|
@ -79,7 +81,7 @@ private:
|
||||||
char ***_cptNames;
|
char ***_cptNames;
|
||||||
uint16 **_cptSizes;
|
uint16 **_cptSizes;
|
||||||
uint16 **_cptTypes;
|
uint16 **_cptTypes;
|
||||||
File *_cptFile;
|
Common::File *_cptFile;
|
||||||
uint32 _resetDataPos;
|
uint32 _resetDataPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ static const char *dinnerFilename = "sky.dnr";
|
||||||
Disk::Disk(const Common::String &gameDataPath) {
|
Disk::Disk(const Common::String &gameDataPath) {
|
||||||
_prefRoot = NULL;
|
_prefRoot = NULL;
|
||||||
|
|
||||||
_dataDiskHandle = new File();
|
_dataDiskHandle = new Common::File();
|
||||||
_dnrHandle = new File();
|
_dnrHandle = new Common::File();
|
||||||
|
|
||||||
uint32 entriesRead;
|
uint32 entriesRead;
|
||||||
|
|
||||||
|
@ -404,14 +404,14 @@ void Disk::fnFlushBuffers(void) {
|
||||||
|
|
||||||
void Disk::dumpFile(uint16 fileNr) {
|
void Disk::dumpFile(uint16 fileNr) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
File out;
|
Common::File out;
|
||||||
byte* filePtr;
|
byte* filePtr;
|
||||||
|
|
||||||
filePtr = loadFile(fileNr);
|
filePtr = loadFile(fileNr);
|
||||||
sprintf(buf, "dumps/file-%d.dmp", fileNr);
|
sprintf(buf, "dumps/file-%d.dmp", fileNr);
|
||||||
|
|
||||||
if (!out.exists(buf, "")) {
|
if (!out.exists(buf, "")) {
|
||||||
if (out.open(buf, File::kFileWriteMode, ""))
|
if (out.open(buf, Common::File::kFileWriteMode, ""))
|
||||||
out.write(filePtr, _lastLoadedFileSize);
|
out.write(filePtr, _lastLoadedFileSize);
|
||||||
}
|
}
|
||||||
free(filePtr);
|
free(filePtr);
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
#include "sky/rnc_deco.h"
|
#include "sky/rnc_deco.h"
|
||||||
|
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Sky {
|
namespace Sky {
|
||||||
|
|
||||||
|
@ -73,8 +75,8 @@ protected:
|
||||||
|
|
||||||
uint32 _dinnerTableEntries;
|
uint32 _dinnerTableEntries;
|
||||||
uint8 *_dinnerTableArea;
|
uint8 *_dinnerTableArea;
|
||||||
File *_dataDiskHandle;
|
Common::File *_dataDiskHandle;
|
||||||
File *_dnrHandle;
|
Common::File *_dnrHandle;
|
||||||
RncDecoder _rncDecoder;
|
RncDecoder _rncDecoder;
|
||||||
|
|
||||||
uint16 _buildList[MAX_FILES_IN_LIST];
|
uint16 _buildList[MAX_FILES_IN_LIST];
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct StreamFileFormat {
|
||||||
* Pointer to a function which tries to open a file of type StreamFormat.
|
* Pointer to a function which tries to open a file of type StreamFormat.
|
||||||
* Return NULL in case of an error (invalid/nonexisting file).
|
* 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[] = {
|
static const StreamFileFormat STREAM_FILEFORMATS[] = {
|
||||||
|
@ -66,7 +66,7 @@ AudioStream* AudioStream::openStreamFile(const char *filename)
|
||||||
char *ext = &buffer[len+1];
|
char *ext = &buffer[len+1];
|
||||||
|
|
||||||
AudioStream* stream = NULL;
|
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) {
|
for (int i = 0; i < ARRAYSIZE(STREAM_FILEFORMATS)-1 && stream == NULL; ++i) {
|
||||||
strcpy(ext, STREAM_FILEFORMATS[i].fileExtension);
|
strcpy(ext, STREAM_FILEFORMATS[i].fileExtension);
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
|
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
|
||||||
#include <FLAC/seekable_stream_decoder.h>
|
#include <FLAC/seekable_stream_decoder.h>
|
||||||
|
|
||||||
|
|
||||||
|
using Common::File;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark --- Flac stream ---
|
#pragma mark --- Flac stream ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
@ -29,11 +29,13 @@
|
||||||
|
|
||||||
class AudioStream;
|
class AudioStream;
|
||||||
class DigitalTrackInfo;
|
class DigitalTrackInfo;
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
DigitalTrackInfo *getFlacTrack(int track);
|
DigitalTrackInfo *getFlacTrack(int track);
|
||||||
|
|
||||||
AudioStream *makeFlacStream(File *file, uint32 size);
|
AudioStream *makeFlacStream(Common::File *file, uint32 size);
|
||||||
|
|
||||||
#endif // #ifdef USE_FLAC
|
#endif // #ifdef USE_FLAC
|
||||||
#endif // #ifndef SOUND_FLAC_H
|
#endif // #ifndef SOUND_FLAC_H
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
class AudioStream;
|
class AudioStream;
|
||||||
class Channel;
|
class Channel;
|
||||||
class File;
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
|
||||||
class SoundHandle {
|
class SoundHandle {
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
#include <mad.h>
|
#include <mad.h>
|
||||||
|
|
||||||
|
|
||||||
|
using Common::File;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark --- MP3 (MAD) stream ---
|
#pragma mark --- MP3 (MAD) stream ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
@ -29,11 +29,13 @@
|
||||||
|
|
||||||
class AudioStream;
|
class AudioStream;
|
||||||
class DigitalTrackInfo;
|
class DigitalTrackInfo;
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
DigitalTrackInfo *getMP3Track(int track);
|
DigitalTrackInfo *getMP3Track(int track);
|
||||||
|
|
||||||
AudioStream *makeMP3Stream(File *file, uint32 size);
|
AudioStream *makeMP3Stream(Common::File *file, uint32 size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,11 @@ public:
|
||||||
int getRate() const { return _outputRate; }
|
int getRate() const { return _outputRate; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef File SFile;
|
|
||||||
|
|
||||||
class MT32File: public MT32Emu::File {
|
class MT32File: public MT32Emu::File {
|
||||||
SFile file;
|
Common::File file;
|
||||||
public:
|
public:
|
||||||
bool open(const char *filename, OpenMode mode) {
|
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);
|
return file.open(filename, accessMode);
|
||||||
}
|
}
|
||||||
void close() {
|
void close() {
|
||||||
|
@ -473,7 +471,7 @@ void MidiDriver_ThreadedMT32::onTimer() {
|
||||||
MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer) {
|
MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer) {
|
||||||
// HACK: It will stay here until engine plugin loader overhaul
|
// HACK: It will stay here until engine plugin loader overhaul
|
||||||
if (ConfMan.hasKey("extrapath"))
|
if (ConfMan.hasKey("extrapath"))
|
||||||
File::addDefaultDirectory(ConfMan.get("extrapath"));
|
Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
|
||||||
return new MidiDriver_MT32(mixer);
|
return new MidiDriver_MT32(mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@
|
||||||
#include <vorbis/vorbisfile.h>
|
#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 -
|
||||||
#pragma mark --- Ogg Vorbis Audio CD emulation ---
|
#pragma mark --- Ogg Vorbis Audio CD emulation ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
@ -29,11 +29,13 @@
|
||||||
|
|
||||||
class AudioStream;
|
class AudioStream;
|
||||||
class DigitalTrackInfo;
|
class DigitalTrackInfo;
|
||||||
class File;
|
namespace Common {
|
||||||
|
class File;
|
||||||
|
}
|
||||||
|
|
||||||
DigitalTrackInfo *getVorbisTrack(int track);
|
DigitalTrackInfo *getVorbisTrack(int track);
|
||||||
|
|
||||||
AudioStream *makeVorbisStream(File *file, uint32 size);
|
AudioStream *makeVorbisStream(Common::File *file, uint32 size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ void MoviePlayer::play(uint32 id) {
|
||||||
// these sequences are language specific
|
// these sequences are language specific
|
||||||
char sndName[20];
|
char sndName[20];
|
||||||
sprintf(sndName, "%s.snd", _sequenceList[id]);
|
sprintf(sndName, "%s.snd", _sequenceList[id]);
|
||||||
File *oggSource = new File();
|
Common::File *oggSource = new Common::File();
|
||||||
if (oggSource->open(sndName)) {
|
if (oggSource->open(sndName)) {
|
||||||
SplittedAudioStream *sStream = new SplittedAudioStream();
|
SplittedAudioStream *sStream = new SplittedAudioStream();
|
||||||
uint32 numSegs = oggSource->readUint32LE(); // number of audio segments, either 1 or 2.
|
uint32 numSegs = oggSource->readUint32LE(); // number of audio segments, either 1 or 2.
|
||||||
|
|
|
@ -186,7 +186,7 @@ void Control::askForCd(void) {
|
||||||
_system->setPalette(palOut, 0, 256);
|
_system->setPalette(palOut, 0, 256);
|
||||||
free(palOut);
|
free(palOut);
|
||||||
|
|
||||||
File test;
|
Common::File test;
|
||||||
char fName[10];
|
char fName[10];
|
||||||
uint8 textA[50];
|
uint8 textA[50];
|
||||||
sprintf(fName, "cd%d.id", SwordEngine::_systemVars.currentCD);
|
sprintf(fName, "cd%d.id", SwordEngine::_systemVars.currentCD);
|
||||||
|
|
|
@ -303,7 +303,7 @@ ArcFile::~ArcFile(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArcFile::open(const char *name) {
|
bool ArcFile::open(const char *name) {
|
||||||
File arc;
|
Common::File arc;
|
||||||
if (!arc.open(name))
|
if (!arc.open(name))
|
||||||
return false;
|
return false;
|
||||||
_bufPos = _buf = (uint8*)malloc(arc.size());
|
_bufPos = _buf = (uint8*)malloc(arc.size());
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
|
|
||||||
namespace Sword1 {
|
namespace Sword1 {
|
||||||
|
|
||||||
WaveAudioStream *makeWaveStream(File *source, uint32 size) {
|
WaveAudioStream *makeWaveStream(Common::File *source, uint32 size) {
|
||||||
return new WaveAudioStream(source, size);
|
return new WaveAudioStream(source, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveAudioStream::WaveAudioStream(File *source, uint32 pSize) {
|
WaveAudioStream::WaveAudioStream(Common::File *source, uint32 pSize) {
|
||||||
int rate, size;
|
int rate, size;
|
||||||
byte flags;
|
byte flags;
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,14 @@ enum MusicMode {
|
||||||
|
|
||||||
class WaveAudioStream : public AudioStream {
|
class WaveAudioStream : public AudioStream {
|
||||||
public:
|
public:
|
||||||
WaveAudioStream(File *source, uint32 pSize);
|
WaveAudioStream(Common::File *source, uint32 pSize);
|
||||||
virtual ~WaveAudioStream();
|
virtual ~WaveAudioStream();
|
||||||
virtual int readBuffer(int16 *buffer, const int numSamples);
|
virtual int readBuffer(int16 *buffer, const int numSamples);
|
||||||
virtual bool isStereo(void) const { return _isStereo; };
|
virtual bool isStereo(void) const { return _isStereo; };
|
||||||
virtual bool endOfData(void) const;
|
virtual bool endOfData(void) const;
|
||||||
virtual int getRate(void) const { return _rate; };
|
virtual int getRate(void) const { return _rate; };
|
||||||
private:
|
private:
|
||||||
File *_sourceFile;
|
Common::File *_sourceFile;
|
||||||
uint8 *_sampleBuf;
|
uint8 *_sampleBuf;
|
||||||
uint32 _rate;
|
uint32 _rate;
|
||||||
bool _isStereo;
|
bool _isStereo;
|
||||||
|
@ -60,7 +60,7 @@ private:
|
||||||
|
|
||||||
class MusicHandle : public AudioStream {
|
class MusicHandle : public AudioStream {
|
||||||
private:
|
private:
|
||||||
File _file;
|
Common::File _file;
|
||||||
bool _looping;
|
bool _looping;
|
||||||
int32 _fading;
|
int32 _fading;
|
||||||
int32 _fadeSamples;
|
int32 _fadeSamples;
|
||||||
|
|
|
@ -79,7 +79,7 @@ ResMan::~ResMan(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResMan::loadCluDescript(const char *fileName) {
|
void ResMan::loadCluDescript(const char *fileName) {
|
||||||
File file;
|
Common::File file;
|
||||||
file.open(fileName);
|
file.open(fileName);
|
||||||
|
|
||||||
if (!file.isOpen()) {
|
if (!file.isOpen()) {
|
||||||
|
@ -205,8 +205,8 @@ void *ResMan::openFetchRes(uint32 id) {
|
||||||
void ResMan::dumpRes(uint32 id) {
|
void ResMan::dumpRes(uint32 id) {
|
||||||
char outn[30];
|
char outn[30];
|
||||||
sprintf(outn, "DUMP%08X.BIN", id);
|
sprintf(outn, "DUMP%08X.BIN", id);
|
||||||
File outf;
|
Common::File outf;
|
||||||
if (outf.open(outn, File::kFileWriteMode)) {
|
if (outf.open(outn, Common::File::kFileWriteMode)) {
|
||||||
resOpen(id);
|
resOpen(id);
|
||||||
MemHandle *memHandle = resHandle(id);
|
MemHandle *memHandle = resHandle(id);
|
||||||
outf.write(memHandle->data, memHandle->size);
|
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
|
if (memHandle->cond == MEM_FREED) { // memory has been freed
|
||||||
uint32 size = resLength(id);
|
uint32 size = resLength(id);
|
||||||
_memMan->alloc(memHandle, size);
|
_memMan->alloc(memHandle, size);
|
||||||
File *clusFile = resFile(id);
|
Common::File *clusFile = resFile(id);
|
||||||
assert(clusFile);
|
assert(clusFile);
|
||||||
clusFile->seek( resOffset(id) );
|
clusFile->seek( resOffset(id) );
|
||||||
clusFile->read( memHandle->data, size);
|
clusFile->read( memHandle->data, size);
|
||||||
|
@ -288,7 +288,7 @@ FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
|
||||||
return (FrameHeader*)frameFile;
|
return (FrameHeader*)frameFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
File *ResMan::resFile(uint32 id) {
|
Common::File *ResMan::resFile(uint32 id) {
|
||||||
Clu *cluster = _prj.clu + ((id >> 24) - 1);
|
Clu *cluster = _prj.clu + ((id >> 24) - 1);
|
||||||
if (cluster->file == NULL) {
|
if (cluster->file == NULL) {
|
||||||
_openClus++;
|
_openClus++;
|
||||||
|
@ -298,7 +298,7 @@ File *ResMan::resFile(uint32 id) {
|
||||||
_openCluEnd->nextOpen = cluster;
|
_openCluEnd->nextOpen = cluster;
|
||||||
_openCluEnd = cluster;
|
_openCluEnd = cluster;
|
||||||
}
|
}
|
||||||
cluster->file = new File();
|
cluster->file = new Common::File();
|
||||||
char fileName[15];
|
char fileName[15];
|
||||||
sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label);
|
sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label);
|
||||||
cluster->file->open(fileName);
|
cluster->file->open(fileName);
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct Grp {
|
||||||
|
|
||||||
struct Clu {
|
struct Clu {
|
||||||
uint32 refCount;
|
uint32 refCount;
|
||||||
File *file;
|
Common::File *file;
|
||||||
char label[MAX_LABEL_SIZE];
|
char label[MAX_LABEL_SIZE];
|
||||||
uint32 noGrp;
|
uint32 noGrp;
|
||||||
Grp *grp;
|
Grp *grp;
|
||||||
|
@ -70,7 +70,7 @@ private:
|
||||||
uint32 resLength(uint32 id);
|
uint32 resLength(uint32 id);
|
||||||
MemHandle *resHandle(uint32 id);
|
MemHandle *resHandle(uint32 id);
|
||||||
uint32 resOffset(uint32 id);
|
uint32 resOffset(uint32 id);
|
||||||
File *resFile(uint32 id);
|
Common::File *resFile(uint32 id);
|
||||||
|
|
||||||
void openCptResourceBigEndian(uint32 id);
|
void openCptResourceBigEndian(uint32 id);
|
||||||
void openScriptResourceBigEndian(uint32 id);
|
void openScriptResourceBigEndian(uint32 id);
|
||||||
|
|
|
@ -96,7 +96,7 @@ private:
|
||||||
void calcWaveVolume(int16 *data, uint32 length);
|
void calcWaveVolume(int16 *data, uint32 length);
|
||||||
bool _waveVolume[WAVE_VOL_TAB_LENGTH];
|
bool _waveVolume[WAVE_VOL_TAB_LENGTH];
|
||||||
uint16 _waveVolPos;
|
uint16 _waveVolPos;
|
||||||
File _cowFile;
|
Common::File _cowFile;
|
||||||
uint32 *_cowHeader;
|
uint32 *_cowHeader;
|
||||||
uint32 _cowHeaderSize;
|
uint32 _cowHeaderSize;
|
||||||
uint8 _currentCowFile;
|
uint8 _currentCowFile;
|
||||||
|
|
|
@ -131,14 +131,14 @@ SwordEngine::SwordEngine(GameDetector *detector, OSystem *syst)
|
||||||
warning("Sound initialization failed");
|
warning("Sound initialization failed");
|
||||||
|
|
||||||
// Add default file directories
|
// Add default file directories
|
||||||
File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
|
Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "MUSIC/");
|
Common::File::addDefaultDirectory(_gameDataPath + "MUSIC/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "SPEECH/");
|
Common::File::addDefaultDirectory(_gameDataPath + "SPEECH/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "clusters/");
|
Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "music/");
|
Common::File::addDefaultDirectory(_gameDataPath + "music/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "speech/");
|
Common::File::addDefaultDirectory(_gameDataPath + "speech/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "video/");
|
Common::File::addDefaultDirectory(_gameDataPath + "video/");
|
||||||
}
|
}
|
||||||
|
|
||||||
SwordEngine::~SwordEngine() {
|
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...
|
void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or what...
|
||||||
File test;
|
Common::File test;
|
||||||
bool fileExists[30];
|
bool fileExists[30];
|
||||||
bool isFullVersion = false; // default to demo version
|
bool isFullVersion = false; // default to demo version
|
||||||
bool missingTypes[8] = { false, false, false, false, false, false, false, false };
|
bool missingTypes[8] = { false, false, false, false, false, false, false, false };
|
||||||
|
|
|
@ -698,7 +698,7 @@ void Screen::rollCredits() {
|
||||||
// now, let's just the standard speech font instead.
|
// now, let's just the standard speech font instead.
|
||||||
|
|
||||||
SpriteInfo spriteInfo;
|
SpriteInfo spriteInfo;
|
||||||
File f;
|
Common::File f;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Read the "Smacker" logo
|
// Read the "Smacker" logo
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
namespace Sword2 {
|
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) {
|
static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) {
|
||||||
if (!fh->file->isOpen()) {
|
if (!fh->file->isOpen()) {
|
||||||
|
@ -64,7 +64,7 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd
|
||||||
char filename[20];
|
char filename[20];
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(file_types); i++) {
|
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);
|
sprintf(filename, "%s%d.%s", base, cd, file_types[i].ext);
|
||||||
if (f.open(filename)) {
|
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 GetCompressedSign(n) (((n) >> 3) & 1)
|
||||||
#define GetCompressedAmplitude(n) ((n) & 7)
|
#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(file), _firstTime(true), _bufferEnd(_outbuf + BUFFER_SIZE) {
|
||||||
|
|
||||||
_file->incRef();
|
_file->incRef();
|
||||||
|
@ -226,7 +226,7 @@ void CLUInputStream::refill() {
|
||||||
_bufferEnd = out;
|
_bufferEnd = out;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStream *makeCLUStream(File *file, int size) {
|
AudioStream *makeCLUStream(Common::File *file, int size) {
|
||||||
return new CLUInputStream(file, size);
|
return new CLUInputStream(file, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) {
|
||||||
// within the clusters at this point it makes no difference. We only
|
// 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
|
// wish to know what resource files there are and what is in each
|
||||||
|
|
||||||
File file;
|
Common::File file;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
byte *temp;
|
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
|
// care which CD it's on. But if we can't find it, keep asking
|
||||||
// for the CD until we do.
|
// for the CD until we do.
|
||||||
|
|
||||||
File *file = openCluFile(cluFileNum);
|
Common::File *file = openCluFile(cluFileNum);
|
||||||
|
|
||||||
if (_resFiles[cluFileNum].entryTab == NULL) {
|
if (_resFiles[cluFileNum].entryTab == NULL) {
|
||||||
// we didn't read from this file before, get its index table
|
// 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;
|
StandardHeader *header = (StandardHeader *) _resList[res].ptr;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
const char *tag;
|
const char *tag;
|
||||||
File out;
|
Common::File out;
|
||||||
|
|
||||||
switch (header->fileType) {
|
switch (header->fileType) {
|
||||||
case ANIMATION_FILE:
|
case ANIMATION_FILE:
|
||||||
|
@ -497,7 +497,7 @@ byte *ResourceManager::openResource(uint32 res, bool dump) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!out.exists(buf, "")) {
|
if (!out.exists(buf, "")) {
|
||||||
if (out.open(buf, File::kFileWriteMode, ""))
|
if (out.open(buf, Common::File::kFileWriteMode, ""))
|
||||||
out.write(_resList[res].ptr, len);
|
out.write(_resList[res].ptr, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -563,8 +563,8 @@ void ResourceManager::addToCacheList(Resource *res) {
|
||||||
_cacheEnd = res;
|
_cacheEnd = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
File *ResourceManager::openCluFile(uint16 fileNum) {
|
Common::File *ResourceManager::openCluFile(uint16 fileNum) {
|
||||||
File *file = new File;
|
Common::File *file = new Common::File;
|
||||||
while (!file->open(_resFiles[fileNum].fileName)) {
|
while (!file->open(_resFiles[fileNum].fileName)) {
|
||||||
// HACK: We have to check for this, or it'll be impossible to
|
// 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.
|
// quit while the game is asking for the user to insert a CD.
|
||||||
|
@ -585,7 +585,7 @@ File *ResourceManager::openCluFile(uint16 fileNum) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::readCluIndex(uint16 fileNum, File *file) {
|
void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
|
||||||
if (_resFiles[fileNum].entryTab == NULL) {
|
if (_resFiles[fileNum].entryTab == NULL) {
|
||||||
// we didn't read from this file before, get its index table
|
// we didn't read from this file before, get its index table
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
#ifndef RESMAN_H
|
#ifndef RESMAN_H
|
||||||
#define 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_MEM_CACHE (8 * 1024 * 1024) // we keep up to 8 megs of resource data files in memory
|
||||||
#define MAX_res_files 20
|
#define MAX_res_files 20
|
||||||
|
@ -54,8 +56,8 @@ struct ResourceFile {
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
private:
|
private:
|
||||||
File *openCluFile(uint16 fileNum);
|
Common::File *openCluFile(uint16 fileNum);
|
||||||
void readCluIndex(uint16 fileNum, File *file = NULL);
|
void readCluIndex(uint16 fileNum, Common::File *file = NULL);
|
||||||
void removeFromCacheList(Resource *res);
|
void removeFromCacheList(Resource *res);
|
||||||
void addToCacheList(Resource *res);
|
void addToCacheList(Resource *res);
|
||||||
void checkMemUsage();
|
void checkMemUsage();
|
||||||
|
|
|
@ -53,14 +53,14 @@ Sound::Sound(Sword2Engine *vm) {
|
||||||
for (i = 0; i < MAXMUS; i++) {
|
for (i = 0; i < MAXMUS; i++) {
|
||||||
_music[i] = NULL;
|
_music[i] = NULL;
|
||||||
|
|
||||||
_musicFile[i].file = new File;
|
_musicFile[i].file = new Common::File;
|
||||||
_musicFile[i].idxTab = NULL;
|
_musicFile[i].idxTab = NULL;
|
||||||
_musicFile[i].idxLen = 0;
|
_musicFile[i].idxLen = 0;
|
||||||
_musicFile[i].fileSize = 0;
|
_musicFile[i].fileSize = 0;
|
||||||
_musicFile[i].fileType = 0;
|
_musicFile[i].fileType = 0;
|
||||||
_musicFile[i].inUse = false;
|
_musicFile[i].inUse = false;
|
||||||
|
|
||||||
_speechFile[i].file = new File;
|
_speechFile[i].file = new Common::File;
|
||||||
_speechFile[i].idxTab = NULL;
|
_speechFile[i].idxTab = NULL;
|
||||||
_speechFile[i].idxLen = 0;
|
_speechFile[i].idxLen = 0;
|
||||||
_speechFile[i].fileSize = 0;
|
_speechFile[i].fileSize = 0;
|
||||||
|
|
|
@ -80,7 +80,7 @@ enum {
|
||||||
|
|
||||||
class CLUInputStream : public AudioStream {
|
class CLUInputStream : public AudioStream {
|
||||||
private:
|
private:
|
||||||
File *_file;
|
Common::File *_file;
|
||||||
bool _firstTime;
|
bool _firstTime;
|
||||||
uint32 _file_pos;
|
uint32 _file_pos;
|
||||||
uint32 _end_pos;
|
uint32 _end_pos;
|
||||||
|
@ -98,7 +98,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLUInputStream(File *file, int size);
|
CLUInputStream(Common::File *file, int size);
|
||||||
~CLUInputStream();
|
~CLUInputStream();
|
||||||
|
|
||||||
int readBuffer(int16 *buffer, const int numSamples);
|
int readBuffer(int16 *buffer, const int numSamples);
|
||||||
|
@ -109,7 +109,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SoundFileHandle {
|
struct SoundFileHandle {
|
||||||
File *file;
|
Common::File *file;
|
||||||
uint32 *idxTab;
|
uint32 *idxTab;
|
||||||
uint32 idxLen;
|
uint32 idxLen;
|
||||||
uint32 fileSize;
|
uint32 fileSize;
|
||||||
|
@ -120,7 +120,7 @@ struct SoundFileHandle {
|
||||||
class MusicInputStream : public AudioStream {
|
class MusicInputStream : public AudioStream {
|
||||||
private:
|
private:
|
||||||
int _cd;
|
int _cd;
|
||||||
//File *_file;
|
//Common::File *_file;
|
||||||
SoundFileHandle *_fh;
|
SoundFileHandle *_fh;
|
||||||
uint32 _musicId;
|
uint32 _musicId;
|
||||||
AudioStream *_decoder;
|
AudioStream *_decoder;
|
||||||
|
@ -201,7 +201,7 @@ private:
|
||||||
SoundHandle _soundHandleSpeech;
|
SoundHandle _soundHandleSpeech;
|
||||||
|
|
||||||
MusicInputStream *_music[MAXMUS];
|
MusicInputStream *_music[MAXMUS];
|
||||||
//File _musicFile[MAXMUS];
|
//Common::File _musicFile[MAXMUS];
|
||||||
SoundFileHandle _musicFile[MAXMUS];
|
SoundFileHandle _musicFile[MAXMUS];
|
||||||
SoundFileHandle _speechFile[MAXMUS];
|
SoundFileHandle _speechFile[MAXMUS];
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ bool Sword2Engine::initStartMenu() {
|
||||||
// We query each in turn and setup an array of start structures.
|
// 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.
|
// 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
|
// ok, load in the master screen manager file
|
||||||
|
|
||||||
|
|
|
@ -109,12 +109,12 @@ namespace Sword2 {
|
||||||
|
|
||||||
Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst) {
|
Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst) {
|
||||||
// Add default file directories
|
// Add default file directories
|
||||||
File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
|
Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "SWORD2/");
|
Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "clusters/");
|
Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "sword2/");
|
Common::File::addDefaultDirectory(_gameDataPath + "sword2/");
|
||||||
File::addDefaultDirectory(_gameDataPath + "video/");
|
Common::File::addDefaultDirectory(_gameDataPath + "video/");
|
||||||
|
|
||||||
_features = detector->_game.features;
|
_features = detector->_game.features;
|
||||||
_targetName = detector->_targetName;
|
_targetName = detector->_targetName;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue