docs: add AGENTS.md operating manual to miami (reVC adaptations)
linux / build (push) Canceled after 0s
linux / build (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,517 @@
|
||||
# AGENTS.md — reVC operating manual for coding agents
|
||||
|
||||
This file is the whole onboarding for an autonomous agent (or a human) who has to
|
||||
change this repository with **zero prior context**. It is deliberately concrete:
|
||||
every command and path below was executed/verified against this tree.
|
||||
|
||||
Read it completely before editing anything. Then read `CODING_STYLE.md` and the
|
||||
`Contributing` section of `README.md` — those two documents are the policy of
|
||||
record; this file only summarises and operationalises them.
|
||||
|
||||
`AGENTS.local.md` (git-ignored) may override anything here on a specific machine;
|
||||
see §9.
|
||||
|
||||
---
|
||||
|
||||
## 1. What this repository is
|
||||
|
||||
reVC is the **reverse-engineered source code of Grand Theft Auto: Vice City**,
|
||||
reconstructed function by function from the PC binaries and made to build as a
|
||||
standalone game.
|
||||
|
||||
* `miami` (**this branch**) — GTA Vice City (`GTA_VERSION GTAVC_PC_11` in
|
||||
`src/core/config.h`).
|
||||
* `master` — re3, the GTA III sibling (`GTA3_PC_11`). Same engine lineage,
|
||||
different game and a different tree.
|
||||
* `lcs` — reLCS, Liberty City Stories (work in progress, much less complete).
|
||||
|
||||
All three branches exist on the remote (`origin/master`, `origin/miami`,
|
||||
`origin/lcs`); `miami` and `lcs` were pushed on 2026-11-29 (tracker issue #1 is
|
||||
closed). Commits made locally on any of them are mirrored to the server by the
|
||||
orchestrator. Do not assume master's files match the other branches — check out the
|
||||
branch you actually mean.
|
||||
|
||||
**No license.** From `README.md`:
|
||||
|
||||
> We don't feel like we're in a position to give this code a license.
|
||||
> The code should only be used for educational, documentation and modding purposes.
|
||||
> We do not encourage piracy or commercial use.
|
||||
> Please keep derivate work open source and give proper credit.
|
||||
|
||||
**Provenance discipline is the central rule.** The project only exists because the
|
||||
code can be compared to the original binaries. From `README.md`'s *Contributing*
|
||||
section:
|
||||
|
||||
> As long as it's not linux/cross-platform skeleton/compatibility layer, all of the
|
||||
> code on the repo that's not behind a preprocessor condition(like FIX_BUGS) are
|
||||
> **completely** reversed code from original binaries.
|
||||
>
|
||||
> We **don't** accept custom codes, as long as it's not wrapped via preprocessor
|
||||
> conditions, or it's linux/cross-platform skeleton/compatibility layer.
|
||||
|
||||
Practical consequence:
|
||||
|
||||
* Code **outside** preprocessor guards must look like what Rockstar would have
|
||||
shipped, i.e. "which code would produce this assembly".
|
||||
* Behavioural additions/fixes belong behind `FIX_BUGS` / `FIX_BUGS_64`, or inside a
|
||||
platform skeleton (`src/skel/`), or in `src/extras/` (explicitly non-reversed).
|
||||
* Accepted PR shapes (README): features that exist in at least one GTA, game/UI/UX
|
||||
bug fixes (original-behaviour fixes behind `FIX_BUGS`), platform-specific or
|
||||
unreversed code, accuracy/understandability improvements, new skeletons or
|
||||
compatibility layers, translation fixes for languages the original game
|
||||
supported, maintainability work.
|
||||
|
||||
Config switches live in `src/core/config.h`. `MASTER` implies `FINAL`; `MASTER`
|
||||
builds drop the debug menu and version text. `VALIDATE_SAVE_SIZE` and `DEBUGMENU`
|
||||
are only defined in non-`MASTER` builds.
|
||||
|
||||
---
|
||||
|
||||
## 2. Hard rules
|
||||
|
||||
Quoted/derived from `CODING_STYLE.md` (read the whole file — it is short):
|
||||
|
||||
* **Indent with TABS.**
|
||||
* **Braces:** same line for control statements, next line after function
|
||||
definitions and structs/classes, `else` on the same line as the closing brace,
|
||||
no braces around single statements, function return type on its own line.
|
||||
The two accepted shapes are shown at the top of `CODING_STYLE.md`; anything
|
||||
closer to Allman/Whitesmiths is "heavily discouraged".
|
||||
* **Types:** `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32` (typedef'd in
|
||||
`src/core/common.h`; `src/extras/re3_inttypes.h` adds the `PRI*` printf macros
|
||||
for them), plus the builtins `float` and `bool`.
|
||||
* "don't use types like `__int16`, we have `int16` for that"
|
||||
* "don't use `unsigned`, we have typedefs for that"
|
||||
* "don't use `char` for anything but actual characters, use `int8`, `uint8` or `bool`"
|
||||
* "don't even think about using win32 types (`BYTE`, `WORD`, &c.) unless you're
|
||||
writing win32 specific code"
|
||||
* **Pointers:** `int *ptr;`, never `int* ptr;`.
|
||||
* **No magic numbers:** "Even if you don't know the exact meaning it's better to
|
||||
call something `FOOBAR_TYPE_4` than just `4`".
|
||||
* **Naming:** hungarian-ish, `m_` members, `ms_` statics, `f` float, `i`/`n` int,
|
||||
`b` bool, `a` array; no `dw` for `DWORD` ("we're not programming win32").
|
||||
* **"Don't just copy paste code from IDA, make it look nice"** and
|
||||
**"try to make the code look as if R* could have written it"**.
|
||||
|
||||
Language standard, from `README.md`:
|
||||
|
||||
> Do not use features from C++11 or later.
|
||||
|
||||
The build currently compiles with `CXX_STANDARD 11` (`src/CMakeLists.txt`), but that
|
||||
is a build-setting detail, not permission: **write C++98-style code in reversed
|
||||
sections**. `nullptr`, `auto`, range-`for`, `override`, lambdas, `std::` containers
|
||||
etc. do not appear in reversed code. The only existing exceptions in the tree are
|
||||
the non-reversed/back-end parts: `src/extras/ini.h`, the INI settings code in
|
||||
`src/core/re3.cpp` (behind `LOAD_INI_SETTINGS`/`CUSTOM_FRONTEND_OPTIONS`), the
|
||||
OpenAL backend (`src/audio/oal/`), and `src/peds/PedAttractor.*` (the VC-era
|
||||
attractor lists use `std::vector`). The formal standard policy is an open decision
|
||||
(Gitea milestone *M4: Toolchain & language modernization*, issue "Ratify C++
|
||||
language-standard policy"); until it lands, the C++98 rule above is the operative
|
||||
one.
|
||||
|
||||
Also: build warnings are expected and must not become errors; the CI workflow
|
||||
deliberately builds without `-Werror`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Build and verify (the gate)
|
||||
|
||||
**A task is not done until the documented build passes.** Run it before every
|
||||
commit. Warnings are fine; a non-zero exit is not.
|
||||
|
||||
### 3.1 Verified container recipe
|
||||
|
||||
The reference environment is a podman container `re3dev-miami`
|
||||
(Ubuntu 24.04, gcc 13.3, cmake 3.28, ninja 1.11). It is created once from the
|
||||
prepared deps image `localhost/re3dev:deps`, from the repository root:
|
||||
|
||||
```sh
|
||||
podman run -dit --name re3dev-miami --security-opt label=disable \
|
||||
-v "$PWD:/src:ro" \
|
||||
localhost/re3dev:deps sleep infinity
|
||||
```
|
||||
|
||||
The source mount is read-only on purpose — builds go to a directory inside the
|
||||
container. If the deps image is not available, start from
|
||||
`docker.io/library/ubuntu:24.04` instead and install the package list from §3.2
|
||||
first.
|
||||
|
||||
**Host-specific note (keep it in `AGENTS.local.md`, not here):**
|
||||
`--security-opt label=disable` is needed on the reference host because SELinux is
|
||||
`Enforcing` there and a plain `:ro` bind mount is otherwise not readable from
|
||||
inside the container. On a host without SELinux (or with it permissive) the flag
|
||||
can be omitted; it does not affect the build itself.
|
||||
|
||||
Configure and build (the same two commands are the whole gate):
|
||||
|
||||
```sh
|
||||
podman exec re3dev-miami cmake -S /src -B /build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DREVC_AUDIO=OAL \
|
||||
-DREVC_VENDORED_LIBRW=True \
|
||||
-DLIBRW_PLATFORM=GL3 \
|
||||
-DLIBRW_GL3_GFXLIB=GLFW
|
||||
|
||||
podman exec re3dev-miami cmake --build /build --parallel 12
|
||||
```
|
||||
|
||||
Expected on the reference host, measured at the time of writing (not a permanent
|
||||
contract): configure succeeds; build compiles **310 Ninja targets**, prints many
|
||||
`-Wmaybe-uninitialized`-style warnings, exits **0** in roughly **20 s** on 12
|
||||
cores, and produces `/build/src/reVC`, a **~30.6 MiB (32,088,720 bytes) ELF64
|
||||
executable**.
|
||||
|
||||
Known quirk: when the source is the git worktree
|
||||
`/var/home/jchroback/Projects/re3-miami` mounted read-only, configure prints
|
||||
`Building reVC GIT SHA1:` with an **empty** value — the worktree's `.git` file
|
||||
points at a host path that does not exist inside the container, so the hash cannot
|
||||
be resolved. It is harmless (only the in-game version string is blank) and does not
|
||||
happen in a normal clone.
|
||||
|
||||
To prove a clean tree still builds (and to avoid stale objects), use a fresh
|
||||
build directory, e.g. `-B /build-verify`, then build it.
|
||||
|
||||
### 3.2 Without the container
|
||||
|
||||
On any Linux box with the packages installed, the identical invocation works from
|
||||
the repo root:
|
||||
|
||||
```sh
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DREVC_AUDIO=OAL \
|
||||
-DREVC_VENDORED_LIBRW=True -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW
|
||||
cmake --build build --parallel "$(nproc)"
|
||||
```
|
||||
|
||||
The option prefix on this branch is **`REVC_`** (`REVC_AUDIO`,
|
||||
`REVC_VENDORED_LIBRW`, plus `REVC_WITH_OPUS` / `REVC_WITH_LIBSNDFILE`); there is no
|
||||
`REVC_INSTALL` option on miami. The dependency list and flags match
|
||||
`.gitea/workflows/linux.yml` (this branch's CI definition; master's copy lives on
|
||||
master). `REVC_AUDIO=OAL` is the only audio backend on Linux (`MSS` is Windows-only
|
||||
and needs the Miles SDK). `LIBRW_GL3_GFXLIB` accepts `GLFW` or `SDL2`, but `SDL2`
|
||||
is only a librw option — reVC itself has no SDL skeleton in `src/skel/`.
|
||||
|
||||
Prerequisites: clone with `--recursive` (librw/ogg/opus/opusfile are submodules) and
|
||||
keep `.git` available — CMake calls `get_git_head_revision()` and embeds the **full
|
||||
40-character** hash via `configure_file` (`cmake/GetGitRevisionDescription.cmake`);
|
||||
only the premake path (`printHash.sh`, `git rev-parse --short`) uses the short hash.
|
||||
|
||||
### 3.3 Running the game (not part of the gate)
|
||||
|
||||
The repository contains **no game assets**. To actually run, you need a legally
|
||||
owned Vice City installation: put the game's `data/`, `models/`, `audio/`, `TEXT/`,
|
||||
`movies/` next to the built binary, then overlay the contents of `gamefiles/`
|
||||
(updated menu/frontend textures, `TEXT/*.gxt` translations, `data/freeroam_miami.scm`,
|
||||
the `neo/` tweaking tables, `gamecontrollerdb.txt`) as the README's installation
|
||||
step describes ("Extract the downloaded zip over your GTA VC directory and run
|
||||
reVC"). Without assets the binary only gets as far as failing to load data.
|
||||
Automated verification therefore stops at the build; visual/gameplay checks need a
|
||||
human-provided asset directory (record it in `AGENTS.local.md`).
|
||||
|
||||
User files (saves and settings) are written next to the game: settings live in
|
||||
`reVC.ini`, saves in the `userfiles/` directory the POSIX skeleton creates.
|
||||
|
||||
---
|
||||
|
||||
## 4. Repository map
|
||||
|
||||
Top level:
|
||||
|
||||
| Path | What it is |
|
||||
|---|---|
|
||||
| `src/` | the game itself (see below) |
|
||||
| `vendor/` | third-party code. `librw`, `ogg`, `opus`, `opusfile` are **git submodules** (pinned); `libsndfile`, `mpg123`, `openal-soft`, `milessdk` are partial in-tree copies (headers/libs) kept for the Windows/legacy builds |
|
||||
| `gamefiles/` | updated/extra game data shipped with releases (`TEXT/*.gxt` translations, frontend/menu TXDs, `data/freeroam_miami.scm`, `neo/*.dat` + `neo.txd`, `gamecontrollerdb.txt`) |
|
||||
| `cmake/` | `Find*.cmake` modules and `GetGitRevisionDescription.cmake` |
|
||||
| `utils/gxt/` | GXT (text table) tooling (`gxt.exe` plus per-language sources) |
|
||||
| `res/`, `codewarrior/`, `autoconf/` | assets, the CodeWarrior project (reference build), premake modules |
|
||||
| `premake5.lua`, `premake-vs*.cmd`, `premake5.exe`, `premake5Linux` | the legacy premake build (Windows-focused) |
|
||||
| `CMakeLists.txt`, `src/CMakeLists.txt` | the primary build (`EXECUTABLE reVC`, `PROJECT REVC`) |
|
||||
| `printHash.sh` / `printHash.bat` | premake-time equivalent of the CMake `GitSHA1.cpp` generation |
|
||||
| `.gitea/` | Gitea Actions CI for this branch (`REVC_*` flags, `reVC` target) |
|
||||
| `.github/` | historical upstream GitHub Actions workflows (`reVC_*`) — reference only |
|
||||
| `AGENTS.md`, `CODING_STYLE.md`, `README.md` | policy |
|
||||
|
||||
Source subsystems (`src/`):
|
||||
|
||||
| Dir | Contents |
|
||||
|---|---|
|
||||
| `core/` | per-frame/event dispatch and game logic (`main.cpp`: `Idle`, `FrontendIdle`, `RenderScene`, `Render2dStuff`, …), `CGame`, `CTimer`, frontend/menus, `reVC.ini` settings loader, streaming, `CFileMgr`/`CFileLoader`, pads and control mapping, profiles, stats, zones, world, `config.h` constants |
|
||||
| `control/` | mission-script VM (`Script2.cpp`…`Script8.cpp`), car/ped AI control (`CarCtrl`, `CarAI`, `PathFind`), set pieces (`CSetPieces`), pickups, garages, phones, replay, records, road blocks, traffic lights, scene edit |
|
||||
| `entities/` | `CEntity`/`CPhysical` base hierarchy |
|
||||
| `peds/` | `CPed`, `CPlayerPed`, civilians/cops/emergency, population, ped AI/combat/IK/routes, attractors (`PedAttractor`) |
|
||||
| `vehicles/` | `CAutomobile`, `CBoat`, `CBike`, `CHeli`, `CPlane`, `CTrain`, cranes, car generators, damage/handling |
|
||||
| `audio/` | `DMAudio`/`AudioManager` front end, `sampman_oal.cpp` + `oal/` (OpenAL backend), `sampman_miles.cpp`, `eax/`, music/radio (`MusicManager`, `PolRadio`) |
|
||||
| `renderer/` | `CRenderer`, `CHud`, `CSprite2d`, particles, weather, water, timecycle, coronas, shadows, skidmarks, glass, ropes, clouds, fluff/script paths, credits, point lights, motion blur, occlusion, cutscene shadows, water creatures, wind modifiers |
|
||||
| `collision/` | `CCollision`, `CColModel`, spheres/boxes/triangles/lines, `CVuCollision` (PS2 VU path) |
|
||||
| `modelinfo/` | model descriptors: simple/clump/ped/vehicle/time/MLO models, `CModelInfo` store |
|
||||
| `save/` | `C_PcSave`, `GenericGameStorage` (byte-wise serialisation), `SaveBuf.h` helpers, memory card stubs, dates |
|
||||
| `skel/` | platform layer: `crossplatform.cpp/.h` (POSIX shims incl. case-insensitive path resolution and user-file folder), `events.*`, `skeleton.*` (RenderWare skeleton API), `glfw/glfw.cpp` (Linux entry point, `main()`), `win/win.cpp` (Windows `WinMain`) |
|
||||
| `extras/` | **non-reversed additions**: debug menu, custom frontend options, post-FX/screen droplets, custom pipelines, INI parser, `GitSHA1.h` |
|
||||
| `fakerw/` | stub headers emulating RenderWare headers that are not needed when librw is used |
|
||||
| `rw/` | RenderWare glue: texture/TXD reading, visibility plugins, MatFX, lights, memory heap/pools |
|
||||
| `math/` | vectors, matrices, quaternions, rects, engine math helpers |
|
||||
| `objects/` | `CObject`, `CCutsceneObject`, dummies, particle/projectile/stinger objects, object data |
|
||||
| `text/` | GXT text (`TheText`), messages, pager |
|
||||
| `weapons/` | `CWeapon`, weapon/bullet/shot/projectile info, explosions, weapon effects |
|
||||
| `animation/` | animation blending (`RpAnimBlend`, `CAnimBlend*`), bones, cutscene manager |
|
||||
| `buildings/` | `CBuilding`, treadables |
|
||||
|
||||
Platform facts verified in-tree:
|
||||
|
||||
* The process entry point and game-state switch are in the platform layer:
|
||||
`main()` in `src/skel/glfw/glfw.cpp`, `WinMain` in `src/skel/win/win.cpp`.
|
||||
`src/core/main.cpp` implements the frame callbacks those shells dispatch to
|
||||
(`Idle`, `FrontendIdle`, `RenderScene`, `Render2dStuff`, …).
|
||||
* Linux runs the **glfw** skeleton: `src/skel/glfw/glfw.cpp` owns `main()`, creates
|
||||
the window, maps GLFW keysyms to `RsKeyCodes`, and runs the game-state loop.
|
||||
* `src/skel/win/` is Windows-only (`WinMain`, win32 resources, `gtavc.ico`).
|
||||
* There is **no SDL skeleton** in `src/skel/`. librw has an SDL2 gfxlib option, but
|
||||
reVC has no SDL-based platform layer.
|
||||
|
||||
---
|
||||
|
||||
## 5. Engine frame flow
|
||||
|
||||
### 5.1 Platform loop (`src/skel/glfw/glfw.cpp`)
|
||||
|
||||
After `RsEventHandler(rsINITIALIZE, nil)` the skeleton runs an outer `while(TRUE)`
|
||||
loop around an inner loop that ends on `RsGlobal.quit`,
|
||||
`FrontEndMenuManager.m_bWantToRestart` or window-close. Each iteration:
|
||||
|
||||
1. `glfwPollEvents()` (window/input events; key mapping is done by the GLFW
|
||||
callbacks installed earlier).
|
||||
2. If the window is not foreground, nothing is ticked (the app idles).
|
||||
3. Otherwise a small state machine on `gGameState` runs. On a default PC build
|
||||
(`NO_MOVIES` is defined in `src/core/config.h`, `PS2_MENU` is not) the flow is:
|
||||
|
||||
```
|
||||
GS_START_UP → GS_INIT_ONCE → GS_INIT_FRONTEND → GS_FRONTEND
|
||||
→ GS_INIT_PLAYING_GAME → GS_PLAYING_GAME
|
||||
```
|
||||
|
||||
The movie states (`GS_INIT_LOGO_MPEG`, `GS_LOGO_MPEG`, `GS_INIT_INTRO_MPEG`,
|
||||
`GS_INTRO_MPEG`) are only entered when `NO_MOVIES` is off, and the
|
||||
movie-playback calls in the glfw skeleton are commented out, so they merely
|
||||
advance; `eGameState` (`src/skel/crossplatform.h`) declares `GS_INIT_ONCE`
|
||||
*after* `GS_INTRO_MPEG`, which is where `GS_INTRO_MPEG`'s `++gGameState` lands.
|
||||
`GS_INIT_ONCE` selects `GS_INIT_PLAYING_GAME` only under `PS2_MENU`; the PC
|
||||
path selects `GS_INIT_FRONTEND`.
|
||||
|
||||
* `GS_FRONTEND` calls `RsEventHandler(rsFRONTENDIDLE, nil)` each iteration **only
|
||||
when the window is not iconified** (`!WindowIconified`), and transitions to
|
||||
`GS_INIT_PLAYING_GAME` once the menu wants to start/load a game.
|
||||
* `GS_INIT_PLAYING_GAME` runs `InitialiseGame()` (`CGame::Initialise("DATA\\GTA_VC.DAT")`)
|
||||
then sets `GS_PLAYING_GAME`.
|
||||
* `GS_PLAYING_GAME` calls `RsEventHandler(rsIDLE, (void*)TRUE)` **only** if the
|
||||
frame limiter is off or `1000/maxFPS` ms have elapsed since the last frame
|
||||
(`CTimer::GetCurrentTimeInCycles()` / `GetCyclesPerMillisecond()`).
|
||||
* `resizeCB()` calls `RsEventHandler(rsIDLE, TRUE)` directly when the window is
|
||||
resized during play, i.e. `Idle()` can be entered outside the normal pacing.
|
||||
|
||||
### 5.2 `Idle()` — one in-game frame (`src/core/main.cpp`)
|
||||
|
||||
`Idle(void *arg)` with `arg != nil` (the normal `rsIDLE` case):
|
||||
|
||||
1. `CTimer::Update()` — wall clock → `ms_fTimeStep` (1.0 == 50 Hz; clamped to
|
||||
`[0.01, 3.0]`; `FIX_BUGS` version also counts 30 Hz logical frames).
|
||||
2. `CSprite2d::InitPerFrame()`, `CFont::InitPerFrame()`.
|
||||
3. `CPointLights::InitPerFrame()`, **`CGame::Process()`** — the simulation tick:
|
||||
`CPad::UpdatePads()`; `DebugMenuProcess()`; `CCutsceneMgr::Update()`;
|
||||
`FrontEndMenuManager.Process()`; `CTheZones::Update()`; `CStreaming::Update()`;
|
||||
then, unless paused: sprite/font init, record capture, `CPad::DoCheats()`,
|
||||
`CClock::Update`, `CWeather::Update`, **`CTheScripts::Process()`**,
|
||||
`CCollision::Update`, `CScriptPaths::Update`, `CTrain/Plane/Heli` updates,
|
||||
`CDarkel`, `CSkidmarks`, `CAntennas`, `CGlass`, `CSetPieces::Update`,
|
||||
`CEventList`, `CParticle`, fires, `CPopulation::Update` (time-budgeted across
|
||||
frames), `CWeapon::UpdateWeapons`, car generators, `CCranes`, `CClouds`,
|
||||
`CMovingThings`, `CWaterCannons`, `CUserDisplay`, `CReplay`,
|
||||
**`CWorld::Process()`**, accidents, pac-man pickups, pickups, garages, rubbish,
|
||||
special FX, `CRopes::Update`, `CTimeCycle::Update`, `TheCamera.Process()`,
|
||||
`CCullZones`, `CGameLogic::Update`, `CBridge`, `CCoronas`, shadows, phone info,
|
||||
`CCarCtrl::GenerateRandomCars` / `CRoadBlocks::GenerateRoadBlocks` /
|
||||
`CCarCtrl::RemoveDistantCars` / `CCarCtrl::RemoveCarsIfThePoolGetsFull`.
|
||||
4. `DMAudio.Service()`.
|
||||
5. Demo-mode timeout / restart / load-request early outs, then
|
||||
`SetLightsWithTimeOfDayColour(Scene.world)`.
|
||||
6. If `arg == nil`, return here (process-only frame).
|
||||
7. Render phase, only when the frontend menu is **inactive** and no screen fade is
|
||||
active (`!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus()
|
||||
!= FADE_2`; the PC path has no render-game-behind-menu option — the
|
||||
`m_bRenderGameInMenu` flag exists only in `src/core/Frontend_PS2.cpp`):
|
||||
1. `CRenderer::ConstructRenderList()`, `CRenderer::PreRender()`.
|
||||
2. Clip/fog setup (`RwCameraSetFarClipPlane` / `RwCameraSetFogDistance` under
|
||||
`FIX_BUGS`).
|
||||
3. `DoRWStuffStartOfFrame_Horizon(...)` with timecycle sky colours (or white
|
||||
during lightning), `DefinedState()`.
|
||||
4. **`RenderScene()`**: `CClouds::Render()`, `DoRWRenderHorizon()`,
|
||||
`CRenderer::RenderRoads()`, `CCoronas::RenderReflections()`,
|
||||
`CRenderer::RenderEverythingBarRoads()`, `CWaterLevel::RenderWater()`,
|
||||
`CRenderer::RenderBoats()`, `CRenderer::RenderFadingInUnderwaterEntities()`,
|
||||
`CWaterLevel::RenderTransparentWater()`,
|
||||
`CRenderer::RenderFadingInEntities()`, `CWeather::RenderRainStreaks()`,
|
||||
`CCoronas::RenderSunReflection()`.
|
||||
5. `RenderDebugShit()`, `RenderEffects()` (glass, water cannons, special FX,
|
||||
ropes, shadows, skidmarks, antennas, rubbish, coronas, particles, pac-man
|
||||
pickups, weapon effects, point lights, moving things, first-person vehicle).
|
||||
6. Optional screen droplets (`SCREEN_DROPLETS`) then
|
||||
`TheCamera.RenderMotionBlur()`.
|
||||
7. **`Render2dStuff()`**: replay, pickup text, widescreen borders, radio name,
|
||||
console, `CHud::Draw()`, 2D special FX, on-screen timer, messages, fonts,
|
||||
`COcclusion::Render()` (non-`MASTER`), `DebugMenuRender()` (debug menu
|
||||
overlay).
|
||||
8. If the menu is active instead: `CDraw::CalculateAspectRatio()`, size/clear
|
||||
the camera and begin update.
|
||||
9. `RenderMenus()` (`FrontEndMenuManager.DrawFrontEnd()`; `VarConsole.Check()`
|
||||
when the menu is closed, non-`MASTER`), `DoFade()`,
|
||||
`Render2dStuffAfterFade()` (`CHud::DrawAfterFade()`, fonts,
|
||||
`CCredits::Render()`), `DoRWStuffEndOfFrame()`.
|
||||
|
||||
`FrontendIdle()` (the non-PS2 `rsFRONTENDIDLE` path) is much smaller:
|
||||
`CDraw::CalculateAspectRatio()`, `CTimer::Update()`, sprite/font init,
|
||||
`CPad::UpdatePads()`, `FrontEndMenuManager.Process()`, camera clear/begin,
|
||||
`DefinedState()`, `RenderMenus()`, `DoFade()`, `Render2dStuffAfterFade()`,
|
||||
`CFont::DrawFonts()`, `DoRWStuffEndOfFrame()`.
|
||||
|
||||
### 5.3 Debug aids you will use
|
||||
|
||||
* **Ctrl+M** toggles the debug menu (`DebugMenuProcess` in
|
||||
`src/extras/debugmenu.cpp`, compiled when `DEBUGMENU` is defined, i.e. all
|
||||
non-`MASTER` builds). It can teleport, spawn vehicles, toggle rendering
|
||||
options, change time/weather, etc.
|
||||
* **Ctrl+B** toggles the free/debug camera (`IMPROVED_CAMERA`, handled in
|
||||
`CCamera::Process` via `CTRLJUSTDOWN('B')` in `src/core/Camera.cpp`; sets
|
||||
`CCam::MODE_DEBUG`).
|
||||
* Debug overlays are drawn by `RenderDebugShit()` in `src/core/main.cpp`. It always
|
||||
calls `CTheScripts::RenderTheScriptDebugLines()` (defined in
|
||||
`src/control/Script5.cpp`); in non-`FINAL` builds it also calls
|
||||
`CRenderer::RenderCollisionLines()` when `gbShowCollisionLines` is set (flag
|
||||
defined in `src/renderer/Renderer.cpp`, toggled from the debug menu),
|
||||
`ThePaths.DisplayPathData()` (`CPathFind::DisplayPathData`,
|
||||
`src/control/PathFind.cpp`) and `CDebug::DrawLines()`. `src/core/Debug.cpp`
|
||||
provides only that generic text/line buffer (`CDebug::AddLine`/`DrawLines`), not
|
||||
the collision or path drawing. `TIMEBARS` (`gbShowTimebars`) prints per-phase
|
||||
timings.
|
||||
|
||||
---
|
||||
|
||||
## 6. Known fragile areas
|
||||
|
||||
Do not "discover" these the hard way; assume they are load-bearing:
|
||||
|
||||
* **High-FPS timing.** `CTimer::Update` (`src/core/Timer.cpp`, `FIX_BUGS` branch)
|
||||
converts wall-clock time into `ms_fTimeStep`, where 1.0 means 50 Hz, clamps it to
|
||||
`[0.01, 3.0]` and freezes time when a frame exceeds 60 ms. Game logic, physics,
|
||||
animation and FX were written around ~30–50 Hz; above that, assumptions about
|
||||
per-frame movement, input deltas and event counts break (README To-Do: "Fix
|
||||
physics for high FPS"; tracker issue: high-FPS physics/mouse input). Never tweak
|
||||
per-frame constants to "fix" an FPS-dependent symptom without a `FIX_BUGS`-scoped
|
||||
change and a clear statement of what the original code assumed.
|
||||
* **Event-pump pacing in the glfw skeleton.** `rsIDLE` is only dispatched from
|
||||
`GS_PLAYING_GAME` under the frame-limiter condition, and `resizeCB()` can call
|
||||
`Idle()` re-entrantly during a window resize. Mouse-look and camera code derive
|
||||
deltas from pad state that is expected to be reset once per tick; touching the
|
||||
loop or the resize path easily produces doubled input or stuck movement.
|
||||
* **Hardcoded backslash data paths.** Examples: `src/vehicles/Train.cpp:448,452`
|
||||
(`"data\\paths\\tracks.dat"`, `tracks2.dat`), `src/vehicles/Plane.cpp:696,775,781`
|
||||
(`"data\\paths\\flight.dat"`, `flight2.dat`, `flight3.dat`),
|
||||
`src/rw/TexRead.cpp:202,229,251,280` (`"DATA\\CAPS.DAT"`), `:382`
|
||||
(`"models\\txd.img"`) and `:476` (`"models\\txd.dir"`).
|
||||
`src/skel/crossplatform.cpp` (`casepath`, `_fcaseopen`, `_caserename`) copes with
|
||||
`/` vs `\` and with case on POSIX, but only for code paths that go through it. Do
|
||||
not blanket-rewrite these literals: on `miami` they are reversed code; Linux path
|
||||
work is tracked as its own task.
|
||||
* **Case sensitivity of asset names.** Linux filesystems are case-sensitive; the
|
||||
original data is not consistently cased. `_fcaseopen`/`casepath` resolve the
|
||||
real name component by component, but direct `fopen`/`RwStreamOpen` calls bypass
|
||||
that. When adding file access, route it through `CFileMgr`/`_fcaseopen`.
|
||||
* **Save-file layout.** `src/save/*` serialises field by field (see `SaveBuf.h`),
|
||||
and `COMPATIBLE_SAVES` / `FIX_INCOMPATIBLE_SAVES` exist precisely because struct
|
||||
layouts differ between platforms/builds (see the comments in `src/core/config.h`).
|
||||
Never `memcpy` a struct to/from the save buffer, never add/reorder save fields
|
||||
without a `COMPATIBLE_SAVES` path, and do not tighten
|
||||
`VALIDATESAVEBUF`/`VALIDATE_SAVE_SIZE` checks across platforms — they only run in
|
||||
non-`MASTER` builds and are a debugging aid, not an on-disk contract.
|
||||
* **`src/extras/GitSHA1.cpp` is generated.** CMake configures
|
||||
`src/extras/GitSHA1.cpp.in` → `<build-dir>/extras/GitSHA1.cpp` and compiles that
|
||||
(see `src/CMakeLists.txt`); the file is git-ignored and must not be created in the
|
||||
source tree. `printHash.sh` is the premake equivalent. See §3.1 for the
|
||||
empty-SHA quirk when building from a read-only worktree mount.
|
||||
* **`vendor/` submodules are pinned** to exact commits (`git submodule status`).
|
||||
Updating them is a deliberate, verified change of its own — not a side effect of
|
||||
another fix.
|
||||
|
||||
---
|
||||
|
||||
## 7. Never touch
|
||||
|
||||
* **`vendor/` submodule pins.** Bumps are coordinated changes that must be
|
||||
separately motivated and build-verified.
|
||||
* **`gamefiles/`** — shipped game data; changing it changes what players get and
|
||||
requires asset knowledge.
|
||||
* **`.github/`** — historical upstream CI (`reVC_*` workflows), kept as a record.
|
||||
Current CI is `.gitea/workflows/`.
|
||||
* **`premake5.exe` / `premake5Linux`** binaries (checked-in tooling).
|
||||
* **Policy text:** `README.md`'s Contributing/Installation/License sections and
|
||||
`CODING_STYLE.md`. These express project policy and need human sign-off; an
|
||||
agent may fix typos in them only if explicitly asked.
|
||||
* **`MASTER` / `GTA_VERSION` semantics in `src/core/config.h`** (and the
|
||||
`VANILLA_DEFINES` block). Changing what `MASTER` means silently changes which
|
||||
code is compiled as "release" — that is a project decision, not a task detail.
|
||||
|
||||
---
|
||||
|
||||
## 8. Workflow for agents
|
||||
|
||||
1. **Pick one bounded task.** Work is tracked in the Gitea issue tracker
|
||||
(`https://git.thetomie.com/rockstargames/re3/issues`), which is shared by re3
|
||||
and reVC, grouped into milestones:
|
||||
*M1: Repo & CI modernization*, *M2: Linux platform hardening*,
|
||||
*M3: Known bug backlog*, *M4: Toolchain & language modernization*.
|
||||
Work one issue (or one clearly separable slice of one issue) per commit.
|
||||
If no tracker access is available, the task brief you are given is the source
|
||||
of truth. If you work on miami, say so in the issue/commit — the same engine
|
||||
bug may exist on `master` and `lcs`.
|
||||
2. **Read the code you will touch**, plus the nearest neighbours that share its
|
||||
patterns (`premake5.lua` and `src/CMakeLists.txt` glob sources, so adding a
|
||||
`.cpp` needs no build-file edit — but headers and platform guards still matter).
|
||||
3. **Keep diffs minimal.** Fix the thing asked; do not reformat, re-sort, rename or
|
||||
"clean up" adjacent reversed code. Match the file's local style even where it
|
||||
disagrees with `CODING_STYLE.md`.
|
||||
4. **Put behaviour changes behind `FIX_BUGS`.** If the change alters what the
|
||||
reversed code does at runtime, guard it (`#ifdef FIX_BUGS`), or place it in
|
||||
`src/extras/` / `src/skel/` if it is genuinely an addition or platform layer.
|
||||
5. **Verify with §3 before committing.** Fresh-ish build dir, exit code 0, binary
|
||||
produced. The three branches are separate trees: run the build on the branch you
|
||||
are committing to.
|
||||
6. **Commit atomically** with a Conventional Commit subject, imperative, no
|
||||
trailing period:
|
||||
`fix:`, `feat:`, `docs:`, `ci:`, `refactor:`, `test:`, `style:`, `perf:`,
|
||||
`chore:` — optionally scoped, e.g. `fix(glfw): ...`.
|
||||
7. **Never `git push`.** There are no push credentials. The orchestrator mirrors
|
||||
local commits to the Gitea remote through the API. Do not rewrite published
|
||||
history; do not force-push; do not create tags.
|
||||
8. **CI is not your gate.** Gitea Actions need a registered runner (tracker issue:
|
||||
runs stay queued without one). The local §3 build is the authoritative check.
|
||||
|
||||
Quick pre-commit checklist:
|
||||
|
||||
- [ ] only the intended files changed (`git status`, `git diff`)
|
||||
- [ ] no C++11+ constructs outside `src/extras/`, skeletons or `FIX_BUGS` guards
|
||||
- [ ] tabs, pointer style, typedef'd integer types respected in new code
|
||||
- [ ] runtime behaviour changes guarded by `FIX_BUGS`
|
||||
- [ ] §3 configure+build exits 0 in a clean build dir
|
||||
- [ ] commit message is one Conventional Commit line
|
||||
|
||||
---
|
||||
|
||||
## 9. `AGENTS.local.md`
|
||||
|
||||
`AGENTS.local.md` at the repo root is git-ignored (added to `.gitignore` alongside
|
||||
this file, following the llama.cpp convention). It is for **machine-specific**
|
||||
facts: where the Vice City asset directory lives, which build directory to use,
|
||||
container names, local runner quirks, paths to a legally-owned game install.
|
||||
|
||||
It **takes precedence over this file** for anything it states, but it may not
|
||||
override the provenance and style rules in §1–§2 or the "never touch" list in §7 —
|
||||
those are project policy, not local configuration.
|
||||
Reference in New Issue
Block a user