aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/sdl/win32/win32.cpp86
-rw-r--r--backends/platform/sdl/win32/win32.h1
-rwxr-xr-xconfigure2
-rw-r--r--dists/scummvm.rc43
-rw-r--r--dists/scummvm.rc.in43
-rw-r--r--ports.mk4
6 files changed, 176 insertions, 3 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index fffc3a2a75..d6a39ff48f 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -39,6 +39,8 @@
#include "backends/platform/sdl/win32/win32.h"
#include "backends/fs/windows/windows-fs-factory.h"
+#include "common/memstream.h"
+
#define DEFAULT_CONFIG_FILE "scummvm.ini"
//#define HIDE_CONSOLE
@@ -170,4 +172,88 @@ Common::WriteStream *OSystem_Win32::createLogFile() {
}
}
+namespace {
+
+class Win32ResourceArchive : public Common::Archive {
+ friend BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam);
+public:
+ Win32ResourceArchive();
+
+ virtual bool hasFile(const Common::String &name);
+ virtual int listMembers(Common::ArchiveMemberList &list);
+ virtual Common::ArchiveMemberPtr getMember(const Common::String &name);
+ virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
+private:
+ typedef Common::List<Common::String> FilenameList;
+
+ FilenameList _files;
+};
+
+BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam) {
+ if (IS_INTRESOURCE(lpszName))
+ return TRUE;
+
+ Win32ResourceArchive *arch = (Win32ResourceArchive *)lParam;
+ arch->_files.push_back(lpszName);
+ return TRUE;
+}
+
+Win32ResourceArchive::Win32ResourceArchive() {
+ EnumResourceNames(NULL, MAKEINTRESOURCE(256), &EnumResNameProc, (LONG_PTR)this);
+}
+
+bool Win32ResourceArchive::hasFile(const Common::String &name) {
+ for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i) {
+ if (i->equalsIgnoreCase(name))
+ return true;
+ }
+
+ return false;
+}
+
+int Win32ResourceArchive::listMembers(Common::ArchiveMemberList &list) {
+ int count = 0;
+
+ for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i, ++count)
+ list.push_back(Common::ArchiveMemberPtr(new Common::GenericArchiveMember(*i, this)));
+
+ return count;
+}
+
+Common::ArchiveMemberPtr Win32ResourceArchive::getMember(const Common::String &name) {
+ return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
+}
+
+Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(const Common::String &name) const {
+ HRSRC resource = FindResource(NULL, name.c_str(), MAKEINTRESOURCE(256));
+
+ if (resource == NULL)
+ return 0;
+
+ HGLOBAL handle = LoadResource(NULL, resource);
+
+ if (handle == NULL)
+ return 0;
+
+ const byte *data = (const byte *)LockResource(handle);
+
+ if (data == NULL)
+ return 0;
+
+ uint32 size = SizeofResource(NULL, resource);
+
+ if (size == 0)
+ return 0;
+
+ return new Common::MemoryReadStream(data, size);
+}
+
+} // End of anonymous namespace
+
+void OSystem_Win32::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
+ s.add("Win32Res", new Win32ResourceArchive());
+
+ OSystem_SDL::addSysArchivesToSearchSet(s, priority);
+}
+
#endif
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 8379c49437..25cb6bfbba 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -32,6 +32,7 @@ class OSystem_Win32 : public OSystem_SDL {
public:
virtual void init();
+ virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
protected:
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
diff --git a/configure b/configure
index 5115181acf..55db209d01 100755
--- a/configure
+++ b/configure
@@ -1639,7 +1639,7 @@ case $_host_os in
mingw*)
DEFINES="$DEFINES -DWIN32 -D__USE_MINGW_ANSI_STDIO=0"
LIBS="$LIBS -lmingw32 -lwinmm"
- OBJS="$OBJS scummvmico.o"
+ OBJS="$OBJS scummvmwinres.o"
add_line_to_config_mk 'WIN32 = 1'
;;
mint*)
diff --git a/dists/scummvm.rc b/dists/scummvm.rc
index 15dd04c0d9..203f57aa46 100644
--- a/dists/scummvm.rc
+++ b/dists/scummvm.rc
@@ -1,7 +1,50 @@
#include "winresrc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define FILE 256
+
#if defined (__MINGW32__) || defined(__CYGWIN32__) || defined(HAS_INCLUDE_SET)
IDI_ICON ICON DISCARDABLE "icons/scummvm.ico"
+
+scummmodern.zip FILE "gui/themes/scummmodern.zip"
+#ifdef USE_TRANSLATION
+translations.dat FILE "gui/themes/translations.dat"
+#endif
+
+#if ENABLE_DRASCULA == STATIC_PLUGIN
+drascula.dat FILE "dists/engine-data/drascula.dat"
+#endif
+#if ENABLE_HUGO == STATIC_PLUGIN
+hugo.dat FILE "dists/engine-data/hugo.dat"
+#endif
+#if ENABLE_KYRA == STATIC_PLUGIN
+kyra.dat FILE "dists/engine-data/kyra.dat"
+#endif
+#if ENABLE_LURE == STATIC_PLUGIN
+lure.dat FILE "dists/engine-data/lure.dat"
+#endif
+#if ENABLE_M4 == STATIC_PLUGIN
+m4.dat FILE "dists/engine-data/m4.dat"
+#endif
+#if ENABLE_QUEEN == STATIC_PLUGIN
+queen.tbl FILE "dists/engine-data/queen.tbl"
+#endif
+#if ENABLE_SKY == STATIC_PLUGIN
+sky.cpt FILE "dists/engine-data/sky.cpt"
+#endif
+#if ENABLE_TEENAGENT == STATIC_PLUGIN
+teenagent.dat FILE "dists/engine-data/teenagent.dat"
+#endif
+#if ENABLE_TOON == STATIC_PLUGIN
+toon.dat FILE "dists/engine-data/toon.dat"
+#endif
+#if ENABLE_AGI == STATIC_PLUGIN
+pred.dic FILE "dists/pred.dic"
+#endif
+
#else
IDI_ICON ICON DISCARDABLE "../../icons/scummvm.ico"
#endif
diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in
index a0fcf82dbb..20e88f1df5 100644
--- a/dists/scummvm.rc.in
+++ b/dists/scummvm.rc.in
@@ -1,7 +1,50 @@
#include "winresrc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define FILE 256
+
#if defined (__MINGW32__) || defined(__CYGWIN32__) || defined(HAS_INCLUDE_SET)
IDI_ICON ICON DISCARDABLE "icons/scummvm.ico"
+
+scummmodern.zip FILE "gui/themes/scummmodern.zip"
+#ifdef USE_TRANSLATION
+translations.dat FILE "gui/themes/translations.dat"
+#endif
+
+#if ENABLE_DRASCULA == STATIC_PLUGIN
+drascula.dat FILE "dists/engine-data/drascula.dat"
+#endif
+#if ENABLE_HUGO == STATIC_PLUGIN
+hugo.dat FILE "dists/engine-data/hugo.dat"
+#endif
+#if ENABLE_KYRA == STATIC_PLUGIN
+kyra.dat FILE "dists/engine-data/kyra.dat"
+#endif
+#if ENABLE_LURE == STATIC_PLUGIN
+lure.dat FILE "dists/engine-data/lure.dat"
+#endif
+#if ENABLE_M4 == STATIC_PLUGIN
+m4.dat FILE "dists/engine-data/m4.dat"
+#endif
+#if ENABLE_QUEEN == STATIC_PLUGIN
+queen.tbl FILE "dists/engine-data/queen.tbl"
+#endif
+#if ENABLE_SKY == STATIC_PLUGIN
+sky.cpt FILE "dists/engine-data/sky.cpt"
+#endif
+#if ENABLE_TEENAGENT == STATIC_PLUGIN
+teenagent.dat FILE "dists/engine-data/teenagent.dat"
+#endif
+#if ENABLE_TOON == STATIC_PLUGIN
+toon.dat FILE "dists/engine-data/toon.dat"
+#endif
+#if ENABLE_AGI == STATIC_PLUGIN
+pred.dic FILE "dists/pred.dic"
+#endif
+
#else
IDI_ICON ICON DISCARDABLE "../../icons/scummvm.ico"
#endif
diff --git a/ports.mk b/ports.mk
index 9e2681fe9e..512fec0507 100644
--- a/ports.mk
+++ b/ports.mk
@@ -161,8 +161,8 @@ osxsnap: bundle
# Windows specific
#
-scummvmico.o: $(srcdir)/icons/scummvm.ico
- $(WINDRES) $(WINDRESFLAGS) -I$(srcdir) $(srcdir)/dists/scummvm.rc scummvmico.o
+scummvmwinres.o: $(srcdir)/icons/scummvm.ico $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(srcdir)/dists/scummvm.rc
+ $(WINDRES) -DHAVE_CONFIG_H $(WINDRESFLAGS) $(DEFINES) -I. -I$(srcdir) $(srcdir)/dists/scummvm.rc scummvmwinres.o
# Special target to create a win32 snapshot binary
win32dist: $(EXECUTABLE)