Sunday, April 19, 2009

Compiling PinMAME With Visual C++

The file setup_vc.txt in the pinmame_cvs directory provides information on compiling pinmame with Visual C++. The first step is to obtain a copy of Microsoft Visual C++. Microsoft provides a free version of their compiler known as the 'Express' version which does not include all features but is suitable for compiling pinmame.

http://www.microsoft.com/express/vc/


In addition, you must install the DirectX Software Developer's Kit as pinmame requires the "d3d.h" and "dsound.h" header files. I tried downloading the latest version (version 9) of DirectX but it did not include the required "d3d.h" file. Instead it had "d3d9.h" and "d3dx9.h". There's a note in setup_vc.txt that indicates a version with DirectInput 7 is required. This can be found here:

http://www.microsoft.com/downloads/details.aspx?familyid=529f03be-1339-48c4-bd5a-8506e5acf571
Rather than modify the source code, I installed this older version of the DirectX SDK. Installing this will create the system environment variable $(DXSDK_DIR).

The nice guys maintaining Pinmame also provide files to help get you up and running quickly. The file PinMAME_VC2002.vcproj contains the required project information to load all the source files into Visual C++ 2002. They also include a bat file to update the project directory to Visual C++ 2008. To do this, run
copy_vc2002_to_vc2008.bat
in the pinmame_cvs directory.

After installing Microsoft Visual C++ 2008 Express and the DirectX SDK, run Visual C++ and open the project PINMAME_VC2008.vcproj. We now need to add links to the DirectX SDK header files and libraries.

  1. Go to the Project->Properties menu. This will open another window with properties for this project.
  2. Select Configuration Properties->C/C++->Additional Include Directories.
  3. Add the directory "$(DXSDK_DIR)include".
  4. Then select Configuation Properties->Linker->Additional Library Directories.
  5. Add the directory "$(DXSDK_DIR)lib\x86".

After adding these changes, close the Properties menu and select Build->Build Solution. This should cause the source files to compile successfully. Then to link and build the application, select Build->Build Project.

This should create a pinmame executable file that can be run at the command line or through the debugger.

No comments:

Post a Comment