Skip to content

Doc_Code_UsingTheCode

Noah Sherwin edited this page Feb 9, 2023 · 22 revisions

Introduction

This wiki entry should give you the run down of how the code is configured and what you need (and optionally need) to have in order to compile the code

If you already have a clone of the codebase, you can run the PrereqChecks.bat script to verify your machine is ready for working with the code. There are some libraries it can't check for, however (refer to the bat source for more).

Base Requirements

  1. For starters, the only supported IDE is Visual Studio 2013 (and the compilers found in it). If you choose to use a newer Visual Studio release, you still need to download Visual Studio 2013 for the v120_xp compiler toolchain. Here's some instructions to help you get Visual Studio 2013.

1a. Create an account on https://my.visualstudio.com

1b. Go to https://visualstudio.microsoft.com/downloads/

i. Scroll down to the bottom of the page and look for "Didn't find what you're looking for?"
ii. Click "Older Downloads"
iii. Expand 2013
iv. Click Download (this will redirect to another page)

1c. Look for "Visual Studio Community 2013 with Update 5"

i. Change the "DVD" selector to "EXE"
ii. Click Download
  1. Next, you'll need the June 2010 version of the DirectX SDK.
  2. Finally, you'll need the C++ Boost libraries. At the time of writing, we're using version 1.55. The project will look for boost under C:\Program Files (x86)\boost\boost_1_55_0, and you will need to have compiled all of boost for Visual C++ 12, with the default function call type set to stdcall:

C++ Boost

When compiling Boost from source on Windows 8.1 or 10, you may need to set your include directories differently. The following is an example using Visual Studio 2013 and Windows 8.1.

set INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt

Alternatively, you can download a prebuilt copy of boost to get started faster. You need the 32-bit version.

Once you've installed boost, open a command prompt in your boost_1_55_0 directory and run:

#!sh
bjam.exe toolset=msvc-12.0 cxxflags=/Gz --build-type=complete define=_SCL_SECURE_NO_WARNINGS,BOOST_NO_EXCEPTIONS,BOOST_FILESYSTEM_NO_DEPRECATED
NOTE
  • Not all binary libraries appear to be able to compile with these defines (likely due to NO_EXCEPTIONS).
  • Be sure to delete the files in /bin.v2/libs/ and /stage/libs/ prior to building so that previous (cached) build objects aren't used.
  • OS defines NOMINMAX, so the bad min/max macros won't be defined, allowing code to use std::min/max. If you need to use macro variants, use VC++'s __min/__max macros.

Visual Leak Detector

Some projects require 'vld.h' from Visual Leak Detector which we use to see if we are leaking memory at runtime. You can get Visual Leak Detector from here.

NOTE

Alternatively, you can install Boost and Visual Leak Detector to any location and redirect lookups of the default Program Files paths to the new paths by using Symbolic and/or Junction links. This can be done via Windows' MKLINK command line utility or with a third-party GUI application. I recommend Link Shell Extension for ease of use on Windows. Instead of left-clicking to drag a file/folder, try right-clicking to drag.

Specific Requirements

BlamLib

LowLevel can optionally build some additional code if you have a copy of the XDK. You will need to remove the LOWLEVEL_NO_X360 define from the project config to even begin to enable this code. If you have the XDK, I assume you aren't just some script kiddie and can handle some of the other small compiler hurdles that will follow

BlamLib references the SlimDX SDK, a .NET wrapper for DirectX.

OpenSauce PC and HEK

Halo PC uses GameSpy for its multiplayer framework. GameSpy's OpenSDK also has some useful HTTP libraries, which we use in Halo1_CE.

If you do not have the Open SDK (it was free, but you'll need to source it elsewhere now)...

  1. Open up the project's Common/Precompile.hpp.
  2. Comment out the YELO_USE_GAMESPY_OPEN define.
  3. You'll also need to remove the SDK's file references in the vcproj. In VS's Solution Explorer, these files can be found under Halo1->Halo1_CE->Common->Shared->GameSpy.

If you do have the SDK, apply the bug fix for ghttpProcess.c that is documented in the same Precompile.hpp mentioned above.

In the lastest OpenSDK they have some code that won't compile under OpenSauce's default settings. We use __stdcall conventions where OpenSDK uses (or assumes) __cdecl. Because of this, you'll need to change the signature of gsiCoreAtExitShutdown in gsCore.c to explicitly be __cdecl.

The /dependencies/GameSpyOpen branch has the above fixes already applied. To use it when building OpenSauce, clone your local OpenSauce repo to ./external_libraries/GameSpyOpen (or the old ./opensauce/shared/include/GameSpyOpen) and checkout branch:dependencies/GameSpyOpen. Eventually, its git data will be cleaned up so it's completely separated from OpenSauce's development history. Doing so will decrease the amount of synced git objects.

OpenSauce Xenon

Chances are high that all code found in the Xenon part of the codebase references the XDK. You'll need that to compile the projects.

Clone this wiki locally