<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://modenc2.markjfox.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.204.126.170</id>
	<title>ModEnc² - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://modenc2.markjfox.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.204.126.170"/>
	<link rel="alternate" type="text/html" href="https://modenc2.markjfox.net/Special:Contributions/84.204.126.170"/>
	<updated>2026-06-06T05:03:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://modenc2.markjfox.net/index.php?title=CSF_File_Format&amp;diff=3937</id>
		<title>CSF File Format</title>
		<link rel="alternate" type="text/html" href="https://modenc2.markjfox.net/index.php?title=CSF_File_Format&amp;diff=3937"/>
		<updated>2007-06-04T20:16:50Z</updated>

		<summary type="html">&lt;p&gt;84.204.126.170: corrected by VK(tm)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSF files hold stringtables for RA2/YR (also for Generals/ZH and probably others).&amp;lt;br&amp;gt;&lt;br /&gt;
For more information about what a CSF file is, go to the [[CSF|CSF page]].&lt;br /&gt;
&lt;br /&gt;
On this page you will find a guide to how the format is built up.&lt;br /&gt;
&lt;br /&gt;
==The Header==&lt;br /&gt;
The header of a CSF file is 0x18 bytes long.&amp;lt;br&amp;gt;&lt;br /&gt;
It is built up like this:&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=&amp;quot;2&amp;quot; cellpadding=&amp;quot;4&amp;quot; style=&amp;quot;border-collapse: collapse; border: 1px solid #000000;background:#F0F0F0;&amp;quot;&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Offset&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Type&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x0&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|char[4]&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;&amp;quot; FSC&amp;quot;&#039;&#039;&#039;&amp;lt;br&amp;gt;CSF header identifier&amp;lt;br&amp;gt;If this is not &amp;quot; FSC&amp;quot;, the game will not load the file.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x4&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;CSF Version&#039;&#039;&#039;&amp;lt;br&amp;gt;The version number of the CSF format.&amp;lt;br&amp;gt;RA2, YR, Generals, ZH and the BFME series use version 3.&amp;lt;br&amp;gt;Nox uses version 2.&amp;lt;br&amp;gt;Nothing is known about the actual difference between the versions.&amp;lt;br&amp;gt;&lt;br /&gt;
Thanks to Siberian GRemlin for providing this information ([http://www.ppmsite.com/forum/viewtopic.php?p=130667#130667 see here])!&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x8&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;NumLabels&#039;&#039;&#039;&amp;lt;br&amp;gt;The total amount of labels in the stringtable.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0xC&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;NumExtraValues&#039;&#039;&#039;&amp;lt;br&amp;gt;The total amount of extra values in the stringtable.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x10&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;(nothing)&#039;&#039;&#039;&amp;lt;br&amp;gt;This is not read or used by the game, which means it is useless.&amp;lt;br&amp;gt;If you want, you can store an extra information tag there, if your program could use one (assuming you want to write a program that reads CSF files).&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x14&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;Language&#039;&#039;&#039;&amp;lt;br&amp;gt;The language value for this stringtable.&amp;lt;br&amp;gt;See below for a list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Language===&lt;br /&gt;
The language DWORD can have the following values (others will be recognized as &amp;quot;Unknown&amp;quot;):&lt;br /&gt;
  0 = US (English)*&lt;br /&gt;
  1 = UK (English)&lt;br /&gt;
  2 = German*&lt;br /&gt;
  3 = French*&lt;br /&gt;
  4 = Spanish&lt;br /&gt;
  5 = Italian&lt;br /&gt;
  6 = Japanese&lt;br /&gt;
  7 = Jabberwockie&lt;br /&gt;
  8 = Korean*&lt;br /&gt;
  9 = Chinese*&lt;br /&gt;
 &amp;gt;9 = Unknown&lt;br /&gt;
&amp;amp;#42; RA2/YR has been released in this language.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
After the header, the label data follows.&lt;br /&gt;
&lt;br /&gt;
A label can be considered an entry in the stringtable (e.g. &amp;quot;GUI:OK&amp;quot; is a label).&amp;lt;br&amp;gt;&lt;br /&gt;
Each label can have a &#039;&#039;&#039;name&#039;&#039;&#039; (e.g. &amp;quot;NAME:MTNK&amp;quot;), a &#039;&#039;&#039;value&#039;&#039;&#039; (e.g. &amp;quot;Grizzly Tank&amp;quot;) and an &#039;&#039;&#039;extra value&#039;&#039;&#039; (no example in the original ra2.csf/ra2md.csf).&amp;lt;br&amp;gt;&lt;br /&gt;
While the name and the extra value are ASCII strings, the value is a Unicode string (in order to support Korean, Chinese, etc).&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s come to how the data is stored in the CSF file:&lt;br /&gt;
&lt;br /&gt;
===Label header===&lt;br /&gt;
The label data begins with a label header, which is built up like this:&lt;br /&gt;
{| cellspacing=&amp;quot;2&amp;quot; cellpadding=&amp;quot;4&amp;quot; style=&amp;quot;border-collapse: collapse; border: 1px solid #000000;background:#F0F0F0;&amp;quot;&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Offset&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Type&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x0&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|char[4]&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;&amp;quot; LBL&amp;quot;&#039;&#039;&#039;&amp;lt;br&amp;gt;Label identifier&amp;lt;br&amp;gt;If this is not &amp;quot; LBL&amp;quot;, the game will not recognize the following data as label data and read the next 4 bytes.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x4&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;Number of sub-strings&#039;&#039;&#039;&amp;lt;br&amp;gt;This is the number of sub-strings.Usual value is 1&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x8&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;LabelNameLength&#039;&#039;&#039;&amp;lt;br&amp;gt;This value holds the size of the label name that follows.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0xC&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|char[LabelNameLength]&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;LabelName&#039;&#039;&#039;&amp;lt;br&amp;gt;A &#039;&#039;&#039;non&#039;&#039;&#039;-zero-terminated string that is as long as the DWORD at 0x8 says. If it is longer, the rest will be cut off.&lt;br /&gt;
|}&lt;br /&gt;
The first label in ra2md.csf can be found at 0x18.&amp;lt;br&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; Spaces, tabs and line breaks will be formatted out of the label&#039;s name, therefore they cannot be used.&lt;br /&gt;
&lt;br /&gt;
===Values===&lt;br /&gt;
Directly after the label header, the value data follows.&amp;lt;br&amp;gt;&lt;br /&gt;
This is how it is built up:&lt;br /&gt;
{| cellspacing=&amp;quot;2&amp;quot; cellpadding=&amp;quot;4&amp;quot; style=&amp;quot;border-collapse: collapse; border: 1px solid #000000;background:#F0F0F0;&amp;quot;&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Offset&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Type&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x0&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|char[4]&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;&amp;quot; RTS&#039;&#039;&#039; or &#039;&#039;&#039;&amp;quot;WRTS&amp;quot;&#039;&#039;&#039;&amp;lt;br&amp;gt;Identifier&amp;lt;br&amp;gt;&amp;quot; RTS&amp;quot; means that there is &#039;&#039;&#039;no&#039;&#039;&#039; extra value for this label.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;WRTS&amp;quot; means that after the value data, data for the extra value follows (see below).&amp;lt;br&amp;gt;&lt;br /&gt;
Everything else is invalid.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x4&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;ValueLength&#039;&#039;&#039;&amp;lt;br&amp;gt;This holds the length of the Unicode string (the value) that follows.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x8&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|byte[ValueLength*2]&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;Value&#039;&#039;&#039;&amp;lt;br&amp;gt;This holds the &#039;&#039;&#039;encoded&#039;&#039;&#039; value of the label.&amp;lt;br&amp;gt;Note that this is ValueLength*2 bytes long, because the value is a Unicode string, i.e. every character is a word instead of a byte.&amp;lt;br&amp;gt;&lt;br /&gt;
To decode the value to a Unicode string, &#039;&#039;&#039;not&#039;&#039;&#039; every byte of the value data (or substract it from 0xFF, see below for an example).&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x8+ValueLength*2&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|DWORD&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;ExtraValueLength&#039;&#039;&#039;&amp;lt;br&amp;gt;This holds the length of the extra value string that follow.&amp;lt;br&amp;gt;&lt;br /&gt;
This only applies if the identifier is &amp;quot;WRTS&amp;quot; and not &amp;quot; RTS&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
!bgcolor=&amp;quot;#e5e5e5&amp;quot; style=&amp;quot;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-top: 1px solid #000000;&amp;quot;|0x8+ValueLength*2+0x4&lt;br /&gt;
|style=&amp;quot;border-left: 1px solid #aaaaaa;border-right: 1px solid #aaaaaa;border-top: 1px solid #aaaaaa;&amp;quot;|char[ExtraValueLength]&lt;br /&gt;
|style=&amp;quot;border: 1px solid #aaaaaa;&amp;quot;|&lt;br /&gt;
&#039;&#039;&#039;ExtraValue&#039;&#039;&#039;&amp;lt;br&amp;gt;Like the label name, a non-zero-terminated string that is as long as ExtraValueLength says. If it is longer, the rest will be cut off.&lt;br /&gt;
|}&lt;br /&gt;
====Decoding the value====&lt;br /&gt;
To decode the value to a Unicode string, &#039;&#039;&#039;not&#039;&#039;&#039; every byte of the value data (or substract it from 0xFF).&amp;lt;br&amp;gt;&lt;br /&gt;
An example in C++:&lt;br /&gt;
 int ValueDataLength = ValueLength &amp;lt;&amp;lt; 1&lt;br /&gt;
 for(int i = 0; i &amp;lt; ValueDataLen;i++)&lt;br /&gt;
 {&lt;br /&gt;
   ValueData[i]=~ValueData[i]&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>84.204.126.170</name></author>
	</entry>
</feed>