mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
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. svn-id: r52345
This commit is contained in:
parent
cd61674010
commit
01a8fc604b
@ -556,7 +556,6 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
|
||||
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 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
|
||||
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 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (pausedMusic)
|
||||
g_sci->_soundCmd->pauseAll(false); // unpause music
|
||||
|
||||
return s->r_acc;
|
||||
}
|
||||
|
||||
|
@ -340,6 +340,8 @@ static byte patchGameRestoreSave[] = {
|
||||
};
|
||||
|
||||
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 @@ void SciEngine::patchGameSaveRestore(SegManager *segMan) {
|
||||
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 @@ void SciEngine::patchGameSaveRestore(SegManager *segMan) {
|
||||
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 @@ void SciEngine::patchGameSaveRestore(SegManager *segMan) {
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user