Skip to content

Middleware ​

Middleware is a library that a game licenses for one job. In most cases it does not need to be reverse engineered. Identify it, label its functions, and replace it in the port with a library that does the same job. Check whether the game depends on any exact behaviour of the library, such as its random numbers, its rounding or its timing.

Common libraries of the era ​

JobLibrarySigns in the filesIn the port
VideoSmacker (RAD Game Tools, 1994).SMK files starting SMK2 or SMK4; smackw32.dllFFmpeg decodes Smacker
VideoBink (RAD, 1999).BIK files starting BIK; binkw32.dllFFmpeg decodes most Bink 1 files
VideoWestwood VQA, Sierra VMD, Cinepak in AVI.VQA, .VMD, .AVIFFmpeg, or a small decoder from the documented format
SoundMiles Sound System (RAD), earlier the Audio Interface Librarymss32.dll, MSS strings; in DOS, AIL driver files (.DIG, .MDI)A modern audio library; MIDI through a software synthesiser
SoundDIGPAK and MIDPAK, HMI Sound Operating SystemDIGPAK drivers as .COM files and MIDPAK music drivers as .ADV files, called through INT 66h; HMI*.386; SOS stringsThe same
SoundFMODfmod.dll, fmodex.dll; FMOD stringsA modern library; FMOD's tracker-module playback has its own quirks to match
SoundDirectSound, DirectMusic, A3D, EAXimports from dsound.dll, dmusic; a3d.dll; EAX stringsSee Sound hardware
3D graphicsDirect3D, OpenGL, Glideimports from ddraw.dll, d3d8.dll, opengl32.dll, glide2x.dllSee 3D accelerators
PhysicsHavok (from 2000), MathEngine, PhysX (from 2005)hk prefixes in RTTI and strings; PhysX DLLsPhysics middleware results must be matched only if the game's rules depend on them; often they are cosmetic
AnimationGranny 3D (RAD).gr2 files; granny2.dllA reader for the format, documented by modders
ScriptingLua (from 1993), Python, Tcllua_pcall, Lua 5.0 strings; python2x.dllUse the same language version; decompile compiled scripts (unluac)
Compressionzlib, LZSS, LZW, Huffman, PKWARE DCL ("implode")zlib's version strings and CRC table; PKWARE stringsA standard library, or the documented algorithm
OnlineGameSpy SDK, DirectPlay, Kaligamespy strings; dplayx.dllReplace with your own networking; do not contact old services (Online games)
ProtectionSafeDisc, SecuROM, StarForce, CD checks.icd files, secdrv.sys, ~df394b.tmp; checks for a disc labelBreaking it is restricted in many countries (Legal); the port reads the player's files and does not need it

When the port must match the middleware ​

Most middleware can be replaced freely. A few cases need care:

  • Music timing. If the game logic waits for the music (a level ends when a song ends, a cut scene follows the music), the port must match the music library's timing. Measure it.
  • Random numbers. A few libraries use the C runtime's rand. If the game also uses rand, the library's calls change the game's sequence. Trace every caller of the random function.
  • Video frame counts. Some games count video frames to time events. Use the same frame rate and frame count as the original file.
  • Scripting. Use the same script language version as the game. Lua 4.0 and 5.0 differ in their libraries and byte code, and Lua 5.3 added an integer type.
  • Physics. If physics sets a game result (a ball's bounce in a sports game), the port must match the physics library's exact results. This is hard to match without the same library. Decide early whether your project can accept a deviation and record it.

How to identify a library inside the executable ​

Libraries are often linked statically, so there is no separate DLL.

  1. Search the strings for version and copyright notices. Most libraries include one.
  2. Look for the library's constant tables: CRC tables, Huffman tables, DCT coefficients.
  3. Compare the function with the library's source if it is open (zlib, Lua). The structure of a compiled zlib inflate loop is easy to recognise once you have seen it.
  4. Label the whole library's functions in Ghidra with a prefix (zlib_, lua_, smk_), so you can skip them while tracing.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.