Difference between revisions of "Compiling ScummVM/Visual Studio/Compiling Libraries"

From ScummVM :: Wiki
Jump to navigation Jump to search
(→‎FLAC: Inlined the FLAC patch into a source code box, as the link to it is down)
m (→‎Note:: Fix casing)
 
(21 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== Instructions for compiling the needed libraries for Visual Studio yourself ==
== Using vcpkg package manager ==


=== Libraries needed ===
If you're using Visual Studio 2015 or later, [https://github.com/Microsoft/vcpkg vcpkg] is the simplest way to get the libraries compiled. It works similar to Linux package managers, but everything is locally compiled from source, so you always get binaries for the specific compiler and architecture you're using.


* [http://www.libsdl.org/download-1.2.php SDL 1.2], file SDL-devel-1.2.XX-VC8.zip (where XX is the current release number)
After following their installation instructions, just run the following command from the vcpkg folder to build the libraries:
Latest stable version at the time of writing this: [http://www.libsdl.org/release/SDL-devel-1.2.14-VC8.zip 1.2.14]


* [http://www.nasm.us/pub/nasm/releasebuilds/ NASM]
<pre>
Latest stable version at the time of writing this: [http://www.nasm.us/pub/nasm/releasebuilds/2.09.10/nasm-2.09.10.zip 2.09.10]
vcpkg install curl faad2 fluidsynth freetype fribidi giflib libflac libjpeg-turbo libmad libmikmod libmpeg2 libogg libpng libtheora libvorbis libvpx sdl2 sdl2-net zlib discord-rpc
</pre>


* [http://downloads.xiph.org/releases/ogg/ libogg] and [http://downloads.xiph.org/releases/vorbis/ libvorbis] for OGG support.
Any missing libraries are optional and currently not available in vcpkg, so you will have to build them yourself if you want to enable them.
Note that the libraries included in the "vorbis" package won't work. You need libogg and libvorbis, not vorbis.
Latest stable versions at the time of writing this: [http://downloads.xiph.org/releases/ogg/libogg-1.3.0.zip 1.3.0] and [http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.zip 1.3.2].


* [ftp://ftp.mars.org/pub/mpeg/ libmad] for MP3 support.
By default this will create x86 DLLs. If you want a different target, you can add "--triplet <triplet>" to the command, for example:
Latest stable version at the time of writing this: [ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz 0.15.1b]


* [http://sourceforge.net/project/showfiles.php?group_id=13478&package_id=12677 libFLAC] for FLAC support.
* '''x64-windows:''' x64 DLLs
Latest stable version at the time of writing this: [http://sourceforge.net/project/showfiles.php?group_id=13478&package_id=12677&release_id=539981 1.2.1]
* '''x86-windows-static-md:''' x86 static LIBs


* [http://libmpeg2.sourceforge.net/downloads.html libmpeg2] for MPEG-2 support - '''no longer needed'''.
=== Note: ===
Get the latest mpeg2dec release from this page, libmpeg2 is included there.  
When using vcpkg to compile libraries, it is important to pass the --vcpkg flag to create_project.exe during repository setup as newer versions of SDL2 locate libraries at <SDL/SDL.h> instead of <SDL.h>.
Latest stable version at the time of writing this: [http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz 0.5.1]


* [http://www.zlib.net/ zlib]
Not every library is compatible with every target, but they should all work as x86/x64 DLLs.
You need the latest zlib source code. If you wish to compile ScummVM 0.8.0 or earlier with zlib support, you'll also need [http://www.winimage.com/zLibDll/crtdll.zip crtdll.lib].
Latest stable version at the time of writing this: [http://www.zlib.net/zlib125.zip 1.2.5]


* [ftp://ftp.simplesystems.org/pub/libpng/png/src/ libpng] (for ScummVM tools, in particular convert_dxa)
== Manually compiling the needed libraries for Visual Studio yourself ==
You need the latest libpng source code.
Latest Windows stable version at the time of writing this: [ftp://ftp.simplesystems.org/pub/libpng/png/src/lpng155.zip 1.5.5]


== Building the libraries ==
Building libraries for use with Visual Studio is a complicated process. Many libraries only feature out-dated project files or have incompatible configurations for their project files. On this page we give a general introduction of the settings we used for building the libraries with Visual Studio 2015 Community Edition. Afterwards, we give a more detailed view on the process of building each individual library.


Now, we need to compile the required libraries.
We used the following settings when compiling the libraries:
* Run-Time Library: We use the "Multi-Threaded DLL" run-time library. For Debug configurations we use the "Multi-Threaded Debug DLL" (option "/MDd"). For Release configurations we use the "Multi-Threaded DLL" (option "/MD").
* Link-time Code Generation: We disable LTCG for all configurations (option "/LTCG:OFF").
* Whole Program Optimization: We disable WPO for all configurations (option "/GL-").
Please assure that any libraries you build use exactly the same configuration settings.


Note that you'll need to build all libraries with the same configuration settings (debug or release). If you don't need a specific library, you can remove it from your build by going to Project->Properties, Configuration Properties->C/C++->Preprocessor and remove the "USE_XXX" directive for that library from there. For example, to remove OGG support, remove the USE_VORBIS directive.
== Special Instructions for Libraries ==


Also, make sure to disable the inclusion of default libraries in all libraries. You can do this from the project properties->Librarian->General and setting "Ignore all default libraries" to "Yes (/NODEFAULTLIB)" (special thanks to nolange for this tip). Finally, make sure that optimization is set to "Maximize speed" (or anything other than "Full optimization"), otherwise it will be impossible to build incremental debug builds later on (you'll get a warning saying "ignoring '/INCREMENTAL' due to '/LTCG' specification"). You can do this from the project properties->C/C++->Optimization, and set "Optimization" to "Maximize Speed (/O2)"
Here, we will take a look at libraries which need special handling when built with Visual Studio.


=== SDL 1.2 ===


=== A note about VS2008/2005 ===
We used the following patch when compiling SDL 1.2, which is required for x64 support. The patch was gladly taken from the SDL mailing list.


If you're building the libraries with VS2008/2005, you will get a lot of deprecation warnings. These are normal and nothing to worry about, they're just Microsoft's way of saying "This is a bad code practice. Use this instead". It's not easy to turn these off without several modifications to the code, so just ignore them.
<syntaxhighlight lang="diff">
 
--- src/video/windx5/SDL_dx5video.c Tue Oct 13 00:07:16 2009
Read more here:
+++ src/video/windx5/SDL_dx5video.c Tue Nov 03 21:14:38 2009
 
@@ -332,7 +332,7 @@
http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/
{ &GUID_Key, 255, 0x8000FF0C, 0x00000000 },
 
};
http://www.gamedev.net/community/forums/topic.asp?topic_id=361433
 
-const DIDATAFORMAT c_dfDIKeyboard = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 256, 256, KBD_fmt };
http://blogs.msdn.com/oldnewthing/archive/2005/01/07/348437.aspx
+const DIDATAFORMAT c_dfDIKeyboard = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_RELAXIS, 256, sizeof(KBD_fmt)/sizeof(KBD_fmt[0]), KBD_fmt };
 
If you do wish to make them disappear, you need to include on top the main function of each library, before the includes, the following lines:
 
/* Mouse */
  #if (_MSC_VER >= 1400) /* VC8+ (VS2005) */
@@ -347,7 +347,7 @@
  #pragma warning(disable : 4996) /* Disable all deprecation warnings */  
{ NULL,      15, 0x80FFFF0C, 0x00000000 },
  #endif /* VC8+ (VS2005) */
};
 
 
-const DIDATAFORMAT c_dfDIMouse = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 16, 7, PTR_fmt };
=== NASM ===
+const DIDATAFORMAT c_dfDIMouse = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_RELAXIS, sizeof(DIMOUSESTATE), sizeof(PTR_fmt)/sizeof(PTR_fmt[0]), PTR_fmt };
 
First of all, we need nasm. So unzip the nasm archive in a directory, copy
static DIOBJECTDATAFORMAT PTR2_fmt[] = {
"nasmw.exe" to "nasm.exe" (because some projects call one and others call the other) and include it in the executable path of VS. To do this, go to Tools->Options->Projects and solutions->VC++ directories. Select "Executable files" from the top right and include the directory where you unzipped nasm into.
{ &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 },
 
@@ -363,7 +363,7 @@
 
{ NULL,       19, 0x80FFFF0C, 0x00000000 }
=== SDL ===
};
 
SDL is already compiled and needs no further changes, so we can skip the compilation step for it.
-const DIDATAFORMAT c_dfDIMouse2 = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 20, 11, PTR2_fmt };
 
+const DIDATAFORMAT c_dfDIMouse2 = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_RELAXIS, sizeof(DIMOUSESTATE), sizeof(PTR2_fmt)/sizeof(PTR2_fmt[0]), PTR2_fmt };
'''Note for x64''': You will need to compile SDL for x64 on your own (as of the time of this writing), to do so you will also need to install the [http://msdn.microsoft.com/en-us/directx/default.aspx DirectX SDK found here]. You will also need to apply this patch [http://robertmegone.com/scummvm/build/sdl.patch from here] (patch gladly taken from the SDL mailing list).
/* Joystick */
@@ -415,7 +415,7 @@
{ NULL, 79, 0x80FFFF0C, 0x00000000 },
};
-const DIDATAFORMAT c_dfDIJoystick = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000001, 80, 44, JOY_fmt };
+const DIDATAFORMAT c_dfDIJoystick = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_ABSAXIS, sizeof(DIJOYSTATE), sizeof(JOY_fmt)/sizeof(JOY_fmt[0]), JOY_fmt };
/* Initialization/Query functions */
</syntaxhighlight>


After adding a new x64 configuration option in the project files, you may also need to remove "/MACHINE:I386" as additional linker command in Project->Properties, Configuration Properties->Linker->Command Line.
After adding a new x64 configuration option in the project files, you may also need to remove "/MACHINE:I386" as additional linker command in Project->Properties, Configuration Properties->Linker->Command Line.
Line 75: Line 84:
=== zlib ===
=== zlib ===


You'll need the zlib source package. After unzipping it, go into the projects directory in the zlib source and open the solution under projects\vstudio. Right click on the "zlib" project, and go to its properties. Then, go to Configuration Properties->C/C++->Code Generation and change the Runtime library from "Multi-Threaded DLL (/MD)" to "Multi-Threaded (/MT)" (if you don't do this step, you'll have issues compiling ScummVM later on). Then, compile the "zlib" project using the LIB release configuration.
We used a custom project file when building zlib to get the old standard library name "zlib.lib". It can be found inside a zip file in the "patches/" directory of our pre-built library package. The project file was created for zlib 1.2.8.


=== libogg ===
=== libogg ===


Compile this first, as many other libraries need it. Go to the win32 directory and build the "libogg_static" solution of your MSVC version (which should be found in one of the sub-directories). The solution should feature working x86 (Win32) and x64 (x64) targets by default, so you can compile either of those depending on whether you decide to build an x86 or x64 ScummVM.
We use the "libogg_static" solution to create a library for static linking.


=== libvorbis ===
=== libvorbis ===
Line 85: Line 94:
You will need to use the "vorbis_static" solution. It should feature working x86 (Win32) and x64 (x64) targets by default.
You will need to use the "vorbis_static" solution. It should feature working x86 (Win32) and x64 (x64) targets by default.


'''Note''': When you do not include your ogg headers/libraries in your global MSVC path settings you will need to do the following: include the libogg include and library paths in VS. To do this, go to Tools->Options->Projects and solutions->VC++ directories and include the include directory of libogg as well as the directory with the compiled ogg library. You'll need vorbis, vorbisfile and also vorbisenc for ScummVM tools.
'''Note''': You need to assure that the headers (and libraries in case you build a dynamically linked libvorbis) of libogg are in the paths MSVC searches.
 
'''Note''': The static solution can be bugged and produce a library named "libvorbisfile.lib" instead of "libvorbisfile_static.lib". You will need to fix the target name in the project settings.
 
'''Note''': You'll need vorbis, vorbisfile and also vorbisenc for ScummVM tools.
 
=== libtheora ===


=== libmpeg2 ===
You will need to use the "libtheora_static" solution.


The VC6 solution files (inside the vc++ folder) need to be used for this library, but first they all need to be changed to DOS format, otherwise Visual Studio will complain that the project files are corrupted. Then, open file config.h inside the vc++ folder and comment out the following line, near the end of the file:
'''Note''': The static solution can be bugged and produce a library named "libtheora.lib" instead of "libtheora_static.lib". You will need to fix the target name in the project settings.
#define restrict __restrict
Open the solution and compile project "libmpeg2". After you compile it, go to its include directory, create a folder "mpeg2dec" in there and copy all files from the include folder in this subfolder. You will end up with 2 directories, "include" and "include\mpeg2dec" with the same files. This is needed, as ScummVM includes files from the "mpeg2dec" directory


=== libmad ===
=== libmad ===


Open and compile the "libmad" solution
You can use the "libmad" solution.


'''Note for x64:''' When you want to build a x64 library for libmad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libmad solution files for x86. For Release mode you will also need to edit the preprocessor definitons via: Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions: there you will need to replace "FPM_INTEL" with "FPM_64BIT".
'''Note for x64:''' When you want to build a x64 library for libmad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libmad solution files for x86. For Release mode you will also need to edit the preprocessor definitons via: Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions: there you will need to replace "FPM_INTEL" with "FPM_64BIT".
Line 101: Line 114:
You will also need to apply the following patch to mad.h:
You will also need to apply the following patch to mad.h:


<source lang="diff">
<syntaxhighlight lang="diff">
--- mad.h Tue Nov 03 18:29:06 2009
--- mad.h Tue Nov 03 18:29:06 2009
+++ mad.h Tue Nov 03 18:29:14 2009
+++ mad.h Tue Nov 03 18:29:14 2009
Line 113: Line 126:
  # define FPM_INTEL
  # define FPM_INTEL
+#endif
+#endif
</source>
</syntaxhighlight>


=== FLAC ===
=== FLAC ===


Open its solution and compile the libFLAC_static project. By default, optimization for this library is set to "full" in release builds, which will prevent you from performing incremental debug builds later on, so make sure to set it to "Maximize speed" (or anything other than "Full optimization"), otherwise it will be impossible to build incremental debug builds later on. Check the introductory section for more information. Also, FLAC OGGs are not needed, so support for these can be dropped by going to the libFLAC_static project settings and removing the FLAC__HAS_OGG switch from C/C++->Preprocessor->Preprocessor Definitions.
Open the FLAC solution and build "libFLAC_static" and "win_utf8_io_static".
 
=== libfaad ===


'''Note for x64''': After converting the Win32 target to x64 you will need to adapt some file settings. First of all you will need to disable all *.nasm files in the "libFLAC_static" project, this can be easily done by right clicking on them and selecting "Properties", now set "Excluded From Build" to "true". Next you will need to adapt the Preprocessor Definitions: First of all remove the following defintions: "FLAC__CPU_IA32", "FLAC__HAS_NASM" and "FLAC__USE_3DNOW", now also add "FLAC__NO_ASM". Last but not least you will need to apply the following patch file to "bitreader.c" of the "libFLAC_static" project:
We used the following patch when compiling libfaad to adjust for changes in the MSVC runtime:


<source lang="diff">
<syntaxhighlight lang="diff">
--- src/libFLAC/bitreader.c Tue Sep 11 05:48:56 2007
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/common.h sources/faad2-2.7/libfaad/common.h
+++ src/libFLAC/bitreader.c Tue Nov 03 19:19:37 2009
--- sources.orig/faad2-2.7/libfaad/common.h 2009-02-05 01:51:03.000000000 +0100
@@ -149,13 +149,23 @@
+++ sources/faad2-2.7/libfaad/common.h 2016-03-09 20:27:08.851178000 +0100
FLAC__CPUInfo cpu_info;
@@ -315,7 +315,7 @@
  };
  #if defined(_WIN32) && !defined(__MINGW32__)
    #define HAS_LRINTF
-    static INLINE int lrintf(float f)
+    /*static INLINE int lrintf(float f)
    {
        int i;
        __asm
@@ -324,7 +324,7 @@
            fistp i
        }
        return i;
-    }
+    }*/
  #elif (defined(__i386__) && defined(__GNUC__) && \
!defined(__CYGWIN__) && !defined(__MINGW32__))
    #ifndef HAVE_LRINTF
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/mp4.c sources/faad2-2.7/libfaad/mp4.c
--- sources.orig/faad2-2.7/libfaad/mp4.c 2009-02-06 04:39:58.000000000 +0100
+++ sources/faad2-2.7/libfaad/mp4.c 2016-03-09 20:27:09.200404900 +0100
@@ -32,6 +32,7 @@
#include "structs.h"
#include <stdlib.h>
+#include <string.h>
#include "bits.h"
#include "mp4.h"
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/ps_dec.c sources/faad2-2.7/libfaad/ps_dec.c
--- sources.orig/faad2-2.7/libfaad/ps_dec.c 2009-01-26 23:32:31.000000000 +0100
+++ sources/faad2-2.7/libfaad/ps_dec.c 2016-03-09 20:27:09.233469100 +0100
@@ -33,6 +33,7 @@
#ifdef PS_DEC
#include <stdlib.h>
+#include <string.h>
#include "ps_dec.h"
#include "ps_tables.h"
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/sbr_hfadj.c sources/faad2-2.7/libfaad/sbr_hfadj.c
--- sources.orig/faad2-2.7/libfaad/sbr_hfadj.c 2008-09-20 00:50:20.000000000 +0200
+++ sources/faad2-2.7/libfaad/sbr_hfadj.c 2016-03-09 20:27:09.400963200 +0100
@@ -40,6 +40,8 @@
  #include "sbr_noise.h"
   
   
-#ifdef _MSC_VER
+#include <string.h>
+#if defined (_MSC_VER)
/* OPT: an MSVC built-in would be better */
static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x)
{
x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
return (x>>16) | (x<<16);
}
+
+
+#ifdef _WIN64
+static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len)
/* static function declarations */
+{
static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
+ while (len--) {
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/sbr_syntax.c sources/faad2-2.7/libfaad/sbr_syntax.c
+ *start = local_swap32_(*start);
--- sources.orig/faad2-2.7/libfaad/sbr_syntax.c 2009-01-26 23:32:31.000000000 +0100
+ ++start;
+++ sources/faad2-2.7/libfaad/sbr_syntax.c 2016-03-09 20:27:09.458518400 +0100
+ }
@@ -48,6 +48,8 @@
+}
+#else
static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len)
{
__asm {
@@ -173,6 +183,7 @@
done1:
}
}
+#endif
  #endif
  #endif
#include "analysis.h"
   
   
  static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word)
+#include <string.h>
</source>
+
/* static function declarations */
/* static function declarations */
  static void sbr_header(bitfile *ld, sbr_info *sbr);
 
</syntaxhighlight>


=== libpng ===
'''Note for x64:''' When you want to build a x64 library for libfaad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libfaad solution files for x86.
 
=== libmpeg2 ===


Open the solution under projects\vstudio. You also need zlib to compile this library, which must be placed in a folder named "zlib" outside libpng's directory. You need to change the settings of zlib like you have done before (i.e. from "Multi-Threaded DLL (/MD)" to "Multi-Threaded (/MT)"). Check the zlib section for more information.
We used a custom solution to build libmpeg2. It can be found inside a zip file in the "patches/" directory of our pre-built library package. The project file was created for libmpeg 0.5.1.

Latest revision as of 06:33, 3 June 2024

Using vcpkg package manager

If you're using Visual Studio 2015 or later, vcpkg is the simplest way to get the libraries compiled. It works similar to Linux package managers, but everything is locally compiled from source, so you always get binaries for the specific compiler and architecture you're using.

After following their installation instructions, just run the following command from the vcpkg folder to build the libraries:

vcpkg install curl faad2 fluidsynth freetype fribidi giflib libflac libjpeg-turbo libmad libmikmod libmpeg2 libogg libpng libtheora libvorbis libvpx sdl2 sdl2-net zlib discord-rpc

Any missing libraries are optional and currently not available in vcpkg, so you will have to build them yourself if you want to enable them.

By default this will create x86 DLLs. If you want a different target, you can add "--triplet <triplet>" to the command, for example:

  • x64-windows: x64 DLLs
  • x86-windows-static-md: x86 static LIBs

Note:

When using vcpkg to compile libraries, it is important to pass the --vcpkg flag to create_project.exe during repository setup as newer versions of SDL2 locate libraries at <SDL/SDL.h> instead of <SDL.h>.

Not every library is compatible with every target, but they should all work as x86/x64 DLLs.

Manually compiling the needed libraries for Visual Studio yourself

Building libraries for use with Visual Studio is a complicated process. Many libraries only feature out-dated project files or have incompatible configurations for their project files. On this page we give a general introduction of the settings we used for building the libraries with Visual Studio 2015 Community Edition. Afterwards, we give a more detailed view on the process of building each individual library.

We used the following settings when compiling the libraries:

  • Run-Time Library: We use the "Multi-Threaded DLL" run-time library. For Debug configurations we use the "Multi-Threaded Debug DLL" (option "/MDd"). For Release configurations we use the "Multi-Threaded DLL" (option "/MD").
  • Link-time Code Generation: We disable LTCG for all configurations (option "/LTCG:OFF").
  • Whole Program Optimization: We disable WPO for all configurations (option "/GL-").

Please assure that any libraries you build use exactly the same configuration settings.

Special Instructions for Libraries

Here, we will take a look at libraries which need special handling when built with Visual Studio.

SDL 1.2

We used the following patch when compiling SDL 1.2, which is required for x64 support. The patch was gladly taken from the SDL mailing list.

--- src/video/windx5/SDL_dx5video.c	Tue Oct 13 00:07:16 2009
+++ src/video/windx5/SDL_dx5video.c	Tue Nov 03 21:14:38 2009
@@ -332,7 +332,7 @@
 	{ &GUID_Key, 255, 0x8000FF0C, 0x00000000 },
 };
 
-const DIDATAFORMAT c_dfDIKeyboard = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 256, 256, KBD_fmt };
+const DIDATAFORMAT c_dfDIKeyboard = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_RELAXIS, 256, sizeof(KBD_fmt)/sizeof(KBD_fmt[0]), KBD_fmt };
 
 
 /* Mouse */
@@ -347,7 +347,7 @@
 	{ NULL,       15, 0x80FFFF0C, 0x00000000 },
 };
 
-const DIDATAFORMAT c_dfDIMouse = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 16, 7, PTR_fmt };
+const DIDATAFORMAT c_dfDIMouse = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_RELAXIS, sizeof(DIMOUSESTATE), sizeof(PTR_fmt)/sizeof(PTR_fmt[0]), PTR_fmt };
 
 static DIOBJECTDATAFORMAT PTR2_fmt[] = {
 	{ &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 },
@@ -363,7 +363,7 @@
 	{ NULL,       19, 0x80FFFF0C, 0x00000000 }
 };
 
-const DIDATAFORMAT c_dfDIMouse2 = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 20, 11, PTR2_fmt };
+const DIDATAFORMAT c_dfDIMouse2 = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_RELAXIS, sizeof(DIMOUSESTATE), sizeof(PTR2_fmt)/sizeof(PTR2_fmt[0]), PTR2_fmt };
 
 
 /* Joystick */
@@ -415,7 +415,7 @@
 	{ NULL, 79, 0x80FFFF0C, 0x00000000 },
 };
 
-const DIDATAFORMAT c_dfDIJoystick = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000001, 80, 44, JOY_fmt };
+const DIDATAFORMAT c_dfDIJoystick = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), DIDF_ABSAXIS, sizeof(DIJOYSTATE), sizeof(JOY_fmt)/sizeof(JOY_fmt[0]), JOY_fmt };
 
 
 /* Initialization/Query functions */

After adding a new x64 configuration option in the project files, you may also need to remove "/MACHINE:I386" as additional linker command in Project->Properties, Configuration Properties->Linker->Command Line.

zlib

We used a custom project file when building zlib to get the old standard library name "zlib.lib". It can be found inside a zip file in the "patches/" directory of our pre-built library package. The project file was created for zlib 1.2.8.

libogg

We use the "libogg_static" solution to create a library for static linking.

libvorbis

You will need to use the "vorbis_static" solution. It should feature working x86 (Win32) and x64 (x64) targets by default.

Note: You need to assure that the headers (and libraries in case you build a dynamically linked libvorbis) of libogg are in the paths MSVC searches.

Note: The static solution can be bugged and produce a library named "libvorbisfile.lib" instead of "libvorbisfile_static.lib". You will need to fix the target name in the project settings.

Note: You'll need vorbis, vorbisfile and also vorbisenc for ScummVM tools.

libtheora

You will need to use the "libtheora_static" solution.

Note: The static solution can be bugged and produce a library named "libtheora.lib" instead of "libtheora_static.lib". You will need to fix the target name in the project settings.

libmad

You can use the "libmad" solution.

Note for x64: When you want to build a x64 library for libmad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libmad solution files for x86. For Release mode you will also need to edit the preprocessor definitons via: Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions: there you will need to replace "FPM_INTEL" with "FPM_64BIT".

You will also need to apply the following patch to mad.h:

--- mad.h	Tue Nov 03 18:29:06 2009
+++ mad.h	Tue Nov 03 18:29:14 2009
@@ -24,7 +24,11 @@
 extern "C" {
 # endif
 
+#ifdef _WIN64
+# define FPM_64BIT
+#else
 # define FPM_INTEL
+#endif

FLAC

Open the FLAC solution and build "libFLAC_static" and "win_utf8_io_static".

libfaad

We used the following patch when compiling libfaad to adjust for changes in the MSVC runtime:

diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/common.h sources/faad2-2.7/libfaad/common.h
--- sources.orig/faad2-2.7/libfaad/common.h	2009-02-05 01:51:03.000000000 +0100
+++ sources/faad2-2.7/libfaad/common.h	2016-03-09 20:27:08.851178000 +0100
@@ -315,7 +315,7 @@
 
   #if defined(_WIN32) && !defined(__MINGW32__)
     #define HAS_LRINTF
-    static INLINE int lrintf(float f)
+    /*static INLINE int lrintf(float f)
     {
         int i;
         __asm
@@ -324,7 +324,7 @@
             fistp i
         }
         return i;
-    }
+    }*/
   #elif (defined(__i386__) && defined(__GNUC__) && \
 	!defined(__CYGWIN__) && !defined(__MINGW32__))
     #ifndef HAVE_LRINTF
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/mp4.c sources/faad2-2.7/libfaad/mp4.c
--- sources.orig/faad2-2.7/libfaad/mp4.c	2009-02-06 04:39:58.000000000 +0100
+++ sources/faad2-2.7/libfaad/mp4.c	2016-03-09 20:27:09.200404900 +0100
@@ -32,6 +32,7 @@
 #include "structs.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "bits.h"
 #include "mp4.h"
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/ps_dec.c sources/faad2-2.7/libfaad/ps_dec.c
--- sources.orig/faad2-2.7/libfaad/ps_dec.c	2009-01-26 23:32:31.000000000 +0100
+++ sources/faad2-2.7/libfaad/ps_dec.c	2016-03-09 20:27:09.233469100 +0100
@@ -33,6 +33,7 @@
 #ifdef PS_DEC
 
 #include <stdlib.h>
+#include <string.h>
 #include "ps_dec.h"
 #include "ps_tables.h"
 
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/sbr_hfadj.c sources/faad2-2.7/libfaad/sbr_hfadj.c
--- sources.orig/faad2-2.7/libfaad/sbr_hfadj.c	2008-09-20 00:50:20.000000000 +0200
+++ sources/faad2-2.7/libfaad/sbr_hfadj.c	2016-03-09 20:27:09.400963200 +0100
@@ -40,6 +40,8 @@
 
 #include "sbr_noise.h"
 
+#include <string.h>
+
 
 /* static function declarations */
 static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
diff -ru '--exclude=*vcx*' '--exclude=*sln*' sources.orig/faad2-2.7/libfaad/sbr_syntax.c sources/faad2-2.7/libfaad/sbr_syntax.c
--- sources.orig/faad2-2.7/libfaad/sbr_syntax.c	2009-01-26 23:32:31.000000000 +0100
+++ sources/faad2-2.7/libfaad/sbr_syntax.c	2016-03-09 20:27:09.458518400 +0100
@@ -48,6 +48,8 @@
 #endif
 #include "analysis.h"
 
+#include <string.h>
+
 /* static function declarations */
 /* static function declarations */
 static void sbr_header(bitfile *ld, sbr_info *sbr);

Note for x64: When you want to build a x64 library for libfaad you will need to create your own x64 config for it. You can do so by easy conversion of the existing libfaad solution files for x86.

libmpeg2

We used a custom solution to build libmpeg2. It can be found inside a zip file in the "patches/" directory of our pre-built library package. The project file was created for libmpeg 0.5.1.