It is currently Mon May 20, 2013 3:16 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu May 31, 2012 11:57 am 
Offline
Snes9x White Belt

Joined: Thu May 31, 2012 10:12 am
Posts: 1
Location: VerĂ­n or Madrid (both Spain)
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 and png_voidp_NULL were dropped so their occurrences were changed to what they were defined, (png_infopp)NULL and (png_voidp)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 (here, 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.

Kind regards.


Attachments:
File comment: Project files and solution for VS2010.
Snes9X-VS2010.zip [12.01 KiB]
Downloaded 162 times
File comment: Update unzip code to 1.1.
unzip-1.1.patch.zip [38.81 KiB]
Downloaded 151 times
File comment: Support building against libpng 1.4+.
support_libpng_14+.patch.zip [836 Bytes]
Downloaded 150 times
Top
 Profile  
 
PostPosted: Sat Jun 02, 2012 4:23 pm 
Offline
Official Win32 Porter/Dev
User avatar

Joined: Thu Aug 30, 2007 10:15 pm
Posts: 450
Thanks. I've commited the libpng patch to git, will take a look at unzip if I can find the time.
I'll probably not commit VS2010 solutions until I finally switch myself, since I do not want to maintain two sets of project files.

A small note though: you need to force include _tfwopen.h when building zlib, otherwise the hacky utf-8 passthrough will not work when trying to open compressed files.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group