aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/POTFILES1
-rw-r--r--engines/mohawk/detection.cpp33
-rw-r--r--engines/mohawk/detection_tables.h84
-rw-r--r--engines/mohawk/dialogs.h6
-rw-r--r--engines/mohawk/myst.cpp20
-rw-r--r--engines/mohawk/myst_scripts.cpp10
-rw-r--r--engines/mohawk/myst_stacks/credits.cpp1
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp2
-rw-r--r--engines/mohawk/myst_stacks/makingof.cpp2
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp4
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp1
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp1
-rw-r--r--engines/mohawk/myst_state.cpp99
-rw-r--r--engines/mohawk/myst_state.h22
-rw-r--r--engines/mohawk/riven.cpp1
-rw-r--r--engines/mohawk/riven.h2
-rw-r--r--engines/mohawk/sound.cpp4
-rw-r--r--engines/mohawk/sound.h6
18 files changed, 180 insertions, 119 deletions
diff --git a/engines/mohawk/POTFILES b/engines/mohawk/POTFILES
index 54d9dcaa3a..036059da6a 100644
--- a/engines/mohawk/POTFILES
+++ b/engines/mohawk/POTFILES
@@ -1,3 +1,4 @@
+engines/mohawk/detection.cpp
engines/mohawk/dialogs.cpp
engines/mohawk/myst.cpp
engines/mohawk/riven.cpp
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index a64d7ff7df..7c202998eb 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -221,10 +221,25 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
// Loading games is only supported in Myst/Riven currently.
#ifdef ENABLE_MYST
if (strstr(target, "myst")) {
- filenames = Mohawk::MystGameState::generateSaveGameList();
+ filenames = g_system->getSavefileManager()->listSavefiles("myst-###.mys");
+ size_t prefixLen = sizeof("myst") - 1;
+
+ for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
+ // Extract the slot number from the filename
+ char slot[4];
+ slot[0] = (*filename)[prefixLen + 1];
+ slot[1] = (*filename)[prefixLen + 2];
+ slot[2] = (*filename)[prefixLen + 3];
+ slot[3] = '\0';
+
+ int slotNum = atoi(slot);
+
+ // Read the description from the save
+ Common::String description = Mohawk::MystGameState::querySaveDescription(slotNum);
+ saveList.push_back(SaveStateDescriptor(slotNum, description));
+ }
- for (uint32 i = 0; i < filenames.size(); i++)
- saveList.push_back(SaveStateDescriptor(i, filenames[i]));
+ Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
} else
#endif
if (strstr(target, "riven")) {
@@ -238,11 +253,11 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
}
void MohawkMetaEngine::removeSaveState(const char *target, int slot) const {
+
// Removing saved games is only supported in Myst/Riven currently.
#ifdef ENABLE_MYST
if (strstr(target, "myst")) {
- Common::StringArray filenames = Mohawk::MystGameState::generateSaveGameList();
- Mohawk::MystGameState::deleteSave(filenames[slot]);
+ Mohawk::MystGameState::deleteSave(slot);
} else
#endif
if (strstr(target, "riven")) {
@@ -254,13 +269,7 @@ void MohawkMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor MohawkMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
#ifdef ENABLE_MYST
if (strstr(target, "myst")) {
- Common::StringArray filenames = Mohawk::MystGameState::generateSaveGameList();
-
- if (slot >= (int) filenames.size()) {
- return SaveStateDescriptor();
- }
-
- return Mohawk::MystGameState::querySaveMetaInfos(filenames[slot]);
+ return Mohawk::MystGameState::querySaveMetaInfos(slot);
} else
#endif
{
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 7941a0d51a..e3eab89a34 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -40,7 +40,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "ae3258c9c90128d274aa6a790b3ad181"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -58,7 +58,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("DEMO.DAT", "c39303dd53fb5c4e7f3c23231c606cd0"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_DEMO | ADGF_UNSTABLE,
+ ADGF_DEMO | ADGF_TESTING,
GUI_OPTIONS_MYST_DEMO
},
GType_MYST,
@@ -76,7 +76,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "4beb3366ed3f3b9bfb6e81a14a43bdcc"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -94,7 +94,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "e0937cca1ab125e48e30dc3cd5046ddf"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -112,7 +112,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "f7e7d7ca69934f1351b5acd4fe4d44c2"),
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -130,7 +130,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "a5795ce1751fc42525e4f9a1859181d5"),
Common::IT_ITA,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -148,7 +148,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "032c88e3b7e8db4ca475e7b7db9a66bb"),
Common::JA_JPN,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -166,7 +166,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "d631d42567a941c67c78f2e491f4ea58"),
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -184,7 +184,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MAKING.DAT", "f6387e8f0f7b8a3e42c95294315d6a0e"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_MAKING_OF
},
GType_MAKINGOF,
@@ -202,7 +202,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MAKING.DAT", "03ff62607e64419ab2b6ebf7b7bcdf63"),
Common::JA_JPN,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_MAKING_OF
},
GType_MAKINGOF,
@@ -220,7 +220,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "c4cae9f143b5947262e6cb2397e1617e"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -238,7 +238,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "f88e0ace66dbca78eebdaaa1d3314ceb"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -256,7 +256,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "aea81633b2d2ae498f09072fb87263b6"),
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -274,7 +274,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "4a05771b60f4a69869838d01e85c9e80"),
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -355,6 +355,23 @@ static const MohawkGameDescription gameDescriptions[] = {
},
// Riven: The Sequel to Myst
+ // Version 1.0.0 (5CD) - Russian, Fargus
+ {
+ {
+ "riven",
+ "",
+ AD_ENTRY1s("a_Data.MHK", "2a840ed74fe5dc3a388bced674d379d5", 12024358),
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_RIVEN,
+ 0,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst
// Version 1.1 (5CD) - Russian, Fargus
{
{
@@ -1878,6 +1895,23 @@ static const MohawkGameDescription gameDescriptions[] = {
"Living Books Player"
},
+ // From Matthew Winder in bug#6557
+ // v1.0E, English, Windows
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1s("AB16B.LB", "c169be346de7b0bbfcd18761fc0a3e49", 3093),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
// From Torsten in bug#3422652
{
{
@@ -2100,6 +2134,22 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // From Matthew Winder in bug#6557
+ {
+ {
+ "lilmonster",
+ "",
+ AD_ENTRY1s("lmasf.lb", "fcb665df1713d0411a41515efb20bebc", 4136),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0
+ },
+
// From afholman in bug#3309308
{
{
@@ -2704,7 +2754,7 @@ static const MohawkGameDescription fallbackDescs[] = {
AD_ENTRY1(0, 0),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -2719,7 +2769,7 @@ static const MohawkGameDescription fallbackDescs[] = {
AD_ENTRY1(0, 0),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_MAKING_OF
},
GType_MAKINGOF,
@@ -2734,7 +2784,7 @@ static const MohawkGameDescription fallbackDescs[] = {
AD_ENTRY1(0, 0),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index bc25c72a43..59b3e01fb7 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -29,11 +29,13 @@
#include "common/str.h"
#include "gui/dialog.h"
#include "gui/options.h"
-#include "gui/widget.h"
-#include "gui/widgets/list.h"
namespace GUI {
class SaveLoadChooser;
+class ButtonWidget;
+class CheckboxWidget;
+class CommandSender;
+class StaticTextWidget;
}
namespace Mohawk {
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index c16fab9131..633b67f7e9 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -231,11 +231,9 @@ Common::Error MohawkEngine_Myst::run() {
// Load game from launcher/command line if requested
if (ConfMan.hasKey("save_slot") && hasGameSaveSupport()) {
- uint32 gameToLoad = ConfMan.getInt("save_slot");
- Common::StringArray savedGamesList = MystGameState::generateSaveGameList();
- if (gameToLoad > savedGamesList.size())
- error ("Could not find saved game");
- _gameState->load(savedGamesList[gameToLoad]);
+ int saveSlot = ConfMan.getInt("save_slot");
+ if (!_gameState->load(saveSlot))
+ error("Failed to load save game from slot %i", saveSlot);
} else {
// Start us on the first stack.
if (getGameType() == GType_MAKINGOF)
@@ -606,7 +604,8 @@ void MohawkEngine_Myst::changeToCard(uint16 card, TransitionType transition) {
_gfx->runTransition(transition, Common::Rect(544, 333), 10, 0);
} else {
_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
- _needsUpdate = true;
+ _system->updateScreen();
+ _needsUpdate = false;
}
}
@@ -1083,19 +1082,14 @@ void MohawkEngine_Myst::loadResources() {
}
Common::Error MohawkEngine_Myst::loadGameState(int slot) {
- if (_gameState->load(MystGameState::generateSaveGameList()[slot]))
+ if (_gameState->load(slot))
return Common::kNoError;
return Common::kUnknownError;
}
Common::Error MohawkEngine_Myst::saveGameState(int slot, const Common::String &desc) {
- Common::StringArray saveList = MystGameState::generateSaveGameList();
-
- if ((uint)slot < saveList.size())
- MystGameState::deleteSave(saveList[slot]);
-
- return _gameState->save(desc) ? Common::kNoError : Common::kUnknownError;
+ return _gameState->save(slot, desc) ? Common::kNoError : Common::kUnknownError;
}
bool MohawkEngine_Myst::hasGameSaveSupport() const {
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 04e7c5a9b7..596180ddb2 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -31,7 +31,6 @@
#include "common/system.h"
#include "common/memstream.h"
#include "common/textconsole.h"
-#include "gui/message.h"
namespace Mohawk {
@@ -685,9 +684,14 @@ void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, uint16 arg
// Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List
debugC(kDebugScript, "Opcode %d: Process Sound Block", op);
- Common::MemoryReadStream stream = Common::MemoryReadStream((const byte *) argv, argc * sizeof(uint16));
+ Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
+ for (uint i = 0; i < argc; i++) {
+ writeStream.writeUint16LE(argv[i]);
+ }
+
+ Common::MemoryReadStream readStream = Common::MemoryReadStream(writeStream.getData(), writeStream.size());
- MystSoundBlock soundBlock = _vm->readSoundBlock(&stream);
+ MystSoundBlock soundBlock = _vm->readSoundBlock(&readStream);
_vm->applySoundBlock(soundBlock);
}
diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp
index b4a2076528..c382263f7c 100644
--- a/engines/mohawk/myst_stacks/credits.cpp
+++ b/engines/mohawk/myst_stacks/credits.cpp
@@ -28,7 +28,6 @@
#include "mohawk/myst_stacks/credits.h"
#include "common/system.h"
-#include "gui/message.h"
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index 1d733d8100..f448108199 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -28,8 +28,6 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/intro.h"
-#include "gui/message.h"
-
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/makingof.cpp b/engines/mohawk/myst_stacks/makingof.cpp
index 1059fd0c5e..a0a1f359ba 100644
--- a/engines/mohawk/myst_stacks/makingof.cpp
+++ b/engines/mohawk/myst_stacks/makingof.cpp
@@ -27,8 +27,6 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/makingof.h"
-#include "gui/message.h"
-
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 9d23d2fb10..bd50c4feb3 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -33,8 +33,6 @@
#include "common/system.h"
#include "common/textconsole.h"
-#include "gui/message.h"
-
namespace Mohawk {
namespace MystStacks {
@@ -3089,6 +3087,8 @@ void Myst::clockReset() {
}
void Myst::clockResetWeight() {
+ _vm->_sound->replaceSoundMyst(9113);
+
_clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack));
if (!_clockWeightVideo)
error("Failed to open cl1wlfch movie");
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index 5402e5a581..454435cf92 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -31,7 +31,6 @@
#include "common/system.h"
#include "common/textconsole.h"
-#include "gui/message.h"
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index a1413f0d71..0560608b24 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -29,7 +29,6 @@
#include "mohawk/myst_stacks/slides.h"
#include "common/system.h"
-#include "gui/message.h"
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp
index 06cd69b23c..4324d6bde5 100644
--- a/engines/mohawk/myst_state.cpp
+++ b/engines/mohawk/myst_state.cpp
@@ -106,16 +106,12 @@ MystGameState::MystGameState(MohawkEngine_Myst *vm, Common::SaveFileManager *sav
MystGameState::~MystGameState() {
}
-Common::StringArray MystGameState::generateSaveGameList() {
- return g_system->getSavefileManager()->listSavefiles("*.mys");
-}
-
-bool MystGameState::load(const Common::String &filename) {
- if (!loadState(filename)) {
+bool MystGameState::load(int slot) {
+ if (!loadState(slot)) {
return false;
}
- loadMetadata(filename);
+ loadMetadata(slot);
// Set Channelwood elevator state to down, because we start on the lower level
_channelwood.elevatorState = 0;
@@ -136,7 +132,8 @@ bool MystGameState::load(const Common::String &filename) {
return true;
}
-bool MystGameState::loadState(const Common::String &filename) {
+bool MystGameState::loadState(int slot) {
+ Common::String filename = buildSaveFilename(slot);
Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filename);
if (!loadFile) {
return false;
@@ -160,9 +157,10 @@ bool MystGameState::loadState(const Common::String &filename) {
return true;
}
-void MystGameState::loadMetadata(const Common::String &filename) {
+void MystGameState::loadMetadata(int slot) {
// Open the metadata file
- Common::InSaveFile *metadataFile = openMetadataFile(filename);
+ Common::String filename = buildMetadataFilename(slot);
+ Common::InSaveFile *metadataFile = _vm->getSaveFileManager()->openForLoading(filename);
if (!metadataFile) {
return;
}
@@ -179,25 +177,19 @@ void MystGameState::loadMetadata(const Common::String &filename) {
delete metadataFile;
}
-bool MystGameState::save(const Common::String &filename) {
- // Make sure the description does not have an extension
- Common::String desc = filename;
- if (filename.hasSuffix(".mys") || filename.hasSuffix(".MYS")) {
- desc = removeExtension(filename);
- }
-
- if (!saveState(desc)) {
+bool MystGameState::save(int slot, const Common::String &desc) {
+ if (!saveState(slot)) {
return false;
}
updateMetadateForSaving(desc);
- return saveMetadata(desc);
+ return saveMetadata(slot);
}
-bool MystGameState::saveState(const Common::String &desc) {
+bool MystGameState::saveState(int slot) {
// Make sure we have the right extension
- Common::String filename = desc + ".mys";
+ Common::String filename = buildSaveFilename(slot);
Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
if (!saveFile) {
return false;
@@ -213,6 +205,14 @@ bool MystGameState::saveState(const Common::String &desc) {
return true;
}
+Common::String MystGameState::buildSaveFilename(int slot) {
+ return Common::String::format("myst-%03d.mys", slot);
+}
+
+Common::String MystGameState::buildMetadataFilename(int slot) {
+ return Common::String::format("myst-%03d.mym", slot);
+}
+
void MystGameState::updateMetadateForSaving(const Common::String &desc) {
// Update save creation info
TimeDate t;
@@ -226,10 +226,10 @@ void MystGameState::updateMetadateForSaving(const Common::String &desc) {
_metadata.totalPlayTime = _vm->getTotalPlayTime();
}
-bool MystGameState::saveMetadata(const Common::String &desc) {
+bool MystGameState::saveMetadata(int slot) {
// Write the metadata to a separate file so that the save files
// are still compatible with the original engine
- Common::String metadataFilename = desc + ".mym";
+ Common::String metadataFilename = buildMetadataFilename(slot);
Common::OutSaveFile *metadataFile = _saveFileMan->openForSaving(metadataFilename);
if (!metadataFile) {
return false;
@@ -248,14 +248,12 @@ bool MystGameState::saveMetadata(const Common::String &desc) {
return true;
}
-SaveStateDescriptor MystGameState::querySaveMetaInfos(const Common::String filename) {
- SaveStateDescriptor desc;
- desc.setDescription(filename);
-
+SaveStateDescriptor MystGameState::querySaveMetaInfos(int slot) {
// Open the metadata file
- Common::InSaveFile *metadataFile = openMetadataFile(filename);
+ Common::String filename = buildMetadataFilename(slot);
+ Common::InSaveFile *metadataFile = g_system->getSavefileManager()->openForLoading(filename);
if (!metadataFile) {
- return desc;
+ return SaveStateDescriptor();
}
Common::Serializer m(metadataFile, nullptr);
@@ -264,10 +262,11 @@ SaveStateDescriptor MystGameState::querySaveMetaInfos(const Common::String filen
Mohawk::MystSaveMetadata metadata;
if (!metadata.sync(m)) {
delete metadataFile;
- return desc;
+ return SaveStateDescriptor();
}
// Set the save description
+ SaveStateDescriptor desc;
desc.setDescription(metadata.saveDescription);
desc.setSaveDate(metadata.saveYear, metadata.saveMonth, metadata.saveDay);
desc.setSaveTime(metadata.saveHour, metadata.saveMinute);
@@ -279,20 +278,26 @@ SaveStateDescriptor MystGameState::querySaveMetaInfos(const Common::String filen
return desc;
}
-Common::InSaveFile *MystGameState::openMetadataFile(const Common::String &filename) {
- // Remove the extension
- Common::String baseName = removeExtension(filename);
-
+Common::String MystGameState::querySaveDescription(int slot) {
// Open the metadata file
- return g_system->getSavefileManager()->openForLoading(baseName + ".mym");
-}
+ Common::String filename = buildMetadataFilename(slot);
+ Common::InSaveFile *metadataFile = g_system->getSavefileManager()->openForLoading(filename);
+ if (!metadataFile) {
+ return "";
+ }
+
+ Common::Serializer m(metadataFile, nullptr);
-Common::String MystGameState::removeExtension(const Common::String &filename) {
- Common::String baseName = filename;
- for (uint i = 0; i < 4; i++) {
- baseName.deleteLastChar();
+ // Read the metadata file
+ Mohawk::MystSaveMetadata metadata;
+ if (!metadata.sync(m)) {
+ delete metadataFile;
+ return "";
}
- return baseName;
+
+ delete metadataFile;
+
+ return metadata.saveDescription;
}
void MystGameState::syncGameState(Common::Serializer &s, bool isME) {
@@ -471,12 +476,14 @@ void MystGameState::syncGameState(Common::Serializer &s, bool isME) {
warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced());
}
-void MystGameState::deleteSave(const Common::String &saveName) {
- debugC(kDebugSaveLoad, "Deleting save file \'%s\'", saveName.c_str());
- Common::String basename = removeExtension(saveName);
+void MystGameState::deleteSave(int slot) {
+ Common::String filename = buildSaveFilename(slot);
+ Common::String metadataFilename = buildMetadataFilename(slot);
+
+ debugC(kDebugSaveLoad, "Deleting save file \'%s\'", filename.c_str());
- g_system->getSavefileManager()->removeSavefile(saveName);
- g_system->getSavefileManager()->removeSavefile(basename + ".mym");
+ g_system->getSavefileManager()->removeSavefile(filename);
+ g_system->getSavefileManager()->removeSavefile(metadataFilename);
}
void MystGameState::addZipDest(uint16 stack, uint16 view) {
diff --git a/engines/mohawk/myst_state.h b/engines/mohawk/myst_state.h
index 50359a5b52..7d5f3f7102 100644
--- a/engines/mohawk/myst_state.h
+++ b/engines/mohawk/myst_state.h
@@ -58,12 +58,12 @@ public:
MystGameState(MohawkEngine_Myst*, Common::SaveFileManager*);
~MystGameState();
- static Common::StringArray generateSaveGameList();
- static SaveStateDescriptor querySaveMetaInfos(const Common::String filename);
+ static SaveStateDescriptor querySaveMetaInfos(int slot);
+ static Common::String querySaveDescription(int slot);
- bool load(const Common::String &filename);
- bool save(const Common::String &filename);
- static void deleteSave(const Common::String &saveName);
+ bool load(int slot);
+ bool save(int slot, const Common::String &desc);
+ static void deleteSave(int slot);
void addZipDest(uint16 stack, uint16 view);
bool isReachableZipDest(uint16 stack, uint16 view);
@@ -292,13 +292,13 @@ public:
private:
void syncGameState(Common::Serializer &s, bool isME);
- static Common::InSaveFile *openMetadataFile(const Common::String &filename);
- bool loadState(const Common::String &filename);
- void loadMetadata(const Common::String &filename);
- bool saveState(const Common::String &desc);
+ static Common::String buildSaveFilename(int slot);
+ static Common::String buildMetadataFilename(int slot);
+ bool loadState(int slot);
+ void loadMetadata(int slot);
+ bool saveState(int slot);
void updateMetadateForSaving(const Common::String &desc);
- bool saveMetadata(const Common::String &desc);
- static Common::String removeExtension(const Common::String &filename);
+ bool saveMetadata(int slot);
// The values in these regions are lists of VIEW resources
// which correspond to visited zip destinations
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 898f68c581..178139ab76 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -25,6 +25,7 @@
#include "common/keyboard.h"
#include "common/translation.h"
#include "common/system.h"
+#include "gui/saveload.h"
#include "mohawk/cursors.h"
#include "mohawk/installer_archive.h"
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 9c23d07c52..3ea50bb38d 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -27,8 +27,6 @@
#include "mohawk/mohawk.h"
#include "mohawk/riven_scripts.h"
-#include "gui/saveload.h"
-
#include "common/hashmap.h"
#include "common/hash-str.h"
#include "common/random.h"
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index a2c08d4a92..38cb0b3608 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -23,12 +23,12 @@
#include "common/debug.h"
#include "common/events.h"
#include "common/system.h"
-#include "common/util.h"
#include "common/textconsole.h"
+#include "audio/mididrv.h"
#include "audio/midiparser.h"
-#include "audio/musicplugin.h"
#include "audio/audiostream.h"
+#include "audio/decoders/adpcm.h"
#include "audio/decoders/mp3.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index c62e6e9874..f09706e155 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -26,9 +26,7 @@
#include "common/scummsys.h"
#include "common/str.h"
-#include "audio/audiostream.h"
#include "audio/mixer.h"
-#include "audio/decoders/adpcm.h"
#include "mohawk/mohawk.h"
#include "mohawk/resource.h"
@@ -36,6 +34,10 @@
class MidiDriver;
class MidiParser;
+namespace Audio {
+class RewindableAudioStream;
+}
+
namespace Mohawk {
#define MAX_CHANNELS 2 // Can there be more than 2?