-
Notifications
You must be signed in to change notification settings - Fork 3
File Formats
This document explains how the file formats of Danmakufu works.
This is the general file that is used for configurations, player data and replays.
16 bytes: header (ASCII: "RecordBufferFile" without null terminator)
4 signed bytes: number of entries in this record
x bytes: contents of one to the count of "RecordBuffer" specific in the previous 4 bytes, the record buffers are sequential.
A single record information.
1 signed byte: type of record (see list of record types for more information)
4 signed bytes: length of the key
x bytes: string that contains the key (no null terminator, encoding is Shift_JIS), take the previous 4 bytes for the length
4 signed bytes: length of the content of the record
x bytes: content of the record, take the previous 4 bytes for the length
Name | Number | Description |
---|---|---|
No Entry | -2 | No content in this entry |
Unknown | -1 | The entry type is not known |
Boolean | 1 | The entry is a boolean (1 byte) |
Integer | 2 | The entry is a 32-bit signed integer |
Float | 3 | The entry is a 32-bit signed float |
Double | 4 | The entry is a 64-bit signed float |
StringA | 5 | The entry is a ANSI (encoding: Shift_JIS) string |
Record | 6 | The entry contains another RecordBuffer |
StringW | 7 | The entry is a Widechar (encoding: UTF-16) string |
This part details how Danmakufu internally performs type conversion.
The type of the entry is actually not checked for getting values with the exception of strings.
For example, if you store a "Float entry" and ask Danmakufu to read the entry as a boolean, it will perform an automatic conversion.
This part is done ONLY during reading of the RecordBuffer content after it was loaded in memory following the format specified before, therefore even if you try to read an integer from a boolean type, the game will not block any loading.
The following table details the type that the developer requests Danmakufu to convert the RecordBuffer to, while data refers to the raw data of the RecordBuffer stored.
Keep in mind that NONE of this functions will fail if the type differs or any error (such as reading trough a small buffer or conversion errors).
Type | Behavour |
---|---|
boolean | Read the first byte of the data, if it's value is greater than 1 then it's a true boolean, otherwise it's false |
integer | Read the first 4 bytes of the data |
float | Read the first 4 bytes of the data |
double | Read the first 8 bytes of the data |
StringA | If the entry type is StringA, then simply read it's content. If the entry type is StringW, then read the UTF-16 string and convert it to Shift_JIS. If the entry is of any other type then return an empty string |
Record | Attempt to read the RecordBuffer |
StringW | If the entry type if StringW, then simply read it's content. If the entry type is StringA, then read the Shift_JIS string and convert it to UTF-16. If the entry is of any other type then return an empty string |
This format contains Danmakufu virtual file information.
The file is composed of two sectors, the first one is the header, which might be compressed, that contains all the information of the files; the second, imeediatly after the header, contains the actual files. Each data is written sequentially, therefore after the header there must be one or more files.
The compression of the archive header is done with Zlib (inflate/deflate) method.
The decompression size is calculated by taking the compressed size and applying an extra chunk (1000 bytes).
11 bytes: header (ASCII: "ArchiveFile" without null terminator)
4 signed bytes: number of entries in this archive
1 signed byte: archive compression, if it's 1 or greater then the archive is compressed
4 signed bytes: size of the archive data (this is equal to the complete size of the archive entries compressed or uncompressed)
x bytes: one or more ArchiveFileEntry compressed
A single archive entry.
4 signed bytes: complete size of this ArchiveFileEntry (basically all the rest of things)
4 signed bytes: length of the string that specifies the directory (this is the length not the real size)
x bytes: directory where the file is virtually stored (encoding: UTF-16)
4 signed bytes: length of the name of the file (this is the length not the real size)
x bytes: name of the file
1 byte: type of compression
4 signed bytes: size of the data (raw/uncompressed)
4 signed bytes: size of the data compressed (if the data is uncompressed then this size is equal to the raw one)
4 signed bytes: position of where the file is physically stored in the file, the position is relative to the start of the entire file
Simple table to show the types of compression that a file can be.
Name | Value | Description |
---|---|---|
None | 0 | The content is not compressed |
Compressed | 1 | The content is compressed |
The configuration file is a RecordBuffer file that contains the fields shown in the table.
Keep in mind that all the records info might not be sequential or included, parse the file like explained before and then check the key/values.
Key Name | Record Type | Description | Optional | Default value |
---|---|---|---|---|
version | Integer | Has to be 1 | No | 1 |
modeScreen | Integer | If the window is fullscreen or not | No | 1 (Windowed) |
sizeWindow | Integer | Size ratio of the window | No | 0 (640x480) |
fpsType | Integer | Type of FPS speed | No | 0 (Normal) |
padIndex | Integer | ID of the associated game pad | Yes | 0 |
mapKey_size | Integer | Raw size of the mapKey data | No | See mapKey explanation for more information |
mapKey | Raw data | A record that contains all the informations about the remapped keys | No | See mapKey explanation for more information |
bLogWindow | Boolean | Enables or disables showing the log window | No | false |
bLogFile | Boolean | Enables or disables outputting logs to a file | No | false |
bMouseVisible | Boolean | Shows or hides the mouse during gameplay | Yes | true |
Name | Value | Description |
---|---|---|
Fullscreen | 0 | Run the game in fullscreen mode |
Window | 1 | Run the game as in windowed mode |
Danmakufu doesn't offer direct modifications of the window width or height trough config, therefore this rateos are used instead.
Name | Value | Width | Height |
---|---|---|---|
640x480 | 0 | 640 | 480 |
800x600 | 1 | 800 | 600 |
960x720 | 2 | 960 | 720 |
1280x960 | 3 | 1280 | 960 |
1600x1200 | 4 | 1600 | 1200 |
1920x1200 | 5 | 1920 | 1200 |
This value detactes the default speed of the game.
Name | Value | Description |
---|---|---|
Normal | 0 | Runs the game in normal speed |
1/2 | 1 | Runs the game at half the speed |
1/3 | 2 | Runs the game at one third of the speed |
Auto | 3 | Automatically select the speed |
The mapKey field contains a list of raw VirtualKey mapping that are inerated trough the number of map keys stored.
The Virtual keys mapping are sequential, meaning that after the first one there's immediatly another one.
4 signed bytes: number of virtual keys stored in this configuration, this number has to be equal to 12 or the virtual key mappings won't be loaded
TODO... write about this bla bla