Build & Compile

Free Eggbert supports multiple build systems and targets. The recommended approach is CMake with the FreeDirect backend.

CMake (Recommended — Cross-platform)

The canonical cross-platform build uses the Free Direct backend, which replaces DirectDraw/DirectSound with SDL3-based equivalents.

Configure and Build

# 1. Initialize submodules
git submodule update --init --recursive

# 2. Configure
cmake -S . -B build -DSPEEDY_BLUPI_BACKEND=FREEDIRECT

# 3. Build
cmake --build build -j

System SDL Override (Advanced)

If you prefer to use system-installed SDL packages instead of the vendored submodules:

cmake -S . -B build -DSPEEDY_BLUPI_BACKEND=FREEDIRECT -DFREE_USE_SYSTEM_SDL=ON
⚠️
Advanced Users Only
FREE_USE_SYSTEM_SDL=ON requires compatible SDL3, SDL3_image, and SDL3_mixer packages to be installed system-wide. The default vendored build is preferred.

Dependency Boundaries

The intended dependency chain is strictly layered:

Free Eggbert game codeFree API / Free Direct public compatibility headersFree API / Free Direct implementationSDL3 / SDL_image / SDL_mixer internals
  • SPEEDY_BLUPI_WINDOWS links only free-api and free-direct
  • SDL include directories and libraries stay private to free-api / free-direct
  • No game source file should include SDL headers directly

Non-MSVC Compiler Options

Because the codebase originates from decompiled code, it uses constructs that modern C++ compilers reject by default. The following permissive flags are applied:

FlagPurpose
-fpermissiveAllow constructs rejected by strict C++
-fms-extensionsEnable Microsoft extensions
-fPICPosition-independent code
-wSuppress all warnings
-Wno-narrowingAllow narrowing conversions
-Wno-int-to-pointer-castAllow int-to-pointer casts
-gGenerate debug symbols
-O0No optimization (easier debugging)

Visual Studio 2022 (Windows, Native DirectX)

For building against the original DirectX 3 SDK on Windows:

  1. Open Speedy Eggbert 2 Source.sln in Visual Studio 2022
  2. Set the platform to x86
  3. Set the debugger target to Win32
  4. Open Project Properties → C/C++ → Command Line → Additional Options
    Add: /wd4700 /wd4703
  5. Open Project Properties → General → Platform Toolset
    Set to: Visual Studio 2022 (v143)
  6. Right-click the solution → Build Solution
ℹ️
/wd4700 /wd4703 Flags
These suppress warnings about potentially uninitialized local variables. Such warnings are widespread in decompiled code because the original compiler used register allocation that reused stack space in ways the decompiler cannot always reconstruct correctly.

Known Workaround for COM Header Error

On some Windows SDK versions, you may encounter:

c:\program files (x86)\windows kits\8.1\include\um\combaseapi.h(229):
error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'

The workaround is to add this before the problematic include:

typedef struct IUnknown IUnknown;

WebAssembly (Emscripten)

Free Eggbert can be compiled to WebAssembly for running in a browser.

Setup

First, install and activate the Emscripten SDK:

source /path/to/emsdk/emsdk_env.sh

Build and Run

# Configure for WebAssembly
emcmake cmake -S . -B cmake-build-web -DCMAKE_BUILD_TYPE=Debug

# Build
cmake --build cmake-build-web -j

# Run in browser (starts local HTTP server)
emrun cmake-build-web/bin/SPEEDY_BLUPI_WINDOWS.html

Game assets from gamefiles/ (DATA, IMAGE08, IMAGE16, SOUND) are preloaded into the Emscripten virtual filesystem at build time — no manual copying is required.

Persistent Saves on Web

Save data is stored in IndexedDB via Emscripten's IDBFS, mounted at /save inside the virtual filesystem. Data persists across page reloads. Clearing browser site data resets to defaults.

// Export /save to IndexedDB (from browser console)
Module.ccall('FreeEggbert_ExportPersistentData', null, [], []);

// Restore /save from IndexedDB
Module.ccall('FreeEggbert_ImportPersistentData', null, [], []);

These functions are defined in src/web_persistence.cpp and exported via EMSCRIPTEN_KEEPALIVE. On non-Emscripten builds, the file is empty.

Android (NDK + Gradle)

See Platform Support → Android for the full Android build guide.

CMake with Visual Studio Generator

When using CMake with the Visual Studio generator on Windows:

git submodule update --init --recursive
cmake -S . -B build -G "Visual Studio 17 2022" -DSPEEDY_BLUPI_BACKEND=FREEDIRECT
cmake --build build --config Debug

Build TODO Items

🔍
Needs Verification
The following build behaviors have been documented but need explicit verification:
  • Clean checkout builds without system SDL packages on Linux
  • FREE_USE_SYSTEM_SDL=ON still works as an override
  • free-api and free-direct link SDL as PRIVATE (not PUBLIC)
  • No game source file contains direct SDL usage (#include <SDL...>)
  • Whether /permissive- is appropriate for decompiled MSVC code