aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/system.cpp8
-rw-r--r--common/system.h19
2 files changed, 27 insertions, 0 deletions
diff --git a/common/system.cpp b/common/system.cpp
index 51f41ecf1d..97c8f8520b 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -49,6 +49,7 @@ OSystem::OSystem() {
_updateManager = nullptr;
#endif
_fsFactory = nullptr;
+ _backendInitialized = false;
}
OSystem::~OSystem() {
@@ -98,6 +99,13 @@ void OSystem::initBackend() {
// set it.
// if (!_fsFactory)
// error("Backend failed to instantiate fs factory");
+
+ _backendInitialized = true;
+}
+
+void OSystem::destroy() {
+ _backendInitialized = false;
+ delete this;
}
bool OSystem::setGraphicsMode(const char *name) {
diff --git a/common/system.h b/common/system.h
index 7caf73a8a2..405d6a90a8 100644
--- a/common/system.h
+++ b/common/system.h
@@ -190,11 +190,23 @@ protected:
*/
FilesystemFactory *_fsFactory;
+private:
+ /**
+ * Indicate if initBackend() has been called.
+ */
+ bool _backendInitialized;
+
//@}
public:
/**
+ *
+ * Destoy this OSystem instance.
+ */
+ void destroy();
+
+ /**
* The following method is called once, from main.cpp, after all
* config data (including command line params etc.) are fully loaded.
*
@@ -205,6 +217,13 @@ public:
virtual void initBackend();
/**
+ * Return false if initBackend() has not yet been called and true otherwise.
+ * Some functionalities such as mutexes cannot be used until the backend
+ * is initialized.
+ */
+ bool backendInitialized() const { return _backendInitialized; }
+
+ /**
* Allows the backend to perform engine specific init.
* Called just before the engine is run.
*/