Language Translation Kit

This modification allows anyone to create The Neverhood translation for their own language.
This document explains translation workflow. If you still have any questions regarding translation
process after reading this don't hesitate to contact us for help.



I. Tools description
dumpsave - tool to dump saved games from Windows system registry to disk (run this tool from "SAVE" folder).
unpakblb - original game .BLB archive unpacker and converter for images, texts, music and sounds.
nhcpacks - this translation .NHC archive file packer and unpacker.
nhcsound - sound and music PCM .WAV files converter to the game .N07 / .N08 format.
copypalt - tool to copy palette from backgrounds .TGA files to fix greyscale .TGA sprites palette.
nhcimage - images .TGA file back converter to the game .N02 format.
n02image - game images .N02 file converter to the .TGA format.
nhcfonts - tool to edit Willie hints, Klogg taunts and Hall of Records font table character width.
nhctexts - tool to edit Willie hints, Klogg taunts and Hall of Records texts.
substext - tool to pack and unpack subtitle files.
font2bmp - tool to convert to .BMP and from .BMP subtitle font image.
nhcsmack - tool to test subtitles with Smacker game video outside of the game (drag and drop video with
subtitle file in the same folder), font file "544E4F46.N0B" required in the same folder as this tool.
Text file "DESCRIPT.ION" contains hints about what files are responsible for.



II. Debugging options
Translation "language.dll" has special options which help a lot to find required resource or
test translation in the game. All options must be changed in the "language.ini" file.

II.1. LogHash
This option allows to log all file hashes from .BLB archives which the game is trying to load
into text file "hashlist.log" in the game folder. For example, if you need to find what images 
are used for a specific scene, do the following:
- put "LogHash=2" (without quotes) in "language.ini"
- make sure you run the game with the "Compatability Renderer" in windowed mode
- run the game, open the menu and before loading the required scene switch with Alt+Tab away from the game 
window and delete "hashlist.log" so only hashes for the loaded scene are be captured there
- load the required scene and exit the game after that
Types which are available to be set with LogHash option:
0 - disabled, do not log anything
2 - Bitmap
3 - Palette
4 - Animation
5 - Data
6 - Text
7 - Sound
8 - Music
10 - Video
255 - log everything

II.2. IsDebug
This option allows to enable some of the game cheats initially so you don't waste any time
entering them every time you run the game. This option is a bitmask, so you must sum all the flags
you want to activate. Possible values for flags:
1 - "fastforward" cheat initially enabled (fast animation playback)
2 - "skipper" always enabled (hardcoded, this can't be disabled in game)
4 - scenes hidden menu always available (hardcoded, this can't be disabled in game)
8 - "ahourprofs" cheat initially enabled (game developer cheat)
For example if you want "skipper" cheat enabled which allows to skip any Smacker videos with
spacebar and want to do a quick scene switch through hidden menu always available you need to add
this line to the "language.ini" file:
IsDebug=6
Because 2 + 4 = 6.
It's highly recommended to set IsDebug to 7 for testing purposes - this will save a lot of time.
The hidden menu is available from the main menu - just click on the topmost pixel row on the
screen. The whole cheat-codes list is available here:
http://ctpax-cheater.losthost.org/htmldocs/nvh.htm
Use "Translate page" button on the left to translate to your language.
If IsDebug is non-zero (i.e. at least one debug feature enabled) the evil annoying laugh at the
third screen at startup with The Neverhood team picture will be replaced with the falling key sound.



III. File format and other useful info
Please note that all data types are in Intel (little endian) byte order from <windows.h> header file.

III.1. LANGUAGE.NHC file format
File header:
  DWORD dwCheck; // archive signature "NHC\0" or 0x0043484E
  DWORD dwStamp; // archive build time stamp: MAKELONG(MAKEWORD(Day, Month), Year)
  DWORD dwSizes; // whole archive size to test integrity
  DWORD dwTotal; // total items in archive
    // For each of dwTotal item:
    DWORD dwFileHash; // item hash as it was in original .BLB game archive
    DWORD dwFileType; // item type as it was in original .BLB game archive
    DWORD dwFileOffs; // item offset from the start of the .NHC archive (absolute)
    DWORD dwFileSize; // item size
Items data follows this header.
Note that items are never packed with PKWARE.
Sound and music items to replace must be uncompressed PCM too (do not use DW ADPCM).
There are new dwFileType types for .NHC format only (not used and not recognized by the game):
11 (0x0B) - subtitle font (8x16 BIOS font 1BPP), must be with hash 0x544E4F46 (it's the word "FONT")
12 (0x0C) - error messages in the same format as subtitles, must be with hash 0x54584554 ("TEXT")
13 (0x0D) - video subtitles, hash must be the same as the video this item is intended to play with



III.2. Subtitles and error messages format:
DWORD from;     // first frame for the subtitles
DWORD till;     // last frame for the subtitle
CCHAR text[40]; // ASCIIZ subtitle text
Note that interval [from..till] are inclusive.
Text messages must be 39 characters or less, since last one will be used to terminate text string.
If text starts with the ^ character it will be displayed at the top of the screen.
All text lines are centered, so if you need to move it to the left or right - just add spaces at the
start or the end of the subtitle text line.
Since each subtitle takes 48 bytes (4+4+40) total subtitle lines can be calculated as follows:
dwLines = dwFileSize / 48;
Note that there can't be more than 128 lines in one subtitle file.

Error messages file has the same format except for a few major differences:
from - contains address to patch
till - text lines relationship (this is ignored)
text - error text message, each must start with the character '+' (ingame message) or '-' (Windows message).
There are 33 message lines total, here is the correct addresses (anything else will be ignored):
4758947 0000|+Error loading game
4758960 0000|+or game not found
4758967 0001|+Error saving game
4758980 0001|+or maximum games saved
4758987 0002|+Maximum number of saved
4759000 0002|+games reached
4759843 0003|+Game exists.
4759835 0003|+Overwrite it?
4759007 0004|+<empty line, but can be used>
4759020 0004|+Error deleting game
4759027 0005|+<empty line, but can be used>
4759040 0005|+No games are saved
4759047 0006|+Game not loaded.
4759054 0007|+Game not saved.
4759061 0008|+Game not deleted.
4759074 0009|+Need name of game.
4758937 0010|+Unknown error
4762577 0011|+Error initializing sound for movies
4762593 0011|+<empty line, but can be used>
4762609 0011|+<empty line, but can be used>
4762664 0012|+Your system may not have
4762680 0012|+enough free disk space to
4762696 0012|+run this game properly
4762983 0013|+DirectDraw reports that your
4762999 0013|+video hardware may not be able
4763015 0013|+to run this game properly
4762815 0014|-Unable to initialize DirectDraw.
4762882 0015|-Unable to initialize DirectDraw.
4762531 0016|-Error initializing DirectSound
4452034 0017|-Error creating window.
4762748 0018|-Resources not found or error reading.
4451108 0019|-Error reading resources or disk.
4451589 0020|-The game is already running.



III.3. Editing ingame texts (type 6) for hints, wall text, etc.
There are three fonts:
283CE401.N02 font red (Klogg)
C6604282.N02 font yellow (Willy)
0800090C.N02 font beige (walls)
Which use special font character width table:
0002486A.N05 (asRecFont item)
They're used for all text (type 6) files in the game.
All other fonts have fixed width and are used in menus (original font: "Comic Sans"):
201C2474.N02 font load game
2328121A.N02 font save game
728523ED.N02 font delete game
94188D4D.N02 font error messages
Also original font used in the credits images: "Garamond".

If you're making a translation into a language that is impossible to fit within 224 displayable
characters, you may want to consider picking the Japanese version as the basis for your translation,
as it uses prerendered images instead of text for Willie's letters and has Hall of Records removed
(and placed into a file to be read outside of the game).



III.4. Smacker video replacement
Please note that the game uses very old Smacker library version "2.1 g" back from 1996-06-19.
If you create or modify original game videos with the official RadGameTools your new files
may not work properly or not work at all in the game. You may try to use an older version of
Smacker tools. Also if you need to replace sound only use "smackmix.exe" tool from RadGameTools,
just don't use Bink sound compression.
