aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README16
-rw-r--r--backends/module.mk1
-rw-r--r--backends/platform/sdl/win32/win32.cpp5
-rw-r--r--backends/saves/windows/windows-saves.cpp78
-rw-r--r--backends/saves/windows/windows-saves.h36
5 files changed, 134 insertions, 2 deletions
diff --git a/README b/README
index 35af23e8c2..d5c8fe1bf1 100644
--- a/README
+++ b/README
@@ -1340,8 +1340,20 @@ config file by setting the savepath parameter. See the example config
file later in this README.
The platforms that currently have a different default directory are:
- Mac OS X: $HOME/Documents/ScummVM Savegames/
- Other unices: $HOME/.scummvm/
+ Mac OS X:
+ $HOME/Documents/ScummVM Savegames/
+
+ Other unices:
+ $HOME/.scummvm/
+
+ Windows Vista/7:
+ \Users\username\AppData\Roaming\ScummVM\Saved games\
+
+ Windows 2000/XP:
+ \Documents and Settings\username\Application Data\ScummVM\Saved games\
+
+ Windows NT4:
+ <windir>\Profiles\username\Application Data\ScummVM\Saved games\
6.1) Autosaves:
diff --git a/backends/module.mk b/backends/module.mk
index 6be595a65e..37209ffcef 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -98,6 +98,7 @@ MODULE_OBJS += \
fs/windows/windows-fs-factory.o \
midi/windows.o \
plugins/win32/win32-provider.o \
+ saves/windows/windows-saves.o \
taskbar/win32/win32-taskbar.o
endif
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 3e09aa2640..453d566c7b 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -38,6 +38,7 @@
#include <SDL_syswm.h> // For setting the icon
#include "backends/platform/sdl/win32/win32.h"
+#include "backends/saves/windows/windows-saves.h"
#include "backends/fs/windows/windows-fs-factory.h"
#include "backends/taskbar/win32/win32-taskbar.h"
@@ -74,6 +75,10 @@ void OSystem_Win32::initBackend() {
FreeConsole();
}
+ // Create the savefile manager
+ if (_savefileManager == 0)
+ _savefileManager = new WindowsSaveFileManager();
+
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
}
diff --git a/backends/saves/windows/windows-saves.cpp b/backends/saves/windows/windows-saves.cpp
new file mode 100644
index 0000000000..87348c3416
--- /dev/null
+++ b/backends/saves/windows/windows-saves.cpp
@@ -0,0 +1,78 @@
+/* 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.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#include "backends/saves/windows/windows-saves.h"
+
+#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "common/config-manager.h"
+#include "common/savefile.h"
+
+WindowsSaveFileManager::WindowsSaveFileManager() {
+ char defaultSavepath[MAXPATHLEN];
+
+ OSVERSIONINFO win32OsVersion;
+ ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO));
+ win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&win32OsVersion);
+ // Check for non-9X version of Windows.
+ if (win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) {
+ // Use the Application Data directory of the user profile.
+ if (win32OsVersion.dwMajorVersion >= 5) {
+ if (!GetEnvironmentVariable("APPDATA", defaultSavepath, sizeof(defaultSavepath)))
+ error("Unable to access application data directory");
+ } else {
+ if (!GetEnvironmentVariable("USERPROFILE", defaultSavepath, sizeof(defaultSavepath)))
+ error("Unable to access user profile directory");
+
+ strcat(defaultSavepath, "\\Application Data");
+
+ // If the directory already exists (as it should in most cases),
+ // we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
+ if (!CreateDirectory(defaultSavepath, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create Application data folder");
+ }
+ }
+
+ strcat(defaultSavepath, "\\ScummVM");
+ if (!CreateDirectory(defaultSavepath, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM application data folder");
+ }
+
+ strcat(defaultSavepath, "\\Saved games");
+ if (!CreateDirectory(defaultSavepath, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM Saved games folder");
+ }
+
+ ConfMan.registerDefault("savepath", defaultSavepath);
+ }
+}
+
+#endif
diff --git a/backends/saves/windows/windows-saves.h b/backends/saves/windows/windows-saves.h
new file mode 100644
index 0000000000..a705aa2b7f
--- /dev/null
+++ b/backends/saves/windows/windows-saves.h
@@ -0,0 +1,36 @@
+/* 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.
+ *
+ */
+
+#ifndef BACKEND_WINDOWS_SAVES_H
+#define BACKEND_WINDOWS_SAVES_H
+
+#include "backends/saves/default/default-saves.h"
+
+/**
+ * Provides a default savefile manager implementation for common platforms.
+ */
+class WindowsSaveFileManager : public DefaultSaveFileManager {
+public:
+ WindowsSaveFileManager();
+};
+
+#endif