aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/posix
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/sdl/posix')
-rw-r--r--backends/platform/sdl/posix/posix-main.cpp54
-rw-r--r--backends/platform/sdl/posix/posix.cpp68
-rw-r--r--backends/platform/sdl/posix/posix.h48
3 files changed, 170 insertions, 0 deletions
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
new file mode 100644
index 0000000000..de9eb2b7ef
--- /dev/null
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#if defined(UNIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(LINUXMOTO) && !defined(GP2XWIZ) && !defined(GP2X) && !defined(DINGUX)
+
+#include "backends/platform/sdl/posix/posix.h"
+#include "backends/plugins/sdl/sdl-provider.h"
+#include "base/main.h"
+
+int main(int argc, char *argv[]) {
+
+ // Create our OSystem instance
+ g_system = new OSystem_POSIX();
+ assert(g_system);
+
+ // Pre initialize the backend
+ ((OSystem_POSIX *)g_system)->init();
+
+#ifdef DYNAMIC_MODULES
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+#endif
+
+ // Invoke the actual ScummVM main entry point:
+ int res = scummvm_main(argc, argv);
+
+ // Free OSystem
+ delete (OSystem_POSIX *)g_system;
+
+ return res;
+}
+
+#endif
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
new file mode 100644
index 0000000000..c9c7304c0f
--- /dev/null
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifdef UNIX
+
+#include "backends/platform/sdl/posix/posix.h"
+#include "backends/saves/posix/posix-saves.h"
+#include "backends/fs/posix/posix-fs-factory.h"
+
+OSystem_POSIX::OSystem_POSIX(Common::String baseConfigName)
+ :
+ _baseConfigName(baseConfigName) {
+}
+
+void OSystem_POSIX::init() {
+ // Initialze File System Factory
+ _fsFactory = new POSIXFilesystemFactory();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::init();
+}
+
+void OSystem_POSIX::initBackend() {
+ // Create the savefile manager
+ if (_savefileManager == 0)
+ _savefileManager = new POSIXSaveFileManager();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::initBackend();
+}
+
+Common::String OSystem_POSIX::getDefaultConfigFileName() {
+ char configFile[MAXPATHLEN];
+
+ // On UNIX type systems, by default we store the config file inside
+ // to the HOME directory of the user.
+ const char *home = getenv("HOME");
+ if (home != NULL && strlen(home) < MAXPATHLEN)
+ snprintf(configFile, MAXPATHLEN, "%s/%s", home, _baseConfigName.c_str());
+ else
+ strcpy(configFile, _baseConfigName.c_str());
+
+ return configFile;
+}
+
+#endif
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
new file mode 100644
index 0000000000..13f9304f1e
--- /dev/null
+++ b/backends/platform/sdl/posix/posix.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef PLATFORM_SDL_POSIX_H
+#define PLATFORM_SDL_POSIX_H
+
+#include "backends/platform/sdl/sdl.h"
+
+class OSystem_POSIX : public OSystem_SDL {
+public:
+ // Let the subclasses be able to change _baseConfigName in the constructor
+ OSystem_POSIX(Common::String baseConfigName = ".scummvmrc");
+ virtual ~OSystem_POSIX() {}
+
+ virtual void init();
+ virtual void initBackend();
+
+protected:
+ // Base string for creating the default path and filename
+ // for the configuration file
+ Common::String _baseConfigName;
+
+ virtual Common::String getDefaultConfigFileName();
+};
+
+#endif