2.7.4 • Published 11 months ago

madden-file-tools v2.7.4

Weekly downloads
123
License
MIT
Repository
github
Last release
11 months ago

madden-file-tools

JS API for reading and extracting EA/Madden files.

Usage

This package is useful for parsing the following files:

  • TDB files: used by legacy Madden, NCAA, and Head Coach games. (Can Read and write)
  • AST files: used by many games. (Note: Read only as of now)
    • Contain other resource files such as DDS files.

EA TDB Files (Legacy Madden, NCAA 14)

const TDBHelper = require('madden-file-tools/helpers/TDBHelper');
const tdbPath = [path to file];

const helper = new TDBHelper();
helper.load(tdbPath)
    .then((file) => {
        // You have access to all the tables here.
        
        // Access individual table
        const awplTable = file.AWPL;
            // Alternative: file.tables[0];
            // `tables` is just an array.

        // To get access to the records, you need to read them in by each table. Tables are not automatically read due to memory constraints.
        file.AWPL.readRecords()
            .then(() => {
                // Here you have access to all the AWPL records and data.
                
                // Access field values
                const firstStc1Field = file.AWPL.records[0].fields['STC1'].value;
                    // Or file.AWPL.records[0].fields.STC1.value;

                    // Alternative: file.AWPL.records[0].STC1;
                    // The alternative is nicer to use, but less performant.


                // Set field values
                file.AWPL.records[0].fields['STC1'].value = 20;

                    // Alternative: file.AWPL.records[0].STC1 = 20;
                    // Again, this way is a little slower, but is nicer to write.

                // Save the file
                helper.save([optional new file here, otherwise overwrite])
                    .then(() => {
                        // File has been saved here.
                    });
            });
    });

Read HC09 Files

The Head Coach 09 save is a little different from the others. It does not contain the DB file at the very beginning, so I've included a nice helper to load and save.

const HeadCoach09Helper = require('madden-file-tools/helpers/HeadCoach09Helper');
const headCoachSaveFilePath = [path to file];

const helper = new HeadCoach09Helper();
helper.load(headCoachSaveFilePath)
    .then((file) => {
        // Same TDB file API as above. You have access to all the tables here.

        // Make changes here

        // Save the file
        helper.save([optional new file here, otherwise overwrite])
            .then(() => {
                // File has been saved here.
            });
    });

Generic TDB Reader/Writer Usage

const fs = require('fs');
const TDBParser = require('madden-file-tools/streams/TDBParser');
const TDBWriter = require('madden-file-tools/streams/TDBWriter');

const parser = new TDBParser();
const readStream = fs.createReadStream([file path here]);

stream.on('end', function () {
    const file = parser.file;

    // Make changes here

    // Save
    const writeStream = fs.createWriteStream([path to write]);
    const writer = new TDBWriter(file);

    writeStream.on('end', () => {
        // File has been saved here.
    });

    writer
        .pipe(writeStream);
});

stream
    .pipe(parser);
2.7.4

11 months ago

2.7.3

11 months ago

2.7.0

11 months ago

2.7.2

11 months ago

2.7.1

11 months ago

2.6.1

2 years ago

2.6.0

2 years ago

2.6.2

2 years ago

2.5.5

3 years ago

2.5.4

3 years ago

2.5.3

3 years ago

2.5.0

3 years ago

2.5.2

3 years ago

2.5.1

3 years ago

2.4.13

3 years ago

2.4.12

3 years ago

2.4.11

3 years ago

2.4.10

3 years ago

2.4.9

3 years ago

2.4.8

3 years ago

2.4.7

3 years ago

2.4.5

3 years ago

2.4.6

3 years ago

2.4.3

3 years ago

2.4.4

3 years ago

2.4.1

3 years ago

2.4.2

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.2.5

3 years ago

2.2.4

3 years ago

2.2.6

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago