samp-cef

samp-cef embeds Chromium Embedded Framework into GTA San Andreas Multiplayer and lets a gamemode or a client-side plugin render HTML, CSS, and JavaScript interfaces in-game.

This repository is a framework/SDK rather than a standalone mod. Using it requires a server plugin or open.mp component, the client package, and a web interface built for the browser API.

Current status

Area Supported configuration
Client Windows x86, Windows 10 or newer
SA:MP client 0.3.DL R1, 0.3.7 R1, and 0.3.7 R3; DL R1 and R3-2 are covered by smoke tests
CEF Official stable windows32 standard distribution, CEF 150
Rendering Software BGRA off-screen rendering; GPU and GPU compositing are currently disabled
Media WebM VP9 + Opus; proprietary H.264 + AAC codecs are not included
Server SA:MP plugin and native open.mp component

SA:MP 0.3.7 R2 is not currently supported by the client API. Do not mix client binaries from different SA:MP revisions.

Features

Installing the client package

Download the cef.zip artifact from GitHub Actions, or build and package it using the instructions below. Extract it into the GTA San Andreas directory:

gta_sa.exe
cef.asi
cef/
  cef-client.dll
  cef-renderer.exe
  libcef.dll
  chrome_elf.dll
  locales/
  resources.pak
  ...

Keep the complete cef/ directory from the package. CEF 150 requires more runtime files than the old CEF 89 client, so copying only libcef.dll, cef-client.dll, and cef-renderer.exe is not sufficient.

Client logging is configured in <GTA>/cef/config.json. The log_level field accepts off, error, warn, info, debug, or trace and defaults to info. Client events are written to <GTA>/cef_client.log.

Server logging also defaults to info. Set the SAMP_CEF_LOG_LEVEL environment variable to off, error, warn, info, debug, or trace before starting a legacy SA:MP or open.mp server to override it.

Local pages belong in <GTA>/cef/assets/. Browser cache, cookies, logs, and per-instance data are stored under <GTA>/cef/user_data/.

Launch multiplayer through samp.exe; starting gta_sa.exe directly launches single-player GTA.

Building the Windows x86 client

Requirements:

From PowerShell:

rustup target add i686-pc-windows-msvc

node scripts/download-cef.mjs --output third_party/cef
$env:CEF_PATH = (Resolve-Path third_party/cef).Path

cargo build --release --target i686-pc-windows-msvc `
  -p cef-client -p cef-renderer -p cef-loader

node scripts/package-client.mjs --cef $env:CEF_PATH --output redist

The package is written to redist/:

CEF_PATH must point to the root of the extracted official distribution. Its import library must be at Release/libcef.lib.

See docs/build.md for tests, cross-compilation, bindings generation, and server builds.

Pinned CEF distribution

The exact distribution is defined in cef-distribution.json. Build and CI scripts never resolve a floating latest archive.

This archive intentionally uses the official codec set. H.264 and AAC are expected to be unavailable; proprietary codecs are outside the current migration scope.

Smoke testing

The fixture in examples/cef150-smoke verifies the behavior expected from the previous client plugin:

Workspace crates

Server builds

Build only the server target appropriate for the host. Building the entire workspace on Linux also selects Windows-only crates.

cargo build --release --package cef-server --target i686-unknown-linux-gnu

For open.mp, use:

scripts/build-openmp-component.sh --openmp-root /path/to/open.mp
scripts/build-openmp-component.sh --openmp-root /path/to/open.mp --server-root /path/to/omp-server

More details are in openmp-component/README.md.

API documentation

Video examples