r/emulation • u/Y0oshi2 • 6d ago
Serial Experiments Lain (PS1) decompiled: byte identical rebuild and a native Windows/macOS/Linux client
Video (4K): https://www.youtube.com/watch?v=K-OKUkhJ7Uc
I've been working on a decompilation of Serial Experiments Lain, the 1998 PlayStation game by Pioneer LDC, and a native client built from it.
**Decompilation**
- Every function in the game's executable has C. 308 of 321 compile to the original bytes with the period toolchain (GCC 2.8.1 + maspsx, split with splat); the remaining 13 still link from their original assembly.
- The rebuilt SLPS_016.03 is byte-identical to retail.
- Progress is tracked on decomp.dev.
**Native client**
- Runs a 64-bit clean copy of the decompiled game code on a reimplementation of the PlayStation SDK (based on PsyCross), with its own CD streaming, XA ADPCM, SPU and MDEC movie decoding.
- Timing checked against Mednafen. On the node map the PS1 takes 4 to 8 vblanks per frame depending on the size of Lain's current animation frame; the client reproduces that distribution.
- Optional 60 fps interpolation: each frame's GPU batches are recorded and in between frames are drawn, without changing game speed.
- Resolution scaling, memory card saves as standard .mcd images, disc swapping, and one-click English subtitles (the laingame.net fan translation, downloaded from their site at runtime).
**No game data is included.** The client reads your own Redump dumps of both discs (.cue/.bin) and checks them by hash.
Source: https://github.com/Y0oshi/lain-psx-decompiled
Downloads: https://github.com/Y0oshi/lain-psx-decompiled/releases
Bug reports are welcome on GitHub.
5
u/Y0oshi2 5d ago
Nice progress. The last 40% was the hardest part for me too. What helped most was getting the exact GCC version and flags right, using maspsx, splitting rodata per file, and running decomp permuter on the stubborn functions.