Reprisal Differences: Rendering and Platform¶
This page covers how Reprisal draws, schedules, plays sound and video, reads its data and talks
to the device: the PC's Direct3D 9 renderer running on Feral3D and Vulkan, the graphics settings
and the device tiers that choose them, the work moved to other threads, the OpenAL audio path,
WebM video, the virtual file system and the .pack containers, saves and cloud saves, remote
resources and languages. Addresses are Ghidra's (ELF virtual address + 0x100000).
Summary¶
| Feature | PC | Reprisal |
|---|---|---|
| Renderer | ZRenderWintelD3D on Direct3D 9 |
the same renderer on Feral's IndirectX Direct3D 9, on Feral3D, on Vulkan |
| Shaders | .fx effects compiled by D3DX from the scene data |
1,309 precompiled variants in /feralshaders, translated to SPIR-V, Vulkan pipelines pre-built from F3DWarmer.db |
| Graphics options | INI options and the in-game menu | four presets (Battery Saver, Graphics, Performance, Performance+) × three hardware tiers, from specifications.xml |
| Device detection | none | GPU name and device code matched against specifications.xml and specification_stock.xml: hardware tier, fixed screen height, driver workarounds |
| Frame rate | uncapped / vsync | Feral3D frame-rate manager: idle and responsive targets per preset (30 to 90), 30 in menus, an optional cap of 30–120 |
| Character drop shadows | one buffer per resolution class (4, 2 or 1) | 11 buffers (NumShadowBuffers), optional atlas, blurred only within BlurredShadowsMaxDist |
| Self-shadowing | INI option SelfShadows |
only within 1,000 units (10 m) of the camera (SelfShadowMaxDist), only with the light array |
| Directional shadows | — | combined directional shadow maps, 1024–2048 per tier, PCF in the shader |
| Post effects | colour curves, bloom, depth cue, finish, roto-zoom, colour offset, noise | the same, each switchable per preset or preference; depth read from an INTZ depth texture instead of a depth pass |
| Anti-aliasing | MSAA | FXAA (preset 0–4 per tier), MSAA off; an optional upscaler (SGSR, CAS), off by default |
| Level of detail | ZRender::SetLOD tables |
the same, with table 2 pushed out (60–384) and crowd LOD distances 30/35/256 |
| Draw batching | one draw per entry (inferred) | consecutive entries of one object merged, except on Mali (DisableObjectDrawBatching) |
| Threads | one game thread | view gathering, render-entry tests, IK bone updates and software vertex lighting spread over the HBMPool thread pool |
| Audio | DirectSound/EAX synth (or OpenAL, Diesel Power) | the same DirectSound synth on Feral's DirectSound emulation, on Feral's OpenAL, on OpenSL ES through SDL |
| Video | Bink (binkw32) |
Feral's Bink API over WebM (VP9 by libvpx, Opus/Vorbis audio) |
| Data | install folder, .zip scene archives, .str speech |
the same paths in a virtual file system over four .pack files (3.8 GB) |
| Scene scripts | one DLL per level | all 14 modules compiled into the library |
| Saves | local folder | the same files, synced to Feral's cloud storage |
| Languages | per install | text in 8 languages; French, Italian and Russian speech downloaded on demand |
Architecture¶
Direct3D 9 on Feral3D¶
PC. ZRenderWintelD3D (engine/drawing/_wintel/renderd3d/) drives Direct3D 9: its material
classes ZRenderMaterialClass*D3D (Standard, Old, Fur, Scatter, Sprites, StaticShadow,
WaterPatch) build ID3DXEffects from the scene's .fx sources, and its render entries
ZRenderEntry*D3D (Geom, Bones, BonesRigid, Deformer, Light, Camera, Sprite, Reflector,
EnvSampler) draw them (PC rendering). The PS2 code in src/ has none
of this.
Reprisal keeps every one of these classes (RTTI) and their PC code, and adds:
- IndirectX (
Idx*): Feral's implementation of the Win32 graphics APIs.IdxDirect3D9,IdxDirect3DDevice9,IdxDirect3DTexture9,IdxDirect3DVertexBuffer9and the rest implement Direct3D 9;IdxD3DXEffect,IdxD3DXConstantTableandIdxD3DXEffectPoolimplement the D3DX effect framework the game uses;IdxDirect3DShaderTranslator(with GLSL and HLSL back ends) andIdxD3DShaderReflectiontranslate and reflect the shader bytecode.IdxDirect3DDeviceContextThreadedrecords the device calls on one thread and executes them on another (inferred from the name). The settings live under the registry pathSoftware\IndirectX\Direct3D\Config(see the device workarounds below). - Feral3D (
Feral3DDevice,Feral3DBuffer,Feral3DTexture,Feral3DShader,Feral3DShaderReflection, the state objects …): Feral's portable graphics layer, which IndirectX draws through. - Vulkan (46
CVulkan*classes): the Feral3D back end on Android —CVulkanDevice,CVulkanSwapchain,CVulkanCommandRecorderandCVulkanThreadedCommandRecorder,CVulkanRenderPassCache,CVulkanFramebufferCache,CVulkanRenderPipelineCache,CVulkanPipelineCache,CVulkanDescriptorManager(monolithic and per-layout),CVulkanReflectionandCVulkanSPIRVCache. glslang is linked in (0x2b56510,0x2c93ef8) to compile the translated shaders to SPIR-V;CVulkanSPIRVCache(VkSPIRVCache, preferenceEnableSPIRVCache, getter0x1bbf208) keeps the results, andVulkanEnablePipelineCacheWrite(0x1bb66b8) lets theVkPipelineCachebe written back.
Feral3D carries a table of driver workarounds, each a kBug_* switch, and specifications.xml
turns some on per device (see Device rules).
Shaders¶
PC. Each material class loads its effect file from the scene data and compiles it with D3DX at load time, with the defines of the material's options.
Reprisal looks for a precompiled variant first (0x1385928):
- A per-renderer cache (count at +0x1810, entries from +0x1818) is searched for the same effect name and the same list of defines; a hit returns the cached effect.
- Otherwise the file name is built as
\feralshaders\<effect>V2_Q<model>[_<DEFINE>…][_PP], where<model>is chosen by the shader quality at+0xa0of the render options: 0 →00, 1 →13, 2 →20, 3 or more →30(table0x329e010); each define is appended with_, cut short before the textENABLED;_PPis added when the option at +0xa9 is set. The VFS lower-cases it, giving names such asstandard20.fxv2_q30_mesh_standard_blend. - If the file exists it is read and handed to the effect creator (
0x1b2b6e0) with flag 0x800 (precompiled); the effect is cached. - If not, the original
.fxsource is compiled as on the PC, with flags 0x500 (0x540 when +0xa6 is set, | 0x80 when +0xa7 is set, | 0x20 with_PP).
The pack holds 1,309 variants, all _q30 (shader model 3): standard00/13/20/30, cloth,
skin, glow, glass, glasssurface, mirror, watersurface, bad, and two Feral effects,
feralobjecthighlight (the Instinct outline, Instinct) and
feralshadows. The library names further Feral techniques: FeralShadow, FeralLightingMPS,
FeralDiffuseBumpSpecularRimLightMPS and FeralDiffuseBumpSpecularTransRimLightMPS (rim-lit
skin and cloth), tech_Ambient_Sprites_Feral, and post-filter shaders Feral Depth Cue, Feral
Depth Cue Noramp and Feral Finish filter beside the PC's Depth Cue and Finish Filter (names
from F3DWarmer.db; the shader code is in the pack and was not read).
Pipeline warming (F3DWarmer.db)¶
Vulkan needs a complete pipeline object for every combination of shaders and state, and building
one on first use stalls the frame. Feral3D's warmer (Feral3DWarmer, Feral3DWarmerDB,
Feral3DWarmerWorker, Feral3DWarmerTask, Feral3DWarmerRequest, Feral3DWarmerClient; the
Direct3D side is IdxDirect3DWarmer) builds them ahead of time from a database recorded on
Feral's test devices. 0x1e75c58 opens it: F3DWarmer.db.zip (extracted to F3DWarmer_zip.db)
if present, else F3DWarmer.db from the APK's assets; then a writable F3DWarmer.db and
F3DWarmerServer.db in the app's folders, merged with it (0x1e7605c). The preferences
EnableF3DWarmer (0x1bbb9c0), UseInMemoryWarmerDB, WarmerUpdateTimeMinTimeMS,
WarmerUpdateTimeMinRatioPC, WarmerUpdateANTimeMinDeltaRatioPC and Use3DWarmerAnalytics tune
it; their defaults were not read.
The file is an SQLite 3 database (4,501,504 bytes, schema config(version, build) = (6, 4)):
| Table | Rows | Columns |
|---|---|---|
objects |
7,502 | id (16-byte hash), class, name, tags, time (seconds to build), trust (5 for all), dependencies, dependents, states |
states |
6,760 | id, data, dependents |
properties |
1 | PreloadOrder (empty) |
idx_objects_tags |
— | an FTS5 index of tags |
class:vk.rp(Vulkan render pipeline, 4,579),mtl.rp(Metal, 1,551),d3d9.ps(638) andd3d9.vs(452),nvn.prog(Switch, 282). One database serves every platform.tags:build:release/build:debugandos:android/os:ios/os:switch. 5,354 objects are tagged Android: all 4,579 Vulkan pipelines, 430 pixel and 345 vertex shaders.name(shaders only): technique, pass and variant, e.g.tech_AmbientHQ_VS20_PS20_pass_p0_15_\Standard20.fxV2_Q30_MESH_STANDARD_SPECULAR_REFLECTION, so the file names above are the warmer's keys too.- References are a four-letter type and a 16-byte id, concatenated:
pipe(a pipeline state),wver/wfrg(vertex/fragment shader),dxbc(Direct3D bytecode),vrnt(variant). states.dataisnzlb, an 8-byte big-endian uncompressed size and a zlib stream (2 rows arennul); 1.9 MB in all.timeranges from 1.4 µs to 1.36 s (mean 9.8 ms): the build cost the warmer uses to order work.
Frame-rate manager¶
PC. The frame rate is not limited apart from vertical sync (EnableVSync,
PC Differences).
Reprisal. Feral3DFramerateManager (constructor 0x1e324c4, vtable 0x31ca218) keeps named
profiles, each an idle and a responsive frame rate, and one active profile:
normalandbatterysaverare created by the device (Feral3DDeviceslot 128,0x1e31078) from the Feral3D settingsFramerateManagerNormalIdleFPS,…NormalResponsiveFPS,…BatterySaverIdleFPS,…BatterySaverResponsiveFPSandFramerateManagerResponsiveFPSDuration(getters0x1bbd1a8–0x1bbd6f8; constructor default for the duration 60), switched on byEnableFramerateManager(0x1bbd054).- The game adds and activates its own profile,
HitmanBloodMoney(0x13d4cf4, called from 20 places: preset changes, pause, menus, video, loading). It reads the preset'sIdleFPSandResponsiveFPS; when the game reports that it is not in play (the game object's slot 0xf8 and two state flags), both are capped at 30. - Requests (
0x1e32a14) raise the rate for a time: each has a priority, a mode (1: an explicit rate; 0 with 1: the profile's responsive rate; 0 with 0: idle) and a remaining time.
Per frame (0x1e32d28, after present):
if not enabled: return
fps = top request ? (explicit | responsive | idle) : active_profile.idle
period = fps ? 1 / fps : 0
left = period - time_since_last_present
while left > 0: // sleep in steps, so a new request can wake it
wait(condition, left * 0.8)
recompute fps and left
for each request: remaining -= elapsed; drop it when <= 0
restart the frame timer
ShowFrameRateValue (a game preference) is copied at start-up into
Software\IndirectX\Direct3D\Config\MaxFramesPerSecond when it is above 0 (0x11e58fc), a hard
cap in the presentation layer (MaxFramesPerSecond, VulkanMaxFramesPerSecond, getter
0x1bbcf00). FeralGUIFpsTarget is the D3D registry value behind the "FPS Target" field of
Feral's debug overlay (from strings only).
Thermal state¶
Android reports the thermal status through Java (nativeThermalStatusChanged, 0x22848b8;
getThermalStatus). The game shell records it in CurrentThermalState/CurrentThermalLevel and
sends analytics events (Feral.GameShell.Thermal.Startup, …AppSuspend, …StateChanged, with
ChangeInThermalLevel; 0x11cd8f8, 0x11ed248). Feral3DGUIThermalIndicatorLayout draws a
thermal indicator in Feral's debug overlay when ShowFeralGUIThermals is set (0x1bbabb0). No
code was found that lowers quality or frame rate from the thermal state.
Graphics settings¶
Start-up options¶
At start-up (0x14f1ed0) Reprisal writes the PC renderer's INI options from the device and the
preferences: Resolution = <width>x<height> of the window (0x11a09fc; the size the UI scale is
computed from, HUD), StartUpperPos = 0,0, PixelAspect, DefaultScene,
DisableAudio=1 and EnableCheats=1 when those preferences are on, and ShadowResolution =
the preference ShadowResolution (registered 1024) when it is not 0. On the PC these come from
the player's INI file. The PS2 code reads none of them.
FixedScreenHeight is registered by CAndroidFeralGame slot 57 (0x123b338) with the device's
value and set by specifications.xml to 720, 864 or 1080 by GPU class (see
Device rules); it is the height of the rendered back buffer (inferred from the
name; its reader was not found).
Shadows¶
PC. ZRenderWintelD3D renders a drop shadow for each lit character into a shadow buffer and
blurs it (BlurShadows), and lets characters shadow themselves (SelfShadows); both are INI
options (PC Differences).
Reprisal. AllocateDeviceBuffers (0x1360b2c) sizes the buffers:
- The number of shadow buffers starts from the PC rule on the shadow resolution R (+0xb4):
R < 512 → 4, 512 ≤ R < 1024 → 2, R ≥ 1024 → 1. If
NumShadowBuffersis not 0 it replaces that number. Registered default 11; the getter's own fallback is 16 (0x11a6748). - With
UseShadowAtlas(no registered default: off, inferred) the buffers are one atlas,floor(sqrt(count) × R)pixels square (3,396 for 11 × 1024), colourD3DFMT_R32F(0x72), depthD3DFMT_D32(0x47), labelledShadow Atlas Color/Depth. Otherwise, for shadow type 1 (+0xb8), one R × R target (format +0xbc) and aD3DFMT_D16depth buffer per shadow buffer. - When the preset's
DirectionalShadowResolutionis not 0, the directional shadow maps are created (0x1361c1c,Directional Shadowmap Color/Depth), preallocatingNumPreallocatedDirectionalSMs(registered 1) of them. - With blurring on (+0xb0) a blur target per shadow buffer (count
NumShadowBuffers, or the count above when it is 0), each R × R.
The scene pass (0x133e514) decides per frame which characters get which shadow. Each caster
record has a "casts a drop shadow" flag (+0x164), a "character" flag (+0x180), a
"self-shadow disabled" flag (+0x198) and its distance d from the camera (+0x184):
- Drop shadows run only when the preset's
EnableDropShadowsis 1.- Combined directional shadows. With
CombineDirectionalShadows(registered on), casters lit by a directional light (light types 3 and 4) are grouped by light into one shadow map each, instead of one buffer per caster (0x1349dd0; inferred from the grouping by light). - Blur. A blur pass is queued for a caster when the renderer's blur is on, the preset's
DropShadowQualityis 1, andBlurredShadowsMaxDistis 0 or d ≤BlurredShadowsMaxDist(registered 0: no limit; getter0x11a6930, cached at0x33bd5b8). The pass (command 0x28) gets a flagd > 700: casters beyond 7 m use the cheaper blur (inferred).
- Combined directional shadows. With
- Self-shadows run only when the preset's
EnableSelfShadowsis 1 andEnableLightArrayis on. A character is added to its light's self-shadow group (0x134a6d8) only when d ≤SelfShadowMaxDist. Registered default 1000 (10 m; stored as the float bit pattern 1151500288); the getter's fallback is 1300 (0x11a683c). Beyond that distance the character is drawn without self-shadowing. - PCF.
UsePCFForDirectionalShadows(registered on) is passed to the shaders as a boolean parameter by the material parameter binder (0x137c7ac, in code Ghidra did not make a function of), so the directional shadow lookup filters several depth comparisons (percentage-closer filtering) instead of one. The filter kernel is in the shader and was not read. M12OptimizationDisableDynamicShadows,…SelfShadowsand…StaticShadowsare registered keys with no getter and no reader: they have no effect in this build.
The shadow projection in the same function takes its field of view from the light: spot lights
(type 2) 2·atan(tan(cone) / sqrt(aspect)), type 1 90°, type 0 twice the cone angle, others 90°
with a far plane of 5,000 units. This part was not compared with the PC.
Post-processing¶
PC. ZPostFilterWintelD3D runs the colour curves and depth blend, the bloom, the heat shimmer
(roto-zoom), the finish, the last-frame blend, the colour offsets and the noise
(PC rendering).
Reprisal computes a 7-bit mask of enabled stages (0x136820c, undecompiled, after
ZRenderWintelD3D slot 105) and passes it to the post filter (0x1371c5c):
mask = 0x7f
if DisableColorCorrection or not ColourCorrection_option: mask &= ~0x01 // colour curves
if preset.DisableBloom: mask &= ~0x02
if preset.DisableDepthOfField: mask &= ~0x04 // depth cue / depth blend
if preset.DisableFinishFilter: mask &= ~0x08
if DisableRotoZoom: mask &= ~0x10
if DisableColorOffset: mask &= ~0x20
if DisableNoise: mask &= ~0x40
if not PostProcessing: mask = 0
ColourCorrection_option is the renderer field +0x1734, which the options menu's Colour
Correction switch sets (Menus). PostProcessing is registered on; the
four Disable* preferences have no registered default (off). The per-preset values are in
Quality tiers: the finish filter is off in every preset except
Graphics on medium and high hardware, and bloom is off for Battery Saver and Performance on low
hardware.
The port's openblood.reprisal_graphics mod has a Colour Correction switch
(port/engine/drawing/old/_sdl/postfiltersdl.cpp); off, it takes out the level's own grading and
keeps the scripted looks (47's dying look). Reprisal clears its bit 0 stage, inferred to be the
whole curves stage, which would take the scripted looks too: the mask's setter 0x1371c5c stores
it in 0x329dff8, and no reader of that word is in the decompiled functions, so which of the PC's
stages bit 0 covers could not be confirmed and the port keeps its behaviour.
ShouldSkipDepthPass (registered on; also forced in Software\IndirectX\Direct3D\Config by
specifications.xml). The PC renders a separate depth pass for the depth-of-field (depth cue)
effect (inferred from the name). In Reprisal's target set-up (0x1363c0c) the device is asked for the INTZ format
(CheckDeviceFormat with FOURCC INTZ, 0x5a544e49, as a depth-stencil texture); with the
preference on, the scene's own depth buffer is created as an INTZ texture and read by the post
filter, so no extra depth pass is drawn. When the MSAA path needs it the RESZ (0x5a534552) resolve
is used. ZPostFilterWintelD3D's constructor (0x1372320) stores the switch at +0x238.
Anti-aliasing: FXAA¶
PC. Multisampling (Antialias, 0/2/4/8).
Reprisal. Every preset sets Antialias to 0 and uses FXAA instead. When the preset is applied
(0x14fc4f4) and the renderer exists (a pointer reached from the global at 0x34e8150), its slot 0x78 receives
(FXAASubpixQuality, FXAAEdgeQualityThreshold, FXAAPreset − 1, FXAAEdgeThresholdMin), and
nothing when FXAAPreset is 0. 0x1363c0c creates an extra full-size target for FXAA when the
preset is not 0. The values, clamped when read (0x14fd4b0):
| Value | Range | Meaning |
|---|---|---|
FXAAPreset |
0–4 | 0 off, 1 lowest to 4 highest quality |
FXAASubpixQuality |
0.0–1.0 | sub-pixel aliasing removal; 0 sharper |
FXAAEdgeQualityThreshold |
0.063–0.333 | local contrast needed to filter; smaller is slower |
FXAAEdgeThresholdMin |
0.0312–0.0833 | darkness below which edges are ignored |
The debug overlay exposes them as FeralFXAA\Preset, \SubpixQuality,
\EdgeQualityTheshold (sic) and \EdgeThresholdMin.
Upscaler¶
UseUpscaler (registered off) renders the 3D scene at a reduced size and scales it up:
- The render size is the window size divided by
UpscaleFactor(registered 2.0), truncated (0x11b6ca8). 0x1363c0ccreates anUpscaler Inputtarget of that size (multisampled when MSAA is set) and the depth buffers at that size; MSAA settings are not stored while the upscaler is on.- The device creates a
CFeralUpscalerD3D9(vtable0x3035830, baseCFeralUpscalerBase) and sets its technique toUpscaleTechnique(registered 5; setter0x136a6d8). The upscaler's own settings (0x136adcc):Upscaler\Technique(default 0),Upscaler\SharpenAmount(0.5),Upscaler\CASUsePixelShader(off),Upscaler\SGSRUseEdgeDir. - The shaders named in the library and the warmer are
Upscaler VS,SGSR PSandSGSR-ED PS(Qualcomm's Snapdragon Game Super Resolution, plain and edge-direction; the source credits "Snapdragon Studios") and AMD CAS sharpening (CASUsePixelShader). Which number selects which technique was not mapped.
No preset or device rule turns the upscaler on, so release builds render at the full (fixed) back-buffer size.
Level of detail¶
PC/PS2. ZRender::SetLOD (src/engine/drawing/renderbase.cpp) fills a 256-entry table from
one of the range tables, chosen by the LevelOfDetail option (default 1): entry i gets the first
level whose range is ≥ i + 1, capped at the maximum level.
Reprisal.
- The renderer's initialisation (
0x1398f2c) sets the geometry LOD fromLevelOfDetail(default 1, maximum level 7) and the character LOD fromCharacterLevelOfDetail(registered 2, maximum 6), or 3 when the INI optionDisableCharacterLODis set. Applying a preset (0x13996f8) sets both again with the preset'sLevelOfDetail(2 in every preset). LODTableOverride(0x11b6768) replaces the range tables. The built-in tables are the PS2's first four (0.5…128; 3…384; 6, 12, 24, 48, 96, 192, 384, 384; and 100,000 × 8). The JSON value inspecifications.xmlkeeps the first, second and fourth and changes the third, the one level 2 uses, to 60, 70, 82, 106, 154, 250, 384, 384: the first six detail steps happen 4 to 10 times further away. The PS2's fifth table (3, 8, 12 …) is not in Reprisal's built-in set.HumanFlowLODOverride(0x11b6a08) fills three integers at0x32992b8(built-in 5, 10, 256) used by the crowd system's LOD;specifications.xmlsets 30, 35, 256. The values are read at0x15dc858(undecompiled; inferred to be the distances at which crowd members switch to their simpler models).
Reflections and the light array¶
EnableReflections(set to 1 byspecifications.xml). In the reflector pass (0x1344d54, undecompiled), when it is off or the reflector's own flag (+0x1c0) is clear, the reflected view is not rendered and a global (0x33bd234) records that reflections are off. The PC always renders it (PC rendering).EnableReflectorCache(1). For a reflector with a cache slot (+0x88 not 0xff) the gathered reflected scene is taken from a cache (0x12e49cc, up to 2,048 entries) instead of being gathered again (inferred).EnableLightArray(1). Gates the self-shadow groups (above) and the light-array parameters of the material binder (0x137bb24–0x137cbfc): lights are passed to the shaders as an array instead of the PC's fixed per-pass light set (inferred). Also read by0x1384b58.
Draw batching¶
0x139cc04 draws the sorted render entries of a material. Consecutive entries that use the same
draw object and continue its index range are drawn with one call (begin, draw n entries, end).
DisableObjectDrawBatching breaks every run, one draw per entry. specifications.xml sets it on
every Mali GPU ("Avoid sparse index buffers on Mali GPUs", HBM-1230).
Buffers and textures¶
StaticVBSizeMB(registered 10): the size of each of the three static vertex buffers (0x1360b2c), or 32 MB when the INI optionExpandVertexBuffersis set. Beside them: three 4 MB index buffers, a 2 MB buffer and smaller dynamic ones. A pool thread copies the dirty ranges of the dynamic vertex and index buffers into the next buffer generation while the frame is prepared (ZRenderDrawD3D::Updatelambda$_1,0x1338474→0x1362244).- ASTC.
ZBitmapASTC4,ZBitmapASTC8andZBitmapASTC12are texture classes for ASTC blocks of 4×4, 8×8 and 12×12 texels. The UI art in/feralships as.astc.ConvertToASTC(registered off; read once by the texture loader at0x1543dc8and cached at0x36af620) re-encodes the game's textures to ASTC with ARM's encoder (ARMASTCEncoder::Encode), caching them as%s_%dx%d.astc(inferred from the names).TextureResolution(0 in every preset) is the PC's texture-size option, 0 being full size. DisableTextureSplitting(registered off) andUseAsyncEvents(registered on) have no getter and no reader in this build.ForceBackbufferToOpaque(set byspecifications.xmlon Samsung, Sony and Xiaomi devices on Android 12 or earlier, HBM-732, "black screen"). Before presenting (0x136592c) the device disables alpha blending (render state 27) and fills the back buffer's alpha, so the compositor never sees a transparent window (inferred from the calls).
Other switches¶
- Blood. The PC's
WantBloodoption stays; the options menu writes it (Menus). DisableM12SprinklerHack(set to 1 byspecifications.xml; read in0x13c1994and0x13c3158, the view's volume gathering) andDisableParticleEmitterCenFix(read inZParticleEmitterslot 107,0x146c5dc) are level and particle fixes, covered on Gameplay.
Device rules¶
specifications.xml sets these per device (conditions from specification_stock.xml, below):
| Rule | Condition | Setting |
|---|---|---|
avoid_sparse_index_buffers_mali_hbm_1230 |
GPU name contains Mali |
DisableObjectDrawBatching 1 |
should_break_render_pass_adreno_740_1_1b9 |
Adreno 740, 750 | D3D ShouldBreakRenderPass 0 |
should_apply_shader_override_adreno_740 |
Adreno 740, 750 | D3D ShouldApplyShaderOverride 1 |
avoid_bgra_fbos_hbm_325_1_1b9 |
Adreno 725, 730, 740 | AvoidFBOsWithBGRAFormat 1 |
samsung_xiaomi_black_screen |
Android ≤ 12 and vendor Samsung, Sony or Xiaomi | ForceBackbufferToOpaque 1 |
mali_flickering_workaround |
device SC-53D, SCG21, a54x (Galaxy A54) |
kBug_Android_Vulkan_Mali_ImplicitLayoutTransitionCorruptsBlending 1 |
android14_beta_flashing |
device oriole, raven, bluejay (Pixel 6, 6 Pro, 6a) |
the same Mali workaround |
pixel_warmer_crash |
device sunfish (Pixel 4a) |
kBug_Android_Vulkan_Adreno_BrokenCreatePipelineConcurrency 1 |
Phone_ui_override |
31 device codes (Motorola One 5G Ace, OnePlus 9 Pro and N10, Nothing Phone 1, Galaxy A31/A51/A80/S10/S10+/Note 9/Note10+) | DeviceIsTablet 0 |
Quality tiers and device presets¶
Hardware tier¶
DefaultTier is the device's hardware class: 0 low, 1 medium, 2 high. 0x11b6b94 reads it once
and clamps it to 0..2 (negative values become 0). specifications.xml sets it by GPU, with a fixed
back-buffer height:
| Tier | GPUs | FixedScreenHeight |
|---|---|---|
| 0 (low) | Mali G57, G68, G72 (MP12, MP18), G76; Adreno 540, 610, 612, 615, 616, 618, 619, 620, 630; PowerVR BXM-8-256 | 720 |
| 1 (medium) | Mali G77, G610; Adreno 640, 642, 642L, 644, 650 | 864 |
| 2 (high) | Mali G78, G710, G715; Xclipse 920, 940; Adreno 660, 725, 730, 740, 750 | 1080 |
| 2 (default) | any other GPU ("Unknown devices should default to high tier") | — |
How a device is matched¶
Specification::CGameSpecificationLoader evaluates specifications.xml at start-up, in file order;
each <spec> whose <conditions> hold writes its <regkey> values (later specs override earlier
ones, and force="TRUE" overwrites a value the player has set), shows its <alert> once (recorded
as SeenSpecificationAlertUUID<uuid>), and is skipped when its <ignore_if_set> key is set
(SkipUnsupportedHardwareCheck). Conditions combine <and>, <or> and <not> over
<GPU_renderer>, <GPU_vendor>, <Vendor_Name>, <Device_Name> (Android's device code),
<Model_Name>, <OS_version_major>, <VRAM>, <GPU_PCI_id> and registry values (<have_not/>),
with <is>, <contains>, <equal>, <less>, <less_or_equal>, <more>; and <stock id>,
which refers to a named condition in specification_stock.xml.
specification_stock.xml (10,033 lines) holds 912 named conditions (<stockcondition>): GPUs by
renderer string (android_adreno_740 = renderer contains Adreno and 740; android_mali_G57;
vendor_PowerVR = vendor is or renderer contains PowerVR; desktop GPUs by PCI id and VRAM for
Feral's other ports), and devices by device code (Pixel_7 = panther). It also holds 146 alert
texts (<stockalert>) and 30 dialogue buttons (<stockbutton>: quit, continue, update, FAQ link …).
The order in this build's specifications.xml:
RecommendedHardware: 125 listed phones and tablets getIsOfficiallySupportedDevice= 1.MinimumSupportedHardwareandUntestedInlegibleHardware: empty lists.UntestedCapableHardware: an unlisted device with one of 33 GPUs (Adreno 540–750, Mali G57–G715, Xclipse, PowerVR) getsHasSimilarHardwareToSupportedDevice= 1 and the alertUnsupportedCapableHardware.UnknownIneligibleHardware: neither flag set → the alertUnsupportedIneligibleHardware.- Android 10 or earlier → the "unsupported OS" alert (minimum 11).
- The vendor workarounds, the
DefaultSettingsblock (every preference default and every preset table, below),Patch_1_2(StrangleMaxFacingDelta90), the three hardware-tier blocks, and the device rules.
android_devices.csv (46,054 rows: device code, retail brand, marketing name, model; Google
Play's device list) gives the marketing name of the device (0x2244518, cached in a model_name
file), for <Model_Name> and analytics.
The four presets¶
The player chooses a preset in the graphics options (Menus). Each preset
value in specifications.xml is a triple, one value per hardware tier (low, medium, high); the
pair (preset, tier) picks one value. 0x14fe580 parses each <name>_<preset> string, splits it at
commas and clamps each value (0x14fd4b0); the table has 4 × 3 dictionaries (`param + preset × 0x18
- tier × 8
). The registered defaults in the library (0x11afad8`) equal the file's values.
| Preset (index, suffix) | Menu name | Debug name |
|---|---|---|
0 _battery |
BATTERY SAVER | Battery Saver (low) |
1 _graphics |
GRAPHICS | Graphics (normal) |
2 _perf |
PERFORMANCE | Performance (high) |
3 _plus |
PERFORMANCE+ | Performance+ (highest) |
| Setting (clamp) | Battery Saver | Graphics | Performance | Performance+ |
|---|---|---|---|---|
TextureResolution (0–7) |
0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 |
LevelOfDetail (0–3) |
2, 2, 2 | 2, 2, 2 | 2, 2, 2 | 2, 2, 2 |
Anisotropy (0–16) |
16, 16, 16 | 16, 16, 16 | 16, 16, 16 | 16, 16, 16 |
Antialias (0–8) |
0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 |
EnableDropShadows (0–1) |
0, 1, 1 | 1, 1, 1 | 1, 1, 1 | 1, 1, 1 |
EnableSelfShadows (0–1) |
1, 1, 1 | 1, 1, 1 | 0, 1, 1 | 0, 0, 1 |
DropShadowQuality (0–1) |
0, 1, 1 | 1, 2→1, 2→1 | 1, 1, 2→1 | 1, 1, 1 |
DisableDepthOfField (0–1) |
0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 |
DisableFinishFilter (0–1) |
1, 1, 1 | 1, 0, 0 | 1, 1, 1 | 1, 1, 1 |
DisableBloom (0–1) |
1, 0, 0 | 0, 0, 0 | 1, 0, 0 | 0, 0, 0 |
IdleFPS (0–120) |
30, 30, 30 | 30, 30, 30 | 40, 40, 40 | 60, 60, 60 |
ResponsiveFPS (0–120) |
30, 30, 30 | 30, 30, 40 | 40, 40, 60 | 90, 90, 90 |
DirectionalShadowResolution (1024–4096) |
1024, 1024, 1024 | 1024, 1536, 2048 | 1024, 1024, 1536 | 1024, 1024, 1024 |
FXAAPreset (0–4) |
0, 0, 0 | 0, 2, 3 | 0, 1, 2 | 0, 0, 0 |
FXAASubpixQuality (0–1) |
0.0 | 0.0 | 0.0 | 0.0 |
FXAAEdgeQualityThreshold |
0.063 | 0.063 | 0.063 | 0.063 |
FXAAEdgeThresholdMin |
0.0312 | 0.0312 | 0.0312 | 0.0312 |
(2→1: the file says 2, the clamp makes it 1.)
Applying a preset (0x14fc4f4):
- Select the dictionary for (preset
0x329fb9c, tier0x329fba0). - If
GraphicsPresetOverriddenis set and a frame-rate choice is made (0x34edeb4= 1..5), replaceResponsiveFPSwith 30, 40, 60, 90 or 120 (table0x9f3f18; 0 means "Preset Default"). - Write
TextureResolution,LevelOfDetail,AnisotropyandAntialiasinto the PC's INI options; reapply the LOD (0x13996f8); pass the FXAA values to the renderer. - If the preset or tier changed, rebuild what depends on it (
0x150f530); reset the frame-rate profile (0x13d4cf4).
The other values are read where they are used (shadows, post filter, frame rate). Rules on the
choice (0x14fc424, 0x14fcba4): on hardware below the high tier a request for Performance+
made from Battery Saver gives Performance, and one made from Performance gives Battery Saver, so
the option skips it; from Graphics it is accepted. While Performance+ is selected the tier cannot
be changed. The tier is the DefaultTier value at
start and after a reset; Reset in the graphics menu (0x14fcd8c) restores tier DefaultTier,
preset 2 (Performance) and the frame-rate choice "Preset Default". An analytics event
(0x14fea58) records OptimisationPreset, DevicePreset, IsDefault, FramerateLimit and
PresetOverride.
Defaults by hardware: a low-tier phone starts in Performance at 40/40 fps without self-shadows, FXAA or bloom; a high-tier phone in Performance at 40/60 fps with self-shadows, FXAA preset 2 and 1536-pixel directional shadows.
Threading¶
PC. The game, the view gathering, the bone updates and the D3D submission run on one thread.
Reprisal has a game thread pool, HBMPool (0x11b5b6c: created once, default thread count,
2 MB stacks), and Feral's NThreadUtilities::DistributedForEach(range, function, pool, 3, wait)
(0x24ab810), which splits a range over the pool and, with wait, returns when every part is
done. Four preferences move work onto it, all registered on.
| Preference | What runs in parallel | Synchronisation |
|---|---|---|
UseAsyncViewspace |
ZViewSpace::FindVisibleVolumes (0x13c1e00): when the view has more than one volume (count +0xe8), each volume's visibility search (0x13c1994) runs as one task (FindVisibleVolumesAsync, 0x13c2af4), into a private list per volume |
waits; the lists are appended to the view's result in volume order on the calling thread, so the result equals the serial one |
UseAsyncRenderEntryUpdates |
ZRenderDrawD3D::Update (slot 18, 0x1334a08): each render entry's "needs update" test (slot 0x18) runs in parallel, the entries that need it collected per worker (lambda $_0, 0x1338214) |
waits; then each collected entry's update (slot 0x20) runs on the calling thread, worker list by worker list. Serially, test and update alternate per entry |
UseAsyncBoneUpdates |
ZRenderDraw::UpdateBoneModifiersListIK (0x139d1f8): the IK and bone-modifier update of each character |
the entry matching the player mask (0x34e80b0/0x34e80ac) is updated first on the calling thread; the others in parallel; waits |
UseAsyncSoftwareLights |
the CPU vertex lighting of FeralLightTaskExecutor (0x12bbf14): a task holds the vertex data and up to 12 lights (0x24c bytes each) |
two queues, each with a worker; a task goes to the queue with the smaller total vertex count. ZRenderDrawD3D::Update opens them (0x12bc0e4) before the entry updates and closes them (0x12bc124) after: drain both, wait without timeout. Without the preference a task runs at once |
UseAsyncEvents is registered (on) but nothing reads it. The script scheduler
(UseFeralScriptScheduler, MaxEventCyclesPerThread) is on Gameplay.
Outside the game code, Feral's layers run their own threads: the IndirectX threaded device
context and Vulkan command recorder, the warmer workers, the audio stream worker (every 10 ms),
the video decode and audio-streaming threads, and asynchronous file reads in the VFS
(VFileHandleAsync, VFileHandlePacked::DoPackedReadInternal).
Audio¶
Which synth runs¶
PC. The sound DLL (ZDllSoundWintel) chooses its synth from game INI options: DirectSound
with EAX (ZSynthDS), OpenAL (ZSynthOpenAL, which loads openal32.dll) or "Diesel Power"
(ZSynthDP). The PS2 code in src/engine/audio has only the PS2 synth.
Reprisal keeps that start-up whole (undecompiled code at 0x1303d48; the synth constructors
are called from 0x1303e90, 0x1303f30 and 0x1303f98). It reads, through the game's option
getter 0x150de34:
| INI option | Default in code | Effect |
|---|---|---|
EnableDirectSound |
1 | build ZSynthDS (constructor 0x13148f8, vtable 0x3031520) |
EnableOpenAL |
0 | build ZSynthOpenAL (constructor 0x1317610, vtable 0x3031940) |
EnableDieselPower |
0 | build ZSynthDP (constructor 0x131aecc) |
NumberOfStreams |
4, clamped to 1..4 | stream channels |
NoEnvMorph, EaxDisable |
— | as on the PC; UseEAX is written back (0x14e4d9c from 0x1304178) |
Each synth object is 0x1def0 bytes. ZSynthOpenAL's library loader (0x1316b70, which
LoadLibrarys openal32.dll and fetches every al*/alc* entry point) has no caller and no
relocation, so the IOI OpenAL path is dead code here, and with EnableOpenAL off the running synth
is the PC's DirectSound/EAX synth, unchanged (inferred: the game INI that could set the option
is inside the encrypted pack). ZSoundBufferOpenAL (vtable 0x3031b18) and
ZSoundListenerOpenAL (0x3031c38) belong to that dormant path; ZEaxBase, ZEaxListener and
ZEaxSource are present as on the PC.
This refines the overview on Reprisal Differences: the game does reach OpenAL, but through Feral's DirectSound emulation, not through IOI's OpenAL classes.
DirectSound on OpenAL¶
Feral's IndirectX layer implements DirectSound (IdxDirectSound, ImpDirectSound*,
0x1c03434–0x1c05b7c, strings Default Playback, IndirectX):
CreateSoundBufferfor a secondary buffer (0x1c046dc) allocates a 0x290-byte stream (0x2128aa4) and initialises it (0x21292c0) with the DirectSound buffer size, sample rate, channel count and block alignment, sample format 0 (16-bit), andDSBCAPS_GLOBALFOCUS(flag bit 15);0x2129c3cthen marks it 3D whenDSBCAPS_CTRL3D(bit 4) is set. A primary buffer goes to the mixer set-up (0x212608c,0x21262d8) instead.- The streams are handed to OpenAL as float buffers (
AL_FORMAT_MONO_FLOAT32,AL_FORMAT_STEREO_FLOAT32in0x212a2ec,0x212b0fc). - OpenAL itself is Feral's build, linked in, with extensions
ALC_FERAL_buffer_frames,ALC_FERAL_buffer_count,ALC_FERAL_mixer_callbackandALC_EXT_ASAreverb (0x21b0c00,0x2d2e648). It plays through SDL2's audio:alcOpenDevice(0x2d2dbe0) setsSDL_AUDIODRIVER=openslESfor the device nameopenslesandSDL_AUDIODRIVER=AAudioforaaudio, then opensDefault OpenAL playback device. The device manager (0x212422c) takes the name fromAndroidAudioDriver: 0 isopensles, 1 isaaudio. The context attributes areALC_FREQUENCY = MasterSampleRateand, when the buffer-count extension is present,ALC_BUFFER_COUNT_FERAL = NumBufferLayers.
Mono folding. OpenAL spatialises only mono sources. 0x212c7e8 folds a stereo buffer into
mono by MonoifyStrategy: 0 = (L + R) / 2, 1 = left, 2 = right, anything else silence; float
samples are clamped to ±1. Used for 3D buffers (inferred).
Buffer preferences¶
A start-up function (0x119f90c, undecompiled; call sites 0x119f934–0x119f954) fills a
configuration block from the preferences and passes it to 0x212c3c0, which stores it in
globals 0x32dbb08–0x32dbb30; the debug dump 0x2123400 prints the field names.
| Field | Preference | Default | Use |
|---|---|---|---|
| SubbufferFrames | SubBufferFrames |
256 | frames per sub-buffer, wired output |
| NumSubBuffers | NumSubBuffers |
8 | sub-buffers per stream, wired output |
| SubBufferFramesBluetooth | SubBufferFramesBluetooth |
512 | the same on Bluetooth |
| NumSubBuffersBluetooth | NumSubBuffersBluetooth |
5 | the same on Bluetooth |
| NumBufferLayers | NumBufferLayers |
2 | ALC_BUFFER_COUNT_FERAL |
| WorkerScheduleFrequency | — | 0.01 s | period of the stream worker thread (0x2125318, 0x2128b98) |
| MonoifyStrategy | — | 1 (left) | see above |
| MasterSampleRate | — | 0 (device rate, inferred) | ALC_FREQUENCY |
| AndroidAudioDriver | — | 0 | OpenSL ES |
With AndroidAudioDriver 0 this build opens OpenSL ES through SDL, not AAudio (the SDL AAudio
driver is linked, 0x2dda394, but not chosen).
Stream sizing (0x21292c0), done once when a buffer is created:
bt = external_output && is_bluetooth // 0x223f060
frames = bt ? SubBufferFramesBluetooth : SubBufferFrames
count = bt ? NumSubBuffersBluetooth : NumSubBuffers
sub = roundup(bytes_per_sample * channels * frames, block_align) // 2 bytes for 16-bit, 4 for float
ring = count * sub
if ring > ds_buffer_bytes: ring = roundup(ring, ds_buffer_bytes)
entries = max(NumSubBuffers, NumSubBuffersBluetooth)
So the queue is 8 × 256 = 2,048 frames (42.7 ms at 48 kHz) wired and 5 × 512 = 2,560 frames
(53.3 ms) on Bluetooth. The two flags come from Java (nativeExternalAudioInitial and
nativeExternalAudioChanges, 0x223efa0, 0x223efc4): an external sink is present when an
output of Android type 3, 4, 7, 8, 11, 13, 22, 26 or 27 is connected, and it is Bluetooth when it
is of type 7 (SCO), 8 (A2DP), 26 (BLE headset) or 27 (BLE speaker).
CorrectAudioBufferDsync¶
PC. ZSynthDS streams music and speech through a double-buffered DirectSound buffer: when the
play cursor crosses into the other half, the half just played is refilled.
Reprisal adds a correction to that routine (undecompiled function 0x1314bc8, getter call at
0x1314c0c; registered default on):
pos = buffer.GetCurrentPosition() // play cursor, bytes
half = size / 2
playing = (0 <= pos < half) ? 0 : 1
if CorrectAudioBufferDsync:
if state == 1 and pos < half and pos >= size / 4:
buffer.SetCurrentPosition(0); stream.cursor = 0
elif state == 0 and pos >= 3 * size / 4:
buffer.SetCurrentPosition(half); stream.cursor = half
if state != playing:
refill_offset = state * half // the half that has just finished
state = playing
return true
The switch to a new half was noticed late (the cursor already more than half-way through it), so the cursor is put back to the start of that half rather than letting it play data that has not been written yet. On a device where the emulated buffer's cursor advances in large sub-buffer steps this avoids audible skips (inferred purpose).
DisableAudio¶
Registered default off. When on, 0x14f1ed0 writes the game INI option DisableAudio=1, and the
start-up 0x14f170c skips creating the sound system (0x1303988, the ZDllSoundWintel factory).
The PS2 code has no such option.
Other audio classes¶
ZVorbisStream(vtable0x3032048; slots0x1319fdc,0x131a1d8,0x1319378) decodes the Ogg Vorbis.strstreams forZSoundBufferWintel(slot 12,0x1319400), using the linked libvorbis. It is PC Wintel code (inferred); the PS2 streams ADPCM.ZAudioTypeManager(0x12c6710) owns about 32 type objects; probably the PC name ofZAudioControllerManagerand its 31ZAudioControllerTypes (inferred).- The Instinct audio changes (low-pass and volume ducking) are on Instinct.
Video¶
PC. ZWintelVideoBink plays .bik files through binkw32 (slot 3, 0x14c0988, builds
"%s.bik"). The skip binding is DropVideo=hold(kb,esc);DropVideo2=hold(kb,return)
(PC Differences).
Reprisal keeps ZWintelVideoBink and the Bink API, and Feral implements that API over WebM.
- File.
vfs-config.xmlmaps the extension.bikto.webm, somovies/x.bikopensmovies/x.webm.legal.bikmaps tolegal_android.webm. The pack holds 35.webmmovies (226 MB). - Open (
ZWintelVideoBinkslot 5,0x14c0364): if the flag at +0xc3d is set orDisableCutscenesis on (Feral's addition; Gameplay), the movie is marked finished at once. OtherwiseBinkSoundUseDirectSound,BinkOpen, a video texture of the movie's size,BinkSetSoundTrack(1, {0}); a movie with more than one audio track is reopened withBINKSNDTRACK(0x4000) and the track of the game language (+0x9f4). Volume: theAudio_Volume_Movieoption − 22 (78 when the option is missing), at least 0, passed asvol / 100 × 32768. - Per frame (slot 8,
0x14c05d8): wait whileBinkWait,BinkDoFrame, lock the texture,BinkCopyToBuffercentred in it (flags 0x80000005, 32-bit with alpha, copy all), draw it letterboxed (full screen width when the movie is wider than the screen, else full height, centred), subtitles,BinkNextFrame, done after the last frame. - Skip. The binding is now
Video={DropVideo=|hold(kb,esc) hold(kb,return);};(either key), and the player owns aZFeralSkipUI(constructor0x173182c, from0x14c1fa8): the hold-to-skip control for touch and gamepad (Menus).
Feral's Bink (CFeralBink, vtable 0x2ab4360):
BinkOpenreads an optional<movie>.audiomap(audio track mapping, inferred) and the registry valuesSoftware\MacDoze\Config\BinkWebmMinTimeAhead/MaxTimeAhead(read-ahead window; defaults not found). The data comes fromCFeralBinkVFileDataSource, orCFeralBinkBufferDataSourceforBINKFROMMEMORY.- The WebM is demuxed with nestegg (
0x2ab9884); codecs VP8, VP9, Vorbis and Opus (table0xb01278). A video track with an alpha mode gets a second decoder for the alpha plane. - Metadata: a JSON dictionary in the WebM tag
frlauxj, or a sidecar.frlauxjfile (when the tag is missing orUseFeralAuxJFilesForWebmAuxDatais set), withBinkYCrCbNew.Enabled,BinkColourMatrix{Enabled, Matrix[16]}andFrameCount(0x2abc58c,0x2abc884). - Decoder (
0x2abd6f0): only when the registry valueBinkWebmUseLibvpxexists and is 0 does it tryCAndroidFeralVideoDecoder(MediaCodecvideo/x-vnd.on2.vp8/vp9, frames inAHardwareBuffers converted through a VulkanVkSamplerYcbcrConversion,0x2abf7f0), falling back on failure. Otherwise, and so by default,CLibVpxFeralVideoDecoder(0x2ac0de0): libvpx with as many threads as hardware threads (1 below two), frame threading when the codec allows it, its own decode thread, and a second decoder and thread for alpha. BinkCopyToBufferconverts YUV to RGBA on the CPU with NEON (0x24b948c→0x2ab58b8→0x2ab5e8c→0x2ab81a8), honouring the colour matrix from the metadata; surface types 32, 32R, 32A and 32RA are supported (0x24ba0c8).- Audio: an "Audio streaming" thread (
0x2ab7d1c) decodes the chosen tracks (Vorbis throughOggPull/OggCopyresamplers, Opus throughOpusResampler,0x2ab1c9c–0x2ab2eb8) into float buffers for Feral'sCAudioRenderer(0x1f39c34), not through the game's DirectSound (inferred). BinkWait(0x2ab6a10) says "wait" whileframe × fps_den × 1000 / fps_num > clock_ms + 30. The clock (+0xa4) is the audio position (samples played, extrapolated by wall time and capped at the samples queued), the monotonic time since start less paused time, or an external time. Which one the game uses was not determined.
Files and data¶
The virtual file system¶
PC. The game reads its install folder, .zip scene archives (FsZip_t,
src/engine/zstdlib/iozip.cpp), .str speech streams and loose files, and writes saves under
the user's documents.
Reprisal keeps those Win32 paths and puts Feral's virtual file system (VFS) under them.
CFeralGame slot 65 (0x11e78d4) loads vfs-config.xml (or the file named by the preference
VFSConfigPrefsOverride) and, unless DisableRemoteResources is on, RemoteResources.xml
(override RemoteResourcesPrefsOverride). CFeralVFSXMLBuilder parses them (0x218d35c
dispatches the elements; the version must be 1.0, 0x21909d4):
| Element | Meaning |
|---|---|
<file src dst> |
map a path (file or folder) to another (0x2190e34) |
<extension src dst> |
replace an extension; both start with ., src unique (0x2191174) |
<options dst type …> |
type = packed (2), remote (3) or split (4); case mode native (1), lower (2), ignore (3); preload (0x218b83c) |
<action cmd …> |
mkpath, touch, clone, cloudsync, cloudsyncr (recursive), syncgroup (regex in from) (0x219181c) |
<group platform=… remoteresource=…> |
applies its children on the listed platforms, or as a downloadable resource |
Variables: the Win32 side is ${DozeAppInstall} (${DozeProgramFiles}\${DozeAppDeveloper},
defaults Q:\Feral\Program Files\WinDeveloper, 0x218c8c4), ${DozeTemp} and others; the
device side (CFeralGame slot 66, 0x11e8418) is ${AppData} (the pack tree, which mirrors the
PC install in lower case), ${AppLocal} (<prefs>/VFS/Local), ${AppSaveData}
(<prefs>/SaveData), ${AppDocuments}, ${AppResources}, ${AndroidOBB}. The Android folders
behind them were not resolved.
The rules in this build's vfs-config.xml:
.bik→.webm(see Video);legal.bik→legal_android.webm.- The PC save folder
Hitman Blood Money→${AppSaveData}. - The PC's writable files and caches (
Cache,Final/scenes/Cache, everyFinal/scenes/Mxx/Cache,Final/PackPC,UserPath,objects.xml,controllers.xml,generatedpack.ini, the post-filter editor'sLort.pof,alllang.txt,Export,AudioStream,ioiaudio) →${AppLocal}. feraluiandUIOverridescan be overridden from writable folders;VirtualUIandVirtualControlPadcome from the APK's assets.Final/locale→final/locale/feral.pc_def.strhastype="split": it is stored as eight.feralsplitparts.- Feral's replacement art over the PC's paths: the target portraits, all load screens
(
loadscreens_feral, "with altered alpha channel"), the hint marks, the mission briefing background, weapon selection and upgrade art, M06's crowd map icons and M03's newspaper cat. - On iOS and Android, cloud-save actions (see Cloud saves); on Switch, HD movies.
The .pack containers¶
The game data is four files: data_core.pack (1,067,860,154 bytes) and data_support1–3.pack.
Only data_core.pack holds an index; the support packs are raw data (data_support1 begins with
a ZIP local header, data_support3 with a WebM header). All numbers are little-endian. The
header is 0xa8 bytes:
| Offset | Type | Value |
|---|---|---|
| 0x00 | u64 | magic 0xaaaabbbbccccdddd (bytes dd dd cc cc bb bb aa aa) |
| 0x08 | u64 | 0x41c7156594b44485 (meaning unknown) |
| 0x10 | u64 | 1, version |
| 0x18 | u64 | 1,937, entry count |
| 0x20 | u64 | 4, number of volumes (inferred) |
| 0x28 | char[128] | Build ID: 86095, NUL-padded |
The reader (0x2186a04, 0x2187014) accepts the file only when the magic matches and the
version is 1. The entries follow at 0xa8, in sorted path order, entry 0 being the root /; they
end at 0x30aa2 and the data starts at 0x30ac0.
u64 name_length
char name[name_length] // full lower-case path, no terminator: "/scenes/m00/m00_main.zip"
u8 type // 0 = file, 1 = directory
u32 volume // file: 0 = data_core, 1..3 = data_support1..3; directory: 0
file: u64 offset // within that volume, 64-byte aligned
u64 size
directory: u64 child_count
u64 child_index[child_count] // entry numbers, not sorted
The name has no terminator: the byte after it is the type, and the u32 that follows is the volume,
not a flags word. 0x21871fc parses each entry into a 0x48-byte
record (type +0, name +8, offset +0x18, size +0x20, children +0x28, volume +0x40); 0x2187014
adds a per-volume base offset when the caller gives one, so the four volumes can also sit in one
file. For every volume the largest offset plus size equals the pack's file size exactly.
| Volume | File | Files | Bytes |
|---|---|---|---|
| 0 | data_core.pack |
162 | 1,067,860,154 |
| 1 | data_support1.pack |
384 | 1,060,607,166 |
| 2 | data_support2.pack |
1,321 | 1,069,569,494 |
| 3 | data_support3.pack |
15 | 602,588,800 |
In all 1,882 files and 55 directories, 3,800,369,447 bytes; the files range from 48 bytes to 262,144,000. The top level:
| Path | Files | Contents |
|---|---|---|
/scenes |
278 (1.07 GB) | the PC scene archives: per scene .zip, _tex.zip, .wav, .whd (140 .zip, 69 .wav, 69 .whd); m00–m06 and m08–m12 20 files each, m13 16, hideout 8, alllevels 4, shared (fonts.zip, osd.zip), and hitmanbloodmoney.* and saveandcontinue.* at the top |
/movies |
35 (226 MB) | .webm movies, including m00_m02p/ and legal_android, feral_intro, se_eidos, intro_bi, outro |
/feralshaders |
1,309 (51.7 MB) | precompiled shader variants <effect>.fxv2_q30_mesh_<variant> (see Shaders) |
/feral |
219 (65.7 MB) | ui/ (152) and shared_ui/ (67): RmlUi documents and styles, PNG/JPG, 7 .astc textures, fonts, 2 .opus sounds |
/feralui |
21 | the menu XML (frontend.xml, briefing.xml, premiss.xml, online.xml, ingame.xml, postmiss_*.xml …) |
/otherxml |
3 | notoriety.xml, money.xml, difficultysettings.xml |
| speech | — | pc_def.str.0–.7.feralsplit (seven parts of 262,144,000 bytes and one of 115,857,797: a 1.95 GB pc_def.str), pc_ger.str (204 MB), pc_spa.str (227 MB), pc_eng.str (48 bytes) |
| loose | — | hitmanbloodmoney.ini (75 bytes), feraltouch.cfg, feral{gamepad,keyboard}{classic,modern}.cfg |
The English speech is pc_def.str; the 48-byte pc_eng.str is a stub (inferred). The member
contents were not examined (see What was not examined).
Classes: CFeralVFSExtensionPacked (vtable 0x3204138, slots 0x2187b4c, 0x2187ccc,
0x2186b08, 0x2186da4, 0x2186e90) on CFeralVFSExtensionPackedBase; the handles
VFileHandlePacked (0x3204818), VFileHandlePackedSplit (0x3204920) and VFileHandleSplit
(parts named %s.%d.feralsplit, 0x21acdd4); CFeralVFSTransformer;
CAndroidFeralVFSExtensionBundle for the APK's own assets. 0x22833bc lists the asset folder for
.obb and .pack files.
.sig files. Each pack has a one-line companion, SIG:<pack>:<size>:<number>, e.g.
SIG:data_core.pack:1067860154:3458261482324732857. 0x227f0ec hashes the text
SIG:<pack>:<size>: and compares the result with the number; it runs when the store's asset-pack
delivery hands a pack over (nativeLoadAssetPackData, 0x227e738, which also reads
FERAL MANIFEST v1; manifests). The number covers only the name and the size, so it checks that
the right, complete file arrived, not its contents (hash function not identified).
Scene scripts¶
PC. Each level's scripts are a DLL (Scriptcs/_gamerelease/*.dll); ScriptEngine::
AttachSceneScripts (PC 0x43bf40) loads it with LoadLibraryA and copies the 716-entry
interface table into its ScriptImports
(PC Differences). The PS2 links
them as relocatable modules (src/engine/zstdlib/zscriptc.cpp).
Reprisal compiles all 14 script modules into the library. A static initialiser (_INIT_299,
0x1552598) fills a map (at 0x37378e0) from the DLL name to a built-in module descriptor:
hideout.dll → 0x32c9ab0, m00.dll → 0x32c9b30 … m13.dll → 0x32cb058 (no m07, as on
the PC). The replacement loader 0x1551030:
- lower-cases the requested name;
- fills a table of engine callbacks (
0x36b77b0onwards); - looks the name up in the map and fails when it is not there;
- copies the 716 interface pointers (0x1660 bytes) from
0x329fdd8to0x3749078, the module'sScriptImports; - runs each script creator in the module's list (slot +0x30);
- keeps the PC's
lScriptLoadedCountcounter (0x37378cc).
0x1551614 is the matching detach. Nothing is loaded at run time (no dlopen); the strings
scriptcs/x64/Gamerelease/ and engine/zstdlib/zscriptc.cpp and the RTTI of ZScriptC remain.
Saves, cloud and online services¶
Save files and profiles¶
PC/PS2. src/hitman3/gui/saveps2.cpp writes SaveGame%i.control and .data.
Reprisal (0x17773d4) writes SaveGame#%i.control and SaveGame#%i.data (with a #) plus
an entry in saveinfo.xml under SaveData (0x11b3248); the profile is \Profile.pro
(0x17736a4). The VFS maps the PC folder Hitman Blood Money to ${AppSaveData}. Save rules
(autosave, ClearSavesOnMissionLoad, saves in M13) are on Gameplay.
| Preference | Default | Effect |
|---|---|---|
UseProfileNamesHashes |
off | on: the profile folder is a hash of the profile name (0x12b46f0) instead of the name itself (0x1772b24, 0x14f170c) |
SaveVersioningWarningLevel, ProfileVersioningWarningLevel |
0 | 0x16ebf70: 0 never warns about a save or profile from another version, 1 warns for one kind of mismatch (status 1), 2 for any; text VersionMismatchWarning or InGame.OldProfileVersion (callers 0x162bca0, 0x1673d94) |
LastUsedProfile, SkipProfileManager |
— | read at 0x119ff10, 0x173bff4, 0x1743210 (undecompiled; not read) |
Cloud saves¶
HitmanBloodMoneyGame::InitialiseFeralCloudDrive (0x119fab8) sets up Feral's cloud drive
(singleton 0x2018150): local root SaveData, remote root Documents/saves, and:
| Preference | Default | Effect |
|---|---|---|
CloudSavesEnabled |
on | upload after each save (0x11b352c) and profile write (0x17736a4) when there are files to send (0x202375c) |
UseCloudOfflineMode |
0 (specifications.xml) |
start offline |
ShowCloudDisabledAlert, ShowCloudCellularAlert |
1 | show the "cloud disabled" and "on a cellular network" alerts; written back after start-up |
SkipCloudStorageCheck |
off | skip the storage-space check |
CloudSyncVersion |
1.0 |
stored at drive +0x1b8 (0x201879c): saves synced under one version string |
UseCloudLock |
on | drive +0xce: hold a feral.lock file in the remote folder while syncing |
UseGoogleSignIn and UseDriveSaveSync |
— (off) | both on: sync through the Google account's drive; neither is set in this build |
It then starts the first sync (0x2018a1c with 60.0, probably a timeout in seconds;
Feral.FeralLib.InitialCloudSync). The cloudsyncr action in vfs-config.xml syncs
${AppSaveData} to Documents/saves; the syncgroup action groups each /Profiles/<name>/
under the label HitmanBloodMoney.GenericUI.CloudSyncGroupProfile.
The sync (0x1dd7504) compares manifests (save_manifest, with save_manifest.old; log
cloud_sync.log):
- Neither a local nor a cloud manifest: nothing to do. Only a local one: upload.
- Equal manifests: nothing to do.
- Otherwise, with the local stamp L, the cloud stamp C and the stamp of the last sync S
(preference
savestamp): C = S and C < L uploads; L = S and L < C downloads (file by file,0x1dd8684); anything else is a conflict, and a callback chooses (2 = take the cloud copy, 1 = upload, else cancel). With no callback the sync is cancelled.
The service is Feral's own online storage (inferred from the request keys in 0x1de0e78,
0x1de5b88).
Remote resources¶
RemoteResources.xml (generated, generate_remote_resources.py) lists three downloadable groups:
frenchaudio (pc_fre.str, 212,794,896 bytes), italianaudio (pc_ita.str, 229,927,620) and
russianaudio (pc_rus.str, 220,087,894). The manager (0x11be0a8) is enabled unless
DisableRemoteResources is on (registered off) and keeps RemoteResourcesDownloadMode (no
registered default: 0). 0x11beb58:
- maps the game language to a resource (
fr1,it2,ru3); - if that speech is not installed and the mode is 0, shows "DOWNLOAD LOCALISED AUDIO" / "Additional download required to enable audio in your selected language." with a DOWNLOAD button;
- sets the mode to 1 and saves it, so the prompt appears once.
The transport reads RemoteResourcesFailoverLimit, …Timeout, EnableODR (the store's
on-demand delivery), ForceFDR (Feral's own download service), DisableAnalytics and
HideTotalBytes (0x11e4458). FeralHDTexturesInitialPopupDisplayed occurs only as a string: no
code reads it and no HD texture resource is listed (from strings only).
Languages¶
FeralInfo.json lists text and speech in English, French, German, Italian and Spanish and text
only in Japanese, Polish and Russian. The text is in <lang>.lproj/Localizable_Game.strings
(loader 0x213ab4c) beside the game's own locale files. Speech: English pc_def.str, German and
Spanish in the pack, French and Italian downloaded. A Russian speech pack is listed in
RemoteResources.xml and downloaded for Russian, although FeralInfo.json calls Russian text
only. The language comes from the platform game object (slot +0x138, read by 0x11d65c4, cached
at 0x32ecee8); the preference Language (registered 0) is not read. How the device locale is
matched to a language was not traced.
Analytics and crash reporting¶
CFeralAnalytics (with CFeralGame::RequestAnalyticsPermission,
InitialiseBasicAnalyticsEvents, the preference AnalyticsPopupShown and
FeralAnalyticsUserIdentifier.txt), CFeralInputDeviceAnalytics, and CFeralCrashReporter,
CAndroidFeralCrashReporter and CFeralCrashDialog (Breakpad microdumps). ForceCrashAutosaves
is on Gameplay. Not examined further.
Preferences¶
Registered default (from the library), getter fallback where it differs, and the value
specifications.xml writes. A dash: none. The registered default wins over the getter's fallback;
specifications.xml values win over both.
| Preference | Registered | Getter | specifications.xml |
Section |
|---|---|---|---|---|
NumShadowBuffers |
11 | 16 | — | Shadows |
SelfShadowMaxDist |
1000 | 1300 | — | Shadows |
BlurredShadowsMaxDist |
0 | 0 | — | Shadows |
CombineDirectionalShadows |
on | on | — | Shadows |
ShadowResolution |
1024 | 1024 | — | Start-up options |
DirectionalShadowResolution |
1024 | — | per preset | Shadows |
UsePCFForDirectionalShadows |
on | on | — | Shadows |
NumPreallocatedDirectionalSMs |
1 | 1 | — | Shadows |
UseShadowAtlas |
— (off) | — | — | Shadows |
M12OptimizationDisable{Dynamic,Self,Static}Shadows |
— | no getter | — | not read |
PostProcessing |
on | on | 1 | Post-processing |
DisableColorCorrection, DisableColorOffset, DisableNoise, DisableRotoZoom |
— (off) | — | — | Post-processing |
ShouldSkipDepthPass |
on | on | 1 (D3D config) | Post-processing |
CharacterLevelOfDetail |
2 | 2 | — | Level of detail |
LODTableOverride, HumanFlowLODOverride |
— | — | JSON arrays | Level of detail |
EnableReflections, EnableReflectorCache, EnableLightArray |
— | — | 1 | Reflections |
DisableObjectDrawBatching |
— (off) | — | 1 on Mali | Draw batching |
UseUpscaler |
off | off | — | Upscaler |
UpscaleFactor |
2.0 | 2.0 | — | Upscaler |
UpscaleTechnique |
5 | 5 | — | Upscaler |
FXAAPreset_*, FXAASubpixQuality_*, FXAAEdgeQualityThreshold_*, FXAAEdgeThresholdMin_* |
as the file | — | per preset | FXAA |
ConvertToASTC, DisableTextureSplitting |
off | — | — | Buffers and textures |
StaticVBSizeMB |
10 | 10 | — | Buffers and textures |
ForceBackbufferToOpaque |
— (off) | — | 1 on some devices | Buffers and textures |
DefaultTier, FixedScreenHeight |
— | — | per GPU | Quality tiers |
UseAsyncViewspace, UseAsyncRenderEntryUpdates, UseAsyncBoneUpdates, UseAsyncSoftwareLights |
on | on | — | Threading |
UseAsyncEvents |
on | no getter | — | not read |
NumSubBuffers, NumSubBuffersBluetooth |
8, 5 | — | — | Audio |
SubBufferFrames, SubBufferFramesBluetooth |
256, 512 | — | — | Audio |
NumBufferLayers |
2 | — | — | Audio |
CorrectAudioBufferDsync |
on | on | — | Audio |
DisableAudio |
off | off | 0 | Audio |
CloudSavesEnabled, UseCloudLock |
on | — | 1, — | Cloud saves |
UseCloudOfflineMode, ShowCloudDisabledAlert, ShowCloudCellularAlert, CloudSyncVersion |
— | — | 0, 1, 1, 1.0 |
Cloud saves |
SkipCloudStorageCheck |
off | — | — | Cloud saves |
UseGoogleSignIn, UseDriveSaveSync |
— | — | — | Cloud saves |
UseProfileNamesHashes |
off | — | — | Save files |
SaveVersioningWarningLevel, ProfileVersioningWarningLevel |
0 | — | 0 | Save files |
DisableRemoteResources |
off | — | 0 | Remote resources |
RemoteResourcesDownloadMode |
— (0) | — | — | Remote resources |
Language |
0 | — | — | not read (Languages) |
Unresolved¶
- Rendering code Ghidra did not decompile. Much of
ZRenderWintelD3D(0x1362f68–0x1369cac), the material parameter binder (0x137b878onwards) and the reflector pass are in code Ghidra did not make functions of; the parts above were read from the disassembly. The upscaler's slots (0x136a100–0x136a6a4) and the directional shadow-map set-up (0x1361c1c) were not read, so the technique numbers ofUpscaleTechnique, the PCF kernel and how the combined directional maps are laid out are unknown. - The PC baseline for the D3D renderer. The PC executable is not available unpacked, so the PC
side of the shadow-buffer count rule, draw batching, the depth pass and the LOD tables is taken
from Reprisal's unchanged code paths and from
src/, not from the PC binary. FixedScreenHeight: its reader was not found (probably in the Java layer or by key object).FramerateManagerResponsiveFPSDuration: the unit of its default (60) and how input raises the responsive rate were not traced.- Bit 0 of the post-filter mask: whether it removes only the level's grading or also the scripted looks.
HumanFlowLODOverride: the consumer at0x15dc858was not read.- The shaders in
/feralshaders(the PCF filter,FeralLightingMPS, the rim-light techniques,Feral Depth Cue) are in the pack and were not examined. - Audio: the real values of the INI options
EnableOpenAL,EnableDirectSoundandDisableAudio(the INI is in the pack); whetherMasterSampleRate0 means the device rate; the defaults ofBinkWebmMinTimeAhead/MaxTimeAhead; whichBinkWaitclock the game uses; the flag atZWintelVideoBink+0xc3d. - Files: the meaning of the pack header word at 0x08, whether the word at 0x20 is the volume
count, the hash behind the
.signumber, the Android folders behind${AppData},${AppLocal}and${AppSaveData}, the 60.0 argument of the cloud-sync calls, and the code that readsLastUsedProfileandSkipProfileManager. - How the device locale chooses the game language.