Hi, yesterday I set up a development environment for Snes9X in Windows using Visual Studio 2010 and after digging in the code a bit I ended creating 2 patches against the current development code (Git) which don't break building. The important one is Windows targeted and the other although affects all OSs doesn't matter really (although I checked it builds on Linux too with it applied). The patches are attached to this post in case you want to apply them, I'll explain them a bit:support_libpng_14+.patch
: This patch is to enable Windows builds to use libpng version 1.4+ (I used the latest as of now, 1.5.20). In libpng 1.4 the definitions of png_infopp_NULL
were dropped so their occurrences were changed to what they were defined, (png_infopp)NULL
. Also, the contents of some structures like png_info
are hidden in newer releases due to the evolution of the API and the recommended procedure is using getters and setters if the members are to be accessed. Since those accessors are present in older libpng versions as well, no breakage is introduced by using them.unzip-1.1.patch
: This patch is not really interesting, the current version of unzip residing in tree is 1.01, the code for 1.1 adds support for ZIP64 which is an extension to ZIP which enables the support for +4GB archives or files. It's useless for Snes9X since there won't be any 20MB ZIP file let alone 4GB+, but since the latest zlib sources include this version too I create that patch.
Attached to this post there are the project files and solution I created to build in Visual Studio 2010, in case they're useful. Right now they all go in the (source)\win32 directory, but if they were to be added to the repository I think it'd be better to have a "projects" directory inside of there containing them all and update the references to the files appropriately.If anybody wants to use the project files, the setup goes as follows:
- Install DirectX SDK: the release of August 2007 was the latest to include import libraries for DirectDraw (ddraw.lib) so you can either use that version or use the latest ones along with ddraw.lib from that release. I did the later, if anybody wants to do so I can send him/her the libs and skip the downloading of 400+MB. In this case the libraries can be put in "Libraries" and "Libraries-x64" directories in (source)\win32. The installation of the SDK creates an environmental variable (DXSDK_DIR) which is used for the include and libraries directories withing the project, so the place where it's installed doesn't matter.
- Install the Cg toolkit: the latest version can be used without problem, like with the DirectX SDK there are environmental variables for the include and libraries directories.
- Install FMOD Ex: the setup doesn't create an environmental variable to the installed API path (yet), the current default is to have it installed in (source)\..\FMODEx. To use the project file I provided there has to be an env. variable called FMOD_EX_API pointing to (FMODExInstallDir)\api and the patch fmod-import-system-wide.patch
, there's a limit of 3 attachments) needs to be applied. The only thing it does is changing an #include directive in CFMODEx.h.
Note for FMOD Ex: in late 2010 support for OpenAL was dropped in FMOD Ex, so if you wish to build Snes9X using any version past that date you have to change at least change line 81 of CFMODEx.cpp to replace FMOD_OUTPUTTYPE_OPENAL by FMOD_OUTPUTTYPE_WINMM for example. If OpenAL support in Snes9X were to be dropped too, I think I could write a patch to it.
- libpng: As with the current build procedure, the sources have to be in (source)\..\libpng. That's where the provided project expects them to be, or you can compile it using a different project file and put the result in "Libraries" and/or "Libraries-x64" in (source)\win32 appending 'd', 'du' or 'u' to the filename depending if it is a debug, unicode debug or unicode build.
- zlib: Same as libpng only in (source)\..\zlib.
When all that is set, open the solution file, select the configuration to build, and build the solution. The final binary would be in (source)\win32\Binaries, if you enable FMOD Ex support copy the corresponding DLL too.tl;dr:
2 patches against current git head to support libpng 1.4+ and update unzip to 1.1, procedure to build Snes9X in Visual Studio 2010 with attached projects and solution.