aboutsummaryrefslogtreecommitdiff
path: root/base/game.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/game.h')
-rw-r--r--base/game.h61
1 files changed, 60 insertions, 1 deletions
diff --git a/base/game.h b/base/game.h
index 0764b7fbac..64e14c52dc 100644
--- a/base/game.h
+++ b/base/game.h
@@ -30,6 +30,10 @@
#include "common/array.h"
#include "common/hash-str.h"
+namespace Graphics {
+ class Surface;
+}
+
/**
* A simple structure used to map gameids (like "monkey", "sword1", ...) to
* nice human readable and descriptive game titles (like "The Secret of Monkey Island").
@@ -67,7 +71,7 @@ public:
setVal("description", pgd.description);
}
- GameDescriptor(Common::String g, Common::String d, Common::Language l = Common::UNK_LANG,
+ GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l = Common::UNK_LANG,
Common::Platform p = Common::kPlatformUnknown) {
setVal("gameid", g);
setVal("description", d);
@@ -103,6 +107,61 @@ public:
}
};
+/**
+ * A hashmap describing details about a given save state.
+ * TODO
+ * Guaranteed to contain save_slot and description values.
+ * Additional ideas: Playtime, creation date, thumbnail, ...
+ */
+class SaveStateDescriptor : public Common::StringMap {
+protected:
+ Graphics::Surface *_thumbnail; // can be NULL
+public:
+ SaveStateDescriptor() : _thumbnail(0) {
+ setVal("save_slot", "-1"); // FIXME: default to 0 (first slot) or to -1 (invalid slot) ?
+ setVal("description", "");
+ }
+
+ SaveStateDescriptor(const Common::String &s, const Common::String &d) : _thumbnail(0) {
+ setVal("save_slot", s);
+ setVal("description", d);
+ }
+
+ ~SaveStateDescriptor() {
+ setThumbnail(0);
+ }
+
+ /** The saveslot id, as it would be passed to the "-x" command line switch. */
+ Common::String &slot() { return getVal("save_slot"); }
+
+ /** The saveslot id, as it would be passed to the "-x" command line switch (read-only variant). */
+ const Common::String &slot() const { return getVal("save_slot"); }
+
+ /** A human readable description of the save state. */
+ Common::String &description() { return getVal("description"); }
+
+ /** A human readable description of the save state (read-only variant). */
+ const Common::String &description() const { return getVal("description"); }
+
+ /**
+ * 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
+ * ratio of the game. If another ratio is required, contact the core team.
+ *
+ * TODO: it is probably a bad idea to read this for *all* games at once,
+ * at least on low-end devices. So this info should probably normally only
+ * be included optionally. I.e. only upon a query for a specific savegame...
+ * To this end, add a getFullSaveStateInfo(target, slot) to the plugin API.
+ */
+ const Graphics::Surface *getThumbnail() const { return _thumbnail; }
+
+
+ void setThumbnail(Graphics::Surface *t);
+};
+
+/** List of savestates. */
+typedef Common::Array<SaveStateDescriptor> SaveStateList;
class Plugin;