Microsoft Visual C++


Prerequisites


First of all, install Microsoft Visual C++ Express 2008.

You will also need the latest DirectX SDK installed (get it from Microsoft). It is recommended to install it in \projects\DirectX SDK (see below for further folder information).

Installing an SVN client is a good idea, too. TortoiseSVN, which integrates with the Windows Explorer, is a good choice.


Folders


The default installation folders are

  • \projects\libraries: The library source code goes here
  • \projects\d2x-xl\trunk: The D2X-XL source code goes here
  • \programs\D2: The compiled program and the required DLLs go here

For the default installation, the projects and programs\d2x-xl folders have to be located in the root folder of the installation drive (e.g. c:\projects and c:\programs\d2x-xl). The involved projects only use relative paths, but if you want to change the general structure of the installation or have the program folder somewhere else, you need to manually change the compiler include paths and linker output directories for all projects contained in the D2X-XL solution.


Files


Download all required source archives (you may want to place them in the projects folder):

Extract the library source archives to \projects\libraries and the D2X-XL source code to \projects\d2x-xl\trunk. Make sure to extract the folders contained in the archives. When done, you should have the following folders (which in turn should have a varying number of subfolders):

  • \projects\d2x-xl\trunk
  • \projects\libraries\libogg-1.3.3
  • \projects\libraries\libvorbis-1.1.2
  • \projects\libraries\SDL-1.2.14
  • \projects\libraries\SDL_mixer-1.2.11
  • \projects\libraries\SDL_image-1.2.7
  • \projects\libraries\smpeg-0.4.4

You will also need a D2X-XL installation in \programs\D2, so create one there or copy an existing over there.


Visual Studio


Launch Visual Studio. If it's the first launch:

  • select "Open", "Project/Solution..." from the "File" menu and load the D2X-XL solution (d2x-xl.sln) from \projects\d2x-xl\trunk\VC9.
  • Delete the d2x-trackir project from the solution.
  • Right click on "d2x-xl" in the solution explorer pane and chose "Set As Startup Project".
  • Find the drop down box in the toolbar located below the menu displaying the quick help "Solution Configurations" when hovering the mouse over it and select "Debug"
  • If you haven't installed the DirectX SDK to \projects\DirectX SDK:
    • Right click on "SDL" in the solution explorer pane and chose "Properties".
    • In the properties dialog, expand the "C++" branch and click on "General".
    • Change the DirectX SDK include path in "Additional Include Directories" to the proper location for your system (might be something like c:\program files\Microsoft DirectX SDK (March 2008)\include)
    • Add the DirectX SDK library path in the input section of the SDL projects linker options (e.g. c:\program files\Microsoft DirectX SDK (March 2008)\Lib\x86)

Otherwise

  • click on the d2-xl project link in the start page displayed by Visual Studio to open the project.


Build the project


To build the program and required DLLs, right click on "d2x-xl" in the solution explorer pane and:

  • chose "Build" to build it compiling only the changed files.

or

  • chose "Rebuild" to build it compiling all files of the project (this will make sure everything is really up to date).

If the linker complains about missing libraries, you will have to manually make Visual Studio build them. right click on the project name (E.g. SDL_mixer) and select "build".


Debugging


If the solution has been successfully built, simply press F5 to launch the debugger and run the program in it. The debugger will stop the program and display the code line causing the problem if it encounters any run time errors. That is, unless the problem is caused by code outside of D2X-XL or any of the libraries contained in its solution. In that case, open the call stack window (chose "Debug" -> "Windows" -> "Call Stack" from the menu) to see where the problem occurred.