Twin Snakes Recomp

Twin Snakes Recomp is static recompilation of Metal Gear Solid: The Twin Snakes (GameCube) for PC. It contains enhancements like true ultrawide support, cheats, and save states.

README

Twin Snakes Recomp

release downloads Discord Patreon Ko-fi Buy Me a Coffee

A static recompilation of Metal Gear Solid: The Twin Snakes (GameCube) for PC.

The game's own PowerPC code (main.dol and the game module mgso.rel it links at start) is translated to C++ ahead of time and runs on a native runtime that stands in for the console's hardware. No game data is included: you need your own disc images of the USA release (GGSEA4, revision 0, discs 1 and 2), for the downloads as for your own build.

Downloads: Windows (zip), Linux / Steam Deck (AppImage), macOS (Apple Silicon, zip) and Android (APK, experimental) builds are on the Releases page. They contain the game's code in recompiled form, none of its data: start the program and choose your disc images on the launcher's disc page (type or paste a path, pick it in the file dialog, or find it in the built-in browser). Disc 2 next to disc 1 is found by itself. Or build it yourself (below): the build recompiles the game from your disc 1. The Windows zip is portable (everything of yours stays in its user folder) and brings the Visual C++ runtime with it; it needs a CPU with AVX2 (Intel Haswell / AMD Ryzen or newer) and says so otherwise.

Status: playable on Windows, Linux (also as an AppImage for the Steam Deck) and macOS, with sound, widescreen and ultrawide, the port's menu, cheats, save states, texture packs, Discord Rich Presence and RetroAchievements; the Android build is experimental (see below). Played through disc 1 and into disc 2 (the change of discs works in play); disc 2 has had less testing.

What's in it

The port's menu opens with F1, or Back + Start on a controller in play (Back alone elsewhere).

  • Both discs. The game changes to disc 2 by itself when the story gets there: no swapping, no menus. GAME > "Disc at start" boots straight from disc 2.
  • Widescreen and ultrawide. 16:9, 21:9 and 32:9, with the game's view widened (not stretched) and the HUD moved to the screen edges: life and O2 bars, radar, item and weapon windows, the pause screen's map. The PSG1 scope and the Stinger's sight keep their shape. An option removes the cutscene letterbox.
  • Controls. The MGS2 Master Collection layout by default (the GameCube layout is an option), the Master Collection's keyboard and mouse layouts (A and B), mouse and gyro aiming in first person, Invert Y and rebinding. Button prompts (pause screen, codec, incoming calls, the torture) show your controller's buttons or your keys.
  • Psycho Mantis. Move the controller to port 2, 3 or 4 from the menu, and choose which games he finds on your memory card and how many saves he counts. The menu also has Meryl's codec frequency, for anyone without the case's back.
  • Cheats. Invincibility, infinite ammo, O2 and grip, no reloading, the stealth suit and bandana, any item or weapon, the PAL key's form, passing Ocelot's torture, a radar that keeps its map during alerts, and the rank figures. Weapons that can start a fight early (the PSG1) ask first.
  • Texture packs. Dolphin's packs work as they are (their GGSEA4 folder goes in textures next to the saves), and the menu can import the ones in Dolphin's folder.
  • Mods. Gecko and Action Replay codes as Dolphin runs them (codes.ini next to the saves, or imported from Dolphin; MODS switches them), including codes that change the game's code: the functions they change run in an interpreter, the rest stays recompiled. File mods replace the disc's files without patching your disc image: each mod is a folder in mods next to the saves, with its files laid out like the disc's (or under files, as Dolphin extracts a disc). Patched disc images work too.
  • Save states, fast loading and skipped intro logos. The game starts straight at its title screen.
  • RetroAchievements (sign in through your browser, so a password manager can fill it in) and Discord Rich Presence.
  • Steam Deck. Full CPU speed while the game runs, for 60 fps where SteamOS's default holds it at 30 (see Building (Linux)).
  • Session logs. Every start writes one, for bug reports (see Reporting a problem).

Known limits:

  • The game runs at 60 fps. Higher frame rates are not supported yet: the game's logic is tied to its frame rate.
  • A save state loads only into the version that made it (on macOS and Android, only in the same session). The game's own saves on the memory card are not affected.

Building (Windows)

Requirements: Visual Studio 2022 Build Tools (C++), CMake 3.25+, Ninja, clang-cl (LLVM).

# 1. Build: recompiles the game straight from your disc 1 image (RVZ, WIA, ISO or GCM)
powershell -ExecutionPolicy Bypass -File tools\build.ps1 -Disc "<your Twin Snakes disc 1.rvz>"

# 2. Run
build\windows\mgs_snakes.exe --disc "<your Twin Snakes disc 1.rvz>"

The code generated from your disc ends up in build/ and is yours alone: never share it. tools\rvz.py (Python + libzstd) can extract a disc or convert it to ISO.

Building (Linux)

Requirements: clang, lld, CMake 3.25+, Ninja, git, and SDL3's build dependencies (X11, Wayland, xkbcommon, ALSA / PulseAudio / PipeWire, udev and D-Bus development packages).

tools/build_linux.sh --disc "<your Twin Snakes disc 1.rvz>"     # -> build/linux/mgs_snakes

On a Steam Deck the game asks SteamOS for full CPU speed while it runs (F1, DISPLAY -> PERFORMANCE, "Full CPU speed", on by default) and puts the old setting back when it quits: SteamOS otherwise keeps the CPU near its base clock, and busy places run at 30 fps.

Building (macOS, Apple Silicon)

Requirements: the Xcode command line tools (xcode-select --install), CMake 3.25+ and Ninja (brew install cmake ninja). Dawn (Metal), SDL3 and the other libraries are fetched and linked in statically: the app needs nothing installed to run.

tools/build_macos.sh --disc "<your Twin Snakes disc 1.rvz>"     # -> build/macos/Twin Snakes Recomp.app

Copy Twin Snakes Recomp.app anywhere; disc images in the same folder as the app are found by themselves. Settings, saves, states and logs live in ~/Library/Application Support/Twin Snakes Recomp/. The arm64 loader allows only position-independent programs, so (as on Android) a save state loads only into the session that made it; the game's own saves on the memory card are not affected.

If the app or the discs are in Downloads, Desktop or Documents, macOS asks once whether the app may use that folder: allow it (System Settings > Privacy & Security > Files and Folders changes it later). The app is signed ad hoc. A downloaded copy is quarantined: open it once, then choose Open Anyway in System Settings > Privacy & Security (or run xattr -dr com.apple.quarantine "Twin Snakes Recomp.app"). Updates: the menu says when a new version is out and opens its page.

Android (experimental)

The APK (TwinSnakesRecomp-v<version>-android-arm64.apk) is for 64-bit ARM phones and handhelds with Vulkan 1.1 (Android 10 or newer). It is new and has had little testing on real devices: reports are welcome. Install it, start it and choose your disc 1 image in the system's file picker. For disc 2, copy its image into Android/data/io.github.gminustwo.mgssnakes/files over USB (that folder is also where settings, the memory card, save states and logs are). A controller works, and touch controls are on screen; the back button or gesture opens the menu. A save state loads only in the session that made it. Updates: the menu says when a new version is out and opens its page; install the new APK over the old one.

To build it (on Windows): powershell -ExecutionPolicy Bypass -File tools\build_android.ps1 -Disc "<your disc 1.rvz>" after tools\build.ps1 (it needs the Android SDK with an NDK, build-tools, platforms;android-35 and a JDK 17+).

Reporting a problem

Open an issue on the Issues page and pick Bug report (or Feature request for an idea): the form asks for what helps. Please check the open issues first, and report one problem per issue. What to have at hand:

  • The version: under the menu's title (F1, or the controller's Back / Select), e.g. "VERSION 1.0.0". Newer versions may already fix it: the menu offers updates at the top of its first page.

  • What happened and where: the area (or menu, cutscene, codec call) and the moment, whether it happens every time, and how to get there.

  • The session log (required): a bug report needs the log of the play session where the problem happened. Every start writes a new one, named by the date and time it started, so if you started the game again afterwards, the newest log is from that later start: pick the right one by its date and time, and drag it into the issue. It's in:

    • Windows: user\logs next to mgs_snakes.exe
    • Steam Deck / Linux: ~/.local/share/Twin Snakes Recomp/logs
    • macOS: ~/Library/Application Support/Twin Snakes Recomp/logs
    • Android: Android/data/io.github.gminustwo.mgssnakes/files/logs (over USB from a PC)

    It lists your settings, the frame rate every 30 seconds, and what the game was doing in a freeze or a crash. It also shows folder paths, which can include your user name: edit those out if you like.

  • Your setup: the controller (and whether Steam starts the game), your display and aspect ratio, a texture pack if you use one, your CPU and graphics card.

  • A screenshot or a short video for anything you can see.

How it works

  • src/recompiler: finds the functions of main.dol and of the module (shared/mgso.rel, linked here at the addresses the game gives it) without symbols, and writes one C++ function per PowerPC function.
  • src/runtime: the console's hardware (CPU state, memory and the virtual memory the game pages from ARAM, video, disc drive, controllers, memory card, audio DSP), rendering through Aurora, the menu, save states, mods and the updater.

Built on Red Two, the Rogue Leader recompilation: its recompiler and runtime are this project's base, and the macOS port comes from Red Two's, by Matt Bousendorfer. Rendering is Aurora's.

Legal

Twin Snakes Recomp is not affiliated with or endorsed by Konami, Silicon Knights or Nintendo. This repository contains no game code or data: you supply your own discs. Licensed under the MIT license (see LICENSE), which covers this repository's own code only, not the game's code that a build (and the prebuilt downloads) contain in recompiled form; third-party libraries keep their own licenses.