Patch:Large text files

From KeenWiki
Jump to navigation Jump to search

This page covers patching large text files. These are the *TXT.CKx files in Keen Vorticons. They contain the help, story, previews and end texts for the game. A utility that makes these patches automatically is Startext. Related patches are Patch:Story Screen (Galaxy). Note that there exists a patch for the story text that does not fit on this page.


Default file locations and sizes

In Keen 1 these files are external and can be of any size (to change their names see Patch:Files and filenames) for other episodes they are internal chunks of text and can be patched like other Patch:Text patches. Often it is easiest to use the %patchfile command with them, to create an easily editable external text file. An example is creating an external help text file for Keen 2:

Keen 2

#Change the help text, max file length 2'016 bytes
%patchfile $15BC0 "HELPTXT.CK2"


Several things should be noticed. First, you need to patch the text. Second, you will need an eternal file in your mod's directory for CKPatch to read, or you will get a 'file not found' error. Third, the file can only be so large before you start overwriting other, important text. In the case above it can be any size less than 2'016 bytes. Until reccently the size of these files could not be changed, but see section below.

The locations and sizes for patches required to patch all the large text files in Keen 2-6 (and Keen Dreams 1.13) are as follows:

Keen	Text	Location	Max Size (bytes)
 2      End	$15844		  896
        Help	$15BC0		2'016
        Preview	$163A0		1'824
        Story	$16AC0		3'232
 3      End	$181A0 		  832
        Help	$179D0 		2'000
        Preview	$184E0 		1'776
        Story	$18BD0 		3'120
 4      Story   $1EE40            512
 5      Story   $1FDE0            604
 6      Story   $1ED50            493
 D      End     $24128          ???
        Help    $22EF0            416
        Story   $23090          2'640

There are several other things to note. Firstly, in Keen Vorticons, these text chunks are automatically parsed, that is, the Keen engine will place line returns in the text automatically, like a word processor. (The line width is about 38 characters) Secondly, again in Vorticons, the text is terminated by the character $1A, not $00 as in most text patches. (The proper ASCII character for this can be found in the Keen 1 text files, right at the end, it resembles a left arrow.) Thirdly, in Vorticons, it is possible to change the text from type 1 (Usually called 'white') to type 2 (Usually called 'grey') by placing the character '~' at the start of a line. (Doing this for more than one line in a row can cause odd results however.) Keen uses this, and a preceding line of '_' to divide its texts up into 'pages'

You can also insert most other characters from the font into the file. Checking the Keen 1 files is recommended. Both Notepad and Wordpad can be used for this, and to create\edit text files.


Changing length of text files

It is possible to change the location the game reads text files from. This allows the modder to rearrange text files and thus change their length. (The total amount of space available cannot be changed, but it can be allocated differently and if a mod does not use something such as the previews text, that space can be given to other documents like the story.)

The location of the text file is given by taking the first value ($xxxxRW) and adding an '0' then adding the second value. Thus Keen 3'a Help text file is at $179D0 ($179D -> $179D0 + 0000 = $179D0)

It is important to keep track of what this does to the available space; increasing a file's location by $10 removes 16 bytes of space from it, decreasing it by $10 adds 16 bytes of space. If files are tightly packed then it can be very hard to alter them (New additions, correcting mistakes.) without having to fiddle with patches. If drastically moving a file the amount of space available can be extremely varied.

Keen 3

#Helptext
%patch $86AD $179DRW
%patch $86B0 $0000W

#Storytext
%patch $86C1 $18BDRW
%patch $86C4 $0000W

#Endtext
%patch $86D5 $181ARW
%patch $86D8 $0000W

#Previews
%patch $86E9 $184ERW
%patch $86EC $0000W

Keen 4 story segment location

#Story read from
%patch $5582 $1EE4RW #This * $10
%patch $5587 $0000W  #Plus this


Text file window footer

The text file window footer is the text used at the bottom of the end, help and story text windows. This gives the window navigation options (Esc quits, the up and down arrows scroll.) This text string uses the two characters $0F and $13 for the up and down arrow symbols.

Text file window footer

#Text file window footer -Keen 1:
%patch $9F10  [$32B5W] #Text called from
%patch $16305 "       ESC to Exit / " $0F " " $13 " to Read      " $00

#Text file window footer -Keen 2:
%patch $98ED  [$3333W] #Text called from
%patch $1AAB3 "       ESC to Exit / " $0F " " $13 " to Read      " $00

#Text file window footer -Keen 3:
%patch $A700  [$33A7W] #Text called from
%patch $1CBC7 "       ESC to Exit / " $0F " " $13 " to Read      " $00


Missing a text file errors

This error is displayed when a vital external file is missing from the game directory. It is mostly encountered in Keen 1 where all the game texts are external but can also appear when things like the Finale file are absent.

Missing text file error texts

#Keen 1:
%patch $B37B  [$359DW] #Text called from
%patch $165ED "Missing a text file!" $00

#Keen 2:
%patch $AA94  [$3578W] #Text called from
%patch $1ACF8 "Missing a text file!" $00

#Keen 3:
%patch $BDEE  [$37C8W] #Text called from
%patch $1CFE8 "Missing a text file!" $00