Benvenuto Visitatore(Log In|Registrati)

> Dynamix Games project, Progress of a general Dynamix unpacker
Nyerguds
messaggio6 Aug 2017, 18:49
Messaggio #1



Gruppo icone

Gruppo: OldGamer
Messaggi: 332
Iscritto il: 27 June 14
Utente Nr.: 20.463
BGE Command & Conquer: Tiberian Dawn
SO Windows7




First of all, sorry about writing in English, but since you guys translate games that are usually in english I suppose most of you won't have much of a problem with this. I'm not going to insult your fine language by screwing over my post with machine translation, though ;)


As some of you may know, I have made tools to support the graphical formats of the Dynamix games. Specifically, I have an editor that can read a load of different Dynamix font types (8 so far I think), and a converter for the SCR images.

When making these, I have made some toolsets in my programs to automate reading and writing the chunks that the Dynamix formats use, and I used the code from an audio extractor for the Dynamix games to support decompressing the data in there.

Since TheRuler asked me about helping him with decompressing text sections in these files, and I just figured out there is a specific indication of which chunks are containers for more chunks inside them, I have started documenting all of the internal chunk hierarchies of the Dynamix games. The plan is to create a full chunk explorer from this, where you can open a file and see all chunks as a tree view, view detailed information on the contents of the data chunks inside it, and can extract, replace and change the compression type on the data inside these chunks (though compression to LZA is not supported at the moment).

I'm not sure such a tool will be usable across all games, though. I can identify the different font types from specific header bytes, but with the general system I'm using it might not be possible to do more complex detections than valid ranges for header bytes.

Note that this is probably going to be a large project; it'll take me weeks, if not months, to finish. But hopefully it'll help us get full access to the internals of all games that use the Dynamix chunk-based formats.

This is all the chunk information I already have. This is mostly just from browsing through the Stellar 2 files. If you know any more chunk specifics, please let me know. This file will be available in the final editor's program folder, so people can freely experiment with adding more supported chunk types.

CODICE
; Dynamix known chunks hierarchy definition

; Not all main chunks are necessarily container chunks. Fonts aren't, for example.
; Chunks that only appear as sub-types do not need to be referenced here.
; If multiple chunk definitions with the same chunk ID are present, the correct type will be detected
; based on the range checks in the header byte definitions.
; Index numbers in this section need to be consecutive. Reading will end when a next number is not found.

[MainChunks]
0=Palette
1=Screen
2=Frames
3=FontV6
4=FontV5
5=FontV4
6=FontV23
7=Text
8=Sound
9=Table
10=VersionInfo
11=ScenePage
12=SceneTT3
13=SceneTTI
14=Overlay
15=Array


; -----------------
; Chunk entries
; -----------------

; Syntax:
; [Name]
; ChunkId=3-letter chunk ID. Will be followed by ":" and the chunk size.
; Children=Names of chunks that can be contained in this one. These are not IDs but header names in this file.
;   If "Children" has values, this is seen as a Container chunk.
;   Container chunks do not support headers or compressed data; they just contain more chunks.
; Header#= Header definition. These can be displayed on the UI.
;   Syntax: Repeat,Type,Minimum,Maximum,Name
;   -Repeat: Amount of times this is repeated. Can reference other header values with format "H#".
;      Header entries with a repetition of more than 1 will not be usable as such "H#" references, though.
;   -Type: Data type. Choose from Byte,Int16,Int32,ColorVga,ColorEga,String
;      String reads on to the next 00, or the end of the chunk
;      ColorVga is 3-byte 6-bit colour. I haven't figured out ColorEga yet; it seems to be 2 bytes per color.
;   -Minimum: Can be left empty. Not applicable to colors or strings.
;   -Maximum: Can be left empty. Not applicable to colors or strings. Can reference other header values with format "H#".
;      Supports special value "CS" for "chunk size". If the data is an index starting from a specific point in
;      the chunk, this can be adjusted as "CS-16", or even "CS-H2" to refer to an already-read header value.
; CompressionOffset=Location in the chunk where the 5-byte compression header starts
;   Can probably just be derived from the header, so this might just change to a boolean, especially if
;   I manage to implement the more complex header reading with repetition based on other header values.

; -----------------
; Main entries
; -----------------

; Color palette
[Palette]
ChunkId=PAL
Children=VgaPalette,EgaPalette,CgaPalette

; Full-screen image. Has an image dimensions chunk in later games to specify a size greater than 320x200.
[Screen]
ChunkId=SCR
Children=ImageDimensions,BinImage,VgaImage,VqtImage

; Animations with multiple frames
[Frames]
ChunkId=BMP
Children=BmpInfo,BinImage,VgaImage,VqtImage

; Font v2 and v3.
[FontV23]
ChunkId=FNT
Header1=1,Byte,1,127,Font width
Header2=1,Byte,1,127,Font height
Header3=1,Byte,,,Start symbol
Header4=1,Byte,1,,Number of symbols

; Font v4
[FontV4]
ChunkId=FNT
Header1=1,Byte,255,255,v4 ID byte
Header2=1,Byte,1,127,Font width
Header3=1,Byte,1,127,Font height
Header4=1,Byte,,127,Line height
Header5=1,Byte,,,Start symbol
Header6=1,Byte,1,,Number of symbols
Header7=1,Int16,0,,Symbol data size
CompressionOffset=8

; Font v5
[FontV5]
ChunkId=FNT
Header1=1,Byte,253,253,v5 ID byte
Header2=1,Byte,1,127,Font width
Header3=1,Byte,1,127,Font height
Header4=1,Byte,,127,Line height
Header5=1,Byte,,,Start symbol
Header6=1,Byte,1,,Number of symbols
Header7=1,Int16,0,,Symbol data size
CompressionOffset=8

; Font v6
[FontV6]
ChunkId=FNT
Header1=1,Int32,0,CS,Font data index start offset
Header2=1,Int32,0,CS,Symbol widths index start offset
Header3=1,Int32,0,CS,Symbol data start offset
Header4=1,Byte,,,Unknown
Header5=1,Byte,,,Line height
Header6=1,Byte,,,Start symbol
Header7=1,Byte,1,,Number of symbols
Header8=1,Byte,1,127,Font width
Header9=1,Byte,1,127,Font height
Header10=H7,Int16,0,CS-H3,Symbol data offset
Header11=H7,Byte,0,H8,Font symbol width
CompressionOffset=-1

[Text]
ChunkId=TXT
CompressionOffset=0

[Sound]
ChunkId=SSM
Children=SoundSng,SoundStd,SoundTan,SoundM32,SoundAdl,SoundSbp,Sound001,Sound003

[Table]
ChunkId=TBL
CompressionOffset=0

; Part of the scene files.
[VersionInfo]
ChunkId=VER
Header1=1,String,,,Version

; Part of the scene files.
[ScenePage]
ChunkId=PAG
Header1=1,Int16,0,,Page number?

; Part of the scene files.
[SceneTT3]
ChunkId=TT3
CompressionOffset=0

; Part of the scene files. TAG seems to contain numbered strings.
[SceneTTI]
ChunkId=TTI
Children=TTITag

; Not sure what this is, but it's another image type.
[Overlay]
ChunkId=OVL
Children=VgaImage,EgaImage,McgImage,CgaImage,TanImage

; Array of 256 items. Looks like it could be palette remap or something like that.
[Array]
ChunkId=ARR
CompressionOffset=-1

; -----------------
; Sub-entries
; -----------------

[VgaPalette]
ChunkId=PAL
CompressionOffset=-1
; not sure if I'll bother implementing colors. Could complicate UI displaying. Though I can just show them as hex triplets I guess.
; Header1=256,ColorVga,,,Color

[EgaPalette]
ChunkId=EGA
CompressionOffset=-1
; ColorEga seems to be 2 bytes. Not sure how that translates to bits... the palettes I found seem to just contain 64 blocks of 4 identical repeated nybbles...
; Header1=64,ColorEga,,,Color

[CgaPalette]
ChunkId=CGA
CompressionOffset=-1
; Header1=1,Int16,,,Unknown (always 1?)
; Seems to be the same colour format as the EGA one, but the chunk is aligned to 1024 bytes for some reason.
; Header2=64,ColorEga,,,Color

[ImageDimensions]
ChunkId=DIM
Header1=1,Int16,0,,Width
Header1=1,Int16,0,,Height
CompressionOffset=-1

[BinImage]
ChunkId=BIN
CompressionOffset=0

[VgaImage]
ChunkId=VGA
CompressionOffset=0

[EgaImage]
ChunkId=EGA
CompressionOffset=0

[McgImage]
ChunkId=MCG
CompressionOffset=0

[CgaImage]
ChunkId=CGA
CompressionOffset=0

[TanImage]
ChunkId=TAN
CompressionOffset=0

[BmpInfo]
ChunkId=DIM
CompressionOffset=-1
Header1=1,Int16,0,,Frames
;Not sure if I can actually implement references to other types... maybe if I save them all as Int64 internally.
;Header2=H1,Int16,Width
;Header3=H1,Int16,Height

[VqtImage]
ChunkId=VQT
CompressionOffset=-1

[SoundSng]
ChunkId=SNG
CompressionOffset=0

[SoundStd]
ChunkId=STD
CompressionOffset=0

[SoundTan]
ChunkId=TAN
CompressionOffset=0

[SoundM32]
ChunkId=M32
CompressionOffset=0

[SoundAdl]
ChunkId=ADL
CompressionOffset=0

[SoundSbp]
ChunkId=SBP
CompressionOffset=0

[Sound001]
ChunkId=001
CompressionOffset=0

[Sound003]
ChunkId=003
CompressionOffset=0

[TTITag]
ChunkId=TAG
Header1=1,Int16,0,,Amount of strings
CompressionOffset=-1


As you see, the sub-chunks of some types (like palettes and images) have the same chunk IDs but different functions, so that's why I gave them all a unique name. The main thing that interests me about the chunks is whether they can be unpacked, and where the compressed information starts. As you see, palettes do not support compression, while image chunks with the same IDs (like "VGA") do.


It might take me some time to get started on this; I got a lot going on these days. But I'll keep you guys updated blush.gif

Messaggio modificato da Nyerguds il 7 Aug 2017, 15:09


--------------------
Expert on all things Command & Conquer 1. Creator of a bunch of small modding tools.
 

Inserisci in questo messaggio
- Nyerguds   Dynamix Games project   6 Aug 2017, 18:49
- - TheRuler   Thanks for sharing Maarten and thanks for all the ...   6 Aug 2017, 19:47
- - Micartu   Thank you for your help. Here we have a lot of tra...   6 Aug 2017, 19:54
- - Jman   Hi Nyerguds, I've combed the interwebz for d...   6 Aug 2017, 22:59
- - Nyerguds   CITAZIONE (TheRuler @ 6 Aug 2017, 20:47) ...   6 Aug 2017, 23:50
- - The Ancient One   What about Betrayal at Krondor?   7 Aug 2017, 08:58
|- - TheRuler   CITAZIONE (The Ancient One @ 7 Aug 2017, 09...   7 Aug 2017, 09:31
- - Micartu   Io ho la copia GOG se volete qualche info a scopo ...   7 Aug 2017, 09:47
- - TheRuler   Ho estratto il testo e sarebbero 1.3MB da tradurre...   7 Aug 2017, 09:54
|- - The Ancient One   CITAZIONE (TheRuler @ 7 Aug 2017, 10:54) ...   7 Aug 2017, 20:59
|- - Gae.brush   CITAZIONE (The Ancient One @ 7 Aug 2017, 20...   6 Feb 2026, 17:03
- - Nyerguds   Well, I already made a (really) simple command lin...   7 Aug 2017, 10:16
|- - TheRuler   CITAZIONE (Nyerguds @ 7 Aug 2017, 11:16) ...   7 Aug 2017, 10:34
- - TheRuler   The DDX of "BaK" are similar to the othe...   7 Aug 2017, 13:42
- - Nyerguds   It'll be hard to support different chunk forma...   7 Aug 2017, 13:56
|- - TheRuler   CITAZIONE (Nyerguds @ 7 Aug 2017, 14:56) ...   7 Aug 2017, 19:14
- - Nyerguds   Ah, you don't get it... the way this editor is...   7 Aug 2017, 20:11
- - TheRuler   Got it. No use of what I discovered for your tool,...   7 Aug 2017, 21:05
- - Nyerguds   Ah, it's okay. It's nice to have a thread ...   7 Aug 2017, 22:12
- - Nyerguds   Status update: Changing compression on chunks wor...   8 Aug 2017, 10:43


Reply to this topicStart new topic
1 utenti stanno leggendo questa discussione (1 visitatori e 0 utenti anonimi)
0 utenti:

 

Modalità di visualizzazione: Passa a: Normale · Passa a: Lineare · Outline


Versione Lo-Fi Oggi è il: 17th November 2026 - 05:36