166 changes: 87 additions & 79 deletions pkg/nsis/warzone2100.nsi

Large diffs are not rendered by default.

39 changes: 37 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ EXTRA_DIST = \
autorevision.cache \
cursorselection

if PORTABLE
bin_PROGRAMS = warzone2100_portable
else
bin_PROGRAMS = warzone2100
endif

noinst_HEADERS = \
action.h \
actiondef.h \
Expand Down Expand Up @@ -151,7 +156,7 @@ noinst_HEADERS = \
weapondef.h \
wrappers.h

warzone2100_SOURCES = \
COMMONSOURCES = \
action.cpp \
advvis.cpp \
ai.cpp \
Expand Down Expand Up @@ -262,7 +267,9 @@ warzone2100_SOURCES = \
wavecast.cpp \
wrappers.cpp

warzone2100_LIBS = \


COMMONLIBS = \
$(top_builddir)/lib/widget/libwidget.a \
$(top_builddir)/lib/sequence/libsequence.a \
$(top_builddir)/lib/sound/libsound.a \
Expand All @@ -275,18 +282,46 @@ warzone2100_LIBS = \
$(top_builddir)/3rdparty/miniupnpc/libminiupnpc.a \
$(top_builddir)/3rdparty/quesoglc/libquesoglc.a

if PORTABLE
warzone2100_portable_SOURCES = $(COMMONSOURCES) $(nodist_COMMONSOURCES)
warzone2100_portable_LIBS = $(COMMONLIBS)
else
warzone2100_SOURCES = $(COMMONSOURCES) $(nodist_COMMONSOURCES)
warzone2100_LIBS = $(COMMONLIBS)
endif

if BACKEND_QT
if PORTABLE
warzone2100_portable_LIBS += $(top_builddir)/lib/qtgame/libqtgame.a
else
warzone2100_LIBS += $(top_builddir)/lib/qtgame/libqtgame.a
endif
endif

if BACKEND_SDL
if PORTABLE
warzone2100_portable_LIBS += $(top_builddir)/lib/sdl/libsdl.a
else
warzone2100_LIBS += $(top_builddir)/lib/sdl/libsdl.a
endif
endif


if PORTABLE
warzone2100_portable_LDADD = $(warzone2100_portable_LIBS) $(LTLIBINTL) $(SDL_LIBS) $(PHYSFS_LIBS) $(PNG_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) \
$(THEORA_LIBS) $(OPENAL_LIBS) $(OPENGLC_LIBS) $(OPENGL_LIBS) $(QT4_LIBS) $(GLEW_LIBS) \
$(X_LIBS) $(X_EXTRA_LIBS) $(LIBCRYPTO_LIBS) $(LDFLAGS)
else
warzone2100_LDADD = $(warzone2100_LIBS) $(LTLIBINTL) $(SDL_LIBS) $(PHYSFS_LIBS) $(PNG_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) \
$(THEORA_LIBS) $(OPENAL_LIBS) $(OPENGLC_LIBS) $(OPENGL_LIBS) $(QT4_LIBS) $(GLEW_LIBS) \
$(X_LIBS) $(X_EXTRA_LIBS) $(LDFLAGS)
endif

if MINGW32
if PORTABLE
warzone2100_portable_LDADD += $(top_builddir)/win32/warzone2100_portable.o $(WIN32_LIBS)
else
warzone2100_LDADD += $(top_builddir)/win32/warzone2100.o $(WIN32_LIBS)
endif
endif

14 changes: 13 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,24 @@ static bool getCurrentDir(char * const dest, size_t const size)
static void getPlatformUserDir(char * const tmpstr, size_t const size)
{
#if defined(WZ_OS_WIN)
// When WZ_PORTABLE is passed, that means we want the config directory at the same location as the program file
DWORD dwRet;
wchar_t tmpWStr[MAX_PATH];
#ifndef WZ_PORTABLE
if ( SUCCEEDED( SHGetFolderPathW( NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, tmpWStr ) ) )
{
#else
if (dwRet = GetCurrentDirectoryW(MAX_PATH, tmpWStr))
{
if(dwRet > MAX_PATH)
{
debug(LOG_FATAL, "Buffer exceeds maximum path to create directory. Exiting.");
exit(1);
}
#endif
if (WideCharToMultiByte(CP_UTF8, 0, tmpWStr, -1, tmpstr, size, NULL, NULL) == 0)
{
debug(LOG_ERROR, "Encoding conversion error.");
debug(LOG_FATAL, "Config directory encoding conversion error.");
exit(1);
}
strlcat(tmpstr, PHYSFS_getDirSeparator(), size);
Expand Down
10 changes: 10 additions & 0 deletions win32/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.rc.o:
$(WINDRES) -DVERSION="\"$(VERSION)\"" -o$@ $<
if PORTABLE
dist_noinst_DATA = warzone2100_portable.rc

else
dist_noinst_DATA = warzone2100.rc
endif

EXTRA_DIST = __BUILD_SCRIPT \
download.pl \
Expand All @@ -27,7 +31,13 @@ EXTRA_DIST = __BUILD_SCRIPT \
libs/zlib/Makefile

if MINGW32
if PORTABLE
nodist_noinst_DATA = \
warzone2100_portable.o
else
nodist_noinst_DATA = \
warzone2100.o
endif

CLEANFILES = $(nodist_noinst_DATA)
endif
47 changes: 47 additions & 0 deletions win32/warzone2100_portable.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

1 VERSIONINFO
FILEVERSION 9,9,9,9
PRODUCTVERSION 9,9,9,9
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Warzone 2100 Project"
VALUE "FileDescription", "Warzone 2100 portable"
VALUE "FileVersion", "master"
VALUE "InternalName", "Warzone 2100"
VALUE "LegalCopyright", "Copyright � 2005-2013 Warzone 2100 Project"
VALUE "OriginalFilename", "warzone2100_portable.exe"
VALUE "ProductName", "Warzone 2100 portable"
VALUE "ProductVersion", "master"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 0x04b0
END
END


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
2 ICON "../icons/wz2100portable.ico"