pc_decomp_pk

pc_decomp_pk is an Android port of Painkiller: Black Edition using ahead-of-time recompilation with native graphics backends and touch controls.

README

Painkiller Black Edition for Android

Version: 0.1-dev · Platform: Android ARM64 · Status: experimental

An unofficial Android port of Painkiller Black Edition using ahead-of-time static x86 recompilation, a local Win32 compatibility host, native graphics backends, and touch controls. The Windows game modules are lifted to C on the build PC and compiled into libpainkiller.so with the Android NDK.

Project repository: phys-winner/pc_decomp_pk.

Compatible game

This project is compatible with Painkiller Black Edition from GOG, including Battle out of Hell. The supported input revision is Black Edition 1.64. Executable and DLL hashes are pinned in config/modules.json; shader data is pinned in config/inputs.json. Other executable revisions and editions are not verified. Buy and use your own copy of the game.

The source repository contains the port, build tools and source dependencies. Original executables, DLLs, game archives, generated game code, saves and signing keys are local inputs and are excluded from Git. The APK requires your game files; it is not a standalone copy of Painkiller. Project licensing does not grant rights to the original game's code, assets or trademarks.

Requirements and installation

  • Android 8.0 / API 26 or newer, with a 64-bit ARM userspace (arm64-v8a).
  • OpenGL ES 3.1 for the default renderer, or Vulkan 1.0 for the Vulkan renderer.
  • Enough free storage for your Black Edition installation and, optionally, a separate converted texture cache. Allow extra space during import.
  • Your own GOG installation, installation archive, or offline installer files.
  1. Install the APK and open Painkiller. Development APKs are signed with a local Android debug key; updates must use the same key to install over an older build.
  2. In the launcher, import your game folder, ZIP archive, or GOG offline installer. Keep the original Bin/ and Data/ layout. Select all companion installer files if the GOG installer is split into multiple files. The launcher checks required files before allowing the game to start. For a ZIP with stored (uncompressed) game data, Play from the archive reads the files in place. Texture conversion also reads that archive; its separate writable cache survives game restarts.
  3. Grant storage access when requested for a folder outside the app's own storage. The launcher also requests local-network access where the Android version requires it.
  4. Choose a renderer. Use the texture conversion offered by the launcher when the selected driver cannot sample the game's DXT textures. ASTC 4x4 and ETC2 caches leave the original archives unchanged and can be removed or extended later.
  5. Press Play. The default shared-storage root is /sdcard/Painkiller; game data uses game/ and saves/settings use userdata/ below that root.

Features

  • Native OpenGL ES and Vulkan renderers, with system Vulkan, bundled Mesa Turnip for supported Adreno devices, and bundled PanVK for supported Mali devices. The launcher probes driver support before selecting a Vulkan mode.
  • Build-time translation of the original shader library, with runtime translation and caching for shaders supplied by mods.
  • Touch movement, aiming and actions, an editable control layout, gyroscope input, and physical keyboard, mouse and controller input. Weapon controls include a configurable wheel that opens on press, swipes, previous/next buttons and a last-weapon tap. Custom buttons can use the full screen, including the strips beside a display cutout; edge-aligned buttons accept touches up to the edge.
  • Port settings integrated into the game's options, rendering scale, FSR1 scaling, a native damage-blur effect, and a performance overlay. Android performance hints (ADPF) are enabled by default on supported devices; the launcher's saved choice takes precedence.
  • Launcher import, renderer selection, texture conversion, logs, and English and Russian launcher text.
  • Selected files from Randomguy7's Fix Compilation v4.4: the fixes option is on by default; balance/gameplay changes are a separate option, off by default. Credits are available in the launcher and android/credits.
  • Native implementations of selected math, Lua, Havok and MP3 hot paths, alongside the lifted engine and its Win32 host.

Current limitations

This is a development release. Menus, rendering, level loading and combat have been exercised on real Adreno and Mali devices during development; a complete campaign playthrough and online multiplayer are not verified. Performance depends on the level, device, thermal state and graphics driver.

Vulkan MSAA is not implemented. Custom shaders and mods use fallback paths and may expose unsupported behavior. Uninitialized Havok integration velocities that caused rocket-combat NaNs have been fixed, with additional bounds guards in the portal walk. Severe FPS drops in extended rocket-heavy combat remain under investigation. Bloom is disabled once for existing profiles as well as new ones. Enabling it shows a one-time warning about graphical artifacts; subsequent saved choices are preserved. The bundled community Turnip binary has an incomplete upstream license manifest; see THIRD_PARTY_NOTICES.md for provenance and scope.

Building

The current scripts target Windows and PowerShell. A fresh clone requires local game inputs and external packaging runtimes; cloning alone is insufficient.

Install Python 3.13, Visual Studio C++ Build Tools with a Windows SDK, a JDK (the default is C:\Portable\jdk-24.0.1, overridable with JAVA_HOME), and:

  • Android SDK Build Tools 36.1.0 and platform android-37.0.
  • Android NDK 27.2.12479018, including its bundled shaderc/glslang sources.
  • Python packages from requirements.txt.

ANDROID_SDK_ROOT overrides the default SDK under the current user's AppData/Local/Android/Sdk. The NDK is pinned by the build scripts.

python -m pip install -r requirements.txt

Prepare the following local inputs:

InputLocation / configuration
Original Windows modulesCopy the files named in config/modules.json from the game's Bin/ into original/bin/; hashes must match. Include the optional Miles modules if available.
Original shader archivepython tools/build_shaders.py --import 'C:\Games\Painkiller Black Edition' copies and validates Data/Shaders.pak. Replace this example path with your own installation.
Fix Compilation v4.4Put the archive named in config/fix-compilation.json into original/fix-compilation/; its SHA-256 is checked during packaging. Source: Randomguy7's Fix Compilation.
Vulkan runtimeSupply the libraries and notices pinned by config/vulkan-runtime.json in original/vulkan-runtime/ (licenses/ for notices), or set PK_VULKAN_RUNTIME.
PanVK referenceA directory with MANIFEST.json, its pinned library and notice; defaults to ../launcher/drivers/panvk. Set PORT_PANVK_REFERENCE to use another copy. Both the manifest and project pins must match.
GOG installer readerA receipted ARM64 libinnoextract.so built with the Heroes V project's tools/build_innoextract.py. Defaults to ../homm5/build/gog-android/libinnoextract.so; set PORT_GOG_READER for another location. Keep build-receipt.json beside it.

The seven external source dependencies under reference/ are Git submodules pinned to exact upstream commits. Initialize them after cloning:

git clone --recurse-submodules https://github.com/phys-winner/pc_decomp_pk.git
cd pc_decomp_pk
# For an existing clone:
git submodule update --init
python tools/dependencies.py

config/dependencies.json records revisions, source file mappings and hashes. tools/dependencies.py copies the required subset into build/dependencies/, applies the patches in patches/dependencies/, and verifies every resulting file. The build scripts also run this preparation automatically. Upstream checkouts stay clean. Local pcrecomp and MojoShader changes, and the standalone dlmalloc MIT-0 notice, are preserved as patches; the prepared sources match the previous source snapshot after line-ending normalization.

The shared launcher in android/launcher/ remains project source: it has no independent upstream Git repository. The SDK/NDK, GOG reader and pinned binary driver inputs remain separately supplied build prerequisites. Select the included launcher explicitly so a sibling checkout cannot silently change the package:

$env:PORT_LAUNCHER = (Resolve-Path android/launcher).Path
python tools/lift_painkiller.py
python tools/build_android.py --jobs 6
python tools/build_apk.py

The lifter validates input hashes, prepares relocated images in generated/input/ and writes C into generated/. APK packaging builds the shader library, texture converter and launcher probe, verifies pinned runtimes, checks signing and 16 KB ZIP alignment, and writes build/android/painkiller.apk plus a JSON receipt. The first build creates build/android/debug.keystore; preserve it privately for future updates. The APK is a debuggable development build.

Profile-guided builds are optional developer tools (--pgo-gen, --pgo-use); they write to separate directories and require a matching locally trained profile. The basic build above does not require one.

Device benchmarks

The development driver can run the game's original C5L1_Benchmark camera route. It records every present from the beginning of the route to the controller's end, including average FPS, 1% and 0.1% lows, frame time percentiles and process CPU. For this level, the route determines the measurement length; --seconds applies to the other levels. Use the first repeat to warm the renderer before comparing the second repeat. A screenshot is taken after the measurement window.

python tools/pk_bench.py -s SERIAL --renderer gles --levels C5L1_Benchmark --cap 1000 --repeat 2 --screenshots --out build/bench/builtin-gles.json

1000 disables the port's FPS cap. These are engine present rates; the display's refresh rate, particularly on an e-ink device, is a separate limit. The 0.1% low is the reciprocal of the average interval of the slowest 0.1% of frames. AAudio logs output underruns and, where timestamps are available, an estimated output latency; this does not measure the complete input-to-speaker delay.

Local publication artifacts

Keep APKs outside Git in pub/, following the same convention as the Heroes V port: painkiller-0.2-dev-<first-eight-characters-of-apk-sha256>.apk, with a neighboring .apk.sha256 file. The suffix identifies the APK's content, not a Git commit.

After building, PowerShell can produce these artifacts:

New-Item -ItemType Directory -Path pub -Force | Out-Null
$apkHash = (Get-FileHash build/android/painkiller.apk -Algorithm SHA256).Hash.ToLowerInvariant()
$apkName = "painkiller-0.2-dev-$($apkHash.Substring(0, 8)).apk"
Copy-Item -LiteralPath build/android/painkiller.apk -Destination (Join-Path pub $apkName)
"$apkHash  $apkName" | Set-Content -LiteralPath (Join-Path pub "$apkName.sha256") -Encoding ascii

The launcher records the source commit in its build metadata when built from a committed checkout. Git remote configuration and local packaging do not publish anything; uploading sources or APKs is a separate action.

Source layout

DirectoryPurpose
android/app/Android activity, input, controls and resources
android/host/, android/runtime/Win32 compatibility host and lifted-code ABI
android/render/Native graphics backends and shader translation
android/port/, android/texconv/In-game port options and texture conversion
android/launcher/Vendored shared launcher snapshot
config/Input hashes, module layout, fix-pack contents and runtime pins
reference/, licenses/Pinned Git submodules and license texts
patches/dependencies/Local changes applied to generated dependency copies
tools/, tests/Lifting, build, profiling and focused native checks

License and credits

Copyright (c) 2026 Eugene and contributors.

Project-authored port code, tools and documentation are licensed under the GNU General Public License, version 3 or (at your option) any later version (GPL-3.0-or-later). See LICENSE. This is a strong copyleft license.

Third-party code retains its own license and attribution; see THIRD_PARTY_NOTICES.md. Generated code derived from the commercial binaries and the original game data are outside this license grant. Painkiller and related names belong to their respective owners. This project is unofficial and is not affiliated with the game's developers, publishers or GOG.