VF4-Final-Tuned-Rev-B-Recomp

VF4-Final-Tuned-Rev-B-Recomp is a native PC port of Virtua Fighter 4 Final Tuned that translates the game to C and compiles it on your PC.

README

VF4 Final Tuned (Ver. B): native recomp

Support on Ko-fi

Virtua Fighter 4 Final Tuned (Ver. B) (Sega AM2, Naomi 2, 2004) as a native Windows program, for Windows and for Steam under Proton.

The game's SH-4 program is translated to C and compiled into a Windows executable on your PC, from your own MAME set. The Naomi 2 hardware is done by the program itself, and the pictures are drawn on your GPU. No emulator runs at play time.

Important

This repository does not contain the game, its code, its data or an executable. You need your own MAME vf4tuned set: gds-0036f.chd and vf4tuned.zip (the 317-0387-COM PIC). Everything the build creates comes from your set and stays on your PC. Never share those files.

Installing a release

Download vf4ft-…-windows.zip from this repository's Releases page. It holds the launcher and builder only, no game. You also need your MAME vf4tuned set: vf4tuned.zip and vf4tuned/gds-0036f.chd.

On Windows:

  1. Extract the zip into a folder of its own, for example C:\Games\VF4FT.
  2. Run vf4ft-launcher.exe.
  3. Game files: Use this set (one it found), or Choose folder… and pick the folder that holds vf4tuned.zip.
  4. Build: the game goes into game\ beside the launcher, or elsewhere with Change…. Press Build. The first build downloads about 200 MB of compiler and takes a few minutes.
  5. Play. Optional: to have the game in your Steam library too, press Add to Steam on the Play page. Steam takes a new shortcut only while it is closed (it rewrites its shortcuts when it exits), so if Steam is open the launcher asks you to exit it (Steam menu, Exit) and then choose Try again. The entry gets its pictures in Steam's library (the cover, the banner and the icon), made from your own build: the first time this takes about half a minute. Press it again any time to recreate the shortcut. (Steam has no description for a game added this way.) Or turn on Start the game directly on the Play page: from then on the launcher opens the game straight away, and the game's menu has Open the launcher.

On Linux or a Steam Deck, through Steam's Proton:

  1. Extract the zip into a folder of its own, for example ~/Games/vf4ft.
  2. In Steam: Games menu, "Add a Non-Steam Game to My Library", Browse, set the file type to "All Files", pick vf4ft-launcher.exe in that folder, "Add Selected Programs".
  3. Right-click the new entry, Properties. Its name (the file's name at first) can be changed at the top, to Virtua Fighter 4 Final Tuned for example. Compatibility: tick "Force the use of a specific Steam Play compatibility tool" and choose Proton Experimental.
  4. Start it from your Steam library, then do steps 3 and 4 above, and press Play: the game starts under the same Proton, with Steam Input. This entry is how you play from now on (it opens on Play once the game is built). To have the entry open the game straight away, turn on Start the game directly on the Play page; the game's menu then has Open the launcher.

If Wine is installed (opening vf4ft-launcher.exe from your file manager starts it), steps 2 and 3 can be done by the launcher instead: open it with Steam closed and press Add to Steam on the Play page (after Game files and Build). It adds itself to your Linux Steam, named Virtua Fighter 4 Final Tuned, set to Proton Experimental and with its pictures; with Steam open it asks you to exit Steam first. Pressed from the Steam entry, it asks you to exit Steam and open vf4ft-launcher.exe again from its folder.

On a Steam Deck, do steps 1 to 3 in Desktop Mode and step 4 in Game Mode (more for the Deck). Plain Wine is not supported for playing: the game runs through Steam's Proton. Under plain Wine, Play first says what to expect (Steam Input missing, Wine's graphics and sound) and offers Add to Steam, Play anyway or Cancel.

Two players on two PCs (on one network, from 0.5.6): both PCs need the same release. On the PC that hosts, press Two PCs on the Play page, then Host as player 1 or Host as player 2: its game shows this PC's address and (from 0.5.7) a six-digit join code while it waits. On the other PC press Two PCs, then Join…, type that address, press Next, type the code and press Join: it is the other player. Each code works once, and three wrong ones stop it working; the host's player gets a new one in the game's menu (Join code). The host's settings and saves are used; each player's card stays on their own PC. If the joining player leaves, the host's game goes on and its player plays alone; from 0.5.7 another PC can then join that game the same way, with the new code the host's game shows, and takes over the other player's side, its own card in. If Windows asks, allow the game through its firewall (it uses UDP port 29404).

Latency optimization (from 0.5.11; the launcher's Settings, Game tab, and the game's menu during a two-PC game) is for a slow connection, such as busy Wi-Fi or a VPN. Off, each PC waits for the other player's controls, and the game stops while they are late. On, it guesses them and goes on, and when a guess was wrong it puts it right at once by running the last few frames again unseen (rollback). Auto, the default, turns it on while the connection needs it: on a home network it stays off. Each PC chooses for itself. It takes processor time, and a Steam Deck may not be fast enough for it: if the game slows down on the Deck, set it to Off there (the other PC can keep it on). (How it works.) (How it works; choosing a side, playing on alone; joining a game going on; the join code.)

Screenshots

The launcher makes the game from your set in three steps. These are the Linux launcher's pages; the Windows release is the same program.

Game filesBuild
The launcher's Game files page: it found the set in ~/Games/naomi2The launcher's Build page: step 4 of 6, Compiling, 45%, with the builder's last lines and Cancel
It finds your MAME set, or you choose its folder.About a minute. Cancel stops it and keeps the game you had.
PlaySettings
The launcher's Play page: Play, Settings, Add to Steam, Build again, Game files, and the Two PCs rowThe launcher's Settings, Gamepad tab: a controller and a set of buttons for each player, each column named as that player's gamepad names them
Play, add the game to Steam, or build it again.The game's settings and controls in tabs. The defaults are the PlayStation 2 version's layout.
CardsCard editor
The launcher's Settings, Cards tab: three cards, Kage given to player 1 and Lau to player 2, with Kage's character, rank, ring name, record, games left and itemsThe card editor's Costume 1 tab: four color parts, hair and eye color, and the item slots
Each player's card, as on a cabinet. New makes a ready card with every item.Ring name, character, rank, and each costume's colors and worn items.

The game's menu, over the paused game: Insert or Esc, or a gamepad's View + Menu held for half a second. The keys and buttons at its foot are the ones you last used, here a DualSense's. Settings that apply at the next start keep a dot until then.

Each kind of gamepad has its own names for the buttons: Xbox One and Series, Xbox 360, DualSense, DualShock 4 and 3, Switch, GameCube, the Steam Deck and Steam Controller, and any other pad. In the menus a button does what its label says (A or ✕ selects, B or ○ goes back, wherever a Nintendo pad has them); the game's controls go by where the buttons sit.

Every gamepad input as each kind of pad names it: Xbox, Xbox 360, PS5, PS4, PS3, Switch, GameCube, Steam and generic

The game's menu, Picture tab: the renderer changed to Software, marked to apply at the next start, with DualSense button glyphs

Game (keyboard)Controls (DualSense)
The game's menu, Game tab: Resume, Credits, Card units, Operator test menu, Restart, Quit, with keyboard keysThe game's menu, Gamepad tab: each player's controller and buttons, changed in the game

Status

Playable with sound, built on your PC from your own set by the builder (M5): from the command line or with the launcher. M6 added saves, free play, the card units, a settings page with rebinding, the GPU renderer at up to 4 times the resolution, the Steam Deck route, and the operator's test mode. The game has its own menu over the picture (Insert, Esc, or a gamepad's View + Menu held): it pauses the game, changes settings, reaches test mode from a gamepad, restarts and quits. Two players can play each other on two PCs on one network, and a PC can join a game going on with the host's join code. The latest release, 0.5.36 (Windows, and the Steam Deck through Proton), is on the Releases page; from 0.5.31 on it has a package for Linux PCs too, whose launcher builds the native game. The plan, with its milestones: docs/design.md.

MilestoneState
M0: cross build, window, input, Steam/ProtonDone 2026-11-12. vf4ft.exe runs under Proton Experimental from Steam (Direct3D 12 through vkd3d-proton by default, Vulkan too) and natively on Linux; with Steam Input on it sees exactly one controller (Steam's virtual pad) and reads stick, D-pad and buttons
M1: translatorDone 2026-11-12. Both programs translate to C (6,632 + 2,120 routines) that compiles with no warnings for Windows and Linux; 1.8 million checks against VF4debug's interpreter, none failed (details)
M2: runtime with the hardware models, headlessDone 2026-11-12. The translated game boots to attract and plays CPU vs CPU matches on VF4debug's hardware models, instruction for instruction the same run as VF4debug's (36,000 attract frames and two whole matches compared hash for hash); about 4 times the real hardware's speed with no picture yet (details)
M3: picture, input, real timeDone 2026-11-12. The game runs in a window at 60 fps natively on Linux and under Proton (Direct3D 12), with keyboard and gamepads, and gives the same run as VF4debug's; played through coin, start and a match with a DualSense. The picture is VF4debug's software renderer, 8 to 9 ms a frame with the machine while playing (details)
M4: soundDone 2026-11-12. The game's own sound driver runs on an ARM7 interpreter with a model of the AICA chip and its effect DSP: music, voices, effects and the game's reverb play in the window on Linux and under Proton, and every run is deterministic (details, the DSP)
M5: builder and launcherDone 2026-11-12. Your MAME set to an installed game in about a minute, with no MAME tools and nothing to install: the builder reads the CHD itself, keeps the disc's encrypted image (the game decrypts it at start), downloads a pinned compiler and SDL3, translates and compiles. The Windows launcher (with its own Python) built and played the game under Proton in a fresh prefix (details)
M6: polishDone 2026-11-12. Saves (the cabinet's backup RAM and settings EEPROM), free play by default the operator's way (or arcade coins), the two card units, user/settings.txt with the launcher's Settings page and rebinding. The GPU renderer (Vulkan, natively and under Proton) draws at 1 to 4 times 640 x 480 and matches the software picture; the machine's frame went from 7.0 to 3.1 ms, which puts the Steam Deck at an estimated 10 to 12 ms a frame. The Deck runs the Windows release under Proton (not yet tried on a real Deck). Test mode runs the game's own test program, test.bin, and EXIT starts the game again (details)

How it works

  1. The builder reads your MAME set (its own CHD reader: no MAME tools), checks it is the supported version, and takes out the DIMM image and its key; it decrypts the program it translates.
  2. The translator turns every one of the game's 6,632 routines into C. It uses the routine tables of the matching decompilation (VF4-Final-Tuned-Rev-B-Decomp-Source).
  3. clang (llvm-mingw) compiles that C together with the runtime, which takes the place of the Naomi 2 hardware: inputs, the DIMM board, the ELAN and rendering chips (drawn with SDL_GPU), and the AICA sound chip.
  4. You play the resulting vf4ft.exe on Windows, or add it to Steam as a non-Steam game and run it with Proton.

Building the game from your set (M5)

You need your MAME vf4tuned set in one folder: gds-0036f.chd and vf4tuned.zip side by side, or MAME's own layout (roms/vf4tuned.zip and roms/vf4tuned/gds-0036f.chd; then give the roms folder). The builder checks both files and stops with a message if either is not the right one. It downloads the pinned compiler (llvm-mingw, 84 MB on Linux, 191 MB on Windows) and SDL3 on its first run, into ~/.cache/vf4ft-builder (Linux) or %LOCALAPPDATA%\vf4ft-builder (Windows), and checks their SHA-256. A build takes about a minute on a fast PC.

From this repository on Linux (Python 3.12 or later: python3 --version; Arch: sudo pacman -S python). Replace the two folders with yours:

python3 -I tools/make_game.py --set ~/Games/naomi2 --out ~/Games/vf4ft

That makes ~/Games/vf4ft/vf4ft.exe (with SDL3.dll, data/ and user/). To play it from Steam with Proton, close Steam (Steam menu, Exit), then:

python3 -I tools/steam_shortcut.py add ~/Games/vf4ft/vf4ft.exe

Start Steam and play "Virtua Fighter 4 Final Tuned" from the library. For a native Linux program instead (needs clang and SDL3: sudo pacman -S clang sdl3 pkgconf), add --target linux to the first command; that makes ~/Games/vf4ft/vf4ft, which you run directly (libvf4ft-vk.so beside it is the game's own: with it the ray tracing works on the renderer's graphics device, design.md s114; without it the game runs as before 0.5.30).

After updating this repository (git pull), rebuild the install with the new code. The set is not needed again, and user/ is kept:

python3 -I tools/make_game.py --update ~/Games/vf4ft

With the launcher. A release is a zip with vf4ft-launcher and everything it runs (on Windows also SDL3.dll and Python's embeddable package, so nothing has to be installed). It walks through three steps, shown at its top: Game files (choose the set's folder; a set it finds in the usual places is offered with Use this set, never taken by itself), Build (where the game goes, with Change…; then the stage, a progress bar, the time so far and the builder's last lines; Cancel stops it cleanly), and Play. The Play page also has Settings (the game's settings and controls, in tabs), Add to Steam (adds the launcher as a non-Steam game, or recreates that entry; with Steam open it asks for Steam to be closed first; under Wine on Linux it adds it to the Linux Steam, set to Proton), Build again and Game files (Back on either of those pages leads to the Play page again), an Update card when the builder is newer than the game it built, and Start the game directly: with it on, the launcher starts hidden, opens the game and closes with it, so its Steam entry plays the game; it still shows itself when it is needed (nothing built, an update, an error), and the game's menu has Open the launcher (details). The mouse (its wheel moves through a list's rows), the keyboard (arrows, Enter, Esc; Q and E switch tabs) and a gamepad (D-pad, A, B; LB and RB switch tabs) all work it. Its window starts maximized (and fullscreen, as a borderless window always, when the game's Fullscreen setting says so); take it out of maximized and it starts as a plain window from then on. The game's window starts maximized too, unless Fullscreen is on or Window size names a size (design.md s70). The game goes into game/ beside the launcher unless you choose another folder with Change… on the Build page: an empty folder or an earlier install is used as it is, and any other folder gets a VF4 Final Tuned folder of its own inside it (the builder never writes among other files). Changing it copies your saves and settings into the new folder at the next build; the old folder stays as it was. The Windows release runs on Windows and, on Linux and the Steam Deck, under Proton (Steam, or umu-run); plain Wine is not supported (why). The launcher's window draws as the game's Renderer and GPU settings say, and changes with them (how); when no GPU can draw it, SDL's own order is used, Vulkan first under Proton and Wine (why). SDL_RENDER_DRIVER picks another of SDL's renderers. To build the launcher from this repository: cmake --build build/linux --target vf4ft-launcher (it needs no translated code), then build/linux/vf4ft-launcher. A release folder is put together by tools/package_release.py (its usage is at its top).

Updates. A release checks this repository's Releases page each time the launcher starts (one request to GitHub, no download). When a newer release is out, the Play page says so:

  • Update now downloads it, puts it in place, restarts the launcher and builds the game again.
  • Install on next launch downloads it now; it installs the next time you start the launcher, which builds the game again. (Its files are put in place as the launcher closes.)

Saves and settings stay. Check for updates, at the foot of the Play page, asks again. A development build never updates itself; only a release folder does (it has release.json). The game added with Add to Steam starts without the launcher, so its own menu has Check for updates too (Game tab). When a newer release is out, turn on Update when I quit: quitting the game then starts the launcher, which updates, builds the game again and closes (details, from the game).

Release 0.5.0 has no updater. To leave it, extract the new zip, copy everything inside its folder into your 0.5.0 folder, replacing the files, then start the launcher and press Update on its "new builder" card. Your Steam entry, saves and settings sta