TSCB
Terrain scene binary (TSCB) files describe terrain areas layout and terrain materials.
TSCB File Specification
Header
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | String | TSCB file signature (magic) 54 53 43 42 or "TSCB"
|
0x04
|
4 | Unsigned Int | TSCB version? 0A 00 00 00 or "10.0.0.0"[1][2]
|
0x08
|
4 | Unsigned Int | Unknown. Always 00 00 00 01 . Game crashes on load screen if not equal to 00 00 00 01 .
|
0x0c
|
4 | Unsigned Int | file_base table relative offset
|
0x10
|
4 | Float | world_scale 500.0 . Scales the terrain along the x- and z-axis.
|
0x14
|
4 | Float | Terrain mesh max height 800.0 . Used to calculate the actual vertex height with hght data.
|
0x18
|
4 | Unsigned Int | material_info_array length (number of elements in the array)
|
0x1c
|
4 | Unsigned Int | area_array length (number of elements in the array)
|
0x20
|
4 | Unsigned Int | Probably padding |
0x24
|
4 | Unsigned Int | Probably padding |
0x28
|
4 | Float | tile_size . Used by the area array.
|
0x2c
|
4 | Unsigned Int | Unknown 00 00 00 08 . [3]
|
Material Information Array
The material information array references texture data contained in content/Model/Terrain.Tex1.sbfres
.
Header
The material information header is one value, the section size. This includes the index table and the value table.
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Material info section size in bytes |
Material Information Array Lookup Table
Following the header is a table of relative offsets to each entry in material_info_array
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Offset to array entry, relative to the first byte of this offset |
Material Information Value Table
Each entry in the array contains an index and four attributes
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Array index (mat_index ) of material_info_array
|
0x04
|
4 | Float | Texture u-axis (x-axis) |
0x08
|
4 | Float | Texture v-axis (y-axis) |
0x0c
|
4 | Float | Unknown. values range from 0-1. |
0x10
|
4 | Float | Unknown. values range from 0.2-1.63 |
Area Array
Area Array Lookup Table
Following the material information section is a table of relative offsets to each entry in area_array
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Offset to array entry, relative to the first byte of this offset |
Area Array Value Table
Each entry contains meta data for one tile in the terrain scene. There are multiple levels of detail (lod) for the terrain.
Entry size ranges from 0x30
to 0x58
depending on the size of extra_info_array
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Float | X Position |
0x04
|
4 | Float | Z Position |
0x08
|
4 | Float | area_size (length and width)
|
0x0c
|
4 | Float | Unknown - Affects grass density.[4] |
0x10
|
4 | Float | Unknown |
0x14
|
4 | Float | Unknown |
0x18
|
4 | Float | Unknown |
0x1c
|
4 | Unsigned Int | Unknown. Usually 0 , 1 or 2 , crashes on 4 , 16 .[5]
|
0x20
|
4 | Unsigned Int | file_base . Relative offset to file base name string.
|
0x24
|
4 | Unsigned Int | Unknown. Usually 0 .
|
0x28
|
4 | Unsigned Int | Unknown. Usually 0 .
|
0x2c
|
4 | Unsigned Int | ref_extra . It seems to be a flag to indicate if there is an attached extra_info_array
|
Parameters
x
- Area tile x coordinate (East-West)
z
- Area tile z coordinate (North-South)
area_size
- Determines the length and width of the area. It can be calculated with:
(area_size / tile_size * world_scale) * 20
tile_size
and world_scale
are in the header.
Extra Information Array
if ref_extra
does not equal 0
there is an extra_info_array
attached to this area. The array is 4 or 8 values long.
Every area includes a .hght and .mate file. The extra_info_array
indicates if there is an additional .water.extm and / or .grass.extm file
Header
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | extra_info_array length. Number of values (not elements) in array. |
(0x04)
|
4 | Unsigned Int | Unknown. Always 20, but only present when extra_info_array length is 8. |
Extra Information Array Value Table
After the Header, there is either 1 (extra_info_array length 4) or 2 (extra_info_array length 8) elements of this structure.
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Int | Unknown. Always 3. |
0x04 | 4 | Unsigned Int | Unknown. 0 or 1. |
0x08 | 4 | Unsigned Int | Unknown. Always 1. |
0x0c | 4 | Unsigned Int | Unknown. Always 0. |
[3, 0, 1, 0, 3, 1, 1, 0] = grass, water [3, 1, 1, 0, 3, 0, 1, 0] = water, grass [3, 1, 1, 0] = water [3, 0, 1, 0] = grass
It seems that water is [3, 1, 1]
and grass is [3, 0, 1]
stera
File Positions
stera
files referenced in the area array are positioned using a z-order curve or the Moser-de Bruijn sequence.
- ↑ U-King.elf:0x024D2F8C-0x024D300A holds two error messages: "【データロード】メジャーバージョンの不一致" ("[Data load] Major version mismatch") and "【データロード】マイナーバージョンの不一致" ("[Data Load] Minor version mismatch")
- ↑ Game crashes on load screen if not equal to
0A 00 00 00
- ↑ Values
1
,2
,4
,5
,6
,8
,9
,10
,13
,14
affects textures.0
,3
,7
,11
,12
,15
,16
will crash the game. - ↑ 0 may be default. Higher numbers have increased density.
- ↑ May be a flag for grass and water?
0
seems to indicate no water or grass.