pc_decomp_ut3

pc_decomp_ut3 is a native Android port of Unreal Tournament 3 built by statically recompiling the original PC executable to C.

README

pc_decomp_ut3

Native Android ARM64 port of Unreal Tournament 3 (PC, 2007), built by statically recompiling the original 32-bit x86 executable and its DLLs to C, compiling that C for AArch64 with the Android NDK, and supplying an Android Win32 / Direct3D 9 compatibility host. No x86 emulator runs on the phone.

Bring your own game. The port needs the files of the Steam version of Unreal Tournament 3: https://store.steampowered.com/app/13210/Unreal_Tournament_3/. This repository contains the port, its build tools and pinned dependencies. Original executables, DLLs, game assets and the C generated from them are not part of it; every input is checked against the SHA-256 of the Steam build in config/inputs.json and config/modules.json.

This is an unofficial fan project, not affiliated with or endorsed by Epic Games or the other rights holders of Unreal Tournament 3. Unreal Tournament 3 and its content belong to their respective owners.

Status and features

Current version: 0.5-dev (versionCode 9). The versionCode also counts internal test builds.

  • The original game code runs as statically recompiled native code; the PE images it was recompiled from are made at start from the game's own Binaries (relocated to the port's bases, size and CRC-32 checked). The Visual C++ 2005 runtime the game's DLLs import is built into the port.
  • Renderers: OpenGL ES 3.2 (the port's Direct3D 9 on GLES, every device), DXVK on the system Vulkan 1.3 driver, and DXVK on Mesa Turnip for Adreno 6xx/7xx, with the bundled Turnip build or your own driver package (an adrenotools ZIP with meta.json, or the driver .so). A driver check in a separate process tells which renderer can run on the device.
  • GLES rendering runs on a dedicated thread by default, with CPU core selection, asynchronous GPU query polling, streaming uploads and shader program prelinking. Program binaries are cached with driver-change invalidation; DXVK pipeline caches distinguish drivers and retain the current and newest other cache for each driver. DXVK also supports scaled vertex formats through a shader fallback when needed, and hands out occlusion queries from one query pool at a time: PowerVR's Vulkan driver splits a render (storing and reloading the whole frame) whenever consecutive queries use different pools.
  • An optional FPS counter (launcher → Options), drawn the same way with every renderer: the frame rate and a frame-time graph in the style of DXVK's HUD, optionally with the system: SoC and its cluster clocks, the game's CPU load and busiest threads, GPU and driver, memory, Android's thermal status and headroom, battery and screen. Android gives apps no CPU or GPU temperature, so heat shows as the thermal status and the battery's temperature.
  • Launcher: game files from a folder or a ZIP archive (a ZIP stored without compression plays in place), languages (English, Russian, German, Polish), update checks through GitHub releases, cleanup of unused files.
  • Touch controls with an analog stick, swipe look, weapon bar selection, vehicle profiles, an editable layout and an optional gyroscope; physical gamepads as XInput controller 0 with the original bindings and rumble.
  • Optional ASTC/ETC2 texture conversion in the launcher, with an undo action and runtime DXT decoding for cache misses and modded textures, including games played directly from a stored ZIP. The launcher shows the scan while it runs and offers retry after a read failure. Original game packages are retained.
  • Drag, resize and hide individual touch controls; floating or fixed movement stick, movement while holding left fire, swipe/tap weapon selection and separate weapon bar/wheel sizes. Global touch visibility includes a startup suggestion based on connected input devices and a “don't ask again” choice. Hold the on-screen Pause button to open the layout editor; a short tap opens the original pause menu.
  • Hor+ widescreen camera, HUD and menu scaling including button callouts, tabs, game modes and map lists; an ANDROID tab in the original settings menu. Touching an option preserves the list's scroll position.
  • Touch selection in the original command menu, including categories, commands and recipients. The Scorpion uses direct stick steering with an axial dead zone, so a small sideways drift of the movement finger does not lock its wheels. Throttle remains analog, and physical gamepad axes retain their original behavior.
  • Tapping an editable text field opens an Android text-editing dialog after the original UI consumes the click. The keyboard control also edits console and chat lines; commits preserve the original character filters, and cancelling keeps the original text. Tabs and bottom action buttons have taller touch targets, with gaps assigned to the nearest button. Long tab captions fit their width; the Android page's button caption uses the selected localization. Seat switching is hidden in one-seat vehicles; its wheel shows available seats and permitted bot swaps.
  • The first start uses an installed localization matching the system language, with English as fallback; the FPS selector lists the display's supported refresh rates at its current resolution.
  • The in-game Android settings support English, Russian, Czech, German, Spanish, French, Hungarian, Italian and Polish. Weapon-button swipes and weapon-bar swipes can be configured separately.
  • Every finger turns the camera by its own movement: a held Fire button (also a phone's shoulder trigger mapped onto it) never blocks look drags with another finger, and dragging from Fire, secondary fire, Jump or Crouch turns the camera too, so the thumb that fired or jumped keeps aiming.
  • LAN games between the PC game and the port, both ways.
  • OpenSpy service and authentication compatibility, adapted from mods/fix_mp/dinput8.dll to the pinned Steam executable. The original login/profile menu is available; an OpenSpy account is needed for online play.
  • Profile writes before sign-in are rejected, so startup defaults cannot overwrite saved settings or campaign progress. ZIP installations create physical save directories beneath virtual archive parents as needed.
  • Bink movies with sound (intro, loading, campaign), skippable by tap or gamepad.
  • The original PC hardware appraisal is disabled on Android. The advanced-video MAX GRAPHICS button applies the original highest quality presets, then disables motion blur, depth of field and both bloom options. The original Screen Percentage is the only 3D resolution control and survives restarts.
  • PhysX effects (CPU) enables the original hardware-effect path with the game's PhysX 2.7.3 CPU solver: hardware scene, cloth and fluid descriptors are translated at the SDK boundary. No AGEIA PPU or CUDA GPU is emulated. OpenAL (AAudio / EAX) selects native OpenAL Soft with EAX 1–5 and EFX effects; Generic Software is the basic mode. Android processes the physics and audio effects on the CPU: on the tested Dimensity tablet OpenAL with EAX gave about 20% fewer frames per second in the benchmark demo (29.2 against 23.4). The PhysX option is the profile setting the game applies on every map start; the CPU simulates scenes, cloth and fluids in both settings, and with it on DM-HeatRay_PhysX ran about 6% slower on a Helio G90T. Maps made for PhysX hardware are CPU-heavy either way: DM-HeatRay_PhysX runs at about 10–11 fps on that phone (2.1 before the native fluid kernels, x87 values in C locals and the native pair removal of the second PhysX thread).
  • Android settings include FSR1 EASU/RCAS and FXAA. Spatial filtering runs on the 3D scene before the HUD, using the original Screen Percentage; both work with GLES and DXVK.
  • Gyroscope mode Firing or aiming follows weapon firing, sniper zoom and guided Redeemer control without holding a separate activation key. Existing gyroscope modes retain their saved indices.
  • Native crashes and uncaught Java exceptions are journaled in userdata/ut3-crash.txt next to userdata/ut3.log. With the launcher's Crash monitor option (Options, off by default) a separate Android process (about 30 MB of memory for the whole game) shows the cause and report path after a crash, with Copy to clipboard and Exit buttons, and keeps persistent reports in userdata/crashes: the native journal, game-log tails and Android's available exit trace/tombstone.

Known limitations: a stable 60 FPS at the display's native resolution is not reached on the tested phones; the port needs Android 11 or newer on 64-bit ARM. OpenSpy endpoint initialization, protocol boundaries and an authenticated Internet match on the Ural BTFA server have been checked. Account creation and every server/mod combination have not been verified.

Tested devices: Google Pixel 10a (Mali-G715, Android 17), Google Pixel 10 (PowerVR, Android 17), and a Snapdragon 870 phone (Adreno 650, Android 15) for the Turnip renderers. Earlier GLES, texture-cache, menu and touch checks also ran on a BOOX GALILEO3 tablet with Android 11. The 0.3-dev changes were additionally checked on realme GT Neo 3T (Snapdragon 870, Android 15) and realme RMX3851 (Snapdragon 8s Gen 3, Android 16). The final version-bumped APK passed build, signature and alignment checks; it was not installed for a separate device run. The scaled-vertex fallback still needs testing on a proprietary Qualcomm Vulkan 1.3 driver, and render-thread core selection needs a two-cluster device comparison.

Requirements

  • Windows 10 or 11 (x64) with the Steam version of Unreal Tournament 3 installed. The UnrealScript package of the port is compiled with the game's own compiler.
  • The Microsoft Visual C++ 2005 runtime 8.0.50727.9680 in C:\Windows\WinSxS (msvcr80.dll, msvcp80.dll; their hashes are pinned in config/modules.json). The recompiler reads them there.
  • Python 3.12 or newer with the packages of requirements.txt.
  • Android SDK with build-tools 36.0.0, platform android-37.0, CMake 3.22.1 and NDK 27.2.12479018; a JDK 17 or newer.

Build the APK

From the root of a clone:

git submodule update --init -- reference/astcenc reference/etcpak
python -m pip install -r requirements.txt
$env:ANDROID_SDK_ROOT = Join-Path $env:LOCALAPPDATA "Android\Sdk"
$env:JAVA_HOME = "C:\Path\To\JDK"

If Steam keeps the game elsewhere than C:\Program Files (x86)\Steam\steamapps\common\Unreal Tournament 3, set source_root in config/inputs.json to that folder.

python tools/inspect_inputs.py --verify      # the Steam files match the pinned hashes
python tools/lift_ut3.py                     # C for UT3.exe and its DLLs in generated/
python tools/build_uscript.py                # build/uscript/AndroidPort.u with the game's compiler
python tools/build_android.py --shared --jobs 4
python tools/build_apk.py --library build/android/libut3.so --output build/apk/ut3.apk

build_android.py first stages the pinned native runtimes: OpenAL Soft with Oboe (reference/audio-runtime), DXVK (reference/dxvk-runtime; the port's bridge is compiled from android/dxvk) and libadrenotools with the bundled Turnip driver (reference/adrenotools, reference/turnip-android). Every prebuilt library is pinned by SHA-256 in the dependencies-*.json files; tools/build_dxvk.py --rebuild and tools/build_native_audio.py --rebuild rebuild DXVK and OpenAL from upstream sources at the pinned revisions.

tools/build_postfx_shaders.py regenerates the checked-in Shader Model 3 FSR1/FXAA kernels using Windows' D3DCompiler.

To prepare the PhysX Mod Pack without running its MSI installer:

python tools/extract_physx_mod.py mods/UT3_PhysXModPack.msi mods/UT3_PhysXModPack

Copy the extracted game directory's contents into the game root. The tool verifies all 73 MSI files and writes a SHA-256 manifest and installation notes; original documents and licences are retained separately. On the tested Android device, HeatRay's hardware-requested fluids and Tornado's hardware-requested cloth create successfully with the CPU solver.

Shaders that no shader cache holds, such as the materials of this pack or of any other mod, are compiled on the device: android/host/hlsl_vkd3d.c answers the game's D3DXCompileShader with vkd3d-shader (reference/vkd3d, built by tools/build_vkd3d.py), and the results are kept in <data>/shadercache while the game also stores them in its own local shader cache. The first load of a map with new materials takes longer (on the tested Dimensity tablet about 17 ms per shader, 1100 shaders for DM-HeatRay_PhysX and 5600 for CTF-Tornado_PhysX); later loads read the caches. tools/test_vkd3d.py checks the compiler on a phone against bytecode of Microsoft's d3dx9_35.dll made from recorded requests (tools/compile_shader_requests.py).

The optional converter, libtexconv.so, is built with tools/build_texconv.py from the upstream ASTC/ETC2 submodules in reference/astcenc and reference/etcpak. Their revisions are pinned by Git; source hashes in dependencies-textures.json use LF line endings so validation also accepts Windows CRLF checkouts.

build_apk.py signs with the signer configured in PORT_SIGNING_CONFIG, else with a local debug key (build/android/debug.keystore). An APK installs as an update only over one with the same signer. The APK contains a stripped copy of libut3.so; the original build output retains its symbols for profiling. The receipt records both library_sha256 (original) and packaged_library_sha256 (APK copy). Removing non-allocated symbol tables saves download and storage space, not resident RAM.

The 0.3-dev APK uses the standard -O2 build above. Earlier release APKs also used profile-guided optimization from a profile recorded on a device and -mtune=cortex-a77.

Selected UE3 hot paths are implemented as native algorithms in android/host/game_native.c, render_native.c, render_hash_native.c and render_draw_native.c: actor transforms and iteration, matrix multiplication, sphere/frustum tests, container lookups and static draw-list traversal. Their adapters preserve the 32-bit guest ABI; the remaining engine and draw policies still use the lifted code. The build redirects both indirect calls and direct calls, including calls in the same generated source file. These implementations use C to share the existing host/runtime; changing the language or a file's extension alone does not remove the guest register model or establish a speedup.

render_visibility_native.c implements the connected 00F01CF0 primitive/view and light visibility traversal, including history setup, restriction filtering, culling decisions and visibility lists. Local bit operations and sparse advancement avoid guest helper calls; engine policy, occlusion-query and rendering callbacks retain their ABI and ordering. render_sparse_native.c also ports the shared 005DAF50 allocation-bit iterator initializer used by visibility and draw traversal. Original bodies remain available for differential testing; absence from one captured match does not make other game functions safe to remove. render_bitarray_native.c shares a native context across the four bit-array storage operations (00BF81A0, 00BF82A0, 00BF82F0, 00BF8340), preserving inline storage, heap ownership and deep assignment. render_light_native.c implements the 00EFF830 per-view light-array destruction loop and capacity reset; actual DPG destruction and allocation remain engine callbacks. render_occlusion_native.c implements the 0117AEC0 temporal occlusion decision and its 01178C60 bounds helper: prior-query results, conservative visibility checks and query scheduling. Internal bounds preparation stays in the native context; history storage, RHI/query ownership and RNG remain callbacks. Explicit floating-point operand order preserves NaN payload behavior.

Native AI algorithms in ai_native.c, ai_reach_native.c and ai_perception_native.c cover weighted navigation graph search, ReachSpec support checks and directional path costs, and perception candidate filtering and controller traversal. ai_trace_native.c implements the segment/AABB test used by collision traces for perception and movement. Scripted bot behavior, virtual cost/visibility policies, perception events and recursive octree traversal retain their original implementations. The ports preserve callback order, guest frames, numerical rounding and cooperative scheduling; they do not reduce the bot population or the frequency of AI updates.

For differential checks, userdata/game-native, render-native and render-hash-native accept 0 (lifted), 1 or no file (native), and 2 (compare results, log mismatches, retain the original result). Checks that would release the guest machine to another thread avoid executing that handover twice. render-draw-native accepts 0/2 (lifted) and 1 or no file (native): drawing cannot be run twice for a live comparison. Its standalone fixture compares the callback sequence, arguments, state and memory changes with the original traversal instead. These developer diagnostics are cached until the process restarts. render-visibility-native, render-sparse-native, render-bitarray-native, render-light-native and render-occlusion-native are experimental: 1 enables native; 0, 2 or no file runs the original once. These nine implementations passed differential checks but were slower in the November 7 Torlan ABBA comparison. The November 8 visibility revision removes duplicate register storage and uses the existing separated guest-state compiler profile for this module only. In paired ARM64 kernel tests it uses 13.79% less CPU than the previous native traversal and 6.53% less than the lifted original. The November 8 Torlan ABBA comparison did not establish a whole-game gain: pooled FPS was 28.143 before and 26.857 after, with substantial thermal/workload drift and opposite pairwise results. The modules remain opt-in. Earlier native modules keep their existing defaults. Their fixtures compare guest register/flag state, callback/yield boundaries and memory mutations, including aliasing and floating-point edge cases, against the lifted originals.

The Android settings page also offers Execution mode: Optimal (ARM64) keeps the existing native defaults above; Exact (x86) forces the recompiled originals for all 30 manual game, render, AI and PhysX targets, overriding individual diagnostic files. The selection is saved as executionMode=0/1 in UTAndroidPort.ini and applies after a process restart. Both modes run as ARM64 code and keep the platform and networking compatibility fixes. Exact selects original algorithms; it is not a complete bit-exact x86 floating-point emulator or a multiplayer guarantee. See execution-mode contracts and precision limits.

Masked call protocol (November 8). tools/call_protocol.py (the Heroes V whole-program analysis, ported to UT3's module layout, with capstone's fcompi/fucompi spelling added to the flag table) writes build/call-protocol*/summary.json: per lifted body the callee-saved registers it may read on entry or change, and which bodies' callers read flags. tools/build_android.py --call-protocol SUMMARY compiles every lifted body with its registers in C locals and rewrites calls, tails and exits through tools/protocol_transform.py: a call publishes and reloads EAX/ECX/EDX/ESP plus what the callee summary requires, flags only where a reader exists, and an exit republishes every callee-saved register the body itself left stale in the globals (clean exits), so host code and full-protocol callers still find the values of the full protocol. Bodies the host replaces (--wrap targets and all void_dispatch_add overrides), import slots of non-ABI exporters (`_