SWAG >> ASX >> Quake Fact Extraction

Introduction

If you intend to perform all of the steps involved in extracting facts from Quake you will need to complete the following steps on a linux intel machine. since asx will only currently run on such machines.

Provided files

The following files are provided to potentially eliminate the work load involved in performing all of the Quake fact extraction steps described below. Note that the build history cites directories specific to where the build was performed, and requires trivial editing if others wish to use this build history as input to asx on source code resident under a different path.

Detailed quake fact extraction steps

The following are all of the steps needed to perform Quake fact extraction, given that one starts with nothing.

  1. Read instructions at http://ioquake3.org/source-codes
  2. Obtain Sliksvn subversion software or other svn download capability
  3. Create a suitable directory to work in and change into this directory.
  4. Download the source using subversion as shown below:
  5. "C:\Program Files\SlikSvn\bin\svn.exe" co svn://svn.icculus.org/quake3/trunk ioquake3
  6. Obtain the SDL Libraries if you wish to physically build Quake from http://www.libsdl.org/download-1.2.php
  7. Migrate the source code if necessary to a linux machine.

or

  1. Alternatively obtain the necessary zip file directly from here.
  2. Decompress ioquake3.zip using unzip ioquake3.zip.

Then:

  1. Create shell scripts for gcc, g++ and if desired as that capture the information about how Quake is built as described in the asx webpage. This will as a subtask involve installing of echoargs. These shell scripts and echoargs can alternatively be obtained from swag:~ijdavis/bin, and then be suitably modified to direct output to a file you may write to.
  2. Perform superficial tests to validate that your wrapping shell scripts that act as front ends to gcc, g++ and asm work.
  3. Make sure the log you are going to capture the build history into is absent or empty before each attempt to build Quake3.
  4. On a 64-bit machine I observed a problem with size_t being defined to be an "unsigned int". This problem can be resolved by changing the typedef statement on line 38 of code/SDL12/include/SDL_config_minimal.h to declare that size_t is an "unsigned long".
  5. Build Quake by issuing the command ./configure and then make, in the ioquake3 directory.
  6. Unless you have installed the SDL libraries, your build will report errors in linkage as consequence of not finding the SDL routines. This is of no consequence if you merely wish to extract the architecture from Quake3, but will require addressing if you actually wish to run Quake3.
  7. Examine the history file you have captured of gcc and g++ operations performed in the building of Quake3. Once you are satisfied that it contains an accurate description of how Quake3 is build (and built only once), rename it to ensure that it is not subsequently written to.
  8. Check the log captured from the build process, and remove any parts of the build process not deemed relevant to the fact extraction.
  9. Download, compile and install asx, or obtain a copy of asx from "swag:~ijdavis/bin/asx". Building asx does provide future opportunity to improve it, but involves also building binutils and zlib which is somewhat tedious.
  10. Set the asx environment variables appropriately. I used
    • ASX_IGNORE="o;a;so" to reduce some clutter in the facts otherwise extracted by asx.
    • ASX_UNLINK=no because I wanted to preserve the assembler files from which facts were actually extracted.
    • ASX_SILENT=yes because I didn't need verbose output from asx.
    • ASX_FORCE=v because I wished to include variables in the fact extraction.
  11. Run asx < history.quake > quake.ta.
  12. Check the start of the output in quake.ta for correctness, and that the final line indicates end of output was reached.
  13. If you don't already have Sun's java installed on your machine download and install it from www.java.sun.
  14. Download and build lsedit.
  15. If running lsedit on a unix machine using X-Windows you may need to set the environment variable DISPLAY=":0.0" and then export DISPLAY, and/or use other magic in order to have LSEdit paint correctly in the display window.
  16. To view the facts extracted use:
    "java -classpath .;bunch.jar -Xms128M -Xmx1024M lsedit.LandscapeEditorFrame quake.ta".
  17. The library bunch.jar need only be specified if you wish to use the bunch clustering facilities from within lsedit. If so you will also need to build the associated java program clue.

Viewing source code

It is possible to view the source code associated with fact extraction using LSEdit. Ideally when viewing the extracted facts source code will be located on the same path that it was found at when performing fact extraction. If the source code as consequence of having to be moved is not reachable by the paths encoded in the ta output, change the named location of the root directory by clicking on this root directory in lsedit, pressing 'a' and then alter the file field appropriately. Note that enter is required following change of a value to commit that change. You can check that the value has been changed by closing the attribute dialog box and then reopening it.

To open source code once this has been done from either an edge or a node that has file/lineno information in its attributes, go to options in the menu bar, and then Specify command. There are a number of example ways of opening up software to visualise source code (you are welcome to submit others for inclusion in the list of examples). Basically the top white line names the command to be executed, and each of the lines in the grey box specify a single parameter to this command. At run time $(X) gets changed into the value of the X attribute in the object which is selected when one invokes the command. Note that one can have more than one command by changing the hot key name in the right hand bottom corner any of (h, f4-f10). If any of the examples work for you just press set to use it. Otherwise choose the best example and then change the values in the dialog after pressing set appropriately.

Grok and JGrok

If you wish to manipulate the facts extracted you may use either grok or jgrok. Note that grok is more stable but runs only on linux platforms. JGrok should work on any machine that supports Sun Java.

Building Quake 3

Building Quake 3 on a Windows PC can be accomplished as follows:

  1. Obtain and unzip ioquake3.zip into its expanded ioquake3 directory
  2. See Building ioquake3
  3. Review Building ioquake3 on Windows - Visual Studio 2008
  4. Download http://libsdl.org/release/SDL-devel-1.2.13-VC8.zip
  5. Unzip into SDL-1.2.13
  6. Invoke visual studio 2008
  7. In Visual Studio File->Open->Project/Solution->ioquake3/misc/msvc/ioq3.sln
  8. For each of cgame, game, q3_ui, quake3 and ui, right click on the item and select Properties->C/C++/Preprocessor and add __WIN32__ (two underbars both sides) to the list of preprocessor definitions, or __WIN64__ as appropriate. Failure to do this will cause operating system unknown error messages during compilation.
  9. For quake3 right click on the item and select Properties->Linker->Input and add to Additional Dependencies psapi.lib before SDLmain.lib. Failure to add this dependency will cause linker error messages about being unable to locate EnumProcesses@12.
  10. Also under Linker->General add the path in additional Library directories where SDL-1.2.13/lib can be found. Failure to add this information will cause the linker to not be able to locate either SDLmain.lib or SDL.lib.
  11. Finally right click on Solution ioq3 (5 projects) and select Rebuild Solution.
  12. All of the relevant software should then compile.
  13. The ioquake3 executable should be located in ioquake3/build/quake3_debug_ta,if you compiled the source using the debug configuration.
  14. Copy SDL.dll from the SDL-1.2.13/lib directory to the directory containing the ioquake3 executable. If this is not done ioquake3 will complain about being unable to find this dll. Alternatively, you might wish to place this DDL in the windows/system32 directory, or use an alternative mechanism for locating it.

Contact information

For more information on fact extraction please contact us at .