diff options
-rw-r--r-- | Makefile.common | 17 | ||||
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 86 | ||||
-rw-r--r-- | backends/platform/sdl/win32/win32.h | 1 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | devtools/create_project/msbuild.cpp | 1 | ||||
-rw-r--r-- | devtools/create_project/visualstudio.cpp | 1 | ||||
-rw-r--r-- | dists/scummvm.rc | 44 | ||||
-rw-r--r-- | dists/scummvm.rc.in | 44 | ||||
-rw-r--r-- | ports.mk | 4 |
9 files changed, 181 insertions, 19 deletions
diff --git a/Makefile.common b/Makefile.common index e96774fe4e..8aee2b6d6e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -63,14 +63,15 @@ endif ifneq ($(findstring $(MAKEFLAGS),s),s) ifneq ($(VERBOSE_BUILD),1) ifneq ($(VERBOSE_BUILD),yes) -QUIET_CXX = @echo ' ' C++ ' ' $@; -QUIET_AS = @echo ' ' AS ' ' $@; -QUIET_NASM = @echo ' ' NASM ' ' $@; -QUIET_AR = @echo ' ' AR ' ' $@; -QUIET_RANLIB = @echo ' ' RANLIB ' ' $@; -QUIET_PLUGIN = @echo ' ' PLUGIN ' ' $@; -QUIET_LINK = @echo ' ' LINK ' ' $@; -QUIET = @ +QUIET_CXX = @echo ' ' C++ ' ' $@; +QUIET_AS = @echo ' ' AS ' ' $@; +QUIET_NASM = @echo ' ' NASM ' ' $@; +QUIET_AR = @echo ' ' AR ' ' $@; +QUIET_RANLIB = @echo ' ' RANLIB ' ' $@; +QUIET_PLUGIN = @echo ' ' PLUGIN ' ' $@; +QUIET_LINK = @echo ' ' LINK ' ' $@; +QUIET_WINDRES = @echo ' ' WINDRES '' $@; +QUIET = @ endif endif endif 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(); @@ -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/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 4b8276da6f..f9a2e936f0 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -340,7 +340,6 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits, "\t\t\t<EntryPointSymbol>WinMainCRTStartup</EntryPointSymbol>\n" "\t\t</Link>\n" "\t\t<ResourceCompile>\n" - "\t\t\t<PreprocessorDefinitions>HAS_INCLUDE_SET;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" "\t\t\t<AdditionalIncludeDirectories>" << prefix << ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n" "\t\t</ResourceCompile>\n" "\t</ItemDefinitionGroup>\n" diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index a7a6ac84a7..8642f071ff 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -240,7 +240,6 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b "\t/>\n" "\t<Tool\n" "\t\tName=\"VCResourceCompilerTool\"\n" - "\t\tPreprocessorDefinitions=\"HAS_INCLUDE_SET\"\n" "\t\tAdditionalIncludeDirectories=\"" << prefix << "\"\n" "\t/>\n" "</VisualStudioPropertySheet>\n"; diff --git a/dists/scummvm.rc b/dists/scummvm.rc index 15dd04c0d9..109437305c 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -1,9 +1,47 @@ #include "winresrc.h" -#if defined (__MINGW32__) || defined(__CYGWIN32__) || defined(HAS_INCLUDE_SET) +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define FILE 256 + IDI_ICON ICON DISCARDABLE "icons/scummvm.ico" -#else -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 VS_VERSION_INFO VERSIONINFO diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in index a0fcf82dbb..c043ce1644 100644 --- a/dists/scummvm.rc.in +++ b/dists/scummvm.rc.in @@ -1,9 +1,47 @@ #include "winresrc.h" -#if defined (__MINGW32__) || defined(__CYGWIN32__) || defined(HAS_INCLUDE_SET) +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define FILE 256 + IDI_ICON ICON DISCARDABLE "icons/scummvm.ico" -#else -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 VS_VERSION_INFO VERSIONINFO @@ -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 + $(QUIET_WINDRES)$(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) |