Zork Nemesis - zfs file

How to translate the files of a game
ghylard
Posts: 77
Joined: Wed Oct 08, 2014 1:03 pm

Zork Nemesis - zfs file

Post by ghylard »

There is a patch to add subtitles to the English version of this game.
https://www.thezorklibrary.com/installguides/znpatch.zip
I would like to be able to adapt this patch to allow subtitles to be added to this game in other languages.
The subtitles are included in the subpatch.zfs file.
A bms script https://github.com/AlexKimov/heavygear-file-formats/blob/master/scripts/zfs.bms allows you to decompile it into many files (sub, txt, etc...=)
The subtitles seem to be in some of the txt files but these files are not directly usable in a text editor.
Image
Is it possible to properly extract the text from these txt files, edit it and then reinsert it?
swuforce
Posts: 233
Joined: Thu Oct 16, 2014 4:39 pm

Re: Zork Nemesis - zfs file

Post by swuforce »

Although the repacked file is different, the extracted ones are similar, so you can give a try to this.
Extract the files to a folder named "unpacked"

Code: Select all

quickbms zfs.bms subpatch.zfs unpacked

Use the attached modified script to repack.

Code: Select all

quickbms zfs_repack.bms subpatch.zfs .

Code: Select all

GoTo 12
get FILECOUNT long
get COUNT long
GoTo 28

XMath SECTION_COUNT "COUNT/FILECOUNT + 1"
XMath REMAINDER "COUNT % FILECOUNT"

savepos OFFSET
log MEMORY_FILE 0 OFFSET

for k = 0 < SECTION_COUNT
   get HEADER_POS long
   get HPOS asize MEMORY_FILE
   append
   put HEADER_POS long MEMORY_FILE
   append
   XMath NUMBER "k + 1"
   if SECTION_COUNT == NUMBER
      math FILECOUNT = REMAINDER
   endif
   xmath OFFSET "OFFSET + 4 + FILECOUNT * 36"
   log MEMORY_FILE2 0 0
   for i = 0 < FILECOUNT
      GetDString FILENAME 16
      get POS long
      get unk1 long
      get SIZE long
      get unk2 long
      get unk3 long
      string NAME p "unpacked\%s" FILENAME
      open FDSE NAME 1
      get SIZE asize 1
      append
      PutDString FILENAME 16 MEMORY_FILE
      put OFFSET long MEMORY_FILE
      put unk1 long MEMORY_FILE
      put SIZE long MEMORY_FILE
      put unk2 long MEMORY_FILE
      put unk3 long MEMORY_FILE
      log MEMORY_FILE2 0 SIZE 1
      append
      math OFFSET += SIZE
   next i
   get SIZE asize MEMORY_FILE2
   append
   log MEMORY_FILE 0 SIZE MEMORY_FILE2
   append
   get SIZE asize MEMORY_FILE
   putVarChr MEMORY_FILE HPOS SIZE long
   GoTo HEADER_POS   
next k

get SIZE asize MEMORY_FILE
log "REPACKED.zfs" 0 SIZE MEMORY_FILE
ghylard
Posts: 77
Joined: Wed Oct 08, 2014 1:03 pm

Re: Zork Nemesis - zfs file

Post by ghylard »

Thank you for this script which allows me to recompile the zfs file. :D
Unfortunately, I won't be able to use it if I can't modify the files containing the game's subtitles beforehand. :(
Let's take for example the case of the file tb2el11c.txt which contains the text
<FONT "Arial" JUSTIFY center BOLD on POINT 18 RED 255 GREEN 255 BLUE 255>
<FONT Arial BOLD on JUSTIFY center POINT 18 RED 211 GREEN 243 BLUE 245>Finally someone has come.
<FONT Arial BOLD on JUSTIFY center POINT 18 RED 211 GREEN 243 BLUE 245>You've got to help us.
<FONT Arial BOLD on JUSTIFY center POINT 18 RED 211 GREEN 243 BLUE 245>They're in the temple.

The file opened in Notepad++ looks like this: Each character is separated by NUL
Image
Editing is therefore impossible to achieve with the text in this form.
swuforce
Posts: 233
Joined: Thu Oct 16, 2014 4:39 pm

Re: Zork Nemesis - zfs file

Post by swuforce »

Open the file with hex editor. Replace 0D0A to 0D000A, then edit as unicode text.
After edit replace back.
ghylard
Posts: 77
Joined: Wed Oct 08, 2014 1:03 pm

Re: Zork Nemesis - zfs file

Post by ghylard »

swuforce wrote:Open the file with hex editor. Replace 0D0A to 0D000A, then edit as unicode text.
After edit replace back.


Thank you for this tip!
It works perfectly!!! :D :D :D