SCI32: Add Save/Restore support for Mac games
This commit is contained in:
parent
ef5885d14d
commit
c1fb6562ac
5 changed files with 42 additions and 2 deletions
|
@ -262,6 +262,7 @@ private:
|
|||
*/
|
||||
reg_t promptSaveRestoreHoyle5(EngineState *s, int argc, reg_t *argv) const;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Prompts the user to save or load a game.
|
||||
*
|
||||
|
|
|
@ -1333,11 +1333,23 @@ reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) {
|
|||
reg_t kSaveGame32(EngineState *s, int argc, reg_t *argv) {
|
||||
const Common::String gameName = s->_segMan->getString(argv[0]);
|
||||
int16 saveNo = argv[1].toSint16();
|
||||
const Common::String saveDescription = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]);
|
||||
Common::String saveDescription = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]);
|
||||
const Common::String gameVersion = (argc <= 3 || argv[3].isNull()) ? "" : s->_segMan->getString(argv[3]);
|
||||
|
||||
debugC(kDebugLevelFile, "Game name %s save %d desc %s ver %s", gameName.c_str(), saveNo, saveDescription.c_str(), gameVersion.c_str());
|
||||
|
||||
// Display the save prompt for Mac games with native dialogs. Passing
|
||||
// zero for the save number would trigger these, but we can't act solely
|
||||
// on that since we shift save numbers around to accommodate autosave
|
||||
// slots, causing some games to pass zero that normally wouldn't.
|
||||
if (g_sci->hasMacSaveRestoreDialogs() && saveNo == 0) {
|
||||
saveNo = g_sci->_guestAdditions->runSaveRestore(true, argv[2]);
|
||||
if (saveNo == -1) {
|
||||
return NULL_REG;
|
||||
}
|
||||
saveDescription = s->_segMan->getString(argv[2]);
|
||||
}
|
||||
|
||||
// Auto-save system used by Torin and LSL7
|
||||
if (gameName == "Autosave" || gameName == "Autosv") {
|
||||
if (saveNo == 0) {
|
||||
|
@ -1402,6 +1414,17 @@ reg_t kRestoreGame32(EngineState *s, int argc, reg_t *argv) {
|
|||
int16 saveNo = argv[1].toSint16();
|
||||
const Common::String gameVersion = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]);
|
||||
|
||||
// Display the restore prompt for Mac games with native dialogs. Passing
|
||||
// zero for the save number would trigger these, but we can't act solely
|
||||
// on that since we shift save numbers around to accommodate autosave
|
||||
// slots, causing some games to pass zero that normally wouldn't.
|
||||
if (g_sci->hasMacSaveRestoreDialogs() && saveNo == 0) {
|
||||
saveNo = g_sci->_guestAdditions->runSaveRestore(false, NULL_REG, s->_delayedRestoreGameId);
|
||||
if (saveNo == -1) {
|
||||
return NULL_REG;
|
||||
}
|
||||
}
|
||||
|
||||
if (gameName == "Autosave" || gameName == "Autosv") {
|
||||
if (saveNo == 0) {
|
||||
// Autosave slot 0 is the autosave
|
||||
|
|
|
@ -368,6 +368,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
|
|||
{ GID_FREDDYPHARKAS, 540, 540, 0, "WaverCode", "init", NULL, 0, 1, { WORKAROUND_FAKE, 0 } }, // Gun pratice mini-game, all temps - 0+1 - bug #5232
|
||||
{ GID_GK1, -1, 64950, -1, "Feature", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // sometimes when walk-clicking
|
||||
{ GID_GK1, -1, 64937, -1, "GKControls", "dispatchEvent", NULL, 6, 6, { WORKAROUND_FAKE, 0 } }, // when using keyboard navigation (tab) in the game settings and hitting 'enter' when over a slider
|
||||
{ GID_GK1, -1, 64994, -1, "Game", "save", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // when saving in Mac version
|
||||
{ GID_GK1, -1, 64994, -1, "Game", "restore", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // when restoring in Mac version
|
||||
{ GID_GK2, -1, 11, 0, "", "export 10", NULL, -1, -1, { WORKAROUND_FAKE, 0 } }, // When game starts and throughout game. temp1 in Italian version, temp3 in others
|
||||
{ GID_GK2, -1, 64921, -1, "Print", "addEdit", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // When trying to use the game debugger's flag setting command
|
||||
{ GID_HOYLE1, 4, 104, 0, "GinRummyCardList", "calcRuns", NULL, 4, 4, { WORKAROUND_FAKE, 0 } }, // Gin Rummy / right when the game starts
|
||||
|
@ -468,6 +470,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
|
|||
{ GID_LSL6HIRES, 820, 82, 0, "", "export 0", NULL, 3, 3, { WORKAROUND_FAKE, 0 } }, // when touching the electric fence - bug #10361
|
||||
{ GID_LSL6HIRES, -1, 64950, 1, "Feature", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // at least when entering swimming pool area
|
||||
{ GID_LSL6HIRES, -1, 64964, 0, "DPath", "init", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // during the game
|
||||
{ GID_LSL6HIRES, -1, 64994, -1, "Game", "save", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // when saving in Mac version
|
||||
{ GID_LSL6HIRES, -1, 64994, -1, "Game", "restore", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // when restoring in Mac version
|
||||
{ GID_LSL7, -1, 64029, 0, "oMessager", "nextMsg", NULL, 4, 4, { WORKAROUND_FAKE, 0 } }, // when running the game with subtitles only
|
||||
{ GID_LSL7, -1, 64017, 0, "oFlags", "clear", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // demo version, when it starts, and whenever the player chooses to go to the "Strip Liar's Dice" mini game
|
||||
{ GID_LSL7, -1, 64017, 0, "oActorFlags", "clear", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // after an NPC walks off the left side of the screen at the Clothing Optional Pool
|
||||
|
@ -552,6 +556,9 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
|
|||
{ GID_SQ6, 210, 210, 0, "buttonSecret", "doVerb", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // after winning the first round of stooge fighter 3
|
||||
{ GID_SQ6, -1, 64994, -1, "Game", "restore", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // When trying to load an invalid save game from the launcher
|
||||
{ GID_SQ6, -1, 64921, -1, "Print", "addEdit", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // When trying to use the game debugger's flag setting command
|
||||
{ GID_SQ6, 105, 105, -1, "doRestoreScript", "changeState", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // when restoring from main menu in Mac version
|
||||
{ GID_SQ6, -1, 64994, -1, "Game", "save", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // when saving in Mac version
|
||||
{ GID_SQ6, -1, 64994, -1, "Game", "restore", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // when restoring in Mac version
|
||||
{ GID_TORIN, -1, 64017, 0, "oFlags", "clear", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // entering Torin's home in the French version
|
||||
{ GID_TORIN, -1, 64029, 0, "oMessager", "nextMsg", NULL, 3, 3, { WORKAROUND_FAKE, 0 } }, // start of chapter one, or when running with subtitles only
|
||||
{ GID_TORIN, -1, 64892, 0, "oEventHandler", "killAllEventHogs", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // when pressing the hint button when the game is about to transition to a new room (race condition) - Trac#9810
|
||||
|
|
|
@ -785,6 +785,14 @@ bool SciEngine::hasMacIconBar() const {
|
|||
(getGameId() == GID_KQ6 || getGameId() == GID_FREDDYPHARKAS);
|
||||
}
|
||||
|
||||
bool SciEngine::hasMacSaveRestoreDialogs() const {
|
||||
return _gameDescription->platform == Common::kPlatformMacintosh &&
|
||||
(getSciVersion() <= SCI_VERSION_2_1_EARLY ||
|
||||
getGameId() == GID_GK2 ||
|
||||
getGameId() == GID_SQ6 ||
|
||||
getGameId() == GID_LIGHTHOUSE);
|
||||
}
|
||||
|
||||
Common::String SciEngine::getSavegameName(int nr) const {
|
||||
return _targetName + Common::String::format(".%03d", nr);
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ enum SciVersion {
|
|||
SCI_VERSION_2, // GK1, PQ4 floppy, QFG4 floppy
|
||||
SCI_VERSION_2_1_EARLY, // GK2 demo, KQ7 1.4/1.51, LSL6 hires, PQ4CD, QFG4CD
|
||||
SCI_VERSION_2_1_MIDDLE, // GK2, Hoyle 5, KQ7 2.00b, MUMG Deluxe, Phantasmagoria 1, PQ:SWAT, Shivers 1, SQ6, Torin
|
||||
SCI_VERSION_2_1_LATE, // demos of LSL7, Lighthouse, RAMA
|
||||
SCI_VERSION_2_1_LATE, // demos and Mac versions of LSL7, Lighthouse, RAMA
|
||||
SCI_VERSION_3 // LSL7, Lighthouse, RAMA, Phantasmagoria 2
|
||||
};
|
||||
|
||||
|
@ -282,6 +282,7 @@ public:
|
|||
|
||||
bool hasParser() const;
|
||||
bool hasMacIconBar() const;
|
||||
bool hasMacSaveRestoreDialogs() const;
|
||||
|
||||
inline ResourceManager *getResMan() const { return _resMan; }
|
||||
inline ScriptPatcher *getScriptPatcher() const { return _scriptPatcher; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue