Difference between revisions of "Magic The Gathering CAT"

From XentaxWiki
Jump to: navigation, search
(CAT: fixed)
(Compatible Programs: site moved)
Line 98: Line 98:
* [[Game Extractor|Game Extractor]]
* [[Game Extractor|Game Extractor]]
* [[MultiEx_Commander|MultiEx Commander]]
* [[MultiEx_Commander|MultiEx Commander]]
* [http://www.ctpax-x.ru/?goto=files&show=109 Magic: The Gathering image decoding tools] (with Delphi source codes)
* [http://www.ctpax-x.org/?goto=files&show=109 Magic: The Gathering image decoding tools] (with Delphi source codes)
=== Other Games ===  
=== Other Games ===  

Revision as of 21:06, 12 May 2013

Choose archive extension:


Format Specifications

// Archive Header
uint32 {4}   - Number Of Files
// for each file
uint32 {4}   - File Hash
uint32 {4}   - File Offset
uint32 {4}   - File Length
byte {X}     - File Data

Notes and Comments

  • The files in the directory are NOT in the same order as the files in the archive. ie. file 1 in the directory may actually be file 3827 in the archive, etc. Actually, all records sorted in ascending order of File Hash value.
  • Hash routine in C++ code for Magic: The Gathering:
unsigned int mtg_hash(char *s){
unsigned int hash;
unsigned int part[2];
unsigned int k;
  hash = (s[0] ^ s[1]) << 24;
  part[0] = 0;
  part[1] = 0;
  k = 3;
    part[k&1] = part[k&1] + (tolower(s[0])*k);
  hash = ((part[0] * part[1]) & 0xffffff) | hash;

Note that names inside CAT from MtG can be brute forced by template:



yyyy - number from 0000 till 9999

z - one of the character from list: 'abcdeftx'

This last character (z) may or may not exists, so first you should try all names from '0000.wvl' till '9999.wvl' and only if none of them match try '0000a.wvl' - '9999a.wvl', '0000b.wvl' - '9999b.wvl' and so on.

MultiEx BMS Script

ImpType Standard ;
Get FN Long 0 ;
For T = 1 To FN ;
Get FID Long 0 ;
SavePos FOO 0 ;
Get FO Long 0 ;
SavePos FSO 0 ;
Get FS Long 0 ;
Log "" FO FS FOO FSO ;
Next T ;

Extended version:

# QucikBMS script for unpacking .CAT files
ImpType Standard
Get FileCount Long
For I = 1 To FileCount
  Get FileHash Long
  Get FileOffs Long
  Get FileSize Long
  SavePos TOC
  String FileName p= "%08X" FileHash
# read signature
  GoTo FileOffs
  Get FileHash Long
# .PCX files (Gunship!)
  If FileHash = 0x0801050A Then
    String FileName += ".PCX"
# .WVL files (Magic: The Gathering)
  If FileHash = 0x00000100 Then
    String FileName += ".WVL"
  Log FileName FileOffs FileSize
  GoTo TOC
Next I

Compatible Programs

Other Games

These games also use this file format

  • Gunship!
  • Magic: The Gathering