openSA

An open-source reimplementation of the GTA San Andreas runtime. Written in C++ on top of librw, checked against the 1.0 US executable you already own. No game files included — bring your own copy.

Get the code Project status

Mission log

What runs today, and what is still ahead. Early-stage: this is a data and streaming layer with viewers, not a playable game.

DoneData loading

IMG v2 archives, gta.dat/default.dat, every IDE section (objects, vehicles, peds, weapons, animated objects, TXD parents), text and binary IPL, RenderWare 3.6 DFF/TXD. All 14 800 models and 3 000 texture dictionaries of the stock game parse without errors.

DoneStreaming slots

The slot layout follows CStreaming::LoadCdDirectory as decompiled from the executable: TXD, COL, IPL, DAT, IFP, RRR and SCM id ranges, a 5000-slot TXD pool, and the model pool sizes from CPools::Initialise.

DoneRequest / load / remove

A synchronous streamer: requesting a model also requests its TXD and parents, resources are read from the archives and released again when the last instance goes away.

DoneStreamed world viewer

sa_stream flies a free camera over the whole map. Models and textures are pulled in around the camera, LOD stand-ins appear at a distance, and everything is dropped again behind you.

PartialVehicles

Body paint from carcols.dat, wheels attached to the wheel dummies, damage parts hidden. The stock wheel for each car and the right-hand wheel orientation are not yet checked against the executable.

PartialTime of day & weather

timecyc colours, sun, moon, clouds and water waves are ported; rain, fog and wind are partly there.

PartialDriving & damage

CAutomobile-style handling from handling.cfg, wheel dust and tyre smoke by surface, panel damage and swinging doors (log-verified).

PartialCJ & script

Walking CJ with his starting outfit composed over the skin, main.scm running in a script VM, pain speech and footsteps. Missions are not reachable yet.

TodoGameplay

Weapons, mission state, boats, full audio mix. The goal is behaviour identical to the original; PLAN.md lists every open item.

On screen

Captured from the project's own viewers, rendering data from the author's legitimately owned copy of the game.

Los Santos streets with distant buildings
Los Santos near Grove Street, streamed around the camera with LOD buildings in the distance.
Downtown Los Santos from a freeway
Downtown, reached by flying across the map — everything loaded on the way.
Infernus with wheels
Vehicle viewer: Infernus with palette paint and wheels.
CJ in his starting outfit above Grove Street
CJ with the starting outfit: vest, jeans and sneakers layered over the skin textures the way ConstructTextures does it.
A wrecked car on its roof
Driving physics and crash handling: the car flipped by a wall hit (damage parts and swinging doors run in this build).
Car with a swung-open door and raised bonnet
After a hit the front door pops open and the bonnet swings up (CDoor::Process port).
Wrecked car on the road with an open door
Swinging doors on the road next to Grove Street.
Eight camera angles of the crash test
Crash test, camera yaw stepped 45° between eight separate runs (a slideshow, not one continuous take).
Cheetah in dark blue
Cheetah painted from carcols.dat (palette entry 20).

How it is built

Every constant that can be read from the game is read from the game. Where it cannot be confirmed yet, the code and notes say so.

PieceSource of truth
Streaming id ranges, IMG directory handlingDecompiled CStreaming::LoadCdDirectory (0x5B6170) in the 1.0 US executable
Pool capacitiesCPools::Initialise (0x550F10): 140 peds, 110 vehicles, 13 000 buildings, 350 objects, 10 150 collision models, …
TXD slot assignmentCFileLoader::LoadObject and CTxdStore::AddTxdSlot; four reserved slots, ids start at 20000
IDE line formatsLoadVehicleObject, LoadPedObject, LoadWeaponObject and friends
Binary IPLHeader, 40-byte instances, LOD indices into the parent text IPL, conjugated quaternions — checked on all 190 streaming IPLs
Renderinglibrw (D3D9 backend)

Build it

Windows, Visual Studio 2022, CMake 3.15+. You need a copy of GTA San Andreas (Steam works) — the viewers only read its data and models folders.

git clone https://github.com/LakoMoor/openSA
cd openSA
git clone https://github.com/aap/librw third_party/librw

cmake -S sa_view -B build/view
cmake --build build/view --config Release --target sa_stream

build\view\Release\sa_stream.exe "C:\Games\GTA San Andreas" 2495 -1690

WASD to move, Q/E for height, Shift to go faster, drag with the left mouse button to look around.