code:
MULTI-PLATFORM SUPPORT FOR MEGAZEUX

The arch/ directory structure contains any code/machinery which is platform
specific. Though is it dubiously named "arch" this refers to the platform
"architecture" rather than the CPU architecture. For example, although GP2X
and NDS both use ARM CPUs, they require different library and build system
machinery to work correctly.

DIRECTORY LAYOUT

Most directories here contain at least a README file describing what toolchain
and dependencies they require to work correctly. Some might also define
additional targets, for post-processing binaries or installing them on the
system.

Additionally, all of these directories must have a Makefile.in which the build
system will automatically include. This file should initialize any variables
that can be tweaked, for example the location of libraries or compiler flags.
The existing Makefile.in files should be a reasonable guide to this
functionality.

ADDING A PLATFORM TO MEGAZEUX

Adding support for a new platform is trivial. Think of a short name for the
platform (for example, Nintendo Dual-Screen is "nds") then create a directory
in arch/ with that name. Create a Makefile.in for your platform. Initially,
you may find configuring for "unix" and then manually altering the
"platform.inc" in the top level is enough to get your build to succeed.

Then, some changes must be made to config.sh to automatically generate both
the src/config.h header (which is fully generic) and the platform.inc. This
script is what users of your port will invoke to build the package.

You may also want to make sure the "build" and "archive" targets do something
for your platform. These targets make auto-builds and shipping binary
packages much easier.

--ajs.

path: arch/README


code:
./config.sh --platform amiga --prefix /usr/local/amiga \
            --disable-libpng --disable-utils --enable-release

repo_name: pgimeno/megazeux

license: mit


code:
STACK 1000000

Assign >NIL: "USR:" EXISTS
IF NOT WARN
ELSE
Assign USR: RAM:
ENDIF

Assign >NIL: "ETC:" EXISTS
IF NOT WARN
ELSE
Assign ETC: RAM:
ENDIF

run >NIL: mzxrun.exe;

path: arch/amiga/MZXRun


code:
#
# amiga makefile generics
#

CC      = ppc-amigaos-gcc -mcrt=clib2 -I${PREFIX}/clib2/include
CXX     = ppc-amigaos-g++ -mcrt=clib2 -I${PREFIX}/clib2/include
STRIP   = ppc-amigaos-strip --strip-unneeded
OBJCOPY = true
CHMOD   = true

BINEXT  = .exe

DSOLDFLAGS = -shared
DSOPRE     = lib
DSOPOST    = .so
DSORPATH   = -Wl,-rpath,${LIBDIR}
DSOSONAME  = -Wl,-soname,

ifeq (${BUILD_MODULAR},1)
ARCH_CFLAGS   += -fPIC
ARCH_CXXFLAGS += -fPIC
ARCH_LDFLAGS  += -use-dynld -lunix
endif

# MZX breaks this optimisation on Amiga
ARCH_CFLAGS   += -fno-strict-aliasing
ARCH_CXXFLAGS += -fno-strict-aliasing

# Amiga needs PNG to be statically linked (inc. zlib)
LIBPNG_LDFLAGS = `libpng12-config --static --ldflags`

#
# Need to nest Amiga binaries in a subdir
#
build := build/${SUBPLATFORM}/MegaZeux
build: ${build}
	${CP} arch/amiga/MegaZeux.info ${build}
	${CP} arch/amiga/MegaZeux.info ${build}/MZXRun.info
	${CP} arch/amiga/MegaZeux.info build/${SUBPLATFORM}
	${CP} arch/amiga/MegaZeux arch/amiga/MZXRun ${build}
	${RM} ${build}/*.debug

include arch/lha.inc


code:
STACK 1000000

Assign >NIL: "USR:" EXISTS
IF NOT WARN
ELSE
Assign USR: RAM:
ENDIF

Assign >NIL: "ETC:" EXISTS
IF NOT WARN
ELSE
Assign ETC: RAM:
ENDIF

run >NIL: megazeux.exe;

path: arch/amiga/MegaZeux


code:
MEGAZEUX ON AMIGA OS 4

Since 2.82b, MegaZeux supports cross compilation to Amiga OS 4. You will
require a valid copy of the operating system software in order to run the
final result; this is not a bare-metal Amiga binary.

The only supported toolchain is for OS 4 and PPC Amigas.
m68k Amigas are not supported.

PREPARATION

The port requires that the Amiga OS 4 SDK and toolchain is installed. There
are several pre-built toolchains available from:

	http://cross.zerohero.se/os4.html

There is an excellent guide for linking your toolchain and the platform SDK
together here:

	http://utilitybase.com/article/show/2007/06/23/231/Installing+an+AmigaOS+4+cross+compiler

The SDL library for AmigaOS 4 (clib2) must be installed. I got my copy from:

	http://www.rcdrummond.net/sdl/index.html

BUILDING MEGAZEUX

First, configure MZX. A suitable config.sh command line is provided in
CONFIG.AMIGA present in this subdirectory. Please note that --prefix MUST
correctly point to the AmigaOS 4 SDK (otherwise it tries to use /usr's
stub headers and fails).

Then start the build with "make".

INSTALLING MEGAZEUX

The usual "make archive" works to generate an LHA compilation of MegaZeux
binaries and Amiga specific scripts. Icons are provided where appropriate.

--ajs

path: arch/amiga/README


code:
#
# android makefile generics
#

ANDROID_LIBPATH ?= ${PREFIX}/out/debug/target/product/${ANDROID_PRODUCT}/obj/lib
ANDROID_PRODUCT ?= generic

CC      = ${CROSS_COMPILE}gcc
CXX     = ${CROSS_COMPILE}g++
AR      = ${CROSS_COMPILE}ar
OBJCOPY = ${CROSS_COMPILE}objcopy
STRIP   = ${CROSS_COMPILE}strip --strip-unneeded

LIBGCC_A := $(shell $(CC) -print-libgcc-file-name)

ifeq (${ARCH},)
ARCH=arm
endif

ifeq (${ARCH},arm)

TOOLCHAIN       ?= ${PREFIX}/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1
CROSS_COMPILE   ?= ${TOOLCHAIN}/bin/arm-eabi-

ARCH_CFLAGS = -march=armv5te \
  -I${PREFIX}/bionic/libc/arch-arm/include \
  -I${PREFIX}/bionic/libc/kernel/arch-arm

ARCH_EXE_LDFLAGS = -Bdynamic -Wl,-T,${PREFIX}/build/core/armelf.x

DSOLDFLAGS = -shared -Wl,-T,${PREFIX}/build/core/armelf.xsc

else ifeq (${ARCH},x86)

TOOLCHAIN	?= ${PREFIX}/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1
CROSS_COMPILE	?= ${TOOLCHAIN}/bin/i686-unknown-linux-gnu-

ARCH_CFLAGS = -march=i686 -fPIC \
  -I${PREFIX}/bionic/libc/arch-x86/include \
  -I${PREFIX}/bionic/libc/kernel/arch-x86

DSOLDFLAGS = -shared

else

$(error Specify a valid supported architecture)

endif

ARCH_CFLAGS += \
  -DANDROID -fno-short-enums \
  -I${PREFIX}/bionic/libc/include \
  -I${PREFIX}/bionic/libc/kernel/common \
  -I${PREFIX}/bionic/libm/include \
  -I${PREFIX}/frameworks/base/include \
  -I${PREFIX}/frameworks/base/opengl/include \
  -I${PREFIX}/system/core/include \
  -I${PREFIX}/hardware/libhardware/include \
  -I${PREFIX}/external/skia/include \
  -Iarch/android

ARCH_CXXFLAGS = \
  ${ARCH_CFLAGS} -I${PREFIX}/bionic/libstdc++/include

ARCH_LDFLAGS = \
  -Bdynamic -nostdlib \
  -Wl,-dynamic-linker,/system/bin/linker \
  -Wl,-rpath-link=${ANDROID_LIBPATH} \
  -L${ANDROID_LIBPATH} -lc -lcutils -lsurfaceflinger $(LIBGCC_A)

ARCH_EXE_LDFLAGS += \
  ${ANDROID_LIBPATH}/crtbegin_dynamic.o \
  ${ANDROID_LIBPATH}/crtend_android.o

DSOPRE     = lib
DSOPOST    = .so
DSORPATH   = -Wl,-rpath,${LIBDIR}
DSOSONAME  = -Wl,-soname,

#
# Bionic implements pthread, no separate library
#
PTHREAD_LDFLAGS =

#
# Headers are in a strange place
#
VORBIS_CFLAGS = -I${PREFIX}/external/tremor
ZLIB_CFLAGS   = -I${PREFIX}/external/zlib
LIBPNG_CFLAGS = -I${PREFIX}/external/libpng ${ZLIB_CFLAGS}

#
# Skia provides libpng symbols on Android
#
LIBPNG_LDFLAGS = -lskiagl

#
# Some of SurfaceFlinger is only available to C++; this wraps
# those bits and makes them available to render_egl (C).
#
arch/android/sfwrapper.o: arch/android/sfwrapper.cpp
	$(if ${V},,@echo "  CXX     " $<)
	${CXX} -MD ${core_cxxflags} -Isrc -c $< -o $@

.PHONY: clean
clean:
	$(if ${V},,@echo "  RM      " arch/android/sfwrapper.{o,d})
	${RM} arch/android/sfwrapper.o arch/android/sfwrapper.d

#
# Need to nest Android binaries in a subdir
# FIXME: Convert this to .apk and wrap it with a Java class
#
build := build/${SUBPLATFORM}/data/megazeux
build: ${build}

include arch/zip.inc


code:
MEGAZEUX ON ANDROID

Android uses the Linux kernel and the build is similar to the UNIX one.

MegaZeux requires a new arch/ as the Android cross-compiler is weird and
uses hand-rolled linker flags to generate programs. This may go away over
time.

At the moment this Android port does nothing. It needs the following work:

  - Possibly fix up software renderer to use Skia (needed for old phones)
  - Implement audio support (audioflinger)

Most of the config.sh options work as-is, see docs/platform-matrix.html for
detailed information.

CHANGES TO ANDROID SOURCE TREE

At the moment the only change required to the source tree is to add a symlink
to work around a case issue when building on Linux:

cd $ANDROID_ROOT/external/tremor
ln -s Tremor tremor

You don't have to do this if you disable audio support (which makes a lot of
sense right now, actually).

BUILD DEPENDENCIES

Android makes this easy, because they bootstrap everything themselves. They
even provide the cross compiler. All you need to do is specify your android
build tree with "--prefix" and the build system does the rest.

CONFIGURATION

The config.sh line I've been using is:

./config.sh --platform android --prefix $HOME/android --disable-editor \
            --disable-modular --disable-utils --disable-audio

However, I've made sure the utils build too, so the --disable-utils is
optional.

INSTALLATION

The "make build" and "make archive" targets work for Android, but they
generate ZIP files rather than .apk's, so you can only run MZX from SD.

path: arch/android/README


code:
/* MegaZeux
 *
 * Copyright (C) 2009 Alistair John Strachan <alistair@devzero.co.uk>
 *
 * 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 "sfwrapper.h"

#include <ui/Rect.h>
#include <ui/Surface.h>
#include <ui/PixelFormat.h>
#include <ui/DisplayInfo.h>
#include <ui/SurfaceComposerClient.h>

#include <binder/ProcessState.h>
#include <binder/IPCThreadState.h>

// Android has a util.h too
#include "../../src/util.h"

extern "C"
{
  /* FIXME: Hack, remove! */
  void *__dso_handle = NULL;
}

namespace android {

static sp<SurfaceComposerClient>  mSession;

static sp<SurfaceControl>         mSurfaceControl;
static sp<Surface>                mSurface;

extern "C" bool SurfaceFlingerInitialize(int target_width, int target_height,
 int depth, bool fullscreen)
{
  if(mSession == NULL)
  {
    ProcessState::self()->startThreadPool();
    mSession = new SurfaceComposerClient();
    if(mSession == NULL)
    {
      warn("Failed to create SurfaceFlinger session\n");
      return false;
    }
  }

  if(mSurfaceControl == NULL)
  {
    uint32_t flags = 0;
    DisplayInfo dinfo;
    status_t status;
    int pixelFormat;

    status = mSession->getDisplayInfo(0, &dinfo);
    if(status)
    {
      warn("Failed to obtain display information\n");
      return false;
    }

    if((unsigned int)target_width > dinfo.w)
      target_width = dinfo.w;

    if((unsigned int)target_height > dinfo.h)
      target_height = dinfo.h;

    if(depth == 32)
      pixelFormat = PIXEL_FORMAT_RGBA_8888;
    else
      pixelFormat = PIXEL_FORMAT_RGB_565;

    // FIXME: Don't assume GL renderers
    flags |= ISurfaceComposer::eHardware | ISurfaceComposer::eGPU;

    mSurfaceControl = mSession->createSurface(getpid(), 0,
     target_width, target_height, pixelFormat, flags);
    if(mSurfaceControl == NULL)
    {
      warn("Failed to create surface control\n");
      return false;
    }

    debug("Asked SurfaceFlinger for a %dx%d (format %d) surface\n",
          target_width, target_height, pixelFormat);

    if(fullscreen)
    {
      mSession->openTransaction();
      mSurfaceControl->setLayer(0x40000000);
      mSession->closeTransaction();
    }
  }

  if(mSurface == NULL)
  {
    mSurface = mSurfaceControl->getSurface();
    assert(mSurface != NULL);
  }

  return true;
}

extern "C" void SurfaceFlingerDeinitialize(void)
{
  if(mSurface != NULL)
  {
    mSurface.clear();
    mSurface = NULL;
  }

  if(mSurfaceControl != NULL)
  {
    mSurfaceControl.clear();
    mSurfaceControl = NULL;
  }

  if(mSession != NULL)
  {
    mSession = NULL;
    IPCThreadState::self()->stopProcess();
  }
}

extern "C" NativeWindowType SurfaceFlingerGetNativeWindow(void)
{
  assert(mSurface != NULL);
  return mSurface.get();
}

extern "C" void SurfaceFlingerSetSwapRectangle(int x, int y, int w, int h)
{
  assert(mSurface != NULL);
  const android::Rect r(x, y, 0 + w, 0 + h);
  mSurface->setSwapRectangle(r);
  debug("Set swap rectangle (%d,%d) [%d,%d]\n", r.left, r.top, r.width(), r.height());
}

} // namespace android


code:
/* MegaZeux
 *
 * Copyright (C) 2009 Alistair John Strachan <alistair@devzero.co.uk>
 *
 * 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 __SFWRAPPER_H
#define __SFWRAPPER_H

#include "compat.h"

__M_BEGIN_DECLS

#include <EGL/egl.h>

bool SurfaceFlingerInitialize(int target_width, int target_height, int depth,
 bool fullscreen);
void SurfaceFlingerDeinitialize(void);
EGLNativeWindowType SurfaceFlingerGetNativeWindow(void);
void SurfaceFlingerSetSwapRectangle(int x, int y, int w, int h);

__M_END_DECLS

#endif // __SFWRAPPER_H


code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleExecutable</key>
	<string>MZXRun</string>
	<key>CFBundleIconFile</key>
	<string>MegaZeux</string>
	<key>CFBundleIdentifier</key>
	<string>MZXRun</string>
	<key>CFBundleName</key>
	<string>MZXRun</string>
</dict>
</plist>


code:
#
# OS X makefile generics
#

STRIP   ?= strip

CROSS_COMPILE_X86_CC  ?= i686-apple-darwin10-gcc-4.2.1
CROSS_COMPILE_X86_CXX ?= i686-apple-darwin10-g++-4.2.1
CROSS_COMPILE_PPC_CC  ?= powerpc-apple-darwin10-gcc-4.2.1
CROSS_COMPILE_PPC_CXX ?= powerpc-apple-darwin10-g++-4.2.1

ifeq (${ARCH},)
ARCH := i686
endif

ifeq (${ARCH},i686)
CC        := ${CROSS_COMPILE_X86_CC}  -mmacosx-version-min=10.4
CXX       := ${CROSS_COMPILE_X86_CXX} -mmacosx-version-min=10.4
REAL_ARCH := i686
else

ifeq (${ARCH},amd64)
CC        := ${CROSS_COMPILE_X86_CC}  -m64 -mmacosx-version-min=10.5
CXX       := ${CROSS_COMPILE_X86_CXX} -m64 -mmacosx-version-min=10.5
REAL_ARCH := amd64
else

ifeq (${ARCH},ppc)
CC        := ${CROSS_COMPILE_PPC_CC}  -mmacosx-version-min=10.4
CXX       := ${CROSS_COMPILE_PPC_CXX} -mmacosx-version-min=10.4
REAL_ARCH := ppc
else

ifeq (${ARCH},ppc64)
CC        := ${CROSS_COMPILE_PPC_CC}  -m64 -mmacosx-version-min=10.4
CXX       := ${CROSS_COMPILE_PPC_CXX} -m64 -mmacosx-version-min=10.4
REAL_ARCH := ppc64
else

REAL_ARCH := $(error Invalid architecture selection)
endif
endif
endif
endif

DSOLDFLAGS = -dynamiclib
DSOPRE     = lib
DSOPOST    = .dylib
DSORPATH   =
DSOSONAME  = -install_name @executable_path/

SDL_CFLAGS  ?= `${PREFIX}/bin/sdl-config --cflags`
SDL_LDFLAGS ?= `${PREFIX}/bin/sdl-config --libs`

LIBPNG_CFLAGS  ?= `${PREFIX}/bin/libpng-config --cflags`
LIBPNG_LDFLAGS ?= `${PREFIX}/bin/libpng-config --ldflags`

arch/darwin/SDLMain.o: arch/darwin/SDLMain.m
	$(if ${V},,@echo "  CC      " $<)
	${CC} -MD ${CFLAGS} ${SDL_CFLAGS} -c $< -o $@

package: all
	${MV} ${core_target} ${core_target}.${REAL_ARCH}
	${MV} ${editor_target} ${editor_target}.${REAL_ARCH}
	${MV} ${mzx} ${mzx}.${REAL_ARCH}
	${MV} ${mzxrun} ${mzxrun}.${REAL_ARCH}

clean:
	${RM} arch/darwin/SDLMain.o arch/darwin/SDLMain.d

package_clean: clean
	${RM} ${core_target}.${REAL_ARCH}
	${RM} ${editor_target}.${REAL_ARCH}
	${RM} ${network_target}.${REAL_ARCH}
	${RM} ${mzx}.${REAL_ARCH}
	${RM} ${mzxrun}.${REAL_ARCH}

lipo:
	@arch/darwin/lipo.sh

dist:
	@${CP} platform.inc platform.inc.orig
	@sed 's,blah,${HOME}/workspace/build-i686,g' \
	     platform.inc.orig >platform.inc
	@${MAKE} ARCH=i686 package
	@${MAKE} ARCH=i686 clean
	@sed 's,blah,${HOME}/workspace/build-powerpc,g' \
	     platform.inc.orig >platform.inc
	@${MAKE} ARCH=ppc package
	@${MAKE} ARCH=ppc clean
	@${MAKE} lipo

build := build/${SUBPLATFORM}/MegaZeux.app/Contents/Resources
build:
	${MKDIR} ${build}/../MacOS
	${CP} arch/darwin/MegaZeux.plist ${build}/../Info.plist
	${CP} contrib/icons/quantump.icns ${build}/MegaZeux.icns
	${RM} ${build}/*.debug ${build}/utils/*.debug
	${MV} ${build}/docs ${build}/../../..
	${MV} ${build}/${mzx} ${build}/../MacOS/MegaZeux
	${MV} ${build}/${mzxrun} ${build}/../MacOS/MZXRun
	${MV} ${build}/*.dylib ${build}/../MacOS
	${LN} -s MegaZeux.app/Contents/Resources/config.txt ${build}/../../..
	${MKDIR} -p ${build}/../../../MZXRun.app/Contents
	${CP} arch/darwin/MZXRun.plist \
		${build}/../../../MZXRun.app/Contents/Info.plist
	${LN} -s ../../MegaZeux.app/Contents/Resources \
		${build}/../../../MZXRun.app/Contents/Resources
	${LN} -s ../../MegaZeux.app/Contents/MacOS \
		${build}/../../../MZXRun.app/Contents/MacOS

archive: build
	@arch/darwin/dmg.sh ${TARGET}


code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleExecutable</key>
	<string>MegaZeux</string>
	<key>CFBundleIconFile</key>
	<string>MegaZeux</string>
	<key>CFBundleIdentifier</key>
	<string>MegaZeux</string>
	<key>CFBundleName</key>
	<string>MegaZeux</string>
</dict>
</plist>


code:
BUILDING MEGAZEUX ON OS X

If you are building on the Darwin 10 platform (OS 10.6 or higher) you can build
MegaZeux without using Xcode by following the instructions in this file. The
resulting package will be a universal binary containing ppc and i686 code.

PREREQUISITES

You must build static library versions of SDL, libpng, Ogg & Vorbis and
have them installed to a common prefix. The following command lines to
`configure' are recommended:

i686:

CC="i686-apple-darwin10-gcc-4.2.1" CFLAGS="-O2 -mmacosx-version-min=10.4" \
LDFLAGS="" ./configure --prefix=$HOME/workspace/build-i686 \
                       --disable-shared --enable-static \
                       --target=i686-apple-darwin10 \
                       --host=i686-apple-darwin10

powerpc:

CC="powerpc-apple-darwin10-gcc-4.2.1" CFLAGS="-O2 -mmacosx-version-min=10.4" \
LDFLAGS="" ./configure --prefix=$HOME/workspace/build-powerpc \
                       --disable-shared --enable-static \
                       --target=powerpc-apple-darwin10 \
                       --host=powerpc-apple-darwin10

Similar command lines can be used for AMD64 and PPC64, but these are not
typically built.

CONFIGURATION

The only tested config.sh line used to build for OS X is:

./config.sh --platform darwin --prefix blah \
            --disable-utils --disable-x11 --enable-release

(X11 support is disabled because it is incompatible with the Framework SDL
 package. If this bug is corrected, it can be re-enabled.)

BUILDING (i686)

You need Xcode's development tools package to have been installed. This does
NOT mean you need all of the Xcode IDE, but you do need the DMG file it is
installed from. This is normally included on your OS X install DVD #1. It is
enough to install the UNIX tools.

make ARCH=i686 package
make distclean

Will build the i686 binary, and put it in the root as "mzxgit.i686". It will
also clean the source tree, which is VERY IMPORTANT.

BUILDING (ppc)

This step is optional, but if you want to support G4 Macs running 10.4, you
need to do this.

make ARCH=ppc package
make distclean

Will build the ppc binary, and put it in the root as "mzxgit.ppc". It will
also clean the source tree, which is VERY IMPORTANT.

BUILDING AMD64/PPC64

The instructions above can also be repeated with ARCH=amd64 and ARCH=ppc64 for
64bit binaries (this may improve performance, but it is not necessary).

PACKAGING (+ UNIVERSAL BINARIES)

Simply run:

make lipo
make archive

This will output a file to the "build/dist/darwin" directory at the top level.
One of these is an installable universal Disk iMaGe.

--ajs (20091225)

path: arch/darwin/README


code:
/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
       Non-NIB-Code & other changes: Max Horn <max@quendi.de>

    Feel free to customize this file to suit your needs
*/

#import <Cocoa/Cocoa.h>

@interface SDLMain : NSObject
@end


code:
/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
       Non-NIB-Code & other changes: Max Horn <max@quendi.de>

    Feel free to customize this file to suit your needs
*/

#import "SDL.h"
#import "SDLMain.h"
#import <sys/param.h> /* for MAXPATHLEN */
#import <unistd.h>

/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
 but the method still is there and works. To avoid warnings, we declare
 it ourselves here. */
@interface NSApplication(SDL_Missing_Methods)
- (void)setAppleMenu:(NSMenu *)menu;
@end

/* Use this flag to determine whether we use SDLMain.nib or not */
#define		SDL_USE_NIB_FILE	0

/* Use this flag to determine whether we use CPS (docking) or not */
#define		SDL_USE_CPS		1
#ifdef SDL_USE_CPS
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
	UInt32		lo;
	UInt32		hi;
} CPSProcessSerNum;

extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);

#endif /* SDL_USE_CPS */

static int    gArgc;
static char  **gArgv;
static BOOL   gFinderLaunch;
static BOOL   gCalledAppMainline = FALSE;

static NSString *getApplicationName(void)
{
    NSDictionary *dict;
    NSString *appName = 0;

    /* Determine the application name */
    dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    if (dict)
        appName = [dict objectForKey: @"CFBundleName"];

    if (![appName length])
        appName = [[NSProcessInfo processInfo] processName];

    return appName;
}

#if SDL_USE_NIB_FILE
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
#endif

@interface SDLApplication : NSApplication
@end

@implementation SDLApplication
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
    /* Post a SDL_QUIT event */
    SDL_Event event;
    event.type = SDL_QUIT;
    SDL_PushEvent(&event);
}
@end

/* The main class of the application, the application's delegate */
@implementation SDLMain

/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
    if (shouldChdir)
    {
        char parentdir[MAXPATHLEN];
		CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
		CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
		if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
	        assert ( chdir (parentdir) == 0 );   /* chdir to the binary app's parent */
		}
		CFRelease(url);
		CFRelease(url2);
	}

}

#if SDL_USE_NIB_FILE

/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
    NSRange aRange;
    NSEnumerator *enumerator;
    NSMenuItem *menuItem;

    aRange = [[aMenu title] rangeOfString:@"SDL App"];
    if (aRange.length != 0)
        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];

    enumerator = [[aMenu itemArray] objectEnumerator];
    while ((menuItem = [enumerator nextObject]))
    {
        aRange = [[menuItem title] rangeOfString:@"SDL App"];
        if (aRange.length != 0)
            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
        if ([menuItem hasSubmenu])
            [self fixMenu:[menuItem submenu] withAppName:appName];
    }
    [ aMenu sizeToFit ];
}

#else

static void setApplicationMenu(void)
{
    /* warning: this code is very odd */
    NSMenu *appleMenu;
    NSMenuItem *menuItem;
    NSString *title;
    NSString *appName;

    appName = getApplicationName();
    appleMenu = [[NSMenu alloc] initWithTitle:@""];

    /* Add menu items */
    title = [@"About " stringByAppendingString:appName];
    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];

    [appleMenu addItem:[NSMenuItem separatorItem]];

    title = [@"Hide " stringByAppendingString:appName];
    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];

    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];

    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];

    [appleMenu addItem:[NSMenuItem separatorItem]];

    title = [@"Quit " stringByAppendingString:appName];
    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];

    /* Put menu into the menubar */
    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
    [menuItem setSubmenu:appleMenu];
    [[NSApp mainMenu] addItem:menuItem];

    /* Tell the application object that this is now the application menu */
    [NSApp setAppleMenu:appleMenu];

    /* Finally give up our references to the objects */
    [appleMenu release];
    [menuItem release];
}

/* Create a window menu */
static void setupWindowMenu(void)
{
    NSMenu      *windowMenu;
    NSMenuItem  *windowMenuItem;
    NSMenuItem  *menuItem;

    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];

    /* "Minimize" item */
    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
    [windowMenu addItem:menuItem];
    [menuItem release];

    /* Put menu into the menubar */
    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
    [windowMenuItem setSubmenu:windowMenu];
    [[NSApp mainMenu] addItem:windowMenuItem];

    /* Tell the application object that this is now the window menu */
    [NSApp setWindowsMenu:windowMenu];

    /* Finally give up our references to the objects */
    [windowMenu release];
    [windowMenuItem release];
}

/* Replacement for NSApplicationMain */
static void CustomApplicationMain (int argc, char **argv)
{
    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
    SDLMain				*sdlMain;

    /* Ensure the application object is initialised */
    [SDLApplication sharedApplication];

#ifdef SDL_USE_CPS
    {
        CPSProcessSerNum PSN;
        /* Tell the dock about us */
        if (!CPSGetCurrentProcess(&PSN))
            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
                if (!CPSSetFrontProcess(&PSN))
                    [SDLApplication sharedApplication];
    }
#endif /* SDL_USE_CPS */

    /* Set up the menubar */
    [NSApp setMainMenu:[[NSMenu alloc] init]];
    setApplicationMenu();
    setupWindowMenu();

    /* Create SDLMain and make it the app delegate */
    sdlMain = [[SDLMain alloc] init];
    [NSApp setDelegate:sdlMain];

    /* Start the main event loop */
    [NSApp run];

    [sdlMain release];
    [pool release];
}

#endif

/*
 * Catch document open requests...this lets us notice files when the app
 *  was launched by double-clicking a document, or when a document was
 *  dragged/dropped on the app's icon. You need to have a
 *  CFBundleDocumentsType section in your Info.plist to get this message,
 *  apparently.
 *
 * Files are added to gArgv, so to the app, they'll look like command line
 *  arguments. Previously, apps launched from the finder had nothing but
 *  an argv[0].
 *
 * This message may be received multiple times to open several docs on launch.
 *
 * This message is ignored once the app's mainline has been called.
 */
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
    const char *temparg;
    size_t arglen;
    char *arg;
    char **newargv;

    if (!gFinderLaunch)  /* MacOS is passing command line args. */
        return FALSE;

    if (gCalledAppMainline)  /* app has started, ignore this document. */
        return FALSE;

    temparg = [filename UTF8String];
    arglen = SDL_strlen(temparg) + 1;
    arg = (char *) SDL_malloc(arglen);
    if (arg == NULL)
        return FALSE;

    newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
    if (newargv == NULL)
    {
        SDL_free(arg);
        return FALSE;
    }
    gArgv = newargv;

    SDL_strlcpy(arg, temparg, arglen);
    gArgv[gArgc++] = arg;
    gArgv[gArgc] = NULL;
    return TRUE;
}

/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
    int status;

    /* Set the working directory to the .app's parent directory */
    [self setupWorkingDirectory:gFinderLaunch];

#if SDL_USE_NIB_FILE
    /* Set the main menu to contain the real app name instead of "SDL App" */
    [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
#endif

    /* Hand off to main application code */
    gCalledAppMainline = TRUE;
    status = SDL_main (gArgc, gArgv);

    /* We're done, thank you for playing */
    exit(status);
}
@end

@implementation NSString (ReplaceSubString)

- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
    unsigned int bufferSize;
    unsigned int selfLen = [self length];
    unsigned int aStringLen = [aString length];
    unichar *buffer;
    NSRange localRange;
    NSString *result;

    bufferSize = selfLen + aStringLen - aRange.length;
    buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));

    /* Get first part into buffer */
    localRange.location = 0;
    localRange.length = aRange.location;
    [self getCharacters:buffer range:localRange];

    /* Get middle part into buffer */
    localRange.location = 0;
    localRange.length = aStringLen;
    [aString getCharacters:(buffer+aRange.location) range:localRange];

    /* Get last part into buffer */
    localRange.location = aRange.location + aRange.length;
    localRange.length = selfLen - localRange.location;
    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];

    /* Build output string */
    result = [NSString stringWithCharacters:buffer length:bufferSize];

    NSDeallocateMemoryPages(buffer, bufferSize);

    return result;
}

@end

#ifdef main
#  undef main
#endif

/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
    /* Copy the arguments into a global variable */
    /* This is passed if we are launched by double-clicking */
    if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
        gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
        gArgv[0] = argv[0];
        gArgv[1] = NULL;
        gArgc = 1;
        gFinderLaunch = YES;
    } else {
        int i;
        gArgc = argc;
        gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
        for (i = 0; i <= argc; i++)
            gArgv[i] = argv[i];
        gFinderLaunch = NO;
    }

#if SDL_USE_NIB_FILE
    [SDLApplication poseAsClass:[NSApplication class]];
    NSApplicationMain (argc, argv);
#else
    CustomApplicationMain (argc, argv);
#endif
    return 0;
}


code:
#!/bin/sh

TARGET=$1

BASEDIR=build/dist/darwin
DMGNAME=${BASEDIR}/${TARGET}.dmg
VOLNAME=MegaZeux

mkdir -p ${BASEDIR}
hdiutil create $DMGNAME -size 10m -fs HFS+ \
                        -volname "$VOLNAME" -layout SPUD &&
DEV_HANDLE=`hdid $DMGNAME | grep Apple_HFS | \
            perl -e '\$_=<>; /^\\/dev\\/(disk.)/; print \$1'`
ditto -rsrcFork build/darwin /Volumes/$VOLNAME &&
hdiutil detach $DEV_HANDLE &&

hdiutil convert $DMGNAME -format UDZO -o $DMGNAME.compressed &&
mv -f $DMGNAME.compressed.dmg $DMGNAME


code:
#!/bin/sh

#
# Lipo all the binaries together, if not already done
#
for FILE in megazeux mzxrun libcore.dylib \
            libeditor.dylib; do
	[ -f ${FILE} ] && continue

	if [ ! -f ${FILE}.i686 -a ! -f ${FILE}.ppc ]; then
		echo "Neither ${FILE}.i686 nor ${FILE}.ppc are present!"
		breakout 4
	fi

	if [ -f ${FILE}.i686 -a ! -f ${FILE}.ppc ]; then
		mv ${FILE}.i686 ${FILE}
	elif [ -f ${FILE}.ppc -a ! -f ${FILE}.i686 ]; then
		mv ${FILE}.ppc ${FILE}
	else
		lipo -create ${FILE}.i686 ${FILE}.ppc -output ${FILE}
		rm -f ${FILE}.i686 ${FILE}.ppc
	fi

	if [ ! -f ${FILE} ]; then
		echo "Failed to compile '${FILE}'.."
		breakout 5
	fi
done


code:
#
# gp2x makefile generics
#

CC      = arm-open2x-linux-gcc
CXX     = arm-open2x-linux-g++
STRIP   = arm-open2x-linux-strip --strip-unneeded
OBJCOPY = arm-open2x-linux-objcopy

BINEXT = .gpe

#
# GP2X binaries must be statically linked.
#
LIBPNG_LDFLAGS = `libpng12-config --static --ldflags`
ARCH_EXE_LDFLAGS = -static

#
# There's a couple of other packaged files on GP2X
#
build: ${build}
	${RM} ${build}/${mzxrun}.debug
	${CP} arch/gp2x/pad.config ${build}
	-@convert -scale 32x32 contrib/icons/quantump.png ${build}/mzxrun.png

include arch/zip.inc


code:
MEGAZEUX ON GP2X

As of MegaZeux 2.81g, Simon Parzer donated a port of MegaZeux to the GP2X. It
has a few limitations, namely video (which has to be scaled down to 320x240),
some minor performance issues and missing keyboard controls.

It does however support playing MegaZeux games with support for sound effects
and music. Several popular titles have been tested.

CONFIGURATION

The GP2X port will override the default audio_buffer to 128 samples; there is
no need to set it explicitly in the config.txt. Also, the gp2x renderer will
be automatically selected; there is no need to set it explicitly in the
config.txt.

The file pad.config must be included in the distribution and copied from
arch/gp2x. This file contains necessary pad mappings for the GP2X controls.

COMPILATION

The only support toolchain for GP2X is the Open2X toolchain. It must be
installed andadded to your environment's PATH variable. For example, if
you have `arm-open2x-linux-gcc' in /usr/arm-linux/bin, you should do
the following:

  export PATH=/usr/arm-linux/bin:$PATH

It is now necessary to compile `SDL', `libmikmod' and `tremor'. Compilation
of these libraries is not covered in this document. It may also be possible
to use the pre-compiled libraries come with your toolchain.

  http://libsdl.org/ (1.2.10 or later)
  http://mikmod.raphnet.net/ (3.1.11 or later)
  http://svn.xiph.org/trunk/Tremor/

Now you must run `config.sh'. The configuration script (config.sh) for the GP2X
platform assumes that --prefix will specify the path to the GP2X SDK. For
example, if you have the SDK installed to $TOOLCHAIN, you should specify:

  ./config.sh --platform gp2x --prefix $TOOLCHAIN --optimize-size \
              --disable-editor --disable-helpsys --disable-utils \
              --enable-mikmod --enable-release --enable-meter

The configuration script will automatically enable/disable other flags on this
platform; do not vary the command above, other than to change the prefix. The
flag `--enable-mikmod' may be replaced with `--disable-audio' if you wish to
disable audio support.

You may now type `make' as normal to contruct a suitable binary for the GP2X.

PACKAGING THE BUILD

You can then use "make archive" to build a build/dist/gp2x/mzxgit-gp2x.zip
file for distribution.

--ajs.


code:
# 1 Up
# 2 Up-Left
# 3 Left
# 4 Down-Left
# 5 Down
# 6 Down-Right
# 7 Right
# 8 Up-Right
# 9 Start
# 10 Select
# 11 L
# 12 R
# 13 A
# 14 B
# 15 X
# 16 Y
# 17 Vol+
# 18 Vol-

# Enter:   13
# Escape:  27
# Space:   32
# Delete:  127
# p:       112
# F3:      284
# F4:      285
# 0 - 9:   48 - 57
# Up:      273
# Down:    274
# Left:    276
# Right:   275

#GP2X Joybutton config
# JOYUP = KEY_UP
joy1button1 = 273
# JOYDOWN = KEY_DOWN
joy1button5 = 274
# JOYLEFT = KEY_LEFT
joy1button3 = 276
# JOYRIGHT = KEY_RIGHT
joy1button7 = 275
# B = KEY_SPACE
joy1button14 = 32
# START = KEY_ESCAPE
joy1button9 = 27
# SELECT = KEY_P
joy1button10 = 112
# A = KEY_A
joy1button13 = 97
# X = KEY_S
joy1button15 = 115
# Y = KEY_D
joy1button16 = 100
# L = KEY_RETURN
joy1button11 = 13
# R = KEY_F2
joy1button12 = 283
# Vol- = KEY_F3
joy1button18 = 284
# Vol+ = KEY_F4
joy1button17 = 285


code:
archive: build
	${RM} -r build/dist/${SUBPLATFORM}
	${MKDIR} -p build/dist/${SUBPLATFORM}
	@cd build/${SUBPLATFORM} && \
	 lha a ../dist/${SUBPLATFORM}/${TARGET}-${SUBPLATFORM}.lha *


code:
#!/bin/sh

if [ "$1" = "" ]; then
	echo "usage: $0 [build dir]"
	exit 0
fi

cd $1

rm -f manifest.txt

for file in `find -mindepth 1 -type f -not -name config.txt \
                                      -not -name pad.config | sort`; do
	size=`du -b $file | cut -f1`
	sha256sum=`sha256sum -b $file | cut -f1 -d\ `
	echo $sha256sum $size `echo $file | sed 's,\.\/,,'` \
		>> manifest.txt
done


code:
#
# mingw makefile generics
#

CC      = ${MINGWBASE}gcc
CXX     = ${MINGWBASE}g++
AR      = ${MINGWBASE}ar
OBJCOPY = ${MINGWBASE}objcopy
STRIP   = ${MINGWBASE}strip --strip-unneeded
WINDRES = ${MINGWBASE}windres
PEFIX   = ${pefix}

BINEXT  = .exe

DSOLDFLAGS = -shared
DSOPRE     =
DSOPOST    = .dll
DSORPATH   =
DSOSONAME  = -Wl,-soname,

# Use MSVCRT directly for stdio; it's faster
ARCH_CFLAGS   += -D__USE_MINGW_ANSI_STDIO=0
ARCH_CXXFLAGS += -D__USE_MINGW_ANSI_STDIO=0

# Fix MINGW's shared library fanaticism
ARCH_LDFLAGS += -static-libstdc++ -static-libgcc

# OpenGL must be linked to MZX
core_ldflags += -lopengl32

# Windows needs PNG to be statically linked (inc. zlib)
LIBPNG_LDFLAGS = `libpng-config --static --ldflags`

ifdef DEBUG
ARCH_LDFLAGS += -mconsole
endif

pefix := arch/mingw/pefix${BINEXT}

-include arch/mingw/pefix.d

arch/mingw/pefix.o: arch/mingw/pefix.c
	$(if ${V},,@echo "  CC      " $<)
	${HOST_CC} -MD ${CFLAGS} -c $< -o $@

${pefix}: arch/mingw/pefix.o
	$(if ${V},,@echo "  LINK    " ${pefix})
	${HOST_CC} arch/mingw/pefix.o -o ${pefix}

all: ${pefix}

clean:
	${RM} -f ${pefix} arch/mingw/pefix.o arch/mingw/pefix.d

#
# Windows builds must copy SDL.dll and create a directx.bat
#
build: ${build}
	${CP} ${shell sdl-config --prefix}/bin/SDL.dll ${build}
	${PEFIX} ${build}/SDL.dll
	${CP} arch/mingw/directx.bat ${build}
ifeq (${BUILD_UTILS},1)
	${CP} arch/mingw/checkres* ${build}/utils
endif
	@arch/manifest.sh ${build}

SUBARCH := ${shell echo ${SUBPLATFORM} | sed 's,windows-,,'}
include arch/zip.inc


code:
checkres overview:
------------------

checkres is a utility that scans an mzx world and finds all of the resources it
relies on.  This means files such as palettes, character sets, modules and
sound effects, as referenced in robotic commands such as LOAD PAL,
LOAD CHAR SET, MOD, SAM, etc.  It also finds references to FILE_OPEN,
LOAD_ROBOT, and more.  What's more, checkres determines if any of those
resources are missing, and informs you of that fact.

checkres usage:
---------------

checkres can be used either via the batch script included or through the
command prompt, as demonstrated by these examples.

	c:\mzx>checkres.bat world.mzx
	Scanning world.mzx...
	missing.sam - NOT FOUND
	title.pal - NOT FOUND
	Press any key to continue...

This also means that you can drag a world file to the batch file icon, and
it'll work perfectly.  In fact, the batch file can accept as many worlds as
you like on the command line, like so:

	c:\mzx>checkres.bat world.mzx world2.mzx world3.mzx

checkres also supports reading zip files to ensure that all resources are
present in the archive.  This is extremely simple to do:

	c:\mzx>checkres.bat world.zip

Finally, checkres supports two options to enhance your resource checking
abilities, -q (quiet) and -a (all).  These can be used like so:

	c:\mzx>checkres.bat -q world.mzx
	Scanning world.mzx...
	missing.sam
	title.pal
	Press any key to continue...

	c:\mzx>checkres.bat -a world.mzx
	Scanning world.mzx...
	missing.sam - NOT FOUND
	music.mod - FOUND
	title.pal - NOT FOUND
	graphics.chr - FOUND
	Press any key to continue...

	c:\mzx>checkres.bat -a -q world.mzx
	Scanning world.mzx...
	missing.sam
	music.mod
	title.pal
	graphics.chr
	Press any key to continue...

This covers all the possibilities of checkres.

checkres conclusion:
--------------------

checkres is a product of ajs and Revvy, and the source for those not win32
inclined is available at:

http://github.com/ajs1984/megazeux/raw/master/src/utils/checkres.c

Copyright (c) 2007 Josh Matthews (mrlachatte@gmail.com)


code:
@REM (C) 2007 Josh Matthews (mrlachatte@gmail.com)
@echo off
set flags=
:args
if "%1"=="-a" (
  set flags=%flags% -a
  shift
)
if "%1"=="-q" (
  set flags=%flags% -q
  shift
)
set ftemp=%1
if "%ftemp:~0,1%"=="-" goto args
:loop
if "%1"=="" goto end
echo Scanning %1...
checkres.exe %flags% %1
shift
pause
goto loop
:end


code:
set SDL_VIDEODRIVER=directx
start "" "%cd%\megazeux.exe"


code:
; MegaZeux NSIS script

!include "MUI2.nsh"

!define srcdir "dist/mzx282"
!define setup "mzx282-x86.exe"
!define exec "mzx282.exe"

!define prodname "MegaZeux"
!define icon "contrib/icons/quantump.ico"

!define regkey "Software\${prodname}"
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"

!define startmenu "$SMPROGRAMS\${prodname}"
!define uninstaller "uninstall.exe"

!define website "http://digitalmzx.net/"

;--------------------------------

XPStyle on

ShowInstDetails hide
ShowUninstDetails hide

Name "${prodname}"
Caption "${prodname}"
OutFile "${setup}"

SetDateSave on
CRCCheck on
SilentInstall normal

SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On

InstallDir "$PROGRAMFILES\${prodname}"
InstallDirRegKey HKLM "${regkey}" ""

RequestExecutionLevel admin

!define MUI_ABORTWARNING

!define MUI_ICON ${icon}
!define MUI_UNICON ${icon}

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

;--------------------------------

; Installer

Section

  WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
  WriteRegStr HKLM "${uninstkey}" "DisplayName" "${prodname} (remove only)"
  WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'

  SetOutPath $INSTDIR

  ; package all files, recursively, preserving attributes
  ; assume files are in the correct places
  File /r "${srcdir}/*"

  WriteUninstaller "${uninstaller}"

SectionEnd

; Start Menu

Section

  CreateDirectory "${startmenu}"
  SetOutPath $INSTDIR ; for working directory
  CreateShortCut "${startmenu}\${prodname}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\${exec}"

  WriteINIStr "${startmenu}\web site.url" "InternetShortcut" "URL" ${website}

SectionEnd

; Uninstaller

UninstallText "This will uninstall ${prodname}."

Section "Uninstall"

  DeleteRegKey HKLM "${uninstkey}"
  DeleteRegKey HKLM "${regkey}"

  Delete "${startmenu}\*.*"
  Delete "${startmenu}"

  RMDir /r "$INSTDIR"

SectionEnd


code:
/**
 * This tool modifies standard Microsoft PE32 and PE32+ (Portable Executable)
 * files on the i386 and AMD64 platforms, such that two identical programs
 * compiled with identical compilers produce an identical binary. Generally,
 * PE binaries are not identical, because TimeDateStamp (which changes
 * continuously) is used in several mandatory executable sections.
 *
 * Apart from the main PE32 header, it is also necessary to modify the
 * optional .edata, .idata and .rsrc sections, since these sections' headers
 * (and in the case of .rsrc, contents) also contain TimeDateStamps.
 *
 * This program additionally works around a binutils bug which generates
 * random garbage between module names in the idata section. Normally,
 * this wouldn't affect program execution, but it does make the binaries
 * non-identical. Replacing this garbage with zeroes solves the problem.
 *
 * Finally, we take the opportunity to tweak DllCharacteristics so that
 * ASLR is enabled on newer Windows operating systems.
 *
 * Copyright (C) 2009-2010 Alistair John Strachan <alistair@devzero.co.uk>
 *
 * 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 <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>

#define SECTION_NAME_LEN 8

typedef enum
{
  SUCCESS,
  OPEN_ERROR,
  READ_ERROR,
  WRITE_ERROR,
  INVALID_MAGIC,
} error_t;

static const char *err_str(error_t err)
{
  switch(err)
  {
    case SUCCESS:
      return "Success";
    case OPEN_ERROR:
      return "Failed to open file";
    case READ_ERROR:
      return "Failure while reading from file";
    case WRITE_ERROR:
      return "Failure while writing to file";
    case INVALID_MAGIC:
      return "File magic was unrecognized or invalid";
    default:
      return "Unknown error";
  }
}

static long ftell_and_rewind(FILE *f)
{
  long size;

  fseek(f, 0, SEEK_END);
  size = ftell(f);
  rewind(f);

  return size;
}

static error_t pe_csum(FILE *f, uint32_t *csum)
{
  uint32_t sum = 0;
  long count, len;
  uint16_t w;

  len = ftell_and_rewind(f);

  for(count = len; count > 1; count -= 2)
  {
    if(fread(&w, sizeof(uint16_t), 1, f) != 1)
      return READ_ERROR;
    sum += w;
  }

  if(count == 1)
  {
    w = 0;
    if(fread(&w, sizeof(uint8_t), 1, f) != 1)
      return READ_ERROR;
    sum += w;
  }

  sum = (sum >> 16) + (sum & 0xFFFF);
  sum += (sum >> 16);

  *csum = (uint32_t)((uint16_t)sum + len);
  return SUCCESS;
}

static error_t process_rsrc(FILE *f, uint32_t rsrc_offset)
{
  uint16_t num_name, num_id, i;
  error_t err = SUCCESS;
  uint32_t ul, *dirs;

  // Skip Characteristics
  if(fseek(f, 4, SEEK_CUR))
    return READ_ERROR;

  // Re-write TimeDateStamp as zero
  ul = 0;
  if(fwrite(&ul, sizeof(uint32_t), 1, f) != 1)
    return WRITE_ERROR;

  // Skip MajorVersion, MinorVersion
  if(fseek(f, 2 + 2, SEEK_CUR))
    return READ_ERROR;

  // Read NumberOfNamedEntries
  if(fread(&num_name, sizeof(uint16_t), 1, f) != 1)
    return READ_ERROR;

  // Read NumberOfIdEntries
  if(fread(&num_id, sizeof(uint16_t), 1, f) != 1)
    return READ_ERROR;

  dirs = malloc(sizeof(uint32_t) * (num_name + num_id));

  for(i = 0; i < num_name + num_id; i++)
  {
    // Skip Name (never used)
    if(fseek(f, 4, SEEK_CUR))
    {
      err = READ_ERROR;
      goto err_free_dirs;
    }

    // Read OffsetToData
    if(fread(&dirs[i], sizeof(uint32_t), 1, f) != 1)
    {
      err = READ_ERROR;
      goto err_free_dirs;
    }
  }

  for(i = 0; i < num_name + num_id; i++)
  {
    // Data is interesting because if the high bit is set on this,
    // we need to read a subdirectory (recursively).

    if(!(dirs[i] & 0x80000000))
      continue;
    dirs[i] &= ~0x80000000;

    // Skip to the specified .rsrc subdirectory
    if(fseek(f, rsrc_offset + dirs[i], SEEK_SET))
    {
      err = READ_ERROR;
      goto err_free_dirs;
    }

    // Process the .rsrc subdirectory
    err = process_rsrc(f, rsrc_offset);
    if(err != SUCCESS)
      goto err_free_dirs;
  }

err_free_dirs:
  free(dirs);
  return err;
}

static error_t walk_rvas(FILE *f, uint16_t cpu_type,
 uint32_t virtaddr, uint32_t offset)
{
  uint32_t rva32, pad, phys, last_phys = 0;
  unsigned int i;
  uint64_t rva;
  long pos;

  while(1)
  {
    // RVAs are real virtual addresses, not just relative ones,
    // so reading them is machine specific
    if(cpu_type == 0x014c)
    {
      if(fread(&rva32, sizeof(uint32_t), 1, f) != 1)
        return READ_ERROR;
      rva = rva32;
    }
    else if(cpu_type == 0x8664)
    {
      if(fread(&rva, sizeof(uint64_t), 1, f) != 1)
        return READ_ERROR;
    }

    // Zero RVA means "stop reading"
    if(!rva)
      break;

    // Convert to file offset (physaddr)
    phys = rva - virtaddr + offset;

    // We need to have processed at least one phys
    // before pad can be computed.

    if(last_phys)
    {
      // Store current offset
      pos = ftell(f);

      // Seek to import name
      if(fseek(f, last_phys, SEEK_SET))
        return READ_ERROR;

      // Compute string length for this RVA function
      for(i = 0; ; i++)
      {
        int b = fgetc(f);
        if(b < 0)
          return READ_ERROR;

        if(i >= 2 && !b)
          break;
      }

      // Win32 I/O needs this between interleaved read/write
      if(fseek(f, ftell(f), SEEK_SET))
        return READ_ERROR;

      // Compute and rewrite pad as zero
      pad = phys - last_phys - (i + 1);
      for(i = 0; i < pad; i++)
        if(fputc(0, f) < 0)
          return WRITE_ERROR;

      // Seek back to where we were
      if(fseek(f, pos, SEEK_SET))
        return READ_ERROR;
    }

    last_phys = phys;
  }

  return SUCCESS;
}

static error_t modify_pe(FILE *f)
{
  uint32_t rsrc_offset = 0, edata_offset = 0, idata_offset = 0;
  uint16_t cpu_type, num_sections, dll_characteristics;
  char section_name[SECTION_NAME_LEN + 1];
  uint32_t ul, idata_virtaddr;
  error_t err = SUCCESS;
  long csum_offset;
  int skip = 0;

  // Check 'MZ' magic
  if(fgetc(f) != 'M')
    return INVALID_MAGIC;
  if(fgetc(f) != 'Z')
    return INVALID_MAGIC;

  // Next 58 bytes of DOS header aren't interesting
  if(fseek(f, 58, SEEK_CUR))
    return READ_ERROR;

  // Read so called 'lfanew' field; offset to PE header
  if(fread(&ul, sizeof(uint32_t), 1, f) != 1)
    return READ_ERROR;

  // Skip to lfanew offset (move us to PE header)
  if(fseek(f, ul, SEEK_SET))
    return READ_ERROR;

  // Check 'PE\x00\x00' magic
  if(fgetc(f) != 'P')
    return INVALID_MAGIC;
  if(fgetc(f) != 'E')
    return INVALID_MAGIC;
  if(fgetc(f) != 0)
    return INVALID_MAGIC;
  if(fgetc(f) != 0)
    return INVALID_MAGIC;

  // Read in Machine (we support limited CPU types)
  if(fread(&cpu_type, sizeof(uint16_t), 1, f) != 1)
    return READ_ERROR;

  // Can only support i386 and AMD64 binaries
  if(cpu_type != 0x014c && cpu_type != 0x8664)
    return INVALID_MAGIC;

  // Read NumberOfSections (used below)
  if(fread(&num_sections, sizeof(uint16_t), 1, f) != 1)
    return READ_ERROR;

  // Win32 I/O needs this between interleaved read/write
  if(fseek(f, ftell(f), SEEK_SET))
    return READ_ERROR;

  // The checksum must be rewritten as a constant value. However,
  // the logical choice of zero does not work correctly, as this
  // exposes a Windows bug which leaves the EXE open after it has
  // loaded, breaking the updater. Use the 2038 timestamp instead.
  ul = 0x7fffffff;
  if(fwrite(&ul, sizeof(uint32_t), 1, f) != 1)
    return WRITE_ERROR;

  // Skip PointerToSymbolTable, NumberOfSymbols, SizeOfOptionalHeader
  // Characteristics
  if(fseek(f, 4 + 4 + 2 + 2, SEEK_CUR))
    return READ_ERROR;

  // Skip Magic, MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
  // SizeOfInitializedData, SizeOfUninitializedData, AddressOfEntryPoint,
  // BaseOfCode, BaseOfData [i386], ImageBase*, SectionAlignment,
  // FileAlignment, MajorOperatingSystemVersion, MinorOperatingSystemVersion,
  // MajorImageVersion, MinorImageVersion, MajorSubsystemVersion,
  // MinorSubsystemVersion, Reserved1, SizeOfImage, SizeOfHeaders
  if(cpu_type == 0x014c)
    skip = 2 + 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4 +
           4 + 4 + 4 + 2 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + 4;
  else if(cpu_type == 0x8664)
    skip = 2 + 1 + 1 + 4 + 4 + 4 + 4 + 4 +
           8 + 4 + 4 + 2 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + 4;
  if(fseek(f, skip, SEEK_CUR))
    return READ_ERROR;

  // Squash obsolete Checksum with zero
  ul = 0;
  csum_offset = ftell(f);
  if(fwrite(&ul, sizeof(uint32_t), 1, f) != 1)
    return WRITE_ERROR;

  // Skip Subsystem
  if(fseek(f, 2, SEEK_CUR))
    return READ_ERROR;

  // Read DllCharacteristics
  if(fread(&dll_characteristics, sizeof(uint16_t), 1, f) != 1)
    return READ_ERROR;

  // Switch on DYNAMIC_BASE and NX_COMPAT
  dll_characteristics |= (0x40 | 0x100);

  // Roll back and re-write DllCharacteristics
  if(fseek(f, -2, SEEK_CUR))
    return READ_ERROR;
  if(fwrite(&dll_characteristics, sizeof(uint16_t), 1, f) != 1)
    return WRITE_ERROR;

  // Skip SizeOfStackReserve*, SizeOfStackCommit*, SizeOfHeapReserve*,
  // SizeOfHeapCommit*, LoaderFlags, NumberOfRvaAndSizes,
  // DataDirectory (16*(4+4))
  if(cpu_type == 0x014c)
    skip = 4 + 4 + 4 + 4 + 4 + 4 + 16 * (4 + 4);
  else if(cpu_type == 0x8664)
    skip = 8 + 8 + 8 + 8 + 4 + 4 + 16 * (4 + 4);
  if(fseek(f, skip, SEEK_CUR))
    return READ_ERROR;

  // PE Section Header processing (find .rsrc if present)
  section_name[SECTION_NAME_LEN] = 0;
  while(num_sections-- > 0)
  {
    uint32_t *offset = NULL;

    // Read the Name
    if(fread(&section_name, SECTION_NAME_LEN, 1, f) != 1)
      return READ_ERROR;

    // Skip Misc
    if(fseek(f, 4, SEEK_CUR))
      return READ_ERROR;

    // Read VirtualAddress (only needed for .idata)
    if(fread(&ul, sizeof(uint32_t), 1, f) != 1)
      return READ_ERROR;

    // Skip SizeOfRawData
    if(fseek(f, 4, SEEK_CUR))
      return READ_ERROR;

    // This isn't .rsrc so we skip PointerToRawData
    if(strcmp(section_name, ".rsrc") == 0)
      offset = &rsrc_offset;
    else if(strcmp(section_name, ".edata") == 0)
      offset = &edata_offset;
    else if(strcmp(section_name, ".idata") == 0)
    {
      offset = &idata_offset;
      idata_virtaddr = ul;
    }

    if(offset)
    {
      // Read the .rsrc PointerToRawData for this section
      if(fread(offset, sizeof(uint32_t), 1, f) != 1)
        return READ_ERROR;
    }
    else
    {
      // Skip the PointerToRawData for this section
      if(fseek(f, 4, SEEK_CUR))
        return READ_ERROR;
    }

    // Skip PointerToRelocations, PointerToLinenumbers,
    // NumberOfRelocations, NumberOfLinenumbers, Characteristics
    if(fseek(f, 4 + 4 + 2 + 2 + 4, SEEK_CUR))
      return READ_ERROR;
  }

  // PE .rsrc section handling
  if(rsrc_offset != 0)
  {
    // Reposition file pointer at (.rsrc)
    if(fseek(f, rsrc_offset, SEEK_SET))
      return READ_ERROR;

    err = process_rsrc(f, rsrc_offset);
    if(err != SUCCESS)
      return err;
  }

  // PE .edata section handling
  if(edata_offset != 0)
  {
    // Reposition file pointer at (.edata+4), Skip Characteristics
    if(fseek(f, edata_offset + 4, SEEK_SET))
      return READ_ERROR;

    // Re-write TimeDateStamp as zero (new Checksum computed later)
    ul = 0;
    if(fwrite(&ul, sizeof(uint32_t), 1, f) != 1)
      return WRITE_ERROR;
  }

  if(idata_offset != 0)
  {
    // Reposition file pointer at (.idata)
    if(fseek(f, idata_offset, SEEK_SET))
      return READ_ERROR;

    while(1)
    {
      uint32_t fnlist;
      long offset;

      // dwRVAFunctionNameList
      if(fread(&fnlist, sizeof(uint32_t), 1, f) != 1)
        return READ_ERROR;

      // Skip dwUseless1, dwUseless2, dwRVAModuleName, dwRVAFunctionAddressList
      if(fseek(f, 4 + 4 + 4 + 4, SEEK_CUR))
        return READ_ERROR;

      // Zero dwRVAFunctionNameList means there are no more modules
      if(!fnlist)
        break;

      fnlist = fnlist - idata_virtaddr + idata_offset;

      // Store current file offset
      offset = ftell(f);

      // Seek to fnlist RVAs
      if(fseek(f, fnlist, SEEK_SET))
        return READ_ERROR;

      // Walk fnlist RVAs
      err = walk_rvas(f, cpu_type, idata_virtaddr, idata_offset);
      if(err != SUCCESS)
        return err;

      // Move back to original position
      if(fseek(f, offset, SEEK_SET))
        return READ_ERROR;
    }
  }

  // Compute and write back valid checksum
  err = pe_csum(f, &ul);
  if(err != SUCCESS)
    return err;
  if(fseek(f, csum_offset, SEEK_SET))
    return READ_ERROR;
  if(fwrite(&ul, sizeof(uint32_t), 1, f) != 1)
    return WRITE_ERROR;

  return SUCCESS;
}

int main(int argc, char *argv[])
{
  error_t err = SUCCESS;
  FILE *f;

  if(argc != 2)
  {
    fprintf(stderr, "usage: %s [exe]\n", argv[0]);
    return 0;
  }

  f = fopen(argv[1], "r+b");
  if(f)
  {
    err = modify_pe(f);
    fclose(f);
  }
  else
    err = OPEN_ERROR;

  if(err != SUCCESS)
    fprintf(stderr, "Failed: %s\n", err_str(err));

  return err;
}


code:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGUID>{B4B378A1-90C6-4A5A-983B-25214A40BC78}</ProjectGUID>
    <RootNamespace>MegaZeux</RootNamespace>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>MultiByte</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>MultiByte</CharacterSet>
    <WholeProgramOptimization>false</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>MultiByte</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>MultiByte</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="PropertySheets">
    <Import Project="$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props')" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
    <_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\..\..\</OutDir>
    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\..\..\</OutDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\Core\</IntDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\Core\</IntDir>
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)</TargetName>
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
    <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.dll</TargetExt>
    <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.dll</TargetExt>
    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(SolutionDir)\..\..\</OutDir>
    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(SolutionDir)\..\..\</OutDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(Configuration)\Core\</IntDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(Configuration)\Core\</IntDir>
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(ProjectName)</TargetName>
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(ProjectName)</TargetName>
    <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|X64'">.dll</TargetExt>
    <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">.dll</TargetExt>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
      <WholeProgramOptimization>true</WholeProgramOptimization>
      <AdditionalIncludeDirectories>../../arch/msvc;Deps/include;Deps/include/SDL;Deps/include/libpng12;../../contrib/libmodplug/src;../../contrib/libmodplug/src/libmodplug;../../contrib/gdm2s3m/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <StringPooling>true</StringPooling>
      <ExceptionHandling>
      </ExceptionHandling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions> /J</AdditionalOptions>
      <WarningLevel>Level3</WarningLevel>
      <CompileAs>CompileAsC</CompileAs>
      <PreprocessorDefinitions>__WIN32__;_CRT_SECURE_NO_WARNINGS;CORE_LIBSPEC=__declspec(dllexport);NEED_PNG_WRITE_SCREEN</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <AdditionalOptions>/NODEFAULTLIB:libcmt %(AdditionalOptions)</AdditionalOptions>
      <AdditionalDependencies>libogg_static.lib;libpng15.lib;libvorbis_static.lib;libvorbisenc.lib;libvorbisfile_static.lib;SDL.lib;SDLmain.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>Deps\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(SolutionDir)\..\..\$(ProjectName).pdb</ProgramDatabaseFile>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
      <WholeProgramOptimization>false</WholeProgramOptimization>
      <AdditionalIncludeDirectories>../../arch/msvc;Deps/include;Deps/include/SDL;Deps/include/libpng12;../../contrib/libmodplug/src;../../contrib/libmodplug/src/libmodplug;../../contrib/gdm2s3m/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <StringPooling>true</StringPooling>
      <ExceptionHandling>
      </ExceptionHandling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions> /J</AdditionalOptions>
      <WarningLevel>Level3</WarningLevel>
      <CompileAs>CompileAsC</CompileAs>
      <PreprocessorDefinitions>__WIN32__;_CRT_SECURE_NO_WARNINGS;CORE_LIBSPEC=__declspec(dllexport);NEED_PNG_WRITE_SCREEN</PreprocessorDefinitions>
      <Optimization>Disabled</Optimization>
    </ClCompile>
    <Link>
      <AdditionalOptions>/NODEFAULTLIB:libcmt %(AdditionalOptions)</AdditionalOptions>
      <AdditionalDependencies>libogg_static.lib;libpng15.lib;libvorbis_static.lib;libvorbisenc.lib;libvorbisfile_static.lib;SDL.lib;SDLmain.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>Deps\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <ProgramDatabaseFile>$(SolutionDir)\..\..\$(ProjectName).pdb</ProgramDatabaseFile>
      <TargetMachine>MachineX86</TargetMachine>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
    <Midl>
      <TargetEnvironment>X64</TargetEnvironment>
    </Midl>
    <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
      <WholeProgramOptimization>true</WholeProgramOptimization>
      <AdditionalIncludeDirectories>../../arch/msvc;Deps/include;Deps/include/SDL;Deps/include/libpng12;../../contrib/libmodplug/src;../../contrib/libmodplug/src/libmodplug;../../contrib/gdm2s3m/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ExceptionHandling>
      </ExceptionHandling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions> /J</AdditionalOptions>
      <WarningLevel>Level3</WarningLevel>
      <DebugInformationFormat>
      </DebugInformationFormat>
      <CompileAs>CompileAsC</CompileAs>
      <PreprocessorDefinitions>__WIN32__;_CRT_SECURE_NO_WARNINGS;CORE_LIBSPEC=__declspec(dllexport)</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <AdditionalDependencies>libogg_static.lib;libpng15.lib;libvorbis_static.lib;libvorbisenc.lib;libvorbisfile_static.lib;SDL.lib;SDLmain.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>Deps\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <GenerateManifest>false</GenerateManifest>
      <GenerateDebugInformation>false</GenerateDebugInformation>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
    <Midl>
      <TargetEnvironment>X64</TargetEnvironment>
    </Midl>
    <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
      <WholeProgramOptimization>true</WholeProgramOptimization>
      <AdditionalIncludeDirectories>../../arch/msvc;Deps/include;Deps/include/SDL;Deps/include/libpng12;../../contrib/libmodplug/src;../../contrib/libmodplug/src/libmodplug;../../contrib/gdm2s3m/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ExceptionHandling>
      </ExceptionHandling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <FloatingPointModel>Fast</FloatingPointModel>
      <AdditionalOptions> /J</AdditionalOptions>
      <WarningLevel>Level3</WarningLevel>
      <DebugInformationFormat>
      </DebugInformationFormat>
      <CompileAs>CompileAsC</CompileAs>
      <PreprocessorDefinitions>__WIN32__;_CRT_SECURE_NO_WARNINGS;CORE_LIBSPEC=__declspec(dllexport)</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <AdditionalDependencies>libogg_static.lib;libpng15.lib;libvorbis_static.lib;libvorbisenc.lib;libvorbisfile_static.lib;SDL.lib;SDLmain.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>Deps\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <GenerateManifest>false</GenerateManifest>
      <GenerateDebugInformation>false</GenerateDebugInformation>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="..\..\contrib\gdm2s3m\src\error.c">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
    </ClCompile>
    <ClCompile Include="..\..\contrib\gdm2s3m\src\gdm.c">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
    </ClCompile>
    <ClCompile Include="..\..\contrib\gdm2s3m\src\gdm2s3m.c">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
    </ClCompile>
    <ClCompile Include="..\..\contrib\gdm2s3m\src\s3m.c">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
    </ClCompile>
    <ClCompile Include="..\..\contrib\gdm2s3m\src\utility.c">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)gdm2s3m\</ObjectFileName>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\fastmix.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_669.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_amf.cpp">
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_dsm.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_far.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_it.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_med.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_mod.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_mtm.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_okt.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_s3m.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_stm.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_ult.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_wav.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\load_xm.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\mmcmp.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\modplug.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\sndfile.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\sndmix.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\snd_dsp.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\snd_flt.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\contrib\libmodplug\src\snd_fx.cpp">
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">$(IntDir)libmodplug\</ObjectFileName>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\src\audio.c" />
    <ClCompile Include="..\..\src\audio_modplug.cpp">
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|X64'">CompileAsCpp</CompileAs>
      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">CompileAsCpp</CompileAs>
    </ClCompile>
    <ClCompile Include="..\..\src\audio_sdl.c" />
    <ClCompile Include="..\..\src\board.c" />
    <ClCompile Include="..\..\src\configure.c" />
    <ClCompile Include="..\..\src\counter.c" />
    <ClCompile Include="..\..\src\data.c" />
    <ClCompile Include="..\..\src\error.c" />
    <ClCompile Include="..\..\src\event.c" />
    <ClCompile Include="..\..\src\event_sdl.c" />
    <ClCompile Include="..\..\src\expr.c" />
    <ClCompile Include="..\..\src\fsafeopen.c" />
    <ClCompile Include="..\..\src\game.c" />
    <ClCompile Include="..\..\src\game2.c" />
    <ClCompile Include="..\..\src\graphics.c" />
    <ClCompile Include="..\..\src\helpsys.c" />
    <ClCompile Include="..\..\src\idarray.c" />
    <ClCompile Include="..\..\src\idput.c" />
    <ClCompile Include="..\..\src\intake.c" />
    <ClCompile Include="..\..\src\legacy_rasm.c" />
    <ClCompile Include="..\..\src\mzm.c" />
    <ClCompile Include="..\..\src\network\host.c" />
    <ClCompile Include="..\..\src\network\manifest.c" />
    <ClCompile Include="..\..\src\network\network.c" />
    <ClCompile Include="..\..\src\network\sha256.c" />
    <ClCompile Include="..\..\src\platform_sdl.c" />
    <ClCompile Include="..\..\src\pngops.c" />
    <ClCompile Include="..\..\src\rasm.c" />
    <ClCompile Include="..\..\src\render.c" />
    <ClCompile Include="..\..\src\render_gl.c" />
    <ClCompile Include="..\..\src\render_gl1.c" />
    <ClCompile Include="..\..\src\render_gl2.c" />
    <ClCompile Include="..\..\src\render_glsl.c" />
    <ClCompile Include="..\..\src\render_sdl.c" />
    <ClCompile Include="..\..\src\render_soft.c" />
    <ClCompile Include="..\..\src\render_yuv.c" />
    <ClCompile Include="..\..\src\render_yuv1.c" />
    <ClCompile Include="..\..\src\render_yuv2.c" />
    <ClCompile Include="..\..\src\robot.c" />
    <ClCompile Include="..\..\src\run_robot.c" />
    <ClCompile Include="..\..\src\scrdisp.c" />
    <ClCompile Include="..\..\src\sfx.c" />
    <ClCompile Include="..\..\src\sprite.c" />
    <ClCompile Include="..\..\src\util.c" />
    <ClCompile Include="..\..\src\validation.c" />
    <ClCompile Include="..\..\src\window.c" />
    <ClCompile Include="..\..\src\world.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\..\contrib\gdm2s3m\src\error.h" />
    <ClInclude Include="..\..\contrib\gdm2s3m\src\gdm.h" />
    <ClInclude Include="..\..\contrib\gdm2s3m\src\gdm2s3m.h" />
    <ClInclude Include="..\..\contrib\gdm2s3m\src\s3m.h" />
    <ClInclude Include="..\..\contrib\gdm2s3m\src\types.h" />
    <ClInclude Include="..\..\contrib\gdm2s3m\src\utility.h" />
    <ClInclude Include="..\..\contrib\libmodplug\src\libmodplug\it_defs.h" />
    <ClInclude Include="..\..\contrib\libmodplug\src\libmodplug\sndfile.h" />
    <ClInclude Include="..\..\contrib\libmodplug\src\libmodplug\stdafx.h" />
    <ClInclude Include="..\..\contrib\libmodplug\src\modplug.h" />
    <ClInclude Include="..\..\contrib\libmodplug\src\tables.h" />
    <ClInclude Include="..\..\src\audio.h" />
    <ClInclude Include="..\..\src\audio_modplug.h" />
    <ClInclude Include="..\..\src\board.h" />
    <ClInclude Include="..\..\src\board_struct.h" />
    <ClInclude Include="..\..\src\compat.h" />
    <ClInclude Include="..\..\src\configure.h" />
    <ClInclude Include="..\..\src\const.h" />
    <ClInclude Include="..\..\src\counter.h" />
    <ClInclude Include="..\..\src\counter_struct.h" />
    <ClInclude Include="..\..\src\data.h" />
    <ClInclude Include="..\..\src\error.h" />
    <ClInclude Include="..\..\src\event.h" />
    <ClInclude Include="..\..\src\expr.h" />
    <ClInclude Include="..\..\src\extmem.h" />
    <ClInclude Include="..\..\src\fsafeopen.h" />
    <ClInclude Include="..\..\src\game.h" />
    <ClInclude Include="..\..\src\game2.h" />
    <ClInclude Include="..\..\src\graphics.h" />
    <ClInclude Include="..\..\src\helpsys.h" />
    <ClInclude Include="..\..\src\idarray.h" />
    <ClInclude Include="..\..\src\idput.h" />
    <ClInclude Include="..\..\src\intake.h" />
    <ClInclude Include="..\..\src\keysym.h" />
    <ClInclude Include="..\..\src\legacy_rasm.h" />
    <ClInclude Include="..\..\src\mzm.h" />
    <ClInclude Include="..\..\src\network\host.h" />
    <ClInclude Include="..\..\src\network\manifest.h" />
    <ClInclude Include="..\..\src\network\network.h" />
    <ClInclude Include="..\..\src\network\sha256.h" />
    <ClInclude Include="..\..\src\platform.h" />
    <ClInclude Include="..\..\src\platform_endian.h" />
    <ClInclude Include="..\..\src\platform_sdl.h" />
    <ClInclude Include="..\..\src\pngops.h" />
    <ClInclude Include="..\..\src\rasm.h" />
    <ClInclude Include="..\..\src\render.h" />
    <ClInclude Include="..\..\src\renderers.h" />
    <ClInclude Include="..\..\src\render_gl.h" />
    <ClInclude Include="..\..\src\render_sdl.h" />
    <ClInclude Include="..\..\src\render_yuv.h" />
    <ClInclude Include="..\..\src\robot.h" />
    <ClInclude Include="..\..\src\robot_struct.h" />
    <ClInclude Include="..\..\src\run_robot.h" />
    <ClInclude Include="..\..\src\scrdisp.h" />
    <ClInclude Include="..\..\src\sfx.h" />
    <ClInclude Include="..\..\src\sprite.h" />
    <ClInclude Include="..\..\src\sprite_struct.h" />
    <ClInclude Include="..\..\src\util.h" />
    <ClInclude Include="..\..\src\validation.h" />
    <ClInclude Include="..\..\src\window.h" />
    <ClInclude Include="..\..\src\world.h" />
    <ClInclude Include="..\..\src\world_struct.h" />
    <ClInclude Include="config.h" />
    <ClInclude Include="dirent.h" />
    <ClInclude Include="msvc.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>