rmexe-mobile-recomp

rmexe-mobile-recomp is a native port of Rockman EXE: Phantom of Network for Android, iOS, Linux, macOS, and Windows that recompiles the game to C++20 and offers 60 FPS motion interpolation.

README

rmexe-mobile-recomp

Static AOT Recompiler (JVM .class $\rightarrow$ C++20) and Native SDL2 Runtime for the Japanese DoCoMo i-αppli (DoJa) flip-phone titles:

  • Rockman EXE: Phantom of Network (MegaMan Battle Network: Phantom of Network, 2004–2009)
  • Rockman EXE: Legend of Network (MegaMan Battle Network: Legend of Network, 2006–2009)

Supports both the original Japanese releases (PoN_jp, LoN_jp) and the English fan-translated patches (PoN, LoN), compiling each .jar ahead-of-time into a standalone native executable with zero external JVM or DoJa emulator dependencies.


Features

  • Ahead-of-Time JVM Bytecode to C++20 Static Recompiler (tools/recomp_jar.py):
    • Parses all class files in PoN.jar (14 classes, 187K lines of generated C++) and LoN.jar (13 classes, 200K lines of generated C++).
    • Translates every JVM instruction into deterministic C++20 basic-block functions with zero-cost exception range dispatch (try/catch over JavaException).
  • Deterministic Handle-Based Memory Arena (runtime/doja_runtime.hpp):
    • All objects and arrays are stored in a contiguous handle table (Ref = int32_t), enabling fast O(1) state snapshotting for rollback netcode and sub-tick interpolation.
  • Clean-Room Native DoJa + CLDC 1.1 Runtime (runtime/doja_runtime.cpp):
    • 240×240 Software Rasterizer & 60 FPS Motion Interpolator: Full support for Graphics.drawImage, drawScaledImage, setFlipMode, setOrigin, fillRect, drawRect, offscreen Image targets, and color-key transparency. Includes a display-list sub-frame motion interpolator (FrameInterpolator) that delivers smooth 60 FPS isometric map scrolling and sprite movement over the deterministic 15 Hz logic loop without altering game speed, with instant 60 FPS / 15 FPS switching (F3, F1 menu, --fps 60|15, controls.cfg).
    • Hardware-Style Indexed GIF89a & Palette Swapping: Built-in LZW GIF decoder for PalettedImage and MediaImage, supporting real-time Palette.setEntry / setPalette swaps used for enemy element coloring, damage flashes, and battle transitions.
    • Authentic Flip-Phone Yamaha MA-3 (YMU762) / MA-5 (YMU765) Stereo FM Audio (common/ymu762_fm.hpp): 44.1 kHz stereo MFi2/MFi5 (.mld) synthesizer featuring 6-waveform 4-Operator (dual 2-Op stack) phase-modulation FM instrument patches, a 26-note MA-3 drum kit, dedicated Rockman EXE battle SE synthesis, panpot/expression/12-bit pitch-bend/vibrato timelines, MA-5 stereo reflection DSP, click-free loop crossfading, and FNV-1a deduplicated on-demand synthesis.
    • Embedded ZIP / JarInflater & ScratchPad Loader: Stream-based PK\x03\x04 deflate extractor (zlib) with automatic detection of the 64-byte DoJa SDK .sp header (511,964 / 512,064 bytes).
    • Copy-on-Write Save Overlay (.sav): Keeps original .jar and .sp files strictly read-only while persisting player save data, downloaded quests, and seasonal courses to .sav overlays.
    • Dual-Mode Capcom i-mode Network & Unified PvP Server (common/capcom_protocol.hpp, common/pvp_protocol.hpp, server/rmexe_server.cpp):
      • Built-in Offline Fallback (Zero-Config Single-Player): Simulates all original Capcom i-mode endpoints (buyreg, server date, scck episodic unlocks, pts portal points, DataSave/Load cloud backups, exesr Top-10 Virus Busting leaderboard & rival chip folders, and dataget.php seasonal 10-wave courses) locally in capcom_local.db.
      • Standalone Unified Server (rmexe_server): Multiplexes TCP HTTP/1.1 (multi-user Capcom cloud saves, live global Virus Busting leaderboard, and PvP room matchmaking) and UDP (low-latency real-time PvP NetBattle frame-input lockstep/rollback relay) on a single port (8765).
    • Cross-Platform 5-Platform Support (CP932 $\leftrightarrow$ UTF-8 & Portable CJK Font Engine): Built-in iconv-free Shift-JIS transcoding, cross-platform POSIX/Winsock2 networking (common/platform_socket.hpp), runtime font selector in the F1 menu, and crisp 12px Japanese/Chinese/English glyph rendering via embedded stb_truetype across Windows, macOS, Linux, Android (APK), and iOS (AltStore IPA).
    • 100% Simplified Chinese Localization Overlay & 3-Language Collection Launcher (rmexe_collection): Non-destructive UTF-8 Chinese translation overlay (assets/translations/pon_zh.json, lon_zh.json) with unified ZH / JP / EN launcher (ZH and JP share one save; EN uses a separate save).
    • QoL, Dual-Slot Autosave & Customizable Assist System: In-game F1 menu options for dual-slot autosave, Buster multiplier, damage/encounter/zenny/run-speed scaling, EX boss toggles, and mobile drag-and-drop touch controller layout editor with touch chip selection.

Repository Layout

rmexe-mobile-recomp/
├── ARCHITECTURE.md          # Full technical specification (60 FPS interpolation & GGPO PvP design)
├── CMakeLists.txt           # Cross-platform CMake build system (Linux & Windows)
├── assets/                  # Place user-supplied .jar, .sp, and .jam files here (gitignored)
│   └── README.md            # Directory structure instructions for JP and EN assets
├── common/
│   ├── capcom_protocol.hpp  # Capcom i-mode binary protocol & persistent cloud/leaderboard engine
│   ├── platform_socket.hpp  # Cross-platform POSIX / Winsock2 TCP & UDP socket abstraction
│   ├── pvp_protocol.hpp     # PvP matchmaking REST + 28-byte UDP real-time frame-sync protocol
│   ├── stb_truetype.h       # Embedded public-domain TrueType/OpenType CJK font rasterizer
│   └── ymu762_fm.hpp        # Yamaha MA-3 (YMU762) / MA-5 (YMU765) 6-waveform ROM & 4-Op FM patches
├── runtime/
│   ├── doja_runtime.hpp     # Deterministic heap, slot types, and DoJaRuntime interface
│   ├── doja_runtime.cpp     # Clean-room DoJa/CLDC runtime, MA-3/MA-5 FM audio, 60 FPS interpolator, UI
│   ├── pvp_pon_engine.inl   # Symmetric 2-player GGPO rollback online PvP engine for PoN
│   ├── net_config.hpp       # CLI/config network, FPS mode & player identity bridge
│   └── main.cpp             # CLI entry point, headless smoke-test & frame capture harness
├── server/
│   └── rmexe_server.cpp     # Standalone single-port TCP (HTTP/1.1) + UDP unified server
└── tools/
    ├── survey_doja.py       # Phase 1 bytecode & ScratchPad static analyzer
    └── recomp_jar.py        # Phase 2 JVM .class -> C++20 ahead-of-time static recompiler

Note on Copyrighted Assets: This repository contains zero copyrighted Capcom game code or assets. You must supply your own legally obtained .jar and .sp files in assets/ prior to building.


Building

Prerequisites (Linux / WSL2 / Windows)
  • C++20 compiler (g++ >= 10, clang++ >= 12, MinGW-w64 / Zig C++, or MSVC)
  • cmake >= 3.16, python3 >= 3.8
  • SDL2 and zlib (libsdl2-dev and zlib1g-dev on Debian/Ubuntu)
1. Place Game Assets

Place the original Japanese and/or English patched files in assets/ as documented in assets/README.md:

Target Executable.jar Path.sp Path
pon_jp_recompassets/PoN_jp/bin/PoN.jarassets/PoN_jp/sp/PoN.sp
pon_en_recompassets/PoN/bin/PoN.jarassets/PoN/sp/PoN.sp
lon_jp_recompassets/LoN_jp/bin/LoN.jarassets/LoN_jp/sp/LoN.sp
lon_en_recompassets/LoN/bin/LoN.jarassets/LoN/sp/LoN.sp
2. Configure and Build with CMake
cmake -B build
cmake --build build -j$(nproc)

Running & Controls

Desktop (Windows / macOS / Linux)

Desktop releases ship the unified rmexe_collection launcher (plus rmexe_server) — the same all-in-one launcher used on mobile. On startup, it automatically scans for both original JP ROMs (PoN_jp / LoN_jp) and fan-translated EN ROMs (PoN / LoN), lets you switch between ZH / JP / EN (synchronizing both game and UI language), and supports drag & drop or IMPORT ROM for .zip / .jar / .sp files. From in-game F1 settings, you can also select Return to Launcher at any time to switch games or ROM languages without restarting the app:

# Unified PoN + LoN Collection launcher (ZH / JP / EN)
./build/rmexe_collection --scale 3 --fps 60

# Direct launch shortcuts via rmexe_collection
./build/rmexe_collection --game pon --lang en
./build/rmexe_collection --game lon --lang zh

# Individual per-ROM binaries are also built locally for development & QA testing
./build/pon_jp_recomp --scale 3 --fps 60
./build/pon_en_recomp --scale 3 --fps 60
./build/lon_jp_recomp --scale 3 --fps 60
./build/lon_en_recomp --scale 3 --fps 60
Mobile (Android APK & iOS AltStore IPA)

Public mobile releases contain zero copyrighted .jar / .sp files. Launch the app and tap any missing game card, IMPORT ROM (multi-select .zip, .jar, or .sp), or IMPORT FOLDER — the app automatically classifies PoN/LoN JP & EN files, extracts .zip archives, copies them into app storage, and refreshes the launcher immediately without needing Android/data access or a restart:

  • Android (rmexe-collection-android-arm64.apk, currently debug-signed):
    • Recommended: Tap IMPORT ROM or IMPORT FOLDER directly in the launcher (uses system SAF file picker; works on Android 11–15+ with zero storage permissions).
    • Manual (adb push fallback):
      /sdcard/Android/data/com.rmexe.recomp/files/assets/
      ├── PoN_jp/bin/PoN.jar   &   PoN_jp/sp/PoN.sp   (required for PoN JP & ZH)
      ├── PoN/bin/PoN.jar      &   PoN/sp/PoN.sp      (required for PoN EN)
      ├── LoN_jp/bin/LoN.jar   &   LoN_jp/sp/LoN.sp   (required for LoN JP & ZH)
      └── LoN/bin/LoN.jar      &   LoN/sp/LoN.sp      (required for LoN EN)
      
  • iOS (rmexe-collection-ios-altstore.ipa, sideload via AltStore / SideStore):
    • Recommended: Tap IMPORT ROM or IMPORT FOLDER directly in the launcher (uses iOS Files UIDocumentPickerViewController).
    • Manual: Open the iOS Files app $\rightarrow$ On My iPhone $\rightarrow$ RMEXE Collection $\rightarrow$ assets/ and place the PoN_jp/, PoN/, LoN_jp/, LoN/ folders there; returning to the app automatically rescans.
Unified Server (rmexe_server) & Online / Offline Modes

By default, all four game clients run in Offline Simulation Mode, handling Capcom i-mode cloud backups, site points, seasonal ranking courses, and NPC rival leaderboards locally without needing an external server.

To host shared cloud saves, a live multi-player PoN Virus Busting Top-10 leaderboard, and PvP NetBattle rooms on a single port (8765 TCP + UDP):

# Start the unified server (persists data to server_data/capcom_state.db)
./build/rmexe_server --port 8765 --data-dir server_data

# Connect any JP or EN client to the unified server (or toggle Online Mode in the F1 menu)
./build/pon_jp_recomp --server 127.0.0.1:8765 --name LAN
Default Controls & In-Game Keybinding Menu

Press F1 or Esc (or Start on a Gamepad) at any time during gameplay to open the interactive Keybinding & Emulator Settings Menu, where you can remap all keyboard slots and controller buttons, switch between 60 FPS Smooth Interpolation and 15 FPS Original Frame Rate, adjust master volume, configure Online/Offline server settings, or toggle the flip-phone Softkey Bar. All settings are automatically saved to controls.cfg.

ActionDoJa KeyDefault KeyboardDefault Gamepad
Move Up / Down / Left / RightKEY_UP / DOWN / LEFT / RIGHTArrow Keys or W A S DD-Pad / Left Stick
A Button (Confirm / Use BattleChip)KEY_SELECT (0x14)Z, J (plus Enter, Space)A / Cross
B Button (Cancel / Mega Buster)KEY_ASTERISK (0x0A)X, KB / Circle
L Button (Left Softkey / Custom)KEY_SOFT1 (0x15)Q, ULB / L1
R Button (Right Softkey / PET Menu)KEY_SOFT2 (0x16)E, I (plus Backspace)RB / R1
Pound / # (Sort Folder / Buster)KEY_POUND (0x0B)C, LX / Square
Page Up / 1 (List Page Up / PoN Rival Folder)KEY_1 (0x01)1, PageUpLT / L2
Page Down / 4 (List Page Down)KEY_4 (0x04)4, PageDownRT / R2
Hold Fast-Forward (Turbo)—Tab, `Y / Triangle
Numeric Keypad (0–9)KEY_0–KEY_9 (0x00–0x09)0–9 / Numpad 0–9—
Emulator Hotkeys
HotkeyFunction
F1 / Esc / StartOpen Pause, Keybinding & Settings Menu (includes Save & Quit)
Tab (hold)Hold for ~3x Fast-Forward
F2Toggle Flip-Phone Bottom Softkey Bar (240×260 $\leftrightarrow$ 240×240)
F3Toggle Frame Rate Mode (60 FPS Smooth Interpolation $\leftrightarrow$ 15 FPS Original)
- / = / F9 (M)Decrease / Increase Master Volume / Toggle Mute
F11 / Alt+EnterToggle Desktop Fullscreen
F12Save 240×240 BMP Screenshot

Architecture & Roadmap

See ARCHITECTURE.md for the complete engineering design.

Completed Milestones
  • Phase 1: Static Bytecode & ScratchPad Survey (tools/survey_doja.py)
  • Phase 2: Ahead-of-Time JVM-to-C++20 Recompiler, SDL2 Native Runtime & Yamaha MA-3/MA-5 Stereo FM Audio
  • Phase 3: 60 FPS Display-List Motion Interpolation & Instant 60 FPS / 15 FPS Toggle
  • Phase 4: Unified Capcom Server & Real-Time PvP NetBattle with GGPO Rollback Netcode (PoN & LoN JP/EN)
  • Phase 5: 100% Simplified Chinese Localization Overlay (PoN & LoN), Runtime Font Selector, QoL/Assist System & Dual-Slot Autosave
  • Phase 6: Cross-Platform 5-Platform Releases (Windows, macOS, Linux, Android APK, iOS AltStore IPA) with Touch Layout Editor
Upcoming Roadmap
  1. 60 Hz GBA-Feel Mode (60 FPS 模拟 GBA 原生手感模式): 60 Hz sub-tick input response (16.7 ms latency) and GBA-paced combat/movement mechanics beyond visual motion interpolation.

License & Disclaimer

  • License: The original source code in this repository is licensed under the MIT License.
  • Third-Party Libraries: Embedded common/stb_truetype.h is dual-licensed under the MIT License / Public Domain. External dependencies (SDL2, zlib) retain their respective licenses.
  • Disclaimer: This project is an independent, clean-room static recompiler and runtime and is not affiliated with, endorsed by, or associated with Capcom Co., Ltd. Rockman EXE / MegaMan Battle Network is a trademark of Capcom Co., Ltd. This repository contains no copyrighted game code or assets; users must supply their own legally obtained files.