Defining Pre-2K-Limit Cards.dat
A few months ago (before Manalink 3.0) I disassembled the Cards.dat file to try and identify the location of all the values in the Manalink.csv, with the goal of defining the Cards.dat file and building a DAT2CSV converter.
I've cleaned up my chart so that hopefully others can read it:
If anyone could fill in those two blanks (where is the CodedStatus and what are the unidentified ~250 bytes before the StartOfNewData),Thanx snako! Now maybe I can remove dependency on the Manalink.csv from the PlayDeck Analyser and finish that DAT2CSV converter.
I removed dependency on the Manalink.csv from the PlayDeck Analyser and finished that DATtoCSV converter.
Edit -
Chart updated to reflect more complete\correct information.
Edit2 -
Updated chart with the final version I used to write the DAT converter.
I've cleaned up my chart so that hopefully others can read it:
- Code: Select all
StartOfCards.dat v3.x
---------------------
This chart was constructed by comparing the Manalink.csv and Cards.dat
from the earliest update from which I had both files (20090427).
The Cards.dat file and this chart are little-endian.
All but the BitFields are broken into 4-byte words.
HeaderSize = 8 bytes
DataFieldSize = 152 bytes
NewDataFieldSize = 20 bytes
StartOfHeader
-------------
byte 00 = Number of DataFields
byte 04 = Size of StringData
-----------
EndOfHeader
StartOfDataFields
-----------------
byte 00 = CardID
byte 04 = Offset for FullCardName
byte 08 = Offset for ShortCardName
byte 12 = Expansion
byte 16 = CardColor
byte 20 = CardType
byte 24 = SubType : SubType2
byte 28 = Offset for CardType
byte 32 = DB Card Type 2
byte 36 = Rarity
byte 40 = Req.Mana, Colorless : Black : Blue : Empty
byte 44 = Req.Mana, Empty : Green : Empty : Red
byte 48 = Req.Mana, White : Empty : Empty : Empty
byte 52 = Mod Dummy 1
byte 56 = Mod Dummy 2
byte 60 = Mod Dummy 3
byte 64 = Mod Dummy 4
byte 68 = Num Pics
byte 72 = Empty
Start of BitField
-----------------
byte # bit#
byte 76 = 0-2 = Mod Combat Manipulator
3-5 = Mod Control
byte = 6-0 = Mod Counter Spell
77 = 1-3 = Mod Recycler
4-6 = Mod Damage Prevention
byte = 7-1 = Mod Gain Life
78 = 2-4 = Mod Discard
5-7 = Mod Draw Cards
byte 79 = 0-2 = Mod Land Destructor
3-5 = Mod Direct Fire
byte 80 = - = Empty
byte 81 = 4-6 = Mod Library Manipulation
byte = 7-1 = Mod Damage Opponent
82 = 2-4 = Mod Creature Generator
5-7 = Mod Creature
byte 83 = 0-2 = Mod Artifacts
3-5 = Mod Enchantments
byte 84 = 0-7 = AI Inc Power
byte 85 = 0-7 = AI Inc Toughness
byte 86 = 0-7 = AI Power
byte 87 = 0-7 = AI Toughness
byte 88 = 0-7 = AI Base Value
byte 89 = - = Empty
byte 90 = 0-2 = Dependent Wall
3-5 = Dependent Creature
byte = 6-0 = Dependent Artifact
91 = - = Empty
byte 92 = 0-7 = Sleighted Color
byte 93 = - = Empty
byte 94 = - = Empty
byte 95 = - = Empty
byte 96 = 2 = VS White
4 = VS Red
6 = VS Green
byte 97 = 0 = VS Blue
2 = VS Black
byte 98 = 2 = For White
4 = For Red
6 = For Green
byte 99 = 0 = For Blue
2 = For Black
byte100 = 2 = Count as White
4 = Count as Red
6 = Count as Green
byte101 = 0 = Count as Blue
2 = Count as Black
byte102 = 2 = VS White Land
4 = VS Red Land
6 = VS Green Land
byte103 = 0 = VS Blue Land
2 = VS Black Land
byte104 = 2 = For White Land
4 = For Red Land
6 = For Green Land
byte105 = 0 = For Blue Land
2 = For Black Land
byte106 = 2 = Count as White Land
4 = Count as Red Land
6 = Count as Green Land
byte107 = 0 = Count as Blue Land
2 = Count as Black Land
byte108 = 0-2 = AI Landhome
3-5 = AI Wall
byte = 6-0 = AI First Strike
109 = 1-3 = AI Trample
4-6 = AI Banding
byte = 7-1 = AI Flying
110 = - = Empty
byte111 = - = Empty
byte112 = 0-3 = Exp Rarity - Revised
4-7 = Exp Rarity - 4th Edition
byte113 = 0-3 = Exp Rarity - 5th Edition
4-7 = Exp Rarity - Chronicles
byte114 = 0-3 = Exp Rarity - 8th Edition
byte115 = Empty
---------------
End of BitField
byte116 = Offset for CardRulesText
byte120 = Offset for CardFlavorText
byte124 = Power
byte128 = Toughness
byte132 = Num of BDA
byte136 = DBA 1-4
byte140 = DBA 5-8
byte144 = Empty : Empty : Mana Source Colors : Inflatable
byte148 = Hack Color : Empty : EnchantTypeOPP + EnchantTypeOWN : Hack Mode
---------------
EndOfDataFields
StartOfTextFields
-----------------
TextFields start at HeaderSize + (DataFieldSize * NumOfDataFields)
TextFields use a NULL as an EndOfField character
Each card has 10 TextFields in the v3.x Cards.dat:
FullName
Name
Type Text
Rules Text
Flavor Text
Damage Text
Effect Title Text
Effect Text
Legacy Title Text
Legacy Text
---------------
EndOfTextFields
StartOfCodedBitField
--------------------
4 byte value for Size of Coded BitField is at HeaderSize +
(DataFieldSize * NumOfDataFields) + Size of StringData
byte 00 = Size of Coded BitField
The Coded BitField immediately follows the Size of Coded BitField value
------------------
EndOfCodedBitField
StartOfNewDataFields
--------------------
NewDataFields start at HeaderSize + (DataFieldSize * NumOfDataFields)
+ Size of StringData + Size of Coded BitField + 4
byte 00 = Offset for Damage Text
byte 04 = Offset for Effect Title Text
byte 08 = Offset for Effect Text
byte 12 = Offset for Legacy Title Text
byte 16 = Offset for Legacy Text
------------------
EndOfNewDataFields
------------------
EndOfCards.dat 3.x
Previous Microprose Cards.dat contain no NewDataFields
and contain only the following TextFields:
dat1.0 = 325187 bytes, 5 textfields: WVL#; FullName; ShortName; RulesText; FlavorText
dat2.0 = 330587 bytes, 5 textfields: FullName; ShortName; CardType; RulesText; FlavorText
dat3.0 = 340009 bytes, 6 textfields: WVL#; FullName; ShortName; CardType; RulesText; FlavorText
I removed dependency on the Manalink.csv from the PlayDeck Analyser and finished that DATtoCSV converter.
Edit -
Chart updated to reflect more complete\correct information.
Edit2 -
Updated chart with the final version I used to write the DAT converter.