aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/agos.h24
-rw-r--r--engines/agos/animation.cpp16
-rw-r--r--engines/agos/detection.cpp9
-rw-r--r--engines/agos/detection_tables.h24
-rw-r--r--engines/agos/res.cpp158
-rw-r--r--engines/agos/res_snd.cpp21
-rw-r--r--engines/agos/saveload.cpp14
-rw-r--r--engines/agos/subroutine.cpp4
8 files changed, 109 insertions, 161 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 87a1228c6a..0b8e585f57 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -25,7 +25,6 @@
#include "engines/engine.h"
-#include "common/archive.h"
#include "common/array.h"
#include "common/error.h"
#include "common/keyboard.h"
@@ -187,27 +186,6 @@ class Debugger;
# define _OPCODE(ver, x) { &ver::x, "" }
#endif
-class ArchiveMan : public Common::SearchSet {
-public:
- ArchiveMan();
-
- void enableFallback(bool val) { _fallBack = val; }
-
-#ifdef ENABLE_AGOS2
- void registerArchive(const Common::String &filename, int priority);
-#endif
-
- virtual bool hasFile(const Common::String &name) const;
- virtual int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const;
- virtual int listMembers(Common::ArchiveMemberList &list) const;
-
- virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
- virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &filename) const;
-
-private:
- bool _fallBack;
-};
-
class AGOSEngine : public Engine {
protected:
friend class Debugger;
@@ -622,8 +600,6 @@ public:
AGOSEngine(OSystem *system, const AGOSGameDescription *gd);
virtual ~AGOSEngine();
- ArchiveMan _archives;
-
byte *_curSfxFile;
uint32 _curSfxFileSize;
uint16 _sampleEnd, _sampleWait;
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 40c9d1d049..d438de049a 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -251,8 +251,8 @@ bool MoviePlayerDXA::load() {
}
Common::String videoName = Common::String::format("%s.dxa", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
- if (!videoStream)
+ Common::File *videoStream = new Common::File();
+ if (!videoStream->open(videoName))
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
error("Failed to load video stream from file %s", videoName.c_str());
@@ -421,8 +421,8 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
bool MoviePlayerSMK::load() {
Common::String videoName = Common::String::format("%s.smk", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
- if (!videoStream)
+ Common::File *videoStream = new Common::File();
+ if (!videoStream->open(videoName))
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
error("Failed to load video stream from file %s", videoName.c_str());
@@ -532,25 +532,25 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) {
memcpy(shortName, baseName, 6);
sprintf(filename, "%s~1.dxa", shortName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
sprintf(filename, "%s~1.smk", shortName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
}
sprintf(filename, "%s.dxa", baseName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
return new MoviePlayerDXA(vm, baseName);
}
sprintf(filename, "%s.smk", baseName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
return new MoviePlayerSMK(vm, baseName);
}
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index a5a42a86ad..b6d3c2f020 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -28,6 +28,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/installshield_cab.h"
#include "agos/intern.h"
#include "agos/agos.h"
@@ -269,8 +270,12 @@ void AGOSEngine::loadArchives() {
if (getFeatures() & GF_PACKED) {
for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) {
- if (!_archives.hasArchive(ag->fileName))
- _archives.registerArchive(ag->fileName, ag->fileType);
+ if (!SearchMan.hasArchive(ag->fileName)) {
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(ag->fileName);
+
+ if (stream)
+ SearchMan.add(ag->fileName, Common::makeInstallShieldArchive(stream, DisposeAfterUse::YES), ag->fileType);
+ }
}
}
}
diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h
index 70757865f5..329af75d0c 100644
--- a/engines/agos/detection_tables.h
+++ b/engines/agos/detection_tables.h
@@ -1091,6 +1091,30 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_32COLOR | GF_CRUNCHED | GF_CRUNCHED_GAMEPC | GF_OLD_BUNDLE | GF_PLANAR
},
+ // Simon the Sorcerer 1 - German Amiga OCS Floppy
+ {
+ {
+ "simon1",
+ "OCS Floppy",
+
+ {
+ { "gameamiga", GAME_BASEFILE, "634c82b7a0b760214fd71add328c7a00", 39493},
+ { "icon.pkd", GAME_ICONFILE, "565ef7a98dcc21ef526a2bb10b6f42ed", 18979},
+ { "stripped.txt", GAME_STRFILE, "f5fc67db3b8c5283cda51c43b98a74f8", 243},
+ { "tbllist", GAME_TBLFILE, "f9d5bf2ce09f82289c791c3ca26e1e4b", 696},
+ { NULL, 0, NULL, 0}
+ },
+ Common::DE_DEU,
+ Common::kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
+ },
+
+ GType_SIMON1,
+ GID_SIMON1,
+ GF_32COLOR | GF_CRUNCHED | GF_OLD_BUNDLE | GF_PLANAR
+ },
+
// Simon the Sorcerer 1 - English Amiga AGA Floppy
{
{
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index cf1d062d96..1c79a073e8 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -24,7 +24,6 @@
#include "common/archive.h"
-#include "common/installshield_cab.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/textconsole.h"
@@ -38,52 +37,6 @@
namespace AGOS {
-ArchiveMan::ArchiveMan() {
- _fallBack = true;
-}
-
-#ifdef ENABLE_AGOS2
-void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
- Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(filename);
-
- if (stream)
- add(filename, makeInstallShieldArchive(stream, DisposeAfterUse::YES), priority);
-}
-#endif
-
-bool ArchiveMan::hasFile(const Common::String &name) const {
- if (_fallBack && SearchMan.hasFile(name))
- return true;
-
- return Common::SearchSet::hasFile(name);
-}
-
-int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const {
- const int matches = _fallBack ? SearchMan.listMatchingMembers(list, pattern) : 0;
- return matches + Common::SearchSet::listMatchingMembers(list, pattern);
-}
-
-int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const {
- const int matches = _fallBack ? SearchMan.listMembers(list) : 0;
- return matches + Common::SearchSet::listMembers(list);
-}
-
-const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const {
- Common::ArchiveMemberPtr ptr = _fallBack ? SearchMan.getMember(name) : Common::ArchiveMemberPtr();
- if (ptr)
- return ptr;
-
- return Common::SearchSet::getMember(name);
-}
-
-Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const {
- if (_fallBack && SearchMan.hasFile(filename)) {
- return SearchMan.createReadStreamForMember(filename);
- }
-
- return Common::SearchSet::createReadStreamForMember(filename);
-}
-
#ifdef ENABLE_AGOS2
uint16 AGOSEngine_Feeble::to16Wrapper(uint value) {
return TO_LE_16(value);
@@ -198,39 +151,35 @@ int AGOSEngine::allocGamePcVars(Common::SeekableReadStream *in) {
}
void AGOSEngine_PN::loadGamePcFile() {
- Common::SeekableReadStream *in;
-
if (getFileName(GAME_BASEFILE) != NULL) {
+ Common::File in;
// Read dataBase
- in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
- if (!in) {
+ if (!in.open(getFileName(GAME_BASEFILE))) {
error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE));
}
- _dataBaseSize = in->size();
+ _dataBaseSize = in.size();
_dataBase = (byte *)malloc(_dataBaseSize);
if (_dataBase == NULL)
error("loadGamePcFile: Out of memory for dataBase");
- in->read(_dataBase, _dataBaseSize);
- delete in;
+ in.read(_dataBase, _dataBaseSize);
if (_dataBase[31] != 0)
error("Later version of system requested");
}
if (getFileName(GAME_TEXTFILE) != NULL) {
+ Common::File in;
// Read textBase
- in = _archives.createReadStreamForMember(getFileName(GAME_TEXTFILE));
- if (!in) {
+ if (!in.open(getFileName(GAME_TEXTFILE))) {
error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE));
}
- _textBaseSize = in->size();
+ _textBaseSize = in.size();
_textBase = (byte *)malloc(_textBaseSize);
if (_textBase == NULL)
error("loadGamePcFile: Out of memory for textBase");
- in->read(_textBase, _textBaseSize);
- delete in;
+ in.read(_textBase, _textBaseSize);
if (_textBase[getlong(30L)] != 128)
error("Unknown compression format");
@@ -238,20 +187,19 @@ void AGOSEngine_PN::loadGamePcFile() {
}
void AGOSEngine::loadGamePcFile() {
- Common::SeekableReadStream *in;
int fileSize;
if (getFileName(GAME_BASEFILE) != NULL) {
/* Read main gamexx file */
- in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_BASEFILE))) {
error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE));
}
if (getFeatures() & GF_CRUNCHED_GAMEPC) {
- uint srcSize = in->size();
+ uint srcSize = in.size();
byte *srcBuf = (byte *)malloc(srcSize);
- in->read(srcBuf, srcSize);
+ in.read(srcBuf, srcSize);
uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
byte *dstBuf = (byte *)malloc(dstSize);
@@ -262,25 +210,23 @@ void AGOSEngine::loadGamePcFile() {
readGamePcFile(&stream);
free(dstBuf);
} else {
- readGamePcFile(in);
+ readGamePcFile(&in);
}
- delete in;
}
if (getFileName(GAME_TBLFILE) != NULL) {
/* Read list of TABLE resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_TBLFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_TBLFILE))) {
error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE));
}
- fileSize = in->size();
+ fileSize = in.size();
_tblList = (byte *)malloc(fileSize);
if (_tblList == NULL)
error("loadGamePcFile: Out of memory for strip table list");
- in->read(_tblList, fileSize);
- delete in;
+ in.read(_tblList, fileSize);
/* Remember the current state */
_subroutineListOrg = _subroutineList;
@@ -290,71 +236,67 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STRFILE) != NULL) {
/* Read list of TEXT resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_STRFILE));
- if (!in)
+ Common::File in;
+ if (!in.open(getFileName(GAME_STRFILE)))
error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE));
- fileSize = in->size();
+ fileSize = in.size();
_strippedTxtMem = (byte *)malloc(fileSize);
if (_strippedTxtMem == NULL)
error("loadGamePcFile: Out of memory for strip text list");
- in->read(_strippedTxtMem, fileSize);
- delete in;
+ in.read(_strippedTxtMem, fileSize);
}
if (getFileName(GAME_STATFILE) != NULL) {
/* Read list of ROOM STATE resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_STATFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_STATFILE))) {
error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE));
}
- _numRoomStates = in->size() / 8;
+ _numRoomStates = in.size() / 8;
_roomStates = (RoomState *)calloc(_numRoomStates, sizeof(RoomState));
if (_roomStates == NULL)
error("loadGamePcFile: Out of memory for room state list");
for (uint s = 0; s < _numRoomStates; s++) {
- uint16 num = in->readUint16BE() - (_itemArrayInited - 2);
+ uint16 num = in.readUint16BE() - (_itemArrayInited - 2);
- _roomStates[num].state = in->readUint16BE();
- _roomStates[num].classFlags = in->readUint16BE();
- _roomStates[num].roomExitStates = in->readUint16BE();
+ _roomStates[num].state = in.readUint16BE();
+ _roomStates[num].classFlags = in.readUint16BE();
+ _roomStates[num].roomExitStates = in.readUint16BE();
}
- delete in;
}
if (getFileName(GAME_RMSLFILE) != NULL) {
/* Read list of ROOM ITEMS resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_RMSLFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_RMSLFILE))) {
error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE));
}
- fileSize = in->size();
+ fileSize = in.size();
_roomsList = (byte *)malloc(fileSize);
if (_roomsList == NULL)
error("loadGamePcFile: Out of memory for room items list");
- in->read(_roomsList, fileSize);
- delete in;
+ in.read(_roomsList, fileSize);
}
if (getFileName(GAME_XTBLFILE) != NULL) {
/* Read list of XTABLE resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_XTBLFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_XTBLFILE))) {
error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE));
}
- fileSize = in->size();
+ fileSize = in.size();
_xtblList = (byte *)malloc(fileSize);
if (_xtblList == NULL)
error("loadGamePcFile: Out of memory for strip xtable list");
- in->read(_xtblList, fileSize);
- delete in;
+ in.read(_xtblList, fileSize);
/* Remember the current state */
_xsubroutineListOrg = _subroutineList;
@@ -828,7 +770,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
uint32 offs, size;
if (getFeatures() & GF_OLD_BUNDLE) {
- Common::SeekableReadStream *in;
+ Common::File in;
char filename[15];
if (id == 23)
id = 112;
@@ -844,22 +786,20 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
sprintf(filename, "0%d.VGA", id);
}
- in = _archives.createReadStreamForMember(filename);
- if (!in)
+ if (!in.open(filename))
error("loadSimonVGAFile: Can't load %s", filename);
- size = in->size();
+ size = in.size();
if (getFeatures() & GF_CRUNCHED) {
byte *srcBuffer = (byte *)malloc(size);
- if (in->read(srcBuffer, size) != size)
+ if (in.read(srcBuffer, size) != size)
error("loadSimonVGAFile: Read failed");
decrunchFile(srcBuffer, _vgaBufferPointers[11].vgaFile2, size);
free(srcBuffer);
} else {
- if (in->read(_vgaBufferPointers[11].vgaFile2, size) != size)
+ if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size)
error("loadSimonVGAFile: Read failed");
}
- delete in;
} else {
offs = _gameOffsetsPtr[id];
@@ -869,7 +809,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
}
void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
- Common::SeekableReadStream *in;
+ Common::File in;
char filename[15];
byte *dst;
uint32 file, offs, srcSize, dstSize;
@@ -922,8 +862,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
}
}
- in = _archives.createReadStreamForMember(filename);
- if (!in) {
+ if (!in.open(filename)) {
if (useError)
error("loadVGAVideoFile: Can't load %s", filename);
@@ -931,11 +870,11 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
return;
}
- dstSize = srcSize = in->size();
+ dstSize = srcSize = in.size();
if (getGameType() == GType_PN && getPlatform() == Common::kPlatformDOS && id == 17 && type == 2) {
// The A2.out file isn't compressed in PC version of Personal Nightmare
dst = allocBlock(dstSize + extraBuffer);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadVGAVideoFile: Read failed");
} else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) {
Common::Stack<uint32> data;
@@ -943,7 +882,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
int dataOutSize = 0;
for (uint i = 0; i < srcSize / 4; ++i) {
- uint32 dataVal = in->readUint32BE();
+ uint32 dataVal = in.readUint32BE();
// Correct incorrect byte, in corrupt 72.out file, included in some PC versions.
if (dataVal == 168042714)
data.push(168050906);
@@ -957,7 +896,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
delete[] dataOut;
} else if (getFeatures() & GF_CRUNCHED) {
byte *srcBuffer = (byte *)malloc(srcSize);
- if (in->read(srcBuffer, srcSize) != srcSize)
+ if (in.read(srcBuffer, srcSize) != srcSize)
error("loadVGAVideoFile: Read failed");
dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
@@ -966,10 +905,9 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
free(srcBuffer);
} else {
dst = allocBlock(dstSize + extraBuffer);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadVGAVideoFile: Read failed");
}
- delete in;
} else {
id = id * 2 + (type - 1);
offs = _gameOffsetsPtr[id];
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index 2777d4f269..86d24e0b07 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -450,17 +450,14 @@ static const char *const dimpSoundList[32] = {
void AGOSEngine::loadSoundFile(const char* filename) {
- Common::SeekableReadStream *in;
-
- in = _archives.createReadStreamForMember(filename);
- if (!in)
+ Common::File in;
+ if (!in.open(filename))
error("loadSound: Can't load %s", filename);
- uint32 dstSize = in->size();
+ uint32 dstSize = in.size();
byte *dst = (byte *)malloc(dstSize);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
- delete in;
_sound->playSfxData(dst, 0, 0, 0);
}
@@ -469,21 +466,19 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
byte *dst;
if (getGameId() == GID_DIMP) {
- Common::SeekableReadStream *in;
+ Common::File in;
char filename[15];
assert(sound >= 1 && sound <= 32);
sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
- in = _archives.createReadStreamForMember(filename);
- if (!in)
+ if (!in.open(filename))
error("loadSound: Can't load %s", filename);
- uint32 dstSize = in->size();
+ uint32 dstSize = in.size();
dst = (byte *)malloc(dstSize);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
- delete in;
} else if (getFeatures() & GF_ZLIBCOMP) {
char filename[15];
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 8eb7f066b3..8b133971de 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1031,7 +1031,12 @@ bool AGOSEngine::loadGame(const Common::String &filename, bool restartMode) {
if (restartMode) {
// Load restart state
- f = _archives.createReadStreamForMember(filename);
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ delete file;
+ file = nullptr;
+ }
+ f = file;
} else {
f = _saveFileMan->openForLoading(filename);
}
@@ -1205,7 +1210,12 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
if (restartMode) {
// Load restart state
- f = _archives.createReadStreamForMember(filename);
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ delete file;
+ file = nullptr;
+ }
+ f = file;
} else {
f = _saveFileMan->openForLoading(filename);
}
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index f5aad2dcc8..7a84a20808 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -266,8 +266,8 @@ Common::SeekableReadStream *AGOSEngine::openTablesFile(const char *filename) {
}
Common::SeekableReadStream *AGOSEngine::openTablesFile_simon1(const char *filename) {
- Common::SeekableReadStream *in = _archives.createReadStreamForMember(filename);
- if (!in)
+ Common::File *in = new Common::File();
+ if (!in->open(filename))
error("openTablesFile: Can't open '%s'", filename);
return in;
}