// A research project by Armağan Barış Özerol
GT4-Droid
An open, from-scratch reimplementation of Gran Turismo 4's engine — rebuilt for Android arm64 and documented format by format.
- Work in progress
- Reimplementation, not emulation
- C++20
- Target: Android arm64 · API 24+
commits
days in development
tests passing
GT4.VOL index entries
documented specs
journal entries
Progress
Ten phases from skeleton to Android product. Live state from the project's own status file.
8 of 10 phases complete
Skeleton & ground rules
Done when: Clean checkout builds; test runner and guards live.
evidence: CMake presets, CI, repo_guard, docs-lint
Disc & volume
Done when: GT4.VOL enumerated on Spec II; RoFS spec and tests; Vfs wired.
evidence: 26,891 entries, B-tree verified (formats/rofs.md)
Program container & ProgramData
Done when: Program image decodes and hashes verify.
evidence: Spec II ELF + retail RSA CORE.GT4 (formats/core_gt4.md)
First decode milestones
Done when: Core asset formats decoded through Vfs; whole-disc surveys.
evidence: SpecDB, text/fonts, Tex1, MDLS/Pat0/CAR4
Adhoc VM & menus
Done when: Script-driven main menu boots, navigates and renders.
evidence: AdhocVM v5/v7, gpb1/gpb2, menu_view (dev/ADHOC.md, behaviour/menus.md)
Courses, cars, rendering
Done when: Fly camera through courses; an assembled car renders.
evidence: 110/110 .ad scenes (formats/course.md), car_view/course_fly
Exact core & racing
Done when: Deterministic 60 Hz race with pinned race_hash, compared against PCSX2.
evidence: m0–m9 ✅ — P6_PLAN.md, VERIFICATION.md
GT Mode & saves
Done when: New game → buy → race → earn → save → reload.
evidence: gt_loop_closeout_disc + gt_loop_live_earn_disc live on Spec II; audit work/verification/p7-closeout/
Presentation & features
Done when: B-spec via commands; display presets; audio and video.
evidence: SPU2/banks, PSS, BspecDirector, widescreen
Becoming a real Android app
Done when: Acceptance checklist green on arm64.
evidence: Gradle/SAF, input, replay parity, perf
Working on now
map→port ledger in P8_PLAN.md (pilot = tag-0xB codec → src/audio/ exact (planned)).
Modules
base
DoneFile/config/log/gzip/crypto/ee::F/ee::D/ee_math/game_random/Vu0Random verified
disc
DoneISO9660/UDF/CHD + RoFS Volume + ProgramImage verified on Spec II & retail US
vfs
DoneDev-override layering + reserved virtual files over Volume
formats
In progressspecdb, text, tex, model, course, gpb2, ps2/vif, save/save-files (memcard) ✅; sound/movie → P8
adhoc
Done.adc parser/disasm, AdhocVM, builtins, host tree, project/widget/input/draw + GT Mode/save natives bound (P7; residual face/network surfaces → P8/out-of-scope)
sim / sim/exact
Donem1–m9 ✅ (tick/apply, collision, AI, records/race_hash, race screen)
input
In progressvirtual_pad DS2 PadState + menu keysym pump ✅; bindings/wheels/FFB/touch pending
render / scene
In progressgles_context, gpu_gles, sprite_batch; P6 m8 VU dequant/cull ✅; P8 modes pending
text
In progressGameFonts live fep/ via Vfs; menu text via sprite_batch
app
In progressCLI + screen registry; car_view, course_fly, menu_view, race_view live
tools/gt4tool
In progress--help lists all commands (RE_TOOLS.md)
track
Donem3h adapter over ExactCourse/Rnw4 (docs/dev/TRACK.md)
race
Donem8 — race_setup/race_view live; host autopilot + pose fill (not Spec II AI)
game
DoneP7 closed: GT Mode natives/saves/garage live; P7_PLAN all passes done
audio / video
PlannedStubs — P8 SPU2/sound banks + MPEG-2/PSS
platform
PlannedStub — P9 Android SAF/insets/tilt + Linux user files
How it's built
How a PlayStation 2 game engine gets rebuilt for a phone — the rules the project holds itself to.
Reimplementation, not emulation
A ground-up engine rewrite that reads the game's own data formats — no PS2 hardware emulation.
Bit-exact math
Every simulation path runs on ee::F/ee::D fixed arithmetic mirroring the original — deterministic and bit-comparable.
Spec first, then code
Each format earns a written spec in docs/ before code lands; decoders, synth tests and real-disc tests follow.
Spec II target profile
Built against GT4 Spec II v1.10 — Adhoc v7, native widescreen. Retail US is a cross-check, never an assumed layout.
Nothing ships from the disc
No game data, assets or code listings in the repository — the engine reads the player's own disc at runtime.
Verified, not assumed
Milestones close on counted test passes, pinned hashes and PCSX2 comparisons — not on vibes.
Specs written so far
A written spec for each decoded format — byte layouts and behaviour, kept in docs/.
- RoFS volume indexDocumented
- CORE.GT4 program containerDocumented
- SpecDB car databaseDocumented
- Fonts & text tablesDocumented
- Tex1 texturesDocumented
- MDLS/Pat0/CAR4 modelsDocumented
- Course scene formatDocumented
- Adhoc script VMDocumented
- Menu project packagesDocumented
- Save game setDocumented
- Save card files & interchangeDocumented
- Sound & banksPlanned
- Movie formatPlanned
The journey256 entries in the log
The project's own work log, trimmed to what mattered.
P0 — Skeleton & ground rules
2Nov 9, 2026EE processor + GhidraMCP resolved
Ghidra's EmotionEngine support and the MCP bridge verified — no port needed.
Nov 9, 2026base/ ported — P0 complete
File, config, log, gzip, crypto and ee::F math landed on a green test suite.
P1 — Disc & volume
2Nov 9, 2026RoFS volume internals
GT4.VOL B-tree index and lagged record stream decoded — 26,891 records enumerated.
Nov 9, 2026VFS port — Phase 1 complete
Vfs layering and reserved virtual files working on top of RoFS.
P2 — Program container & ProgramData
3Nov 9, 2026Base crypto primitives
SHA/RSA primitives prepared for unpacking the program container.
Nov 9, 2026Program-image decode chain
Spec II BOOT2 ELF and retail RSA CORE.GT4 chains cracked open.
Nov 9, 2026Program plumbing
ProgramData tables and placement pipeline wired through Vfs.
P3 — First decode milestones
5Nov 9, 2026Retail GT4 US: real CORE.GT4 + multi-chain RoFS
Multi-chain RoFS and RSA CORE.GT4 verified on the retail US disc.
Nov 12, 2026SpecDB container decoded
GTDB Huffman archive, GTID tables and GTST strings unlocked.
Nov 24, 2026Text and font decoders
FT01/KNJI fonts and RT01/RT03 tables decoded with EUC-JP layout.
Nov 9, 2026Tex1 texture decoder
GS memory swizzle, CSM1/CSA CLUTs and paint patches decoded.
Nov 9, 2026Model containers (MDLS/Pat0/CAR4)
MDLS model sets, Pat0 patches and CAR4 car packages opened.
P5 — Courses, cars, rendering
6Nov 9, 2026Course containers
config/*.ad scenes with RNW4/REP4/Mot1/GDGT blocks decoded — 110/110.
Nov 9, 2026New GT4 scene blocks
GT4-specific scene blocks (distinct from GT3R) mapped and decoded.
Nov 9, 2026MDLS draw packets cracked
slot-4 node programs fully decoded — models on the road to rendering.
Nov 9, 2026REF decode → course scenery
REF address semantics bound to course scenery; CAR4 transforms clarified.
Nov 9, 2026Per-draw textures + dev screens
Per-draw texture indices bound; car_view/course_fly dev screens live.
Nov 9, 2026Phase 5 complete
Cars render, free-fly through courses — Phase 5 acceptance criteria green.
P4 — Adhoc VM & menus
6Nov 10, 2026Adhoc .adc container
ADCH bytecode container and class schema decoded.
Nov 10, 2026adhoc-dis disassembler
Real .adc disassembler tool — full instruction set covered.
Nov 10, 2026AdhocVM core
v5/v7 bytecode execution model, class/object tree and builtin surface.
Nov 10, 2026Serialized images + boot chain — 555/569
Serialized script images load; scripted menus boot through the chain.
Nov 10, 2026Project boot path
gpb1/gpb2 project packages wired into boot — the menu script runs.
Nov 11, 2026M-class/widget semantics
Behavioural semantics of Adhoc M-classes and the widget tree documented.
P6 — Exact core & racing
16Nov 15, 2026m1a closeout: compressed GTDB + key census
Compressed GTDB records and key-table architecture fully mapped.
Nov 12, 2026m2 closeout
Conductor step, subclass vtables and input tables closed; m1/m2 docs compressed.
Nov 12, 2026m3h: track/ adapter + m3 closeout
Host-facing track API over ExactCourse/Rnw4 — probes, walls, poses, LapTimer.
Nov 12, 2026m4b: inner pipeline = program VM
The dynamics' inner pipeline confirmed as the program-resource VM.
Nov 16, 2026m4 closeout
Acceptance recount + tick-diff harness comparing green against PCSX2 frames.
Nov 17, 2026Physics docs consolidated
Dynamics tick bodies systematised under behaviour/; collisions.md seeded.
Nov 19, 2026Rigid-body decodes + tests
GDGT rigid-body cluster fully decoded; the port landed on typed decodes.
Nov 17, 2026m5f-2: update_all + pairwise family in ee::F
Collision-pair drivers and update_all ported into exact arithmetic.
Nov 19, 2026m6f-2b: AI pump + Race/Pit wiring
tick_ai_pump in place; AI drivers wired to Race/Pit and pinned.
Nov 19, 2026m6 closeout
AI drivers — device manager, dispatch pump, A/B tick — acceptance recount green.
Nov 19, 2026m7c: recorder + race-flow ports
0x20-byte packet delta codec, RaceOrganization queue and RaceRecord ported.
Nov 19, 2026m7d: race_hash pins + stream round-trip
Stored record stream's race_hash pinned; write-read round-trip green.
Nov 19, 2026m7 closeout
Records, race flow and the race_hash contract — acceptance recount green.
Nov 19, 2026m8i: race_view screen + pins
Race screen live with a frame loop; camera/replay transport pinned.
Nov 19, 2026m8 closeout
Race screen — scene updater, tick, event channel — acceptance recount green.
Nov 19, 2026m9: P6 closeout — exact core done
Deterministic 60 Hz race, pinned race_hash, PCSX2 comparison — P6 green.
P7 — GT Mode & saves
9Nov 28, 2026p7-a1: save crypto kit + EncryptUnit
Memory-card save encryption kit, EncryptUnit and garage ciphers.
Nov 22, 2026p7-a2: .ps2 memcard store + atomic persistence
.ps2 memory-card store with atomic writes — saves persist safely.
Nov 22, 2026p7 phase F batch
GT Mode phase-F items in one batch: F2/F5/F6/F11 closed, F4/F7 in progress.
Nov 22, 2026p7: F6 implemented
Used-car wear model landed following the EE wear model.
Nov 22, 2026p7-f7: race prize payout traced
Native result and script payout chain traced; host-side credit wired.
Nov 22, 2026p7-f3: MOption binds + dispatch fix
MOption subset bound and the singleton method-dispatch bug fixed.
Nov 22, 2026p7-f4 evidence: license wire layout
License book = 0x1A0 block + 124×0x1F8 units; getUnit/predicates take string args.
Nov 22, 2026p7-f4 implementation: license codec + COURSE map
License codec, string-arg natives and the COURSE field map landed.
Nov 24, 2026P7 closeout — full loop green
New game → buy → race → earn → save → reload verified live on the Spec II disc; the residual audit verdicted every open item.
Audits and re-checks
3Nov 9, 2026Final acceptance matrix + B9 closeout
All B1–B9 improvement-audit items closed; the acceptance matrix is green.
Nov 19, 2026MP2 closeout — zero-orphan recount
Project-wide audit closed: c1–c8 module audits fully reconciled against the a0 census.
Nov 28, 2026RECHECK closeout — rcz
P0–P6 re-verification finished — zero orphan findings, all anchors resolved.
Tools built along the way
1Nov 18, 2026Unattended sub-pass queue
/auto + devin-queue: an engine running queued RE sub-passes autonomously.
First steps
1Nov 9, 2026Agent-aware scaffolding + Spec II retarget
Build presets, repo guards and docs structure stood up; target switched to GT4 Spec II v1.10.
Latest commits
- 2026-11-24a440a43docs: pre-P8 hygiene pass — P7-closeout drift fixes + folds
- 2026-11-2441e140bP7_PLAN: fold phases B/C/E/F table markers to ✅
- 2026-11-24ea5c4fep7-docs: closeout folds — P7 ✅
- 2026-11-24d494f93p7: record unit index = table ordinal + closeout loop — P7 gate green
- 2026-11-24837d402p7-f7: honest autopilot lap — parker #2 closed
- 2026-11-2409abea4p7-f7: Spec II SET_STATE continuation semantics + page-module graft — parker #1 closed
GT4-Droid source is opening to the public on GitHub as work in progress.
GT4-Droid is an independent research project — not affiliated with or endorsed by Sony Interactive Entertainment or Polyphony Digital. Gran Turismo is a trademark of its respective owner.