aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/game.cpp4
-rw-r--r--engines/game.h8
-rw-r--r--gui/launcher.cpp4
3 files changed, 14 insertions, 2 deletions
diff --git a/engines/game.cpp b/engines/game.cpp
index 5011685412..3e6cdc2e79 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -115,6 +115,10 @@ void SaveStateDescriptor::setDeletableFlag(bool state) {
setVal("is_deletable", state ? "true" : "false");
}
+void SaveStateDescriptor::setWriteProtectedFlag(bool state) {
+ setVal("is_write_protected", state ? "true" : "false");
+}
+
void SaveStateDescriptor::setSaveDate(int year, int month, int day) {
char buffer[32];
snprintf(buffer, 32, "%.2d.%.2d.%.4d", day, month, year);
diff --git a/engines/game.h b/engines/game.h
index 9a8c25e35b..21bfbce0f5 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -151,12 +151,18 @@ public:
bool getBool(const Common::String &key) const;
/**
- * Sets the 'is_deletable' key, which indicates, if the
+ * Sets the 'is_deletable' key, which indicates if the
* given savestate is safe for deletion.
*/
void setDeletableFlag(bool state);
/**
+ * Sets the 'is_write_protected' key, which indicates if the
+ * given savestate can be overwritten or not
+ */
+ void setWriteProtectedFlag(bool state);
+
+ /**
* Return a thumbnail graphics surface representing the savestate visually.
* This is usually a scaled down version of the game graphics. The size
* should be either 160x100 or 160x120 pixels, depending on the aspect
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index c11cc58ae1..3f569c22bb 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -673,11 +673,13 @@ void SaveLoadChooser::updateSelection(bool redraw) {
int selItem = _list->getSelected();
bool isDeletable = _delSupport;
+ bool isWriteProtected = false;
if (selItem >= 0 && !_list->getSelectedString().empty() && _metaInfoSupport) {
SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str()));
isDeletable = desc.getBool("is_deletable") && _delSupport;
+ isWriteProtected = desc.getBool("is_write_protected");
if (_thumbnailSupport) {
const Graphics::Surface *thumb = desc.getThumbnail();
@@ -720,7 +722,7 @@ void SaveLoadChooser::updateSelection(bool redraw) {
// Disable these buttons if nothing is selected, or if an empty
// list item is selected.
- _chooseButton->setEnabled(selItem >= 0 && (!_list->getSelectedString().empty()));
+ _chooseButton->setEnabled(selItem >= 0 && (!_list->getSelectedString().empty()) && !isWriteProtected);
// Delete will always be disabled if the engine doesn't support it.
_deleteButton->setEnabled(isDeletable && (selItem >= 0) && (!_list->getSelectedString().empty()));