stmyste.re/layton-rev
A byte-perfect decompilation of the Professor Layton Nintendo DS engine. Every puzzle has an answer.

What is this?

This project is (for now) a byte-perfect decompilation of the game engine from Professor Layton and the Curious Village (Nintendo DS, 2007, Level-5). The goal is to replace every compiled function with matching C code, verified against the original ROM binary.

The approach is the same as sm64 and pokediamond: extract the ARM9/ARM7 binaries from the ROM, disassemble everything, then work through it function by function until the rebuilt binary is identical to the original.

The scripting language the game uses to run puzzles and cutscenes is a major focus. Getting that understood is what makes the rest of the engine start making sense.

$ python3 tools/extract.py cv.nds Game title : LAYTON1 Game code : A5FE ARM9 : offset=0x00004000 addr=0x02000000 size=0x0007C530 ARM7 : offset=0x00098400 addr=0x02380000 size=0x00026DB8 [bin] original/arm9.bin (509,232 bytes) [asm] arm9/asm/arm9.s [bin] original/arm7.bin (159,160 bytes) [asm] arm7/asm/arm7.s

Current state

Work is ongoing. Both binaries build byte-perfect against the original ROM. Parts of ARM9 and ARM7 have been replaced with C so far, the rest stays as disassembled stubs for now. Several NitroSDK functions have been identified and labeled by matching the embedded SDK stamps against known symbol patterns.

Target
Curious Village
NDS · A5FE · 2007
Build
byte-perfect
ARM9 + ARM7 match original
ARM7
partial
C functions + labeled stubs
SDK libs
6 identified
via embedded stamps

Engine File Formats

Almost everything in the game is packed into the NitroFS filesystem inside the ROM. Most assets use Level-5’s own container formats on top of that. This table gets updated as formats are worked out.

Extension / Magic Format Status
.arc Level-5 archive container
Wraps multiple files; used for rooms, puzzles, etc.
todo
.gds Game Design Script, the engine’s scripting language
Bytecode VM that runs all puzzles, cutscenes, and events
todo
.dat Generic data container, format varies by context
Dialogue, puzzle definitions, room layouts
todo
.nclr / .ncgr / .nscr NitroSDK standard graphics formats
Palette / tile data / screen layout, well-documented externally
known
.nanr / .ncer NitroSDK animation and cell data
Sprite animations
known
.mio Actimagine VX video stream
Used for the cutscenes
todo