Einzelnen Beitrag anzeigen

Benutzerbild von TKC
TKC

Registriert seit: 21. Apr 2004
Ort: Tuningen
367 Beiträge
 
Delphi XE2 Enterprise
 
#1

wie am besten Strukturierte Datei lesen (Warhammer Replay)

  Alt 5. Dez 2005, 19:34
Hallo,

ich möchte einen kleinen Replay Manager für Warhammer programmieren.

Die Replay Dateien sind im Relic Chunky Format gespeichert.
Ich brauche nur ein paar bestimmte Werte aus diesen Dateien, z.B. Name des Replays ... usw.

Leider habe ich noch keinen Ansatz wie ich da vorgehen soll, TFileStream scheint da wohl ganz geeignet zu sein.
Villeicht kann mir da jemand nen Tipp geben wie ich da ansetzen muss.

Ein paar infos über den Aufbau der Datei habe ich bereits im Internet gefunden:
Code:
@Pos: 0
[WORD] // Replay Version 1 < Patch 1.3 with Patch 1.3 it got 2
@Pos: 166
[KEYWORD](DATASDSC) // START OF NEW CHUNK
[WORD] // Chunk version (?) always 1 so far
[WORD] // Chunk data size
[WORD] // A variable string length
[WORD] // (?)
[WORD] // Number of teams (?)
[WORD] // Number of active players (without spectators)
[WORD] // Map Size
[WORD] // String length
[WORD] // Game/engine name
[WORD]->%length% // length of additional header infos
[UNICODETEXT] // Double-byte engine version string (%length%*2)
[WORD]->%length% // lenth of map Name
[TEXT] // Map name (%length%)
[WORD] // (?)
[WORD] // (?)
[WORD] // (?)
[WORD] // (?)

{REP VERSION 1}
[WORD] // (?)
[BYTE] // (?)
[KEYWORD](FOLDMODI) // START OF NEW CHUNK
[WORD] // Chunk version (?) always 1 so far
[WORD] // (?)
[WORD] // (?)
[KEYWORD](DATADMOD) // START OF NEW CHUNK
[WORD] // Chunk version (?) always 4 so far
[WORD]->%length% // Chunk data size
[TEXT] // (?) (%length%)
[KEYWORD](DATABASE) // START OF NEW CHUNK
[WORD] // Chunk version (?) always 4 so far
[WORD] // Chunk data size
{END VERSION 1}

{REP VERSION 2}
[KEYWORD](DATABASE) // START OF NEW CHUNK
[WORD] // Chunk version (?) always 4 so far
[WORD] // Chunk data size
{END VERSION 2}

[WORD] // Always 0 so far
[WORD] // Always 3 so far
[WORD] // Avavible Slots (after Patch 1.3 always 8 cause spec slots)
[WORD] // (?)
[WORD] // Always 8 so far
[WORD] // (?)

{8 Keytext with 1byte value - not sorted!}
[WORD] FDIA //= AIDF (AI Difficulty) - It took me a while to figure these out...backwards-endian
[WORD] // 1. Byte is the value
[WORD] TSSR //= RSST (Starting Resources)
[WORD] // 1. Byte is the value
[WORD] MTKL //= LKTM (Lock Teams)
[WORD] // 1. Byte is the value
[WORD] AEHC //= CHEA (Cheats Enabled)
[WORD] // 1. Byte is the value
[WORD] COLS //= SLOC (Starting Location)
[WORD] // 1. Byte is the value
[WORD] DPSG //= GSPD (Game Speed)
[WORD] // 1. Byte is the value
[WORD] HSSR //= RSSH (Resource Sharing)
[WORD] // 1. Byte is the value
[WORD] TRSR //= RSRT (Resource Rate)
[BYTE] // The Byte is the value

[WORD]->%length% // length of ingame Name
[UNICODETEXT] // Double-byte game name (%length% * 2)
[WORD] // End of Gamename Always 0 so far
[WORD]->%length% // This is the number of Win conditions that are set. Each one is a constant DWORD that follows.

{%length% win conditions}
[WORD] // Win conditon
-157708158 Annihilate
-1826760460 SuddenDeath
-1158102879 Assassinate
-779857721 EconomicVictory
735076042 ControlArea
863969525 DestroyHQ
1959084950 TakeandHolde
{END Win Conditions}

{Now for any Slot There come Player data
[KEYWORD](FOLDGPLY) // START OF NEW CHUNK - GPLY = Game Player? There is one of these chunks for each player.
[WORD] 2 // Chunk version (?) Always 2 so far
[WORD] 41330 // Chunk data size
[WORD] 0 // A variable string length Always 0 so far
[KEYWORD](DATAINFO) // START OF NEW CHUNK
[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 54 // Chunk data size
[WORD] 0 // A variable string length Always 0 so far
[WORD]->%length% // length of Plyer Name
[UNICODETEXT] // Double-byte player name (%length% * 2)
[WORD] // Type of Slot (0 Host/2 player/4 specc/7 empty/11 computer)
[WORD] // Team of the Player (counter starts with 0)
[WORD]->%length% // lengt of race string
[TEXT] // Race Name (%length%)
[WORD] // (?) Always 0 so far

[KEYWORD](FOLDTCUC) // START OF NEW CHUNK - TCUC = Team Colors, something, something?
{Also Possible: FOLDGPLY -> New Player beginns (happens with spec slots)}

[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 84 // Chunk data size
[WORD] 0 // A variable string length Always 0 so far
[KEYWORD](DATALCIN) // START OF NEW CHUNK - LCIN = Local?? NOTE: This section differs for the replay's "local" player
[WORD] 1 // Chunk version (?) Always 1 so far
[WORD]->%length% 12 // Chunk data size
[TEXT] // (?) (%length%)
[WORD] // (?) Always 0 so far
[KEYWORD](DATAUNCU) // START OF NEW CHUNK - UNCU = ????
[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 32 // Chunk data size
[WORD] 0 // A variable string length Always 0 so far
[WORD]->%length% // length of ColorScheme
[UNICODETEXT] // Double-byte scheme name (%length% * 2)
[WORD] // Primary NOTE: Colors are BGRA (blue, green, red, alpha)
[WORD] // Secondary
[WORD] // Trim
[WORD] // Weapons
[WORD] // Eyes

[KEYWORD](FOLDTCBD) // START OF NEW CHUNK - TCBD = Team color Badge?
{Also Possible: FOLDGPLY -> New Player beginns (happens sometimes...)}
{Another keyword FOLDTCBD -> Badge/Banner sometimes change their position in the Replay}
{If none of this Keywords is matchetd it seams like an broken header.. So ignore the 8byte keyword and go on with action data}

[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 16460 // Chunk data size - A bigish chunk...hence the transferring badges lag
[WORD] 0 // A variable string length
[KEYWORD](FOLDIMAG) // START OF NEW CHUNK - IMAG = Image (badge in this case)
[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 16460 // Chunk data size
[WORD]->%length% // A variable string length
{IF %length% GT 0 then the Badge has a special Name}
[TEXT] // Name of the Badge (%length%)
{END}
[KEYWORD](DATAATTR) // START OF NEW CHUNK - ATTR = Image attribute(s)?
[WORD] 2 // Chunk version (?) Always 2 so far
[WORD] 16 // Chunk data size
[WORD] 0 // (?)
[WORD] 0 // (?)
[WORD] 64 // Image WIDTH
[WORD] 64 ´ // Image HEIGHT
[WORD] 1 // (?) Always 1 so far
[KEYWORD](DATADATA) // START OF NEW CHUNK - DATA = Image data?
[WORD] 2 // Chunk version (?) Always 2 so far
[WORD] 16 // Chunk data size
[WORD] 0 // (?)

{Now comes the image data. Pixel by pixel form heigth to width in RGBA colors - you also have to mirror the picture}


[KEYWORD](FOLDTCBN) // START OF NEW CHUNK - TCBN = Team color Banner?
[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 24652 // Chunk data size
[WORD] 0 // (?)
[KEYWORD](FOLDIMAG ) // START OF NEW CHUNK - IMAG = Image (banner in this case)
[WORD] 1 // Chunk version (?) Always 1 so far
[WORD] 1152 // Chunk data size
[WORD] 0 // (?)
[KEYWORD](DATAATTR) // START OF NEW CHUNK - ATTR = Image attribute(s)?
[WORD] 2 // Chunk version (?) Always 2 so far
[Word] 16 // Chunk data size
[WORD] 0 // (?)
[WORD] 0 // (?)
[WORD] 64 // Image WIDTH
[WORD] 96 ´ // Image HEIGHT
[WORD] 1 // (?) Always 1 so far
[KEYWORD](DATADATA) // START OF NEW CHUNK - DATA = Image data?
[WORD] 2 // Chunk version (?) Always 2 so far
[WORD] 1536 // Chunk data size
[WORD] 0 // (?)

{Now comes the image data. Pixel by pixel form heigth to width in RGBA colors - you also have to turn the picture}

{End of Player Data}

{Now The acion Data starts.. DoW is working with 8Ticks per second}
[WORD] // Action Key - Action Key 1 identefies an Chat msg so far
[WORD] // Action Length
{IF second action key is 1}
[WORD] // Action Key
{IF this action key is also 1 its an chat msg}
[WORD] // Length of Chat chunk
[BYTE] // Also length of Chat chunk so far
{IF REP Version 1}
[BYTE] // Player ID (As same orders as they are listed bevore)
[BYTE] // Reciver 0 All/1 Team/2 System
[BYTE] // (?)
{IF Rep Version 2}
[WORD]->%len% // Length of Player Name
[UNICODETEXT] // Double-byte player name (%len% * 2)
[WORD] // Player ID > 1000 are normal players blow the IDs of the Spectators
[WORD] // Msg Type 0 Player/1 Spec/2 System
[WORD] // Reciver 0 All/1 Team/2 System
{End of Version spec Data}
[WORD]->%len% // Length of Chat MSG
[UNICODETEXT] // Double-byte chat msg (%len% * 2)
{If second Action Key is not 1}
[WORD]->%length% // length of action
[BYTE] // (?)
[TEXT] // (?) (%length%)
{If action key is 0}
[BYTE]
{IF REP version 2}
[BYTE] // Indicatios if the action block has action (1) or not (0)
{END Version depanding handling}
[WORD] // Number of this tick (8 per second!)
Als Anlage habe ich noch ein Replay angehängt.

Ich freue mich schon auf eure Anregungen.
Angehängte Dateien
Dateityp: rar 6p_kasyr_lutien.2005-12-01.22-17-57_141.rar (67,2 KB, 5x aufgerufen)
  Mit Zitat antworten Zitat