[Scummvm-cvs-logs] SF.net SVN: scummvm:[52345] scummvm/trunk/engines/sci
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Tue Aug 24 17:11:53 CEST 2010
Revision: 52345
http://scummvm.svn.sourceforge.net/scummvm/?rev=52345&view=rev
Author: m_kiewitz
Date: 2010-08-24 15:11:53 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
SCI: replacing save dialog as well
experimental feature - enable by putting "scireplacedialog=true" inside scummvm section of scummvm.ini
LSL6 currently loses the ability to quicksave, when using the feature. Although i don't see it as a huge loss. That way it's now possible to save to up to 100 slots instead of just 20.
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kfile.cpp
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp 2010-08-24 14:58:29 UTC (rev 52344)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp 2010-08-24 15:11:53 UTC (rev 52345)
@@ -556,7 +556,6 @@
int16 savegameId = -1;
Common::String game_description;
Common::String version;
- bool pausedMusic = false;
if (argc > 3)
version = s->_segMan->getString(argv[3]);
@@ -581,11 +580,9 @@
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
game_description = dialog->getResultString();
delete dialog;
- if (savegameId < 0) {
- g_sci->_soundCmd->pauseAll(false); // unpause music
+ g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
+ if (savegameId < 0)
return NULL_REG;
- }
- pausedMusic = true;
} else {
// Real call from script
@@ -653,9 +650,6 @@
}
}
- if (pausedMusic)
- g_sci->_soundCmd->pauseAll(false); // unpause music
-
return s->r_acc;
}
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2010-08-24 14:58:29 UTC (rev 52344)
+++ scummvm/trunk/engines/sci/sci.cpp 2010-08-24 15:11:53 UTC (rev 52345)
@@ -340,6 +340,8 @@
};
void SciEngine::patchGameSaveRestore(SegManager *segMan) {
+ const Object *gameObject = segMan->getObject(_gameObjectAddress);
+ const uint16 gameMethodCount = gameObject->getMethodCount();
const Object *gameSuperObject = segMan->getObject(_gameSuperClassAddress);
const uint16 gameSuperMethodCount = gameSuperObject->getMethodCount();
reg_t methodAddress;
@@ -372,6 +374,7 @@
kernelIdSave = kernelNr;
}
+ // Search for gameobject-superclass ::restore
for (uint16 methodNr = 0; methodNr < gameSuperMethodCount; methodNr++) {
uint16 selectorId = gameSuperObject->getFuncSelector(methodNr);
Common::String methodName = _kernel->getSelectorName(selectorId);
@@ -379,6 +382,22 @@
methodAddress = gameSuperObject->getFunction(methodNr);
Script *script = segMan->getScript(methodAddress.segment);
scriptRestorePtr = script->getBuf(methodAddress.offset);
+ }
+ if (methodName == "save") {
+ methodAddress = gameSuperObject->getFunction(methodNr);
+ Script *script = segMan->getScript(methodAddress.segment);
+ scriptSavePtr = script->getBuf(methodAddress.offset);
+ }
+ }
+
+ // Search for gameobject ::save, if there is one patch that one instead
+ for (uint16 methodNr = 0; methodNr < gameMethodCount; methodNr++) {
+ uint16 selectorId = gameObject->getFuncSelector(methodNr);
+ Common::String methodName = _kernel->getSelectorName(selectorId);
+ if (methodName == "save") {
+ methodAddress = gameObject->getFunction(methodNr);
+ Script *script = segMan->getScript(methodAddress.segment);
+ scriptSavePtr = script->getBuf(methodAddress.offset);
break;
}
}
@@ -396,12 +415,12 @@
memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave));
patchPtr[8] = kernelIdRestore;
}
- //if (scriptSavePtr) {
- // // Now patch in our code
- // byte *patchPtr = const_cast<byte *>(scriptSavePtr);
- // memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave));
- // patchPtr[8] = kernelIdSave;
- //}
+ if (scriptSavePtr) {
+ // Now patch in our code
+ byte *patchPtr = const_cast<byte *>(scriptSavePtr);
+ memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave));
+ patchPtr[8] = kernelIdSave;
+ }
}
bool SciEngine::initGame() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list